Compare commits

..

1 Commits

Author SHA1 Message Date
DarioS d86f1cf47f EgtMachKernel 2.5a3 :
- pulizia codice.
2023-01-23 16:52:25 +01:00
104 changed files with 10482 additions and 33124 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
+13 -42
View File
@@ -503,15 +503,13 @@ Chiseling::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento // verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged && if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) { ( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione // confermo i percorsi di lavorazione
m_nChisels = nCurrChisels ; m_nChisels = nCurrChisels ;
string sLog = string( "Chiseling apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ; LOG_DBG_INFO( GetEMkLogger(), "Chiseling apply skipped : status already ok") ;
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente // eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply)) if ( ! Update( bPostApply))
return false ; return false ;
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ; LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo // esco con successo
return true ; return true ;
@@ -597,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) ;
@@ -769,39 +764,15 @@ Chiseling::UpdateToolData( bool* pbChanged)
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ; ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr) if ( pTMgr == nullptr)
return false ; return false ;
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome) // recupero l'utensile nel DB utensili
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) { if ( pTdata == nullptr)
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ; return false ;
if ( pTdata == nullptr) // verifico se sono diversi (ad esclusione del nome)
return false ; m_TParams.m_sName = pTdata->m_sName ;
m_Params.m_ToolUuid = m_TParams.m_Uuid ; bool bChanged = ! SameTool( m_TParams, *pTdata) ;
}
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri // 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 (" +
@@ -1016,7 +987,7 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale // la porto in globale
pCrvCompo->ToGlob( frGlob) ; pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie // sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ; AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, 0) ;
// la restituisco // la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ; lstPC.emplace_back( Release( pCrvCompo)) ;
return true ; return true ;
@@ -1042,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) ;
@@ -1052,7 +1023,7 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale // la porto in globale
pCrvCompo->ToGlob( frGlob) ; pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie // sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ; AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, 0) ;
// la restituisco // la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ; lstPC.emplace_back( Release( pCrvCompo)) ;
} }
@@ -1523,7 +1494,7 @@ Chiseling::GenerateChiselingCl( const SqHole& hole, int nPathId)
SetAuxDir( hole.vtAux) ; SetAuxDir( hole.vtAux) ;
// 1 -> punto approccio // 1 -> punto approccio
SetFlag( 1) ; SetFlag( 1) ;
double dAppr = GetSafeZ() ; double dAppr = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
Point3d ptP1 = hole.ptIni + hole.vtExtr * dAppr ; Point3d ptP1 = hole.ptIni + hole.vtExtr * dAppr ;
if ( AddRapidStart( ptP1) == GDB_ID_NULL) if ( AddRapidStart( ptP1) == GDB_ID_NULL)
return false ; return false ;
+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)) ; }
+53 -294
View File
@@ -21,24 +21,22 @@
#include "/EgtDev/Include/EGkAngle.h" #include "/EgtDev/Include/EGkAngle.h"
#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkUserObjFactory.h" #include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGnStringKeyVal.h" #include "/EgtDev/Include/EGnStringKeyVal.h"
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
using namespace std ; using namespace std ;
//------------------------------ Errors -------------------------------------- //------------------------------ Errors --------------------------------------
// 2001 = "Error moving axis xx" // 2001 = "Error adding fixture xx"
// 2002 = "Error adding fixture xx" // 2002 = "Error placing fixture xx"
// 2003 = "Error placing fixture xx" // 2003 = "Error in MoveToCornerRawPart xx"
// 2004 = "Error in MoveToCornerRawPart xx" // 2004 = "Error in MoveToCenterRawPart xx"
// 2005 = "Error in MoveToCenterRawPart xx" // 2005 = "Error in ApplyRotationToRawPart xx"
// 2006 = "Error in ApplyRotationToRawPart xx" // 2006 = "Error in OnSpecialApplyDisposition (xxx)"
// 2007 = "Error in OnSpecialApplyDisposition (xxx)" // 2007 = "Error in Disposition : axes values not calculable"
// 2008 = "Error in Disposition : axes values not calculable" // 2008 = "Error in Disposition : outstroke xxx"
// 2009 = "Error in Disposition : outstroke xxx" // 2009 = "Error in Disposition : link movements not calculable"
// 2010 = "Error in Disposition : link movements not calculable" // 2010 = "Error in Disposition : link outstroke xxx"
// 2011 = "Error in Disposition : link outstroke xxx"
// 2051 = "Table Ref1 changed : (xyz) -> (XYZ)" // 2051 = "Table Ref1 changed : (xyz) -> (XYZ)"
// 2052 = "Warning in Disposition : No shifts" // 2052 = "Warning in Disposition : No shifts"
// 2053 = "Warning in OnSpecialApplyDisposition (xxx)" // 2053 = "Warning in OnSpecialApplyDisposition (xxx)"
@@ -48,15 +46,11 @@ static string DIS_TABLE = "Tab" ;
static string DIS_PHASE = "Ph" ; static string DIS_PHASE = "Ph" ;
static string DIS_REF1 = "Ref1" ; static string DIS_REF1 = "Ref1" ;
static string DIS_AREA1 = "Area1" ; static string DIS_AREA1 = "Area1" ;
static string DIS_AXD_TOT = "AxT" ;
static string DIS_AXD_NAME = "AxN" ;
static string DIS_AXD_POS = "AxP" ;
static string DIS_FXD_TOT = "FxT" ; static string DIS_FXD_TOT = "FxT" ;
static string DIS_FXD_NAME = "FxN" ; static string DIS_FXD_NAME = "FxN" ;
static string DIS_FXD_POS = "FxP" ; static string DIS_FXD_POS = "FxP" ;
static string DIS_FXD_ANG = "FxA" ; static string DIS_FXD_ANG = "FxA" ;
static string DIS_FXD_MOV = "FxM" ; static string DIS_FXD_MOV = "FxM" ;
static string DIS_FXD_LINK = "FxL" ;
static string DIS_MVD_TOT = "MvT" ; static string DIS_MVD_TOT = "MvT" ;
static string DIS_MVD_ID = "MvI" ; static string DIS_MVD_ID = "MvI" ;
static string DIS_MVD_TYPE = "MvT" ; static string DIS_MVD_TYPE = "MvT" ;
@@ -92,13 +86,10 @@ 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 ;
pDisp->m_bTabOk = m_bTabOk ; pDisp->m_bTabOk = m_bTabOk ;
pDisp->m_vAxData = m_vAxData ;
pDisp->m_vFixData = m_vFixData ; pDisp->m_vFixData = m_vFixData ;
pDisp->m_vMvrData = m_vMvrData ; pDisp->m_vMvrData = m_vMvrData ;
pDisp->m_sHead = m_sHead ; pDisp->m_sHead = m_sHead ;
@@ -127,17 +118,12 @@ Disposition::Dump( string& sOut, bool bMM, const char* szNewLine) const
sOut += DIS_REF1 + EQUAL + "(" + ToString( m_ptRef1, 3) + ")" + szNewLine ; sOut += DIS_REF1 + EQUAL + "(" + ToString( m_ptRef1, 3) + ")" + szNewLine ;
sOut += DIS_AREA1 + EQUAL + "(" + ToString( m_b3Area1, 3) + ")" + szNewLine ; sOut += DIS_AREA1 + EQUAL + "(" + ToString( m_b3Area1, 3) + ")" + szNewLine ;
sOut += DIS_AREA1_OFFS + EQUAL + "(" + ToString( m_dAreaOffset) + ")" + szNewLine ; sOut += DIS_AREA1_OFFS + EQUAL + "(" + ToString( m_dAreaOffset) + ")" + szNewLine ;
for ( const auto& AxData : m_vAxData) {
sOut += "AxD=" + AxData.sName + "," +
ToString( AxData.dPos) + szNewLine ;
}
for ( const auto& FixData : m_vFixData) { for ( const auto& FixData : m_vFixData) {
sOut += "FxD=" + FixData.sName + "," + sOut += "FxD=" + FixData.sName + "," +
ToString( FixData.nId) + ",(" + ToString( FixData.nId) + ",(" +
ToString( FixData.ptPos) + ")," + ToString( FixData.ptPos) + ")," +
ToString( FixData.dAng) + "," + ToString( FixData.dAng) + "," +
ToString( FixData.dMov) + "," + ToString( FixData.dMov) + szNewLine ;
( IsEmptyOrSpaces( FixData.sTaLink) ? "__" : FixData.sTaLink) + szNewLine ;
} }
for ( const auto& MvrData : m_vMvrData) { for ( const auto& MvrData : m_vMvrData) {
sOut += "MvD=" + ToString( MvrData.nRawId) + "," ; sOut += "MvD=" + ToString( MvrData.nRawId) + "," ;
@@ -171,14 +157,12 @@ Disposition::Save( int nBaseId, STRVECTOR& vString) const
{ {
try { try {
int k = - 1 ; int k = - 1 ;
int nAxdTot = int( m_vAxData.size()) ;
int nAxdLines = ( nAxdTot == 0 ? 0 : 1 + 2 * nAxdTot) ;
int nFxdTot = int( m_vFixData.size()) ; int nFxdTot = int( m_vFixData.size()) ;
int nFxdLines = 1 + 5 * nFxdTot ; int nFxdLines = 1 + 4 * nFxdTot ;
int nMvdTot = int( m_vMvrData.size()) ; int nMvdTot = int( m_vMvrData.size()) ;
int nMvdLines = 1 + 4 * nMvdTot ; int nMvdLines = 1 + 4 * nMvdTot ;
int nOther = 7 ; int nOther = 7 ;
vString.insert( vString.begin(), 4 + nAxdLines + nFxdLines + nMvdLines + nOther, "") ; vString.insert( vString.begin(), 4 + nFxdLines + nMvdLines + nOther, "") ;
// Nome // Nome
if ( ! SetVal( DIS_TABLE, m_sTabName, vString[++k])) if ( ! SetVal( DIS_TABLE, m_sTabName, vString[++k]))
return false ; return false ;
@@ -191,16 +175,6 @@ Disposition::Save( int nBaseId, STRVECTOR& vString) const
// Prima area // Prima area
if ( ! SetVal( DIS_AREA1, m_b3Area1, vString[++k])) if ( ! SetVal( DIS_AREA1, m_b3Area1, vString[++k]))
return false ; return false ;
// Dati assi (se presenti)
if ( nAxdTot > 0) {
if ( ! SetVal( DIS_AXD_TOT, nAxdTot, vString[++k]))
return false ;
for ( const auto& AxData : m_vAxData) {
if ( ! SetVal( DIS_AXD_NAME, AxData.sName, vString[++k]) ||
! SetVal( DIS_AXD_POS, AxData.dPos, vString[++k]))
return false ;
}
}
// Dati sottopezzi // Dati sottopezzi
if ( ! SetVal( DIS_FXD_TOT, nFxdTot, vString[++k])) if ( ! SetVal( DIS_FXD_TOT, nFxdTot, vString[++k]))
return false ; return false ;
@@ -208,8 +182,7 @@ Disposition::Save( int nBaseId, STRVECTOR& vString) const
if ( ! SetVal( DIS_FXD_NAME, FixData.sName, vString[++k]) || if ( ! SetVal( DIS_FXD_NAME, FixData.sName, vString[++k]) ||
! SetVal( DIS_FXD_POS, FixData.ptPos, vString[++k]) || ! SetVal( DIS_FXD_POS, FixData.ptPos, vString[++k]) ||
! SetVal( DIS_FXD_ANG, FixData.dAng, vString[++k]) || ! SetVal( DIS_FXD_ANG, FixData.dAng, vString[++k]) ||
! SetVal( DIS_FXD_MOV, FixData.dMov, vString[++k]) || ! SetVal( DIS_FXD_MOV, FixData.dMov, vString[++k]))
! SetVal( DIS_FXD_LINK, FixData.sTaLink, vString[++k]))
return false ; return false ;
} }
// Dati posizionamento grezzi // Dati posizionamento grezzi
@@ -262,27 +235,12 @@ Disposition::Load( const STRVECTOR& vString, int nBaseGdbId)
// prima area // prima area
if ( ! GetVal( vString[++k], DIS_AREA1, m_b3Area1)) if ( ! GetVal( vString[++k], DIS_AREA1, m_b3Area1))
return false ; return false ;
// dati assi opzionali
int nAxdTot = 0 ;
if ( ! GetVal( vString[++k], DIS_AXD_TOT, nAxdTot))
-- k ;
int nAxdLines = ( nAxdTot == 0 ? 0 : 1 + 2 * nAxdTot) ;
if ( nAxdTot > 0) {
if ( int( vString.size()) < 3 + nAxdLines + 1)
return false ;
m_vAxData.insert( m_vAxData.begin(), nAxdTot, AxisData()) ;
for ( auto& AxData : m_vAxData) {
if ( ! GetVal( vString[++k], DIS_AXD_NAME, AxData.sName) ||
! GetVal( vString[++k], DIS_AXD_POS, AxData.dPos))
return false ;
}
}
// dati sottopezzi // dati sottopezzi
int nFxdTot ; int nFxdTot ;
if ( ! GetVal( vString[++k], DIS_FXD_TOT, nFxdTot)) if ( ! GetVal( vString[++k], DIS_FXD_TOT, nFxdTot))
return false ; return false ;
int nFxdLines = 1 + 3 * nFxdTot ; int nFxdLines = 1 + 3 * nFxdTot ;
if ( int( vString.size()) < 3 + nAxdLines + nFxdLines + 1) if ( int( vString.size()) < 3 + nFxdLines + 1)
return false ; return false ;
m_vFixData.insert( m_vFixData.begin(), nFxdTot, FixtureData()) ; m_vFixData.insert( m_vFixData.begin(), nFxdTot, FixtureData()) ;
for ( auto& FixData : m_vFixData) { for ( auto& FixData : m_vFixData) {
@@ -296,17 +254,13 @@ Disposition::Load( const STRVECTOR& vString, int nBaseGdbId)
if ( ! GetVal( vString[++k], DIS_FXD_MOV, FixData.dMov)) if ( ! GetVal( vString[++k], DIS_FXD_MOV, FixData.dMov))
-- k ; -- k ;
} }
if ( k + 1 < int( vString.size())) {
if ( ! GetVal( vString[++k], DIS_FXD_LINK, FixData.sTaLink))
-- k ;
}
} }
// dati posizionamento grezzi // dati posizionamento grezzi
int nMvdTot ; int nMvdTot ;
if ( ! GetVal( vString[++k], DIS_MVD_TOT, nMvdTot)) if ( ! GetVal( vString[++k], DIS_MVD_TOT, nMvdTot))
return false ; return false ;
int nMvdLines = 1 + 4 * nMvdTot ; int nMvdLines = 1 + 4 * nMvdTot ;
if ( int( vString.size()) < 3 + nAxdLines + nFxdLines + nMvdLines) if ( int( vString.size()) < 3 + nFxdLines + nMvdLines)
return false ; return false ;
m_vMvrData.insert( m_vMvrData.begin(), nMvdTot, MoveRawData()) ; m_vMvrData.insert( m_vMvrData.begin(), nMvdTot, MoveRawData()) ;
for ( auto& MvrData : m_vMvrData) { for ( auto& MvrData : m_vMvrData) {
@@ -479,16 +433,6 @@ Disposition::Apply( bool bVerifyTab)
if ( ( ! m_bTabOk || bVerifyTab) && ! SetTable( m_sTabName)) if ( ( ! m_bTabOk || bVerifyTab) && ! SetTable( m_sTabName))
return false ; return false ;
bool bOk = true ; bool bOk = true ;
// annullo movimento assi
m_pMchMgr->ResetAllAxesPos( false, true) ;
// aggiornamento movimenti assi
for ( auto& AxData : m_vAxData) {
if ( ! m_pMchMgr->SetAxisPos( AxData.sName, AxData.dPos)) {
string sOut = "Error moving axis " + AxData.sName ;
m_pMchMgr->SetLastError( 2001, sOut) ;
bOk = false ;
}
}
// aggiornamento sottopezzi // aggiornamento sottopezzi
for ( auto& FixData : m_vFixData) { for ( auto& FixData : m_vFixData) {
// se sottopezzo da caricare // se sottopezzo da caricare
@@ -496,7 +440,7 @@ Disposition::Apply( bool bVerifyTab)
int nId = AddFixture( FixData.sName, GDB_ID_NULL, FixData.ptPos, FixData.dAng, FixData.dMov, false) ; int nId = AddFixture( FixData.sName, GDB_ID_NULL, FixData.ptPos, FixData.dAng, FixData.dMov, false) ;
if ( nId == GDB_ID_NULL) { if ( nId == GDB_ID_NULL) {
string sOut = "Error adding fixture " + FixData.sName ; string sOut = "Error adding fixture " + FixData.sName ;
m_pMchMgr->SetLastError( 2002, sOut) ; m_pMchMgr->SetLastError( 2001, sOut) ;
bOk = false ; bOk = false ;
} }
else else
@@ -506,7 +450,7 @@ Disposition::Apply( bool bVerifyTab)
else { else {
if ( ! PlaceFixture( FixData.nId, FixData.ptPos, FixData.dAng, FixData.dMov)) { if ( ! PlaceFixture( FixData.nId, FixData.ptPos, FixData.dAng, FixData.dMov)) {
string sOut = "Error placing fixture " + ToString( FixData.nId) ; string sOut = "Error placing fixture " + ToString( FixData.nId) ;
m_pMchMgr->SetLastError( 2003, sOut) ; m_pMchMgr->SetLastError( 2002, sOut) ;
bOk = false ; bOk = false ;
} }
} }
@@ -528,21 +472,21 @@ Disposition::Apply( bool bVerifyTab)
case MoveRawData::COR : case MoveRawData::COR :
if ( ! MoveToCornerRawPart( vMvrData.nRawId, vMvrData.ptP, vMvrData.nFlag, false, false)) { if ( ! MoveToCornerRawPart( vMvrData.nRawId, vMvrData.ptP, vMvrData.nFlag, false, false)) {
string sOut = "Error in MoveToCornerRawPart " + ToString( vMvrData.nRawId) ; string sOut = "Error in MoveToCornerRawPart " + ToString( vMvrData.nRawId) ;
m_pMchMgr->SetLastError( 2004, sOut) ; m_pMchMgr->SetLastError( 2003, sOut) ;
bOk = false ; bOk = false ;
} }
break ; break ;
case MoveRawData::CEN : case MoveRawData::CEN :
if ( ! MoveToCenterRawPart( vMvrData.nRawId, vMvrData.ptP, vMvrData.nFlag, false, false)) { if ( ! MoveToCenterRawPart( vMvrData.nRawId, vMvrData.ptP, vMvrData.nFlag, false, false)) {
string sOut = "Error in MoveToCenterRawPart " + ToString( vMvrData.nRawId) ; string sOut = "Error in MoveToCenterRawPart " + ToString( vMvrData.nRawId) ;
m_pMchMgr->SetLastError( 2005, sOut) ; m_pMchMgr->SetLastError( 2004, sOut) ;
bOk = false ; bOk = false ;
} }
break ; break ;
case MoveRawData::ROT : case MoveRawData::ROT :
if ( ! ApplyRotationToRawPart( vMvrData.nRawId, vMvrData.ptP.x, vMvrData.ptP.y, vMvrData.ptP.z, false)) { if ( ! ApplyRotationToRawPart( vMvrData.nRawId, vMvrData.ptP.x, vMvrData.ptP.y, vMvrData.ptP.z, false)) {
string sOut = "Error in ApplyRotationToRawPart " + ToString( vMvrData.nRawId) ; string sOut = "Error in ApplyRotationToRawPart " + ToString( vMvrData.nRawId) ;
m_pMchMgr->SetLastError( 2006, sOut) ; m_pMchMgr->SetLastError( 2005, sOut) ;
bOk = false ; bOk = false ;
} }
break ; break ;
@@ -574,69 +518,6 @@ Disposition::IsInTable( const BBox3d& b3B)
return b3AllArea.EnclosesXY( b3B) ; return b3AllArea.EnclosesXY( b3B) ;
} }
//----------------------------------------------------------------------------
bool
Disposition::MoveAxis( const string& sName, double dPos)
{
// verifico MachMgr e GeomDB
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// verifico tavola
if ( ! m_bTabOk && ! SetTable( m_sTabName))
return false ;
// verifico sia un asse di disposizione (ovvero dipendente dalla tavola)
if ( ! m_pMchMgr->IsDispositionAxis( sName, m_sTabName))
return false ;
// cerco eventuale movimento dello stesso asse già inserito
int nInd = -1 ;
for ( int i = 0 ; i < int( m_vAxData.size()) ; ++ i) {
if ( m_vAxData[i].sName == sName) {
nInd = i ;
break ;
}
}
// eseguo movimento
if ( ! m_pMchMgr->SetAxisPos( sName, dPos))
return false ;
// salvo movimento
if ( nInd < 0)
m_vAxData.emplace_back( sName, dPos) ;
else
m_vAxData[nInd].dPos = dPos ;
m_nStatus |= MCH_ST_GEO_MODIF ;
return true ;
}
//----------------------------------------------------------------------------
bool
Disposition::RemoveAxis( const string& sName)
{
// verifico MachMgr e GeomDB
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// verifico tavola
if ( ! m_bTabOk && ! SetTable( m_sTabName))
return false ;
// verifico sia un asse di disposizione (ovvero dipendente dalla tavola)
if ( ! m_pMchMgr->IsDispositionAxis( sName, m_sTabName))
return false ;
// cerco eventuale movimento dello stesso asse già inserito
int nInd = -1 ;
for ( int i = 0 ; i < int( m_vAxData.size()) ; ++ i) {
if ( m_vAxData[i].sName == sName) {
nInd = i ;
break ;
}
}
// se non trovato, non devo fare alcunché
if ( nInd < 0)
return true ;
// rimetto asse in home e rimuovo movimento dalla lista
m_pMchMgr->ResetAxisPos( sName) ;
m_vAxData.erase( m_vAxData.begin() + nInd) ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Disposition::AddFixture( const string& sName, int nId, const Point3d& ptPos, double dAngDeg, Disposition::AddFixture( const string& sName, int nId, const Point3d& ptPos, double dAngDeg,
@@ -734,26 +615,20 @@ Disposition::AddFixture( const string& sName, int nId, const Point3d& ptPos, dou
return GDB_ID_NULL ; return GDB_ID_NULL ;
} }
// muovo eventuale parte mobile // muovo eventuale parte mobile
double dMovEff = dMov ;
int nMobId = m_pGeomDB->GetFirstNameInGroup( nFixtId, FXT_MOBILE) ; int nMobId = m_pGeomDB->GetFirstNameInGroup( nFixtId, FXT_MOBILE) ;
if ( nMobId != GDB_ID_NULL) { if ( nMobId != GDB_ID_NULL) {
double dMinVal = 0 ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MINPOS, dMinVal) ;
double dMaxVal = INFINITO ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MAXPOS, dMaxVal) ;
double dCurrVal = 0 ; double dCurrVal = 0 ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ; m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ;
dMovEff = Clamp( dMov, dMinVal, dMaxVal) ; if ( abs( dMov - dCurrVal) > EPS_SMALL) {
if ( abs( dMovEff - dCurrVal) > EPS_SMALL) {
Vector3d vtDir = Z_AX ; Vector3d vtDir = Z_AX ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ; m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ;
m_pGeomDB->TranslateGroup( nMobId, ( dMovEff - dCurrVal) * vtDir) ; m_pGeomDB->TranslateGroup( nMobId, (dMov - dCurrVal) * vtDir) ;
m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, dMovEff) ; m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, dMov) ;
} }
} }
// se da aggiungere alla lista // se da aggiungere alla lista
if ( bAddToList) { if ( bAddToList) {
m_vFixData.emplace_back( sName, nFixtId, ptPos, dAngDeg, dMovEff) ; m_vFixData.emplace_back( sName, nFixtId, ptPos, dAngDeg, dMov) ;
m_nStatus |= MCH_ST_GEO_MODIF ; m_nStatus |= MCH_ST_GEO_MODIF ;
} }
return nFixtId ; return nFixtId ;
@@ -857,31 +732,6 @@ Disposition::RotateFixture( int nId, double dDeltaAngDeg)
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
Disposition::SetFixtureLink( int nId, const string& sTaLink)
{
// verifica validità sottopezzo
if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyFixtureInGroup( nId, false))
return false ;
// verifico aggiornamento tavola
if ( ! m_bTabOk && ! SetTable( m_sTabName))
return false ;
// verifico ch eil link sia un asse di disposizione (ovvero dipendente dalla tavola)
if ( ! m_pMchMgr->IsDispositionAxis( sTaLink, m_sTabName))
return false ;
// aggiorno la posizione dell'oggetto nel vettore dei comandi
for ( auto& FixData : m_vFixData) {
if ( FixData.nId == nId) {
FixData.sTaLink = sTaLink ;
break ;
}
}
// imposto stato a modificato
m_nStatus |= MCH_ST_PARAM_MODIF ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Disposition::MoveFixtureMobile( int nId, double dDeltaMov) Disposition::MoveFixtureMobile( int nId, double dDeltaMov)
@@ -892,72 +742,22 @@ Disposition::MoveFixtureMobile( int nId, double dDeltaMov)
// verifico aggiornamento tavola // verifico aggiornamento tavola
if ( ! m_bTabOk && ! SetTable( m_sTabName)) if ( ! m_bTabOk && ! SetTable( m_sTabName))
return false ; return false ;
// recupero la parte mobile // muovo eventuale parte mobile
int nMobId = m_pGeomDB->GetFirstNameInGroup( nId, FXT_MOBILE) ; int nMobId = m_pGeomDB->GetFirstNameInGroup( nId, FXT_MOBILE) ;
if ( nMobId == GDB_ID_NULL) if ( nMobId != GDB_ID_NULL) {
return false ; double dCurrVal = 0 ;
// recupero limiti di corsa e posizione m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ;
double dMinVal = 0 ; if ( abs( dDeltaMov) > EPS_SMALL) {
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MINPOS, dMinVal) ; Vector3d vtDir = Z_AX ;
double dMaxVal = INFINITO ; m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MAXPOS, dMaxVal) ; m_pGeomDB->TranslateGroup( nMobId, dDeltaMov * vtDir) ;
double dCurrVal = 0 ; m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, ( dCurrVal + dDeltaMov)) ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ; }
// verifico movimento richiesto e fattibile non nullo
double dDeltaEff = Clamp( dCurrVal + dDeltaMov, dMinVal, dMaxVal) - dCurrVal ;
if ( abs( dDeltaEff) < EPS_SMALL)
return true ;
// eseguo il movimento
Vector3d vtDir = Z_AX ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ;
m_pGeomDB->TranslateGroup( nMobId, dDeltaEff * vtDir) ;
m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, ( dCurrVal + dDeltaEff)) ;
// aggiorno la posizione dell'oggetto nel vettore dei comandi
for ( auto& FixData : m_vFixData) {
if ( FixData.nId == nId) {
FixData.dMov += dDeltaEff ;
break ;
}
} }
// imposto stato a modificato
m_nStatus |= MCH_ST_PARAM_MODIF ;
return true ;
}
//----------------------------------------------------------------------------
bool
Disposition::SetFixtureMobile( int nId, double dMov)
{
// verifica validità sottopezzo
if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyFixtureInGroup( nId, false))
return false ;
// verifico aggiornamento tavola
if ( ! m_bTabOk && ! SetTable( m_sTabName))
return false ;
// recupero la parte mobile
int nMobId = m_pGeomDB->GetFirstNameInGroup( nId, FXT_MOBILE) ;
if ( nMobId == GDB_ID_NULL)
return false ;
// recupero limiti di corsa e posizione
double dMinVal = 0 ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MINPOS, dMinVal) ;
double dMaxVal = INFINITO ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MAXPOS, dMaxVal) ;
double dCurrVal = 0 ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ;
// verifico movimento richiesto e fattibile non nullo
double dMovEff = Clamp( dMov, dMinVal, dMaxVal) ;
if ( abs( dMovEff - dCurrVal) < EPS_SMALL)
return true ;
// eseguo il movimento
Vector3d vtDir = Z_AX ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ;
m_pGeomDB->TranslateGroup( nMobId, ( dMovEff - dCurrVal) * vtDir) ;
m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, dMovEff) ;
// aggiorno la posizione dell'oggetto nel vettore dei comandi // aggiorno la posizione dell'oggetto nel vettore dei comandi
for ( auto& FixData : m_vFixData) { for ( auto& FixData : m_vFixData) {
if ( FixData.nId == nId) { if ( FixData.nId == nId) {
FixData.dMov = dMovEff ; FixData.dMov += dDeltaMov ;
break ; break ;
} }
} }
@@ -1005,21 +805,15 @@ Disposition::PlaceFixture( int nId, const Point3d& ptPos, double dAngDeg, double
if ( abs( dAngDeg) > EPS_ANG_SMALL) if ( abs( dAngDeg) > EPS_ANG_SMALL)
m_pGeomDB->RotateGroup( nId, ORIG, Z_AX, dAngDeg) ; m_pGeomDB->RotateGroup( nId, ORIG, Z_AX, dAngDeg) ;
// muovo eventuale parte mobile // muovo eventuale parte mobile
double dMovEff = dMov ;
int nMobId = m_pGeomDB->GetFirstNameInGroup( nId, FXT_MOBILE) ; int nMobId = m_pGeomDB->GetFirstNameInGroup( nId, FXT_MOBILE) ;
if ( nMobId != GDB_ID_NULL) { if ( nMobId != GDB_ID_NULL) {
double dMinVal = 0 ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MINPOS, dMinVal) ;
double dMaxVal = INFINITO ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MAXPOS, dMaxVal) ;
double dCurrVal = 0 ; double dCurrVal = 0 ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ; m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ;
dMovEff = Clamp( dMov, dMinVal, dMaxVal) ; if ( abs( dMov - dCurrVal) > EPS_SMALL) {
if ( abs( dMovEff - dCurrVal) > EPS_SMALL) {
Vector3d vtDir = Z_AX ; Vector3d vtDir = Z_AX ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ; m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ;
m_pGeomDB->TranslateGroup( nMobId, ( dMovEff - dCurrVal) * vtDir) ; m_pGeomDB->TranslateGroup( nMobId, ( dMov - dCurrVal) * vtDir) ;
m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, dMovEff) ; m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, dMov) ;
} }
} }
// aggiorno la posizione dell'oggetto nel vettore dei comandi // aggiorno la posizione dell'oggetto nel vettore dei comandi
@@ -1027,7 +821,7 @@ Disposition::PlaceFixture( int nId, const Point3d& ptPos, double dAngDeg, double
if ( FixData.nId == nId) { if ( FixData.nId == nId) {
FixData.ptPos = ptPos ; FixData.ptPos = ptPos ;
FixData.dAng = dAngDeg ; FixData.dAng = dAngDeg ;
FixData.dMov = dMovEff ; FixData.dMov = dMov ;
break ; break ;
} }
} }
@@ -1091,7 +885,7 @@ Disposition::MoveToCornerRawPart( int nRawId, const Point3d& ptP, int nFlag, boo
case MCH_CR_TR : case MCH_CR_TR :
vtMove = ( m_ptRef1 + ptP) - Point3d( b3Raw.GetMax().x, b3Raw.GetMax().y, b3Raw.GetMin().z) ; vtMove = ( m_ptRef1 + ptP) - Point3d( b3Raw.GetMax().x, b3Raw.GetMax().y, b3Raw.GetMin().z) ;
break ; break ;
default : // MCH_CR_BL default : // RPCP_BL
vtMove = ( m_ptRef1 + ptP) - b3Raw.GetMin() ; vtMove = ( m_ptRef1 + ptP) - b3Raw.GetMin() ;
break ; break ;
case MCH_CR_BR : case MCH_CR_BR :
@@ -1142,7 +936,7 @@ Disposition::MoveToCenterRawPart( int nRawId, const Point3d& ptP, int nFlag, boo
case MCH_CE_TC : case MCH_CE_TC :
vtMove = ( m_ptRef1 + ptP) - Point3d( ptCen.x, b3Raw.GetMax().y, ptCen.z) ; vtMove = ( m_ptRef1 + ptP) - Point3d( ptCen.x, b3Raw.GetMax().y, ptCen.z) ;
break ; break ;
default : // MCH_CE_ML default : // RPCE_ML
vtMove = ( m_ptRef1 + ptP) - Point3d( b3Raw.GetMin().x, ptCen.y, ptCen.z) ; vtMove = ( m_ptRef1 + ptP) - Point3d( b3Raw.GetMin().x, ptCen.y, ptCen.z) ;
break ; break ;
case MCH_CE_MR : case MCH_CE_MR :
@@ -1266,7 +1060,7 @@ Disposition::RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg)
case MCH_CR_TR : case MCH_CR_TR :
vtCorr = Vector3d( b3Raw.GetMax().x - b3OriRaw.GetMax().x, b3Raw.GetMax().y - b3OriRaw.GetMax().y, b3Raw.GetMin().z - b3OriRaw.GetMin().z) ; vtCorr = Vector3d( b3Raw.GetMax().x - b3OriRaw.GetMax().x, b3Raw.GetMax().y - b3OriRaw.GetMax().y, b3Raw.GetMin().z - b3OriRaw.GetMin().z) ;
break ; break ;
default : // MCH_CR_BL default : // RPCP_BL
vtCorr = Vector3d( b3Raw.GetMin().x - b3OriRaw.GetMin().x, b3Raw.GetMin().y - b3OriRaw.GetMin().y, b3Raw.GetMin().z - b3OriRaw.GetMin().z) ; vtCorr = Vector3d( b3Raw.GetMin().x - b3OriRaw.GetMin().x, b3Raw.GetMin().y - b3OriRaw.GetMin().y, b3Raw.GetMin().z - b3OriRaw.GetMin().z) ;
break ; break ;
case MCH_CR_BR : case MCH_CR_BR :
@@ -1281,7 +1075,7 @@ Disposition::RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg)
case MCH_CE_TC : case MCH_CE_TC :
vtCorr = Vector3d( ptCen.x - ptOriCen.x, b3Raw.GetMax().y - b3OriRaw.GetMax().y, ptCen.z - ptOriCen.z) ; vtCorr = Vector3d( ptCen.x - ptOriCen.x, b3Raw.GetMax().y - b3OriRaw.GetMax().y, ptCen.z - ptOriCen.z) ;
break ; break ;
default : // MCH_CE_ML default : // RPCE_ML
vtCorr = Vector3d( b3Raw.GetMin().x - b3OriRaw.GetMin().x, ptCen.y - ptOriCen.y, ptCen.z - ptOriCen.z) ; vtCorr = Vector3d( b3Raw.GetMin().x - b3OriRaw.GetMin().x, ptCen.y - ptOriCen.y, ptCen.z - ptOriCen.z) ;
break ; break ;
case MCH_CE_MR : case MCH_CE_MR :
@@ -1411,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)
@@ -1450,26 +1227,10 @@ Disposition::RemoveRawPart( int nRawId)
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
Disposition::GetMoveAxisData( int nInd, string& sName, double& dPos) const
{
// verifico MachMgr e GeomDB
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// verifico l'indice
if ( nInd < 0 || nInd >= int( m_vAxData.size()))
return false ;
// recupero i dati
sName = m_vAxData[nInd].sName ;
dPos = m_vAxData[nInd].dPos ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Disposition::GetFixtureData( int nInd, string& sName, int& nId, Point3d& ptPos, Disposition::GetFixtureData( int nInd, string& sName, int& nId, Point3d& ptPos,
double& dAngDeg, double& dMov, string& sTaLink) const double& dAngDeg, double& dMov) const
{ {
// verifico MachMgr e GeomDB // verifico MachMgr e GeomDB
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
@@ -1483,7 +1244,6 @@ Disposition::GetFixtureData( int nInd, string& sName, int& nId, Point3d& ptPos,
ptPos = m_vFixData[nInd].ptPos ; ptPos = m_vFixData[nInd].ptPos ;
dAngDeg = m_vFixData[nInd].dAng ; dAngDeg = m_vFixData[nInd].dAng ;
dMov = m_vFixData[nInd].dMov ; dMov = m_vFixData[nInd].dMov ;
sTaLink = m_vFixData[nInd].sTaLink ;
return true ; return true ;
} }
@@ -1593,12 +1353,11 @@ 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) + ")" ;
m_pMchMgr->SetLastError( 2007, sOut) ; m_pMchMgr->SetLastError( 2006, sOut) ;
return false ; return false ;
} }
// recupero eventuale warning // recupero eventuale warning
@@ -1634,26 +1393,26 @@ 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( 2008, "Error in Disposition : axes values not calculable") ; m_pMchMgr->SetLastError( 2007, "Error in Disposition : axes values not calculable") ;
else else
m_pMchMgr->SetLastError( 2009, "Error in Disposition : outstroke ") ; m_pMchMgr->SetLastError( 2008, "Error in Disposition : outstroke ") ;
return false ; return false ;
} }
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine di tutti // gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine di tutti
if ( ! AdjustStartEndMovements()) { if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ; string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty()) if ( sInfo.empty())
m_pMchMgr->SetLastError( 2010, "Error in Disposition : link movements not calculable") ; m_pMchMgr->SetLastError( 2009, "Error in Disposition : link movements not calculable") ;
else else
m_pMchMgr->SetLastError( 2011, "Error in Disposition : link outstroke ") ; m_pMchMgr->SetLastError( 2010, "Error in Disposition : link outstroke ") ;
return false ; return false ;
} }
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso // assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
+9 -31
View File
@@ -15,18 +15,6 @@
#include "Operation.h" #include "Operation.h"
//----------------------------------------------------------------------------
struct AxisData
{
std::string sName ; // nome dell'asse ausiliario da muovere
double dPos ; // posizione dell'asse
AxisData( void)
: sName(), dPos( 0) {}
AxisData( const std::string& sN, double dP)
: sName( sN), dPos( dP) {}
} ;
typedef std::vector<AxisData> AXDATAVECTOR ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
struct FixtureData struct FixtureData
{ {
@@ -35,9 +23,8 @@ struct FixtureData
Point3d ptPos ; // posizione nel riferimento tavola Point3d ptPos ; // posizione nel riferimento tavola
double dAng ; // angolo di rotazione attorno al centro double dAng ; // angolo di rotazione attorno al centro
double dMov ; // posizione eventuale parte mobile double dMov ; // posizione eventuale parte mobile
std::string sTaLink ; // eventuale asse di tavola a cui è fissata
FixtureData( void) FixtureData( void)
: sName(), nId( GDB_ID_NULL), ptPos(), dAng( 0), dMov( 0), sTaLink() {} : sName(), nId( GDB_ID_NULL), ptPos(), dAng( 0), dMov( 0) {}
FixtureData( const std::string& sN, int nI, const Point3d& ptP, double dA, double dM) FixtureData( const std::string& sN, int nI, const Point3d& ptP, double dA, double dM)
: sName( sN), nId( nI), ptPos( ptP), dAng( dA), dMov( dM) {} : sName( sN), nId( nI), ptPos( ptP), dAng( dA), dMov( dM) {}
} ; } ;
@@ -69,14 +56,14 @@ class Disposition : public Operation
{ return true ; } { return true ; }
bool Save( int nBaseId, STRVECTOR& vString) const override ; bool Save( int nBaseId, STRVECTOR& vString) const override ;
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 ;
@@ -84,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 :
@@ -101,17 +88,13 @@ class Disposition : public Operation
bool GetTableRef1( Point3d& ptRef1) const ; bool GetTableRef1( Point3d& ptRef1) const ;
bool GetTableArea1( BBox3d& b3Area1) const ; bool GetTableArea1( BBox3d& b3Area1) const ;
bool GetTableAreaOffset1( BBox3d& b3AreaOffs1) const ; bool GetTableAreaOffset1( BBox3d& b3AreaOffs1) const ;
bool MoveAxis( const std::string& sName, double dPos) ;
bool RemoveAxis( const std::string& sName) ;
int AddFixture( const std::string& sName, int nId, const Point3d& ptPos, double dAngDeg = 0, int AddFixture( const std::string& sName, int nId, const Point3d& ptPos, double dAngDeg = 0,
double dMov = 0, bool bAddToList = true) ; double dMov = 0, bool bAddToList = true) ;
int GetFirstFixture( void) ; int GetFirstFixture( void) ;
int GetNextFixture( int nId) ; int GetNextFixture( int nId) ;
bool MoveFixture( int nId, const Vector3d& vtMove) ; bool MoveFixture( int nId, const Vector3d& vtMove) ;
bool RotateFixture( int nId, double dDeltaAngDeg) ; bool RotateFixture( int nId, double dDeltaAngDeg) ;
bool SetFixtureLink( int nId, const std::string& sTaLink) ;
bool MoveFixtureMobile( int nId, double dDeltaMov) ; bool MoveFixtureMobile( int nId, double dDeltaMov) ;
bool SetFixtureMobile( int nId, double dMov) ;
bool PlaceFixture( int nId, const Point3d& ptPos, double dAngDeg, double dMov) ; bool PlaceFixture( int nId, const Point3d& ptPos, double dAngDeg, double dMov) ;
bool RemoveFixture( int nId) ; bool RemoveFixture( int nId) ;
bool MoveToCornerRawPart( int nRawId, const Point3d& ptP, int nFlag, bool bAddToList = true, bool bVerify = true) ; bool MoveToCornerRawPart( int nRawId, const Point3d& ptP, int nFlag, bool bAddToList = true, bool bVerify = true) ;
@@ -119,19 +102,15 @@ 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 GetMoveAxisData( int nInd, std::string& sName, double& dPos) const ;
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, std::string& sTaLink) const ; double& dAngDeg, double& dMov) const ;
bool GetMoveRawData( int nInd, int& nRawId, int& nType, Point3d& ptPos, int& nFlag) const ; bool GetMoveRawData( int nInd, int& nRawId, int& nType, Point3d& ptPos, int& nFlag) const ;
bool SpecialApply( bool bRecalc) ; bool SpecialApply( bool bRecalc) ;
bool SpecialUpdate( void) ; bool SpecialUpdate( void) ;
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) ;
@@ -144,7 +123,6 @@ class Disposition : public Operation
Point3d m_ptRef1 ; // origine 1 della tavola Point3d m_ptRef1 ; // origine 1 della tavola
BBox3d m_b3Area1 ; // area utile 1 della tavola BBox3d m_b3Area1 ; // area utile 1 della tavola
std::array<double,4> m_dAreaOffset ; // eventuali allargamenti dell'area sui 4 lati (0=XP, 1=YP, 2=XM, 3=YM) std::array<double,4> m_dAreaOffset ; // eventuali allargamenti dell'area sui 4 lati (0=XP, 1=YP, 2=XM, 3=YM)
AXDATAVECTOR m_vAxData ; // elenco movimenti assi ausiliari
FIXDATAVECTOR m_vFixData ; // elenco posizionamento bloccaggi FIXDATAVECTOR m_vFixData ; // elenco posizionamento bloccaggi
MVRDATAVECTOR m_vMvrData ; // elenco movimenti grezzi MVRDATAVECTOR m_vMvrData ; // elenco movimenti grezzi
std::string m_sHead ; // eventuale testa usata per muovere i pezzi std::string m_sHead ; // eventuale testa usata per muovere i pezzi
+132 -2082
View File
File diff suppressed because it is too large Load Diff
+15 -67
View File
@@ -18,23 +18,8 @@
#include "ToolData.h" #include "ToolData.h"
#include "MachiningConst.h" #include "MachiningConst.h"
//----------------------------------------------------------------------------
// definizione strutture e vettori per fori, utensili e maschere
struct Hole ; struct Hole ;
struct MHDrill ;
struct HoleInfo ;
struct ToolInfo ;
class ICurve ; class ICurve ;
typedef std::vector<MHDrill> TABMHDRILL ;
typedef std::vector<HoleInfo> VECTORHOLE ;
typedef std::vector<ToolInfo> VECTORTOOL ;
//----------------------------------------------------------------------------
// definizione tipologia foratura
const int DRILL_TYPE_ERR = 0 ;
const int DRILL_TYPE_STD = 1 ; // 1 tool
const int DRILL_TYPE_MULTI_FIXED = 2 ; // più utensili fissi
const int DRILL_TYPE_MULTI_SEL = 3 ; // più utensili selezionabili
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class Drilling : public Machining class Drilling : public Machining
@@ -77,57 +62,24 @@ class Drilling : public Machining
bool UpdateToolData( bool* pbChanged = nullptr) override ; bool UpdateToolData( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ; const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ; bool GetGeometry( SELVECTOR& vIds) const override ;
bool GetSkippedGeometry( SELVECTOR& vIds) const override ;
public : public :
Drilling( void) ; Drilling( void) ;
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, bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId) ;
double dMHOff = 0, const Vector3d& vtAux = V_NULL, int nDrillType = DRILL_TYPE_STD,
INTVECTOR* pvActiveExit = nullptr, ToolInfo* currToolData = nullptr) ;
bool AdapthPathToMainTool( int nInd, const SelData& nCircId, const std::string& sPName, int nClId,
double dMHOff, const Vector3d& vtAux, int nDrillType,
INTVECTOR* pvActiveExit, ToolData* currToolData) ;
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, const Vector3d& vtA, const ToolData& currToolData) ; bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId) ;
bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHOff, const Vector3d& vtA, const ToolData& currToolData) ; bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) ;
bool MultiHeadDrilling( const SELVECTOR& vId, int nClId, bool bFixed, TABMHDRILL& vDrills, double& dMHOff) ;
bool CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux) ;
bool CalcMaskSel( VECTORHOLE& vHoles, const VECTORTOOL& vTools, const Vector3d& vtTool, const Vector3d& vtAux) ;
bool CalcDrilledHolesByConfig( VECTORHOLE& vHoles, int nMyInd, int nIndConfig, INTVECTOR& vIndDrilled) ;
bool EraseDuplicatedConfigs( VECTORHOLE& vHoles) ;
bool KeepMinRotatedConfigs( VECTORHOLE& vHoles, const Vector3d& vtAux, const Vector3d& vtTool) ;
bool CalcMultiHeadUndrilledHoles( const VECTORHOLE& vHoles, INTVECTOR& vIdUndrilledHoles) ;
bool CalcMultiHeadPartialDrilledHoles( const TABMHDRILL& vDrills, const VECTORHOLE& vHoles, const VECTORTOOL& vTools,
const INTVECTOR& vIdUndrilledHoles, INTDBLVECTOR& vIdPartialdrilledHoles) ;
bool CheckBasedConfig( const VECTORHOLE& vHoles, int nHoleInd, int& nValidConfig, bool& bBaseCase) ;
bool GetClosestHolesToHole( const VECTORHOLE& vHoles, int nMyInd, bool bDrilled, INTVECTOR& vInds) ;
bool OrderConfigsForSelectableTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndToolMain, TABMHDRILL& vDrills) ;
bool GetConfigsWithMoreDrilledHoles( const VECTORHOLE& vHoles, INTVECTOR& vInds) ;
bool ChooseBestConfigForSelectableTools( const VECTORHOLE& vHoles, int nIndToolMain, INTVECTOR& vConfInds, int& nBestConf) ;
bool CheckOtherHolesWithTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP,
const Frame3d& frHTM, const Frame3d& frHMTOP, double dDiamToler, int& nDrills) ;
bool GetHoleBestConfig( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nInd, TABMHDRILL& tabDrills, const Vector3d& vtAux, const Vector3d& vtTool, int& nOkHole) ;
bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id) ;
bool MultiHeadOrderConfig( TABMHDRILL& tabDrills, const VECTORHOLE& vHoles, const Vector3d& vtTool, const Vector3d& vtAux) ;
bool MultiHeadHoleToolsConfig( const VECTORHOLE& vHoles, int nConfig, INTINTVECTOR& vConfMask) ;
int VerifyMultiParallelDrills( void) ;
/* debug functions */
void PrintConfigs( const VECTORHOLE& vHoles) ;
void PrintDescent( const MHDrill& myMHDescent) ;
/* end debug functions */
private : private :
double GetSpeed() const double GetSpeed() const
@@ -142,19 +94,15 @@ class Drilling : public Machining
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; } { return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
private : private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
DrillingData m_Params ; // parametri lavorazione DrillingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile ToolData m_TParams ; // parametri utensile
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 double m_dDistBottom ; // distanza del foro dal bordo del grezzo
double m_dDistBottom ; // distanza del foro dal bordo del grezzo AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
INTVECTOR m_vUndrilledId ; // vettore degli identificativi dei fori non svuotati
INTDBLVECTOR m_vPartialDrilledId ; // vettore degli identificatii dei fori lavorati parzialmente
// con profodnità mancante
} ; } ;
+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.
+2 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio 15
VisualStudioVersion = 17.12.35527.113 VisualStudioVersion = 15.0.28307.645
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EgtMachKernel", "EgtMachKernel.vcxproj", "{0BD58222-92F3-48B2-B656-4497D1956874}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EgtMachKernel", "EgtMachKernel.vcxproj", "{0BD58222-92F3-48B2-B656-4497D1956874}"
EndProject EndProject
+7 -42
View File
@@ -21,13 +21,13 @@
<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</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">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v141_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
@@ -39,7 +39,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
@@ -102,10 +102,9 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EMK;_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>
@@ -237,8 +235,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="EMkDllMain.cpp" /> <ClCompile Include="EMkDllMain.cpp" />
<ClCompile Include="Estimator.cpp" /> <ClCompile Include="Estimator.cpp" />
<ClCompile Include="Exit.cpp" /> <ClCompile Include="Exit.cpp" />
<ClCompile Include="FiveAxisMilling.cpp" />
<ClCompile Include="FiveAxisMillingData.cpp" />
<ClCompile Include="Generator.cpp" /> <ClCompile Include="Generator.cpp" />
<ClCompile Include="GenMachining.cpp" /> <ClCompile Include="GenMachining.cpp" />
<ClCompile Include="GenMachiningData.cpp" /> <ClCompile Include="GenMachiningData.cpp" />
@@ -275,7 +271,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="OperationCL.cpp" /> <ClCompile Include="OperationCL.cpp" />
<ClCompile Include="Pocketing.cpp" /> <ClCompile Include="Pocketing.cpp" />
<ClCompile Include="PocketingData.cpp" /> <ClCompile Include="PocketingData.cpp" />
<ClCompile Include="PocketingNT.cpp" />
<ClCompile Include="Processor.cpp" /> <ClCompile Include="Processor.cpp" />
<ClCompile Include="SawFinishing.cpp" /> <ClCompile Include="SawFinishing.cpp" />
<ClCompile Include="SawFinishingData.cpp" /> <ClCompile Include="SawFinishingData.cpp" />
@@ -284,8 +279,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="SawRoughing.cpp" /> <ClCompile Include="SawRoughing.cpp" />
<ClCompile Include="SawRoughingData.cpp" /> <ClCompile Include="SawRoughingData.cpp" />
<ClCompile Include="SetupMgr.cpp" /> <ClCompile Include="SetupMgr.cpp" />
<ClCompile Include="SimulatorSP.cpp" /> <ClCompile Include="Simulator.cpp" />
<ClCompile Include="SimulatorMP.cpp" />
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
@@ -295,8 +289,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="Head.cpp" /> <ClCompile Include="Head.cpp" />
<ClCompile Include="SurfFinishing.cpp" /> <ClCompile Include="SurfFinishing.cpp" />
<ClCompile Include="SurfFinishingData.cpp" /> <ClCompile Include="SurfFinishingData.cpp" />
<ClCompile Include="SurfRoughing.cpp" />
<ClCompile Include="SurfRoughingData.cpp" />
<ClCompile Include="Table.cpp" /> <ClCompile Include="Table.cpp" />
<ClCompile Include="TcPos.cpp" /> <ClCompile Include="TcPos.cpp" />
<ClCompile Include="ToolData.cpp" /> <ClCompile Include="ToolData.cpp" />
@@ -309,15 +301,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkArcSpecial.h" /> <ClInclude Include="..\Include\EGkArcSpecial.h" />
<ClInclude Include="..\Include\EGkBBox1d.h" /> <ClInclude Include="..\Include\EGkBBox1d.h" />
<ClInclude Include="..\Include\EGkBBox3d.h" /> <ClInclude Include="..\Include\EGkBBox3d.h" />
<ClInclude Include="..\Include\EGkBiArcs.h" /> <ClInclude Include="..\Include\EGkCDeBoxPolyhedron.h" />
<ClInclude Include="..\Include\EGkCalcPocketing.h" />
<ClInclude Include="..\Include\EGkCAvSilhouetteSurfTm.h" />
<ClInclude Include="..\Include\EGkCAvToolSurfTm.h" />
<ClInclude Include="..\Include\EGkCDeBoxClosedSurfTm.h" />
<ClInclude Include="..\Include\EGkCDeClosedSurfTmClosedSurfTm.h" />
<ClInclude Include="..\Include\EGkCDeConeFrustumClosedSurfTm.h" />
<ClInclude Include="..\Include\EGkCDeCylClosedSurfTm.h" />
<ClInclude Include="..\Include\EGkCDeSpheClosedSurfTm.h" />
<ClInclude Include="..\Include\EGkChainCurves.h" /> <ClInclude Include="..\Include\EGkChainCurves.h" />
<ClInclude Include="..\Include\EGkColor.h" /> <ClInclude Include="..\Include\EGkColor.h" />
<ClInclude Include="..\Include\EGkCurve.h" /> <ClInclude Include="..\Include\EGkCurve.h" />
@@ -325,11 +309,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkCurveAux.h" /> <ClInclude Include="..\Include\EGkCurveAux.h" />
<ClInclude Include="..\Include\EGkCurveComposite.h" /> <ClInclude Include="..\Include\EGkCurveComposite.h" />
<ClInclude Include="..\Include\EGkCurveLine.h" /> <ClInclude Include="..\Include\EGkCurveLine.h" />
<ClInclude Include="..\Include\EGkCurveLocal.h" />
<ClInclude Include="..\Include\EGkCurvePointDiffGeom.h" /> <ClInclude Include="..\Include\EGkCurvePointDiffGeom.h" />
<ClInclude Include="..\Include\EGkDistPointCurve.h" /> <ClInclude Include="..\Include\EGkDistPointCurve.h" />
<ClInclude Include="..\Include\EGkDistPointLine.h" />
<ClInclude Include="..\Include\EGkDistPointSurfTm.h" />
<ClInclude Include="..\Include\EGkExtText.h" /> <ClInclude Include="..\Include\EGkExtText.h" />
<ClInclude Include="..\Include\EGkFrame3d.h" /> <ClInclude Include="..\Include\EGkFrame3d.h" />
<ClInclude Include="..\Include\EGkGdbConst.h" /> <ClInclude Include="..\Include\EGkGdbConst.h" />
@@ -342,13 +323,10 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkGeoObjType.h" /> <ClInclude Include="..\Include\EGkGeoObjType.h" />
<ClInclude Include="..\Include\EGkGeoPoint3d.h" /> <ClInclude Include="..\Include\EGkGeoPoint3d.h" />
<ClInclude Include="..\Include\EGkGeoVector3d.h" /> <ClInclude Include="..\Include\EGkGeoVector3d.h" />
<ClInclude Include="..\Include\EGkHashGrids1d.h" />
<ClInclude Include="..\Include\EGkHashGrids2d.h" /> <ClInclude Include="..\Include\EGkHashGrids2d.h" />
<ClInclude Include="..\Include\EGkIntersCurves.h" /> <ClInclude Include="..\Include\EGkIntersCurves.h" />
<ClInclude Include="..\Include\EGkIntersCurveSurfTm.h" />
<ClInclude Include="..\Include\EGkIntersLineSurfTm.h" /> <ClInclude Include="..\Include\EGkIntersLineSurfTm.h" />
<ClInclude Include="..\Include\EGkIntersLineTria.h" /> <ClInclude Include="..\Include\EGkIntersLineTria.h" />
<ClInclude Include="..\Include\EGkIntersPlaneSurfTm.h" />
<ClInclude Include="..\Include\EGkIntervals.h" /> <ClInclude Include="..\Include\EGkIntervals.h" />
<ClInclude Include="..\Include\EGkLuaAux.h" /> <ClInclude Include="..\Include\EGkLuaAux.h" />
<ClInclude Include="..\Include\EGkMaterial.h" /> <ClInclude Include="..\Include\EGkMaterial.h" />
@@ -359,10 +337,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkPoint3d.h" /> <ClInclude Include="..\Include\EGkPoint3d.h" />
<ClInclude Include="..\Include\EGkPointGrid3d.h" /> <ClInclude Include="..\Include\EGkPointGrid3d.h" />
<ClInclude Include="..\Include\EGkPolyArc.h" /> <ClInclude Include="..\Include\EGkPolyArc.h" />
<ClInclude Include="..\Include\EGkPolygon3d.h" />
<ClInclude Include="..\Include\EGkPolygonElevation.h" />
<ClInclude Include="..\Include\EGkPolyLine.h" /> <ClInclude Include="..\Include\EGkPolyLine.h" />
<ClInclude Include="..\Include\EGkQuaternion.h" />
<ClInclude Include="..\Include\EGkSelection.h" /> <ClInclude Include="..\Include\EGkSelection.h" />
<ClInclude Include="..\Include\EGkSfrCreate.h" /> <ClInclude Include="..\Include\EGkSfrCreate.h" />
<ClInclude Include="..\Include\EGkStmFromCurves.h" /> <ClInclude Include="..\Include\EGkStmFromCurves.h" />
@@ -370,7 +345,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkStringUtils3d.h" /> <ClInclude Include="..\Include\EGkStringUtils3d.h" />
<ClInclude Include="..\Include\EGkSurf.h" /> <ClInclude Include="..\Include\EGkSurf.h" />
<ClInclude Include="..\Include\EGkSurfFlatRegion.h" /> <ClInclude Include="..\Include\EGkSurfFlatRegion.h" />
<ClInclude Include="..\Include\EGkSurfLocal.h" />
<ClInclude Include="..\Include\EGkSurfTriMesh.h" /> <ClInclude Include="..\Include\EGkSurfTriMesh.h" />
<ClInclude Include="..\Include\EGkTriangle3d.h" /> <ClInclude Include="..\Include\EGkTriangle3d.h" />
<ClInclude Include="..\Include\EGkUiUnits.h" /> <ClInclude Include="..\Include\EGkUiUnits.h" />
@@ -380,7 +354,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkVolZmap.h" /> <ClInclude Include="..\Include\EGkVolZmap.h" />
<ClInclude Include="..\Include\EGnEgtUUID.h" /> <ClInclude Include="..\Include\EGnEgtUUID.h" />
<ClInclude Include="..\Include\EGnFileUtils.h" /> <ClInclude Include="..\Include\EGnFileUtils.h" />
<ClInclude Include="..\Include\EGnGetKeyData.h" />
<ClInclude Include="..\Include\EGnGetModuleVer.h" /> <ClInclude Include="..\Include\EGnGetModuleVer.h" />
<ClInclude Include="..\Include\EGnLuaAux.h" /> <ClInclude Include="..\Include\EGnLuaAux.h" />
<ClInclude Include="..\Include\EGnLuaMgr.h" /> <ClInclude Include="..\Include\EGnLuaMgr.h" />
@@ -395,7 +368,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EgtLibVer.h" /> <ClInclude Include="..\Include\EgtLibVer.h" />
<ClInclude Include="..\Include\EgtNumCollection.h" /> <ClInclude Include="..\Include\EgtNumCollection.h" />
<ClInclude Include="..\Include\EgtNumUtils.h" /> <ClInclude Include="..\Include\EgtNumUtils.h" />
<ClInclude Include="..\Include\EgtPerfCounter.h" />
<ClInclude Include="..\Include\EgtPointerOwner.h" /> <ClInclude Include="..\Include\EgtPointerOwner.h" />
<ClInclude Include="..\Include\EgtStringBase.h" /> <ClInclude Include="..\Include\EgtStringBase.h" />
<ClInclude Include="..\Include\EgtStringConverter.h" /> <ClInclude Include="..\Include\EgtStringConverter.h" />
@@ -423,8 +395,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="DrillingData.h" /> <ClInclude Include="DrillingData.h" />
<ClInclude Include="Estimator.h" /> <ClInclude Include="Estimator.h" />
<ClInclude Include="Exit.h" /> <ClInclude Include="Exit.h" />
<ClInclude Include="FiveAxisMilling.h" />
<ClInclude Include="FiveAxisMillingData.h" />
<ClInclude Include="Generator.h" /> <ClInclude Include="Generator.h" />
<ClInclude Include="GenMachining.h" /> <ClInclude Include="GenMachining.h" />
<ClInclude Include="GenMachiningData.h" /> <ClInclude Include="GenMachiningData.h" />
@@ -449,7 +419,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="OutputConst.h" /> <ClInclude Include="OutputConst.h" />
<ClInclude Include="Pocketing.h" /> <ClInclude Include="Pocketing.h" />
<ClInclude Include="PocketingData.h" /> <ClInclude Include="PocketingData.h" />
<ClInclude Include="PocketingNT.h" />
<ClInclude Include="Processor.h" /> <ClInclude Include="Processor.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="SawFinishing.h" /> <ClInclude Include="SawFinishing.h" />
@@ -462,14 +431,10 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="SetTempPhase.h" /> <ClInclude Include="SetTempPhase.h" />
<ClInclude Include="SetupMgr.h" /> <ClInclude Include="SetupMgr.h" />
<ClInclude Include="Simulator.h" /> <ClInclude Include="Simulator.h" />
<ClInclude Include="SimulatorSP.h" />
<ClInclude Include="SimulatorMP.h" />
<ClInclude Include="stdafx.h" /> <ClInclude Include="stdafx.h" />
<ClInclude Include="Head.h" /> <ClInclude Include="Head.h" />
<ClInclude Include="SurfFinishing.h" /> <ClInclude Include="SurfFinishing.h" />
<ClInclude Include="SurfFinishingData.h" /> <ClInclude Include="SurfFinishingData.h" />
<ClInclude Include="SurfRoughing.h" />
<ClInclude Include="SurfRoughingData.h" />
<ClInclude Include="Table.h" /> <ClInclude Include="Table.h" />
<ClInclude Include="TcPos.h" /> <ClInclude Include="TcPos.h" />
<ClInclude Include="ToolData.h" /> <ClInclude Include="ToolData.h" />
+5 -104
View File
@@ -150,7 +150,7 @@
<ClCompile Include="MachMgrDBTools.cpp"> <ClCompile Include="MachMgrDBTools.cpp">
<Filter>Source Files\MachMgr</Filter> <Filter>Source Files\MachMgr</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="SimulatorSP.cpp"> <ClCompile Include="Simulator.cpp">
<Filter>Source Files\Output</Filter> <Filter>Source Files\Output</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="MachMgrPhases.cpp"> <ClCompile Include="MachMgrPhases.cpp">
@@ -234,24 +234,6 @@
<ClCompile Include="TcPos.cpp"> <ClCompile Include="TcPos.cpp">
<Filter>Source Files\Machine</Filter> <Filter>Source Files\Machine</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="FiveAxisMillingData.cpp">
<Filter>Source Files\Machinings</Filter>
</ClCompile>
<ClCompile Include="FiveAxisMilling.cpp">
<Filter>Source Files\Operations</Filter>
</ClCompile>
<ClCompile Include="SurfRoughingData.cpp">
<Filter>Source Files\Machinings</Filter>
</ClCompile>
<ClCompile Include="SurfRoughing.cpp">
<Filter>Source Files\Operations</Filter>
</ClCompile>
<ClCompile Include="SimulatorMP.cpp">
<Filter>Source Files\Output</Filter>
</ClCompile>
<ClCompile Include="PocketingNT.cpp">
<Filter>Source Files\Operations</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="DllMain.h"> <ClInclude Include="DllMain.h">
@@ -347,7 +329,7 @@
<ClInclude Include="..\Include\EMkDispositionConst.h"> <ClInclude Include="..\Include\EMkDispositionConst.h">
<Filter>Header Files\Include</Filter> <Filter>Header Files\Include</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="SimulatorSP.h"> <ClInclude Include="Simulator.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Generator.h"> <ClInclude Include="Generator.h">
@@ -428,6 +410,9 @@
<ClInclude Include="..\Include\EGkBBox3d.h"> <ClInclude Include="..\Include\EGkBBox3d.h">
<Filter>Header Files\Include</Filter> <Filter>Header Files\Include</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\Include\EGkCDeBoxPolyhedron.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkChainCurves.h"> <ClInclude Include="..\Include\EGkChainCurves.h">
<Filter>Header Files\Include</Filter> <Filter>Header Files\Include</Filter>
</ClInclude> </ClInclude>
@@ -683,90 +668,6 @@
<ClInclude Include="..\Include\EGkBBox1d.h"> <ClInclude Include="..\Include\EGkBBox1d.h">
<Filter>Header Files\Include</Filter> <Filter>Header Files\Include</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="FiveAxisMillingData.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="FiveAxisMilling.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SurfRoughingData.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SurfRoughing.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkBiArcs.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCalcPocketing.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCAvSilhouetteSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCAvToolSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeBoxClosedSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeClosedSurfTmClosedSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeConeFrustumClosedSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeCylClosedSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeSpheClosedSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurveLocal.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkDistPointLine.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkDistPointSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkHashGrids1d.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntersCurveSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntersPlaneSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPolygon3d.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPolygonElevation.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkQuaternion.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkSurfLocal.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnGetKeyData.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtPerfCounter.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="SimulatorMP.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Simulator.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PocketingNT.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="EgtMachKernel.rc"> <ResourceCompile Include="EgtMachKernel.rc">
+12 -76
View File
@@ -15,12 +15,9 @@
#include "stdafx.h" #include "stdafx.h"
#include "DllMain.h" #include "DllMain.h"
#include "Estimator.h" #include "Estimator.h"
#include "MachMgr.h" #include "Machine.h"
#include "OutputConst.h" #include "OutputConst.h"
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnGetKeyData.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/SELkKeyProc.h"
using namespace std ; using namespace std ;
@@ -48,75 +45,23 @@ Estimator::Init( MachMgr* pMchMgr)
bool bool
Estimator::Run( const string& sCncFile, const string& sInfo) Estimator::Run( const string& sCncFile, const string& sInfo)
{ {
// Controllo della licenza // emetto info di log
unsigned int nOpt1, nOpt2 ; { string sOut = "Estimator Run : " + sCncFile ;
int nOptExpDays ; LOG_INFO( GetEMkLogger(), sOut.c_str()) ; }
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( ! GetEMkNetHwKey())
nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
// Verifica della abilitazione
bool bMinTime = false ;
if ( nOptExpDays >= GetMinDay())
bMinTime = true ;
bool bCurrTime = false ;
if ( nOptExpDays >= GetCurrDay())
bCurrTime = true ;
bool bKey = false ;
if ( nRet == KEY_OK)
bKey = true ;
bool bAdvMach = false ;
if ( ( nOpt1 & KEYOPT_EMK_ADV) != 0)
bAdvMach = true ;
// Esecuzione
if ( bMinTime && bCurrTime && bKey) {
// se non previste lavorazioni avanzate, verifico la loro assenza
if ( ! bAdvMach) {
int nOpId = m_pMchMgr->GetFirstActiveOperation() ;
while ( nOpId != GDB_ID_NULL) {
int nType = m_pMchMgr->GetOperationType( nOpId) ;
if ( nType == OPER_SURFROUGHING || nType == OPER_SURFFINISHING || nType == OPER_FIVEAXISMILLING) {
m_pMchMgr->SetLastError( 1001, "ADVANCED_MACH_OFF") ;
std::string sErr = "Warning on Key (MKC/AMO)" ;
LOG_ERROR( GetEMkLogger(), sErr.c_str()) ;
return false ;
}
nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ;
}
}
// emetto info di log
{ string sOut = "Estimator Run : " + sCncFile ;
LOG_INFO( GetEMkLogger(), sOut.c_str()) ; }
// cancello l'eventuale file di uscita (e anche il file errore)
EraseFile( sCncFile) ;
string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ;
EraseFile( sErrFile) ;
// lancio il processore
bool bOk = Processor::Run( sCncFile, sInfo) ;
// in caso di errore rinomino il file di output
if ( ! bOk)
RenameFile( sCncFile, sErrFile) ;
return bOk ;
}
// cancello l'eventuale file di uscita (e anche il file errore) // cancello l'eventuale file di uscita (e anche il file errore)
EraseFile( sCncFile) ; EraseFile( sCncFile) ;
string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ; string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ;
EraseFile( sErrFile) ; EraseFile( sErrFile) ;
// Generazione non abilitata // lancio il processore
m_pMchMgr->SetLastError( 1000, "NC_OFF") ; bool bOk = Processor::Run( sCncFile, sInfo) ;
std::string sErr = "Warning on Key (MKC/KYO)" ;
LOG_ERROR( GetEMkLogger(), sErr.c_str()) ; // in caso di errore rinomino il file di output
return false ; if ( ! bOk)
RenameFile( sCncFile, sErrFile) ;
return bOk ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -179,15 +124,6 @@ Estimator::CallOnTableData( void)
return m_pMachine->LuaCallFunction( ON_ESTIM_TABLE_DATA) ; return m_pMachine->LuaCallFunction( ON_ESTIM_TABLE_DATA) ;
} }
//----------------------------------------------------------------------------
bool
Estimator::CallOnTableAxisData( void)
{
if ( ! m_pMachine->LuaExistsFunction( ON_ESTIM_TABLE_AXIS_DATA))
return true ;
return m_pMachine->LuaCallFunction( ON_ESTIM_TABLE_AXIS_DATA) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Estimator::CallOnFixtureData( void) Estimator::CallOnFixtureData( void)
-1
View File
@@ -33,7 +33,6 @@ class Estimator : public Processor
bool CallOnDispositionStart( void) override ; bool CallOnDispositionStart( void) override ;
bool CallOnDispositionEnd( void) override ; bool CallOnDispositionEnd( void) override ;
bool CallOnTableData( void) override ; bool CallOnTableData( void) override ;
bool CallOnTableAxisData( void) override ;
bool CallOnFixtureData( void) override ; bool CallOnFixtureData( void) override ;
bool CallOnRawMoveData( void) override ; bool CallOnRawMoveData( void) override ;
bool CallOnToolSelect( void) override ; bool CallOnToolSelect( void) override ;
-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 ;
} }
-1021
View File
File diff suppressed because it is too large Load Diff
-97
View File
@@ -1,97 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : FiveAxisMilling.h Data : 22.05.24 Versione : 2.6e5
// Contenuto : Dichiarazione della classe FiveAxisMilling.
//
//
//
// Modifiche : 22.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Machining.h"
#include "FiveAxisMillingData.h"
#include "ToolData.h"
class ICurve ;
class ICurveComposite ;
//----------------------------------------------------------------------------
class FiveAxisMilling : public Machining
{
public : // IUserObj
FiveAxisMilling* Clone( void) const override ;
const std::string& GetClassName( void) const override ;
bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
bool ToSave( void) const override
{ return true ; }
bool Save( int nBaseId, STRVECTOR& vString) const override ;
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
public : // Operation
int GetType( void) const override
{ return OPER_FIVEAXISMILLING ; }
bool IsEmpty( void) const override
{ return ( m_nMills == 0) ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
protected : // Operation
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ;
public : // Machining
bool Prepare( const std::string& sMillName) override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool SetGeometry( const SELVECTOR& vIds) override ;
bool Preview( bool bRecalc) override ;
bool Apply( bool bRecalc, bool bPostApply) override ;
bool Update( bool bPostApply) override ;
bool GetParam( int nType, bool& bVal) const override ;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
public :
FiveAxisMilling( void) ;
private :
bool MyApply( bool bRecalc, bool bPostApply) ;
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
double GetApproxLinTol( void) const override ;
private :
double GetSpeed() const
{ return ( IsNullAngValue( m_Params.m_dSpeed) ? m_TParams.m_dSpeed : m_Params.m_dSpeed) ; }
double GetFeed() const
{ return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
double GetStartFeed() const
{ return ( IsNullLenValue( m_Params.m_dStartFeed) ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
double GetEndFeed() const
{ return ( IsNullLenValue( m_Params.m_dEndFeed) ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
double GetTipFeed() const
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
double GetOffsL() const
{ return ( IsUnknownValue( m_Params.m_dOffsL) ? m_TParams.m_dOffsL : m_Params.m_dOffsL) ; }
double GetOffsR() const
{ return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
FiveAxisMillingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nMills ; // numero di percorsi di lavoro generati
bool m_bRunning ; // flag di calcoli in corso
} ;
-557
View File
@@ -1,557 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : FiveAxisMillingData.cpp Data : 22.05.24 Versione : 2.6e5
// Contenuto : Implementazione struttura dati fresatura a 5 assi.
//
//
//
// Modifiche : 22.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "FiveAxisMillingData.h"
#include "MachiningDataFactory.h"
#include "MachiningConst.h"
#include "/EgtDev/Include/EmkToolConst.h"
#include "/EgtDev/Include/EmkSimuGenConst.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include <array>
#include <cassert>
using namespace std ;
//----------------------------------------------------------------------------
enum nFiveAxisMillingKey {
KEY_AB = 0,
KEY_AI,
KEY_DH,
KEY_F,
KEY_FE,
KEY_FS,
KEY_FT,
KEY_INV,
KEY_NAME,
KEY_NNS,
KEY_NNU,
KEY_OL,
KEY_OR,
KEY_PS,
KEY_S,
KEY_SCC,
KEY_SUBTYPE,
KEY_TI,
KEY_TNAME,
KEY_TUUID,
KEY_UUID,
KEY_ZZZ} ; // rappresenta il numero di elementi
static const array<string,KEY_ZZZ> sFiveAxisMillingKey = {
"AB",
"AI",
"DH",
"F",
"FE",
"FS",
"FT",
"INV",
"NAME",
"NNS",
"NNU",
"OL",
"OR",
"PS",
"S",
"SCC",
"SUB",
"TI",
"TN",
"TU",
"UUID"} ;
//----------------------------------------------------------------------------
MCHDATA_REGISTER( MT_FIVEAXISMILLING, "FIVEAXISMILLING", FiveAxisMillingData) ;
//----------------------------------------------------------------------------
FiveAxisMillingData*
FiveAxisMillingData::Clone( void) const
{
// alloco oggetto
FiveAxisMillingData* pDdata = new(nothrow) FiveAxisMillingData ;
// copio i dati
if ( pDdata != nullptr) {
if ( ! pDdata->CopyFrom( this)) {
delete pDdata ;
return nullptr ;
}
}
return pDdata ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::CopyFrom( const MachiningData* pMdata)
{
// è inutile copiare se sorgente coincide con destinazione
if ( pMdata == this)
return true ;
// la sorgente deve essere dello stesso tipo
const FiveAxisMillingData* pFdata = GetFiveAxisMillingData( pMdata) ;
if ( pFdata == nullptr)
return false ;
// eseguo copia
m_Uuid = pFdata->m_Uuid ;
m_sName = pFdata->m_sName ;
m_ToolUuid = pFdata->m_ToolUuid ;
m_sToolName = pFdata->m_sToolName ;
m_sBlockedAxis = pFdata->m_sBlockedAxis ;
m_sInitAngs = pFdata->m_sInitAngs ;
m_nSolCh = pFdata->m_nSolCh ;
m_dSpeed = pFdata->m_dSpeed ;
m_dFeed = pFdata->m_dFeed ;
m_dEndFeed = pFdata->m_dEndFeed ;
m_dStartFeed = pFdata->m_dStartFeed ;
m_dTipFeed = pFdata->m_dTipFeed ;
m_dOffsL = pFdata->m_dOffsL ;
m_dOffsR = pFdata->m_dOffsR ;
m_bToolInvert = pFdata->m_bToolInvert ;
m_bInvert = pFdata->m_bInvert ;
m_sDepth = pFdata->m_sDepth ;
m_dStartPos = pFdata->m_dStartPos ;
m_nSubType = pFdata->m_nSubType ;
m_sSysNotes = pFdata->m_sSysNotes ;
m_sUserNotes = pFdata->m_sUserNotes ;
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::SameAs(const MachiningData* pMdata) const
{
// se coincide con altro -> uguali
if ( pMdata == this)
return true ;
// se sono di tipo diverso -> diversi
const FiveAxisMillingData* pFdata = GetFiveAxisMillingData( pMdata) ;
if ( pFdata == nullptr)
return false ;
// confronto termine a termine
return ( m_Uuid == pFdata->m_Uuid &&
m_sName == pFdata->m_sName &&
m_ToolUuid == pFdata->m_ToolUuid &&
m_sToolName == pFdata->m_sToolName &&
m_sBlockedAxis == pFdata->m_sBlockedAxis &&
m_sInitAngs == pFdata->m_sInitAngs &&
m_nSolCh == pFdata->m_nSolCh &&
abs( m_dSpeed - pFdata->m_dSpeed) < EPS_MACH_ANG_PAR &&
abs( m_dFeed - pFdata->m_dFeed) < EPS_MACH_LEN_PAR &&
abs( m_dEndFeed - pFdata->m_dEndFeed) < EPS_MACH_LEN_PAR &&
abs( m_dStartFeed - pFdata->m_dStartFeed) < EPS_MACH_LEN_PAR &&
abs( m_dTipFeed - pFdata->m_dTipFeed) < EPS_MACH_LEN_PAR &&
abs( m_dOffsL - pFdata->m_dOffsL) < EPS_MACH_LEN_PAR &&
abs( m_dOffsR - pFdata->m_dOffsR) < EPS_MACH_LEN_PAR &&
m_bToolInvert == pFdata->m_bToolInvert &&
m_bInvert == pFdata->m_bInvert &&
m_sDepth == pFdata->m_sDepth &&
abs( m_dStartPos - pFdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
m_nSubType == pFdata->m_nSubType &&
m_sSysNotes == pFdata->m_sSysNotes &&
m_sUserNotes == pFdata->m_sUserNotes) ;
}
//----------------------------------------------------------------------------
int
FiveAxisMillingData::GetSize( void) const
{
// in debug verifico validità ultimo campo
assert( sFiveAxisMillingKey[KEY_UUID] == "UUID") ;
return KEY_ZZZ ;
}
//----------------------------------------------------------------------------
string
FiveAxisMillingData::GetTitle( void) const
{
return MCHDATA_GETNAME( FiveAxisMillingData) ;
}
//----------------------------------------------------------------------------
int
FindFiveAxisMillingKey( const string& sKey)
{
auto TheRange = equal_range( sFiveAxisMillingKey.cbegin(), sFiveAxisMillingKey.cend(), sKey) ;
if ( TheRange.first == TheRange.second)
return - 1 ;
return int( TheRange.first - sFiveAxisMillingKey.cbegin()) ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::FromString( const string& sString, int& nKey)
{
// separo chiave da valore
string sKey, sVal ;
SplitFirst( sString, "=", sKey, sVal) ;
// riconosco la chiave
nKey = FindFiveAxisMillingKey( ToUpper( sKey)) ;
bool bOk = ( nKey >= 0) ;
switch ( nKey) {
case KEY_AB :
m_sBlockedAxis = sVal ;
break ;
case KEY_AI :
m_sInitAngs = sVal ;
break ;
case KEY_DH :
m_sDepth = sVal ;
if ( m_sDepth.empty())
m_sDepth = "0" ;
break ;
case KEY_F :
bOk = ::FromString( sVal, m_dFeed) ;
break ;
case KEY_FE :
bOk = ::FromString( sVal, m_dEndFeed) ;
break ;
case KEY_FS :
bOk = ::FromString( sVal, m_dStartFeed) ;
break ;
case KEY_FT :
bOk = ::FromString( sVal, m_dTipFeed) ;
break ;
case KEY_INV :
bOk = ::FromString( sVal, m_bInvert) ;
break ;
case KEY_NAME :
m_sName = sVal ;
bOk = ! m_sName.empty() ;
break ;
case KEY_NNS :
m_sSysNotes = sVal ;
break ;
case KEY_NNU :
m_sUserNotes = sVal ;
break ;
case KEY_OL :
bOk = ::FromString( sVal, m_dOffsL) ;
break ;
case KEY_OR :
bOk = ::FromString( sVal, m_dOffsR) ;
break ;
case KEY_PS :
bOk = ::FromString( sVal, m_dStartPos) ;
break ;
case KEY_S :
bOk = ::FromString( sVal, m_dSpeed) ;
break ;
case KEY_SCC :
bOk = ::FromString( sVal, m_nSolCh) ;
break ;
case KEY_SUBTYPE :
bOk = ::FromString( sVal, m_nSubType) ;
break ;
case KEY_TNAME :
m_sToolName = sVal ;
break ;
case KEY_TI :
bOk = ::FromString( sVal, m_bToolInvert) ;
break ;
case KEY_TUUID :
bOk = ::FromString( sVal, m_ToolUuid) ;
break ;
case KEY_UUID :
bOk = ::FromString( sVal, m_Uuid) ;
break ;
default :
bOk = false ;
break ;
}
return bOk ;
}
//----------------------------------------------------------------------------
string
FiveAxisMillingData::ToString( int nKey) const
{
switch ( nKey) {
case KEY_AB : return ( sFiveAxisMillingKey[KEY_AB] + "=" + m_sBlockedAxis) ;
case KEY_AI : return ( sFiveAxisMillingKey[KEY_AI] + "=" + m_sInitAngs) ;
case KEY_DH : return ( sFiveAxisMillingKey[KEY_DH] + "=" + m_sDepth) ;
case KEY_F : return ( sFiveAxisMillingKey[KEY_F] + "=" + ::ToString( m_dFeed)) ;
case KEY_FE : return ( sFiveAxisMillingKey[KEY_FE] + "=" + ::ToString( m_dEndFeed)) ;
case KEY_FS : return ( sFiveAxisMillingKey[KEY_FS] + "=" + ::ToString( m_dStartFeed)) ;
case KEY_FT : return ( sFiveAxisMillingKey[KEY_FT] + "=" + ::ToString( m_dTipFeed)) ;
case KEY_INV : return ( sFiveAxisMillingKey[KEY_INV] + "=" + ::ToString( m_bInvert)) ;
case KEY_NAME : return ( sFiveAxisMillingKey[KEY_NAME] + "=" + m_sName) ;
case KEY_NNS : return ( sFiveAxisMillingKey[KEY_NNS] + "=" + m_sSysNotes) ;
case KEY_NNU : return ( sFiveAxisMillingKey[KEY_NNU] + "=" + m_sUserNotes) ;
case KEY_OL : return ( sFiveAxisMillingKey[KEY_OL] + "=" + ::ToString( m_dOffsL)) ;
case KEY_OR : return ( sFiveAxisMillingKey[KEY_OR] + "=" + ::ToString( m_dOffsR)) ;
case KEY_PS : return ( sFiveAxisMillingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
case KEY_S : return ( sFiveAxisMillingKey[KEY_S] + "=" + ::ToString( m_dSpeed)) ;
case KEY_SCC : return ( sFiveAxisMillingKey[KEY_SCC] + "=" + ::ToString( m_nSolCh)) ;
case KEY_SUBTYPE : return ( sFiveAxisMillingKey[KEY_SUBTYPE] + "=" + ::ToString( m_nSubType)) ;
case KEY_TI : return ( sFiveAxisMillingKey[KEY_TI] + "=" + ::ToString( m_bToolInvert)) ;
case KEY_TNAME : return ( sFiveAxisMillingKey[KEY_TNAME] + "=" + m_sToolName) ;
case KEY_TUUID : return ( sFiveAxisMillingKey[KEY_TUUID] + "=" + ::ToString( m_ToolUuid)) ;
case KEY_UUID : return ( sFiveAxisMillingKey[KEY_UUID] + "=" + ::ToString( m_Uuid)) ;
default : return "" ;
}
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::IsOptional( int nKey) const
{
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::VerifySolCh( int nVal) const
{
return IsValidOperationScc( nVal) ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::VerifyTool( const ToolsMgr* pToolsMgr, const string& sVal, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( sVal) ;
if ( pTdata == nullptr)
return false ;
if ( ( pTdata->m_nType & TF_MILL) == 0 && ( pTdata->m_nType & TF_SAWBLADE) == 0)
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( m_ToolUuid) ;
return ( pTdata != nullptr) ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::SetParam( int nType, bool bVal)
{
switch ( nType) {
case MPA_INVERT :
m_bInvert = bVal ;
return true ;
case MPA_TOOLINVERT :
m_bToolInvert = bVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::SetParam( int nType, int nVal)
{
switch ( nType) {
case MPA_SCC :
if ( ! VerifySolCh( nVal))
return false ;
m_nSolCh = nVal ;
return true ;
case MPA_SUBTYPE :
m_nSubType = nVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::SetParam( int nType, double dVal)
{
switch ( nType) {
case MPA_SPEED :
m_dSpeed = dVal ;
return true ;
case MPA_FEED :
m_dFeed = dVal ;
return true ;
case MPA_STARTFEED :
m_dStartFeed = dVal ;
return true ;
case MPA_ENDFEED :
m_dEndFeed = dVal ;
return true ;
case MPA_TIPFEED :
m_dTipFeed = dVal ;
return true ;
case MPA_OFFSL :
m_dOffsL = dVal ;
return true ;
case MPA_OFFSR :
m_dOffsR = dVal ;
return true ;
case MPA_DEPTH :
m_sDepth = ::ToString( dVal) ;
return true ;
case MPA_STARTPOS :
m_dStartPos = dVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::SetParam( int nType, const string& sVal)
{
switch ( nType) {
case MPA_NAME :
m_sName = sVal ;
return true ;
case MPA_TOOL :
m_sToolName = sVal ;
return true ;
case MPA_DEPTH_STR :
m_sDepth = sVal ;
return true ;
case MPA_TUUID :
return ::FromString( sVal, m_ToolUuid) ;
case MPA_UUID :
return ::FromString( sVal, m_Uuid) ;
case MPA_SYSNOTES :
m_sSysNotes = sVal ;
return true ;
case MPA_USERNOTES :
m_sUserNotes = sVal ;
return true ;
case MPA_INITANGS :
m_sInitAngs = sVal ;
return true ;
case MPA_BLOCKEDAXIS :
m_sBlockedAxis = sVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::ResetTool( void)
{
m_sToolName.clear() ;
m_ToolUuid.Clear() ;
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::GetParam( int nType, bool& bVal) const
{
switch ( nType) {
case MPA_INVERT :
bVal = m_bInvert ;
return true ;
case MPA_TOOLINVERT :
bVal = m_bToolInvert ;
return true ;
}
bVal = false ;
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::GetParam( int nType, int& nVal) const
{
switch ( nType) {
case MPA_TYPE :
nVal = MT_FIVEAXISMILLING ;
return true ;
case MPA_SCC :
nVal = m_nSolCh ;
return true ;
case MPA_SUBTYPE :
nVal = m_nSubType ;
return true ;
}
nVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::GetParam( int nType, double& dVal) const
{
switch ( nType) {
case MPA_SPEED :
dVal = m_dSpeed ;
return true ;
case MPA_FEED :
dVal = m_dFeed ;
return true ;
case MPA_STARTFEED :
dVal = m_dStartFeed ;
return true ;
case MPA_ENDFEED :
dVal = m_dEndFeed ;
return true ;
case MPA_TIPFEED :
dVal = m_dTipFeed ;
return true ;
case MPA_OFFSL :
dVal = m_dOffsL ;
return true ;
case MPA_OFFSR :
dVal = m_dOffsR ;
return true ;
case MPA_STARTPOS :
dVal = m_dStartPos ;
return true ;
}
dVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::GetParam( int nType, string& sVal) const
{
switch ( nType) {
case MPA_NAME :
sVal = m_sName ;
return true ;
case MPA_TOOL :
sVal = m_sToolName ;
return true ;
case MPA_DEPTH_STR :
sVal = m_sDepth ;
return true ;
case MPA_TUUID :
sVal = ::ToString( m_ToolUuid) ;
return true ;
case MPA_UUID :
sVal = ::ToString( m_Uuid) ;
return true ;
case MPA_SYSNOTES :
sVal = m_sSysNotes ;
return true ;
case MPA_USERNOTES :
sVal = m_sUserNotes ;
return true ;
case MPA_INITANGS :
sVal = m_sInitAngs ;
return true ;
case MPA_BLOCKEDAXIS :
sVal = m_sBlockedAxis ;
return true ;
}
sVal = "" ;
return false ;
}
-76
View File
@@ -1,76 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : FiveAxisMillingData.h Data : 22.05.24 Versione : 2.6e5
// Contenuto : Dichiarazione della struct FiveAxisMillingData e costanti associate.
//
//
//
// Modifiche : 22.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "MachiningData.h"
//----------------------------------------------------------------------------
struct FiveAxisMillingData : public MachiningData
{
EgtUUID m_ToolUuid ; // identificativo universale dell'utensile
std::string m_sToolName ; // nome dell'utensile
std::string m_sInitAngs ; // angoli iniziali suggeriti (Nome1=val1,Nome2=val2)
std::string m_sBlockedAxis ; // eventuale asse rotante bloccato (Nome=val)
int m_nSolCh ; // criterio scelta soluzione (quando possibili molteplici)
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
double m_dTipFeed ; // velocità di lavorazione di sfondamento ( se 0 da utensile)
double m_dOffsR ; // offset radiale ( se UNKNOWN_PAR da utensile)
double m_dOffsL ; // offset longitudinale ( se UNKNOWN_PAR da utensile)
bool m_bToolInvert ; // flag per inversione direzione utensile da geometria
bool m_bInvert ; // flag di inversione direzione lavorazione
std::string m_sDepth ; // affondamento (espressione numerica)
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
int m_nSubType ; // da [GenMachining] di Ini di macchina
std::string m_sSysNotes ; // note interne
std::string m_sUserNotes ; // note dell'utente
FiveAxisMillingData( void)
: m_ToolUuid(), m_nSolCh( 0), m_dSpeed( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
m_dOffsR( 0), m_dOffsL( 0), m_bToolInvert( false), m_bInvert( false), m_dStartPos( 0), m_nSubType( 0) {}
FiveAxisMillingData* Clone( void) const override ;
bool CopyFrom( const MachiningData* pMdata) override ;
bool SameAs(const MachiningData* pMdata) const override ;
int GetType( void) const override
{ return MT_FIVEAXISMILLING ; }
int GetSize( void) const override ;
std::string GetTitle( void) const override ;
bool FromString( const std::string& sString, int& nKey) override ;
std::string ToString( int nKey) const override ;
bool IsOptional( int nKey) const override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool ResetTool( void) override ;
bool GetParam( int nType, bool& bVal) const override ;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const override ;
bool VerifyTool( const ToolsMgr* pToolsMgr, const std::string& sVal, const ToolData*& pTdata) const override ;
bool VerifySolCh( int nVal) const ;
} ;
//----------------------------------------------------------------------------
inline const FiveAxisMillingData* GetFiveAxisMillingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_FIVEAXISMILLING)
return nullptr ;
return ( static_cast<const FiveAxisMillingData*>( pMdata)) ; }
inline FiveAxisMillingData* GetFiveAxisMillingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_FIVEAXISMILLING)
return nullptr ;
return ( static_cast<FiveAxisMillingData*>( pMdata)) ; }
+16 -105
View File
@@ -39,7 +39,6 @@ using namespace std ;
// 2806 = "Error in GenMachining : link movements not calculable" // 2806 = "Error in GenMachining : link movements not calculable"
// 2807 = "Error in GenMachining : link outstroke xx" // 2807 = "Error in GenMachining : link outstroke xx"
// 2808 = "Error in GenMachining : post apply not calculable" // 2808 = "Error in GenMachining : post apply not calculable"
// 2809 = "Error in GenMachining : Tool loading failed"
// 2851 = "Warning in GenMachining : Skipped entity (xx)" // 2851 = "Warning in GenMachining : Skipped entity (xx)"
// 2852 = "Warning in GenMachining : No machinable path" // 2852 = "Warning in GenMachining : No machinable path"
// 2853 = "Warning in GenMachining : Tool name changed (xx)" // 2853 = "Warning in GenMachining : Tool name changed (xx)"
@@ -55,27 +54,15 @@ static const string EVAR_INVERT = ".INVERT" ; // IN (bool) flag di inversio
static const string EVAR_STARTPOS = ".STARTPOS" ; // IN (num) quota di inizio lavorazione (sempre >= 0) static const string EVAR_STARTPOS = ".STARTPOS" ; // IN (num) quota di inizio lavorazione (sempre >= 0)
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_SYSNOTES = ".SYSNOTES" ; // IN (string) note interne
static const string EVAR_USERNOTES = ".USERNOTES" ;// IN (string) note dell'utente
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
static const string EVAR_TIPFEED = ".TIPFEED" ; // IN (num) feed di punta dell'utensile static const string EVAR_TIPFEED = ".TIPFEED" ; // IN (num) feed di punta dell'utensile
static const string EVAR_ISROBOT = ".ISROBOT" ; // IN (bool) flag per indicare che la cinematica è di tipo robot static const string EVAR_SYSNOTES = ".SYSNOTES" ; // IN (string) note interne
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok) static const string EVAR_USERNOTES = ".USERNOTES" ;// IN (string) note dell'utente
static const string EVAR_MILLS = ".MILLS" ; // OUT (int) numero di percorsi di lavoro static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string EVAR_MILLS = ".MILLS" ; // OUT (int) numero di percorsi di lavoro
static const string ON_PREVIEW = "OnPreview_" ; static const string ON_PREVIEW = "OnPreview_" ;
static const string ON_APPLY = "OnApply_" ; static const string ON_APPLY = "OnApply_" ;
@@ -449,12 +436,6 @@ GenMachining::Preview( bool bRecalc)
return false ; return false ;
} }
// rendo corrente l'utensile usato nella lavorazione
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
m_pMchMgr->SetLastError( 2809, "Error in GenMachining : Tool loading failed") ;
return false ;
}
// recupero gruppo per geometria di Preview // recupero gruppo per geometria di Preview
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ; int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
@@ -499,25 +480,13 @@ GenMachining::Preview( bool bRecalc)
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
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_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
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()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
// eseguo // eseguo
bOk = bOk && pMch->LuaCallFunction( sPreview, false) ; bOk = bOk && pMch->LuaCallFunction( sPreview, false) ;
// recupero valori parametri obbligatori // recupero valori parametri obbligatori
@@ -557,27 +526,19 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento // verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged && if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) { ( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione // confermo i percorsi di lavorazione
m_nMills = nCurrMills ; m_nMills = nCurrMills ;
string sLog = string( "GenMachining apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ; LOG_DBG_INFO( GetEMkLogger(), "GenMachining apply skipped : status already ok") ;
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente // eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply)) if ( ! Update( bPostApply))
return false ; return false ;
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ; LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo // esco con successo
return true ; return true ;
} }
m_nStatus = MCH_ST_TO_VERIFY ; m_nStatus = MCH_ST_TO_VERIFY ;
// rendo corrente l'utensile usato nella lavorazione
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
m_pMchMgr->SetLastError( 2809, "Error in GenMachining : Tool loading failed") ;
return false ;
}
// recupero gruppo per geometria di lavorazione (Cutter Location) // recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ; int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
@@ -622,25 +583,13 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
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_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
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()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
// eseguo // eseguo
bOk = bOk && pMch->LuaCallFunction( sApply, false) ; bOk = bOk && pMch->LuaCallFunction( sApply, false) ;
// recupero valori parametri obbligatori // recupero valori parametri obbligatori
@@ -687,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) ;
@@ -856,39 +802,15 @@ GenMachining::UpdateToolData( bool* pbChanged)
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ; ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr) if ( pTMgr == nullptr)
return false ; return false ;
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome) // recupero l'utensile nel DB utensili
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) { if ( pTdata == nullptr)
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ; return false ;
if ( pTdata == nullptr) // verifico se sono diversi (ad esclusione del nome)
return false ; m_TParams.m_sName = pTdata->m_sName ;
m_Params.m_ToolUuid = m_TParams.m_Uuid ; bool bChanged = ! SameTool( m_TParams, *pTdata) ;
}
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri // 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 (" +
@@ -970,14 +892,3 @@ GenMachining::VerifyGeometry( SelData Id, int& nSubs, int& nType)
else else
return false ; return false ;
} }
//----------------------------------------------------------------------------
double
GenMachining::GetApproxLinTol( void) const
{
double dLinTol ;
if ( GetValInNotes( m_Params.m_sUserNotes, "LinTol", dLinTol))
return dLinTol ;
else
return Operation::GetApproxLinTol() ;
}
-1
View File
@@ -67,7 +67,6 @@ class GenMachining : public Machining
private : private :
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ; bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
double GetApproxLinTol( void) const override ;
private : private :
double GetSpeed() const double GetSpeed() const
+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)) ; }
+14 -58
View File
@@ -17,10 +17,8 @@
#include "Generator.h" #include "Generator.h"
#include "MachMgr.h" #include "MachMgr.h"
#include "OutputConst.h" #include "OutputConst.h"
#include "/EgtDev/Include/EMkDllMain.h"
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnGetKeyData.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/SELkKeyProc.h"
using namespace std ; using namespace std ;
@@ -48,49 +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 ;
}
else {
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ; nOpt1, nOpt2, nOptExpDays) ;
if ( ! GetEMkNetHwKey()) bEnabled = ( nRet == KEY_OK && ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0) ;
nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, }
nOpt1, nOpt2, nOptExpDays) ; if ( bEnabled) {
// Verifica della abilitazione
bool bMinTime = false ;
if ( nOptExpDays >= GetMinDay())
bMinTime = true ;
bool bCurrTime = false ;
if ( nOptExpDays >= GetCurrDay())
bCurrTime = true ;
bool bKey = false ;
if ( nRet == KEY_OK)
bKey = true ;
bool bNcOff = false ;
if ( ( nOpt1 & KEYOPT_EMK_NC_OFF) != 0)
bNcOff = true ;
bool bAdvMach = false ;
if ( ( nOpt1 & KEYOPT_EMK_ADV) != 0)
bAdvMach = true ;
// Esecuzione
if ( bMinTime && bCurrTime && bKey && ! bNcOff) {
// se non previste lavorazioni avanzate, verifico la loro assenza
if ( ! bAdvMach) {
int nOpId = m_pMchMgr->GetFirstActiveOperation() ;
while ( nOpId != GDB_ID_NULL) {
int nType = m_pMchMgr->GetOperationType( nOpId) ;
if ( nType == OPER_SURFROUGHING || nType == OPER_SURFFINISHING || nType == OPER_FIVEAXISMILLING) {
m_pMchMgr->SetLastError( 1001, "ADVANCED_MACH_OFF") ;
std::string sErr = "Warning on Key (MKC/AMO)" ;
LOG_ERROR( GetEMkLogger(), sErr.c_str()) ;
return false ;
}
nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ;
}
}
// emetto info di log // emetto info di log
{ string sOut = "Generator Run : " + sCncFile ; { string sOut = "Generator Run : " + sCncFile ;
@@ -111,14 +79,9 @@ 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 = ( bNcOff ? "Warning on Key (MKC/NCO)" : "Warning on Key (MKC/KYO)") ; std::string sErr = "Warning on Key (MKC/NCO)" ;
LOG_ERROR( GetEMkLogger(), sErr.c_str()) ; LOG_ERROR( GetEMkLogger(), sErr.c_str()) ;
return false ; return false ;
} }
@@ -181,13 +144,6 @@ Generator::CallOnTableData( void)
return m_pMachine->LuaCallFunction( ON_TABLE_DATA) ; return m_pMachine->LuaCallFunction( ON_TABLE_DATA) ;
} }
//----------------------------------------------------------------------------
bool
Generator::CallOnTableAxisData( void)
{
return m_pMachine->LuaCallFunction( ON_TABLE_AXIS_DATA) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Generator::CallOnFixtureData( void) Generator::CallOnFixtureData( void)
-1
View File
@@ -33,7 +33,6 @@ class Generator : public Processor
bool CallOnDispositionStart( void) override ; bool CallOnDispositionStart( void) override ;
bool CallOnDispositionEnd( void) override ; bool CallOnDispositionEnd( void) override ;
bool CallOnTableData( void) override ; bool CallOnTableData( void) override ;
bool CallOnTableAxisData( void) override ;
bool CallOnFixtureData( void) override ; bool CallOnFixtureData( void) override ;
bool CallOnRawMoveData( void) override ; bool CallOnRawMoveData( void) override ;
bool CallOnToolSelect( void) override ; bool CallOnToolSelect( void) override ;
+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 -6
View File
@@ -16,16 +16,11 @@
//----------------- Costanti generali ---------------------------------------- //----------------- Costanti generali ----------------------------------------
#include "/EgtDev/Include/EGkGeoConst.h" #include "/EgtDev/Include/EGkGeoConst.h"
//----------- Minima distanza di sicurezza ----------------------------------
const double MIN_SAFEDIST = 5.0 ;
//----------- Costanti per approssimazioni con polilinee o poliarchi -------- //----------- Costanti per approssimazioni con polilinee o poliarchi --------
const double LIN_TOL_STD = 0.1 ; const double LIN_TOL_STD = 0.1 ;
const double LIN_TOL_MID = 0.05 ; const double LIN_TOL_MID = 0.05 ;
const double LIN_TOL_RAW = 0.5 ;
const double ANG_TOL_STD_DEG = 15 ;
const double ANG_TOL_MID_DEG = 45 ;
const double ANG_TOL_MAX_DEG = 90 ; const double ANG_TOL_MAX_DEG = 90 ;
const double ANG_TOL_STD_DEG = 15 ;
const double LIN_FEA_STD = 20 ; const double LIN_FEA_STD = 20 ;
//----------- Costante per offset salva spigoli di lama su cornici curve ---- //----------- Costante per offset salva spigoli di lama su cornici curve ----
+2 -8
View File
@@ -52,7 +52,6 @@ Head::Clone( void) const
pHead->m_bMaxDeltaR2On1 = m_bMaxDeltaR2On1 ; pHead->m_bMaxDeltaR2On1 = m_bMaxDeltaR2On1 ;
pHead->m_Rot2Stroke = m_Rot2Stroke ; pHead->m_Rot2Stroke = m_Rot2Stroke ;
pHead->m_nSolCh = m_nSolCh ; pHead->m_nSolCh = m_nSolCh ;
pHead->m_vsOtherColl = m_vsOtherColl ;
} }
catch( ...) { catch( ...) {
delete pHead ; delete pHead ;
@@ -74,7 +73,6 @@ Head::Dump( string& sOut, bool bMM, const char* szNewLine) const
sOut += "ExitCount=" + ToString( m_nExitCount) + szNewLine ; sOut += "ExitCount=" + ToString( m_nExitCount) + szNewLine ;
sOut += "HSet=" + ToString( m_vsHSet) + szNewLine ; sOut += "HSet=" + ToString( m_vsHSet) + szNewLine ;
sOut += "ADir=" + ToString( m_vtADir) + szNewLine ; sOut += "ADir=" + ToString( m_vtADir) + szNewLine ;
sOut += "OtherColl=" + ToString( m_vsOtherColl) + szNewLine ;
return true ; return true ;
} }
@@ -105,7 +103,7 @@ Head::GetGeomDB( void) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
Head::Head( void) Head::Head( void)
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_nType( MCH_HT_NONE), m_nExitCount( 0), : m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_nType( MCH_HT_NONE), m_nExitCount( 0),
m_nSelectType( MCH_SLT_FIXEDEXITS), m_dRot1W( 1), m_bMaxDeltaR2On1( true), m_nSolCh( MCH_SCC_NONE) m_dRot1W( 1), m_bMaxDeltaR2On1( true), m_nSolCh( MCH_SCC_NONE)
{ {
m_Rot2Stroke.Min = - INFINITO ; m_Rot2Stroke.Min = - INFINITO ;
m_Rot2Stroke.Max = INFINITO ; m_Rot2Stroke.Max = INFINITO ;
@@ -113,7 +111,7 @@ Head::Head( void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet, int nSelectType, const Vector3d& vtADir, Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet, 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)
{ {
m_sName = sName ; m_sName = sName ;
@@ -124,10 +122,6 @@ Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet,
m_nExitCount = 1 ; m_nExitCount = 1 ;
m_vsHSet.clear() ; m_vsHSet.clear() ;
m_vsHSet.push_back( sHSet) ; m_vsHSet.push_back( sHSet) ;
if ( nSelectType == MCH_SLT_FIXEDEXITS || nSelectType == MCH_SLT_ONEEXIT || nSelectType == MCH_SLT_MULTIEXITS)
m_nSelectType = nSelectType ;
else
m_nSelectType = MCH_SLT_FIXEDEXITS ;
m_vtADir = vtADir ; m_vtADir = vtADir ;
m_vtADir.Normalize() ; m_vtADir.Normalize() ;
m_dRot1W = dRot1W ; m_dRot1W = dRot1W ;
+1 -4
View File
@@ -30,7 +30,7 @@ class Head : public IUserObj
public : public :
Head( void) ; Head( void) ;
bool Set( const std::string& sName, int nType, int nExitCount, const std::string& sHSet, int nSelectType, bool Set( const std::string& sName, int nType, int nExitCount, const std::string& sHSet,
const Vector3d& vtADir, double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const Vector3d& vtADir, double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh,
const STRVECTOR& vsOthColl) ; const STRVECTOR& vsOthColl) ;
bool AddHeadToHSet( const std::string& sHead) ; bool AddHeadToHSet( const std::string& sHead) ;
@@ -43,8 +43,6 @@ class Head : public IUserObj
{ return m_nExitCount ; } { return m_nExitCount ; }
const STRVECTOR& GetHSet(void) const const STRVECTOR& GetHSet(void) const
{ return m_vsHSet ; } { return m_vsHSet ; }
int GetSelectType( void) const
{ return m_nSelectType ; }
const Vector3d& GetADir( void) const const Vector3d& GetADir( void) const
{ return m_vtADir ; } { return m_vtADir ; }
double GetRot1W( void) const double GetRot1W( void) const
@@ -65,7 +63,6 @@ class Head : public IUserObj
int m_nType ; int m_nType ;
int m_nExitCount ; int m_nExitCount ;
STRVECTOR m_vsHSet ; STRVECTOR m_vsHSet ;
int m_nSelectType ;
Vector3d m_vtADir ; Vector3d m_vtADir ;
double m_dRot1W ; double m_dRot1W ;
bool m_bMaxDeltaR2On1 ; bool m_bMaxDeltaR2On1 ;
-20
View File
@@ -47,10 +47,6 @@ const std::string MACH_RAW_SOLID = "RawSolid" ;
const std::string MACH_RAW_CENTER = "RawCenter" ; const std::string MACH_RAW_CENTER = "RawCenter" ;
// Nome del contorno esterno del grezzo // Nome del contorno esterno del grezzo
const std::string MACH_RAW_OUTLINE = "RawOutline" ; const std::string MACH_RAW_OUTLINE = "RawOutline" ;
// Nome della regione superiore del grezzo
const std::string MACH_RAW_UP_REG = "RawUpReg" ;
// Nome della regione inferiore del grezzo
const std::string MACH_RAW_DOWN_REG = "RawDwnReg" ;
// Nome del kerf del grezzo // Nome del kerf del grezzo
const std::string MACH_RAW_KERF = "Kerf" ; const std::string MACH_RAW_KERF = "Kerf" ;
@@ -84,12 +80,6 @@ const std::string GENMACHINING_SEC = "GenMachining" ;
// Chiave (radice) per nome lavorazione generica i-esima // Chiave (radice) per nome lavorazione generica i-esima
const std::string GENMACHINING_SCRIPT_KEY = "GenScript" ; const std::string GENMACHINING_SCRIPT_KEY = "GenScript" ;
//----------------------------------------------------------------------------
// Sezione fresature 5assi nel file INI di macchina
const std::string FIVEAXISMILLING_SEC = "5AxMilling" ;
// Chiave (radice) per nome lavorazione 5assi i-esima
const std::string FIVEAXISMILLING_SCRIPT_KEY = "5AxScript" ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Sezione di attrezzaggio nel file INI di macchina // Sezione di attrezzaggio nel file INI di macchina
const std::string SETUP_SEC = "Setup" ; const std::string SETUP_SEC = "Setup" ;
@@ -122,12 +112,6 @@ const std::string MILLHOLDER_KEY = "MillHolder" ;
// Sezione portautensili nel file INI di macchina // Sezione portautensili nel file INI di macchina
const std::string TOOLHOLDER_SEC = "ToolHolder" ; const std::string TOOLHOLDER_SEC = "ToolHolder" ;
//----------------------------------------------------------------------------
// Sezione lavorazioni nel file INI di macchina
const std::string MACHININGS_SEC = "Machinings" ;
// Chiave per abilitare discesa e risalita in rapido da fresature con estremi fuori dal grezzo
const std::string RAPIDONOUT_KEY = "RapidOnOut" ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Minimo spessore del grezzo // Minimo spessore del grezzo
const double RAW_MIN_H = 1 ; const double RAW_MIN_H = 1 ;
@@ -143,15 +127,11 @@ const double MAX_ANG_CEN = 150.001 ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Tolleranza su elevazione per attacchi e uscite // Tolleranza su elevazione per attacchi e uscite
const double LIO_ELEV_TOL = 2.0 ; const double LIO_ELEV_TOL = 2.0 ;
const double LIO_ELEV_FLOAT = 10.0 ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Per FlatParts (vedi Nesting di EgtExecutor) // Per FlatParts (vedi Nesting di EgtExecutor)
const std::string NST_EXT_LAYER = "OutLoop" ; const std::string NST_EXT_LAYER = "OutLoop" ;
const std::string NST_PARTREG_LAYER = "Region" ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Minima componente zeta di versore utensile per lavorazione da sopra (-45deg) // Minima componente zeta di versore utensile per lavorazione da sopra (-45deg)
const double MIN_ZDIR_TOP_TOOL = -0.7072 ; const double MIN_ZDIR_TOP_TOOL = -0.7072 ;
// Minima componente zeta di versose utensile èer mortasatura quasi verticale (45deg)
const double MIN_ZDIR_VERT_CHSAW = 0.7072 ;
+8 -41
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2024 // EgalTech 2015-2022
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : MachMgr.h Data : 25.11.24 Versione : 2.6k5 // File : MachMgr.h Data : 21.09.22 Versione : 2.4i4
// Contenuto : Dichiarazione della classe MachMgr. // Contenuto : Dichiarazione della classe MachMgr.
// //
// //
@@ -11,12 +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.
// 30.03.24 DS Aggiunte GetAllAxesNames e GetCalcTable.
// 02.04.24 DS Aggiunta GetClEntAxesMask.
// 22.04.24 DS Aggiunta GetExitId.
// 25.11.24 DS Aggiunta GetMachiningSkippedGeometry.
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -101,9 +95,7 @@ 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 ;
bool ChangeMachGroupName( int nId, const std::string& sNewName) 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 ;
int GetMachGroupId( const std::string& sName) const override ; int GetMachGroupId( const std::string& sName) const override ;
@@ -157,9 +149,6 @@ class MachMgr : public IMachMgr
bool GetTableAreaOffset( int nInd, BBox3d& b3AreaOffs) const override ; bool GetTableAreaOffset( int nInd, BBox3d& b3AreaOffs) const override ;
bool ChangeTable( const std::string& sTable, bool bUpdateDisp) override ; bool ChangeTable( const std::string& sTable, bool bUpdateDisp) override ;
bool ShowOnlyTable( bool bVal) override ; bool ShowOnlyTable( bool bVal) override ;
bool MoveDispAxis( const std::string& sName, double dPos) override ;
bool RemoveDispAxis( const std::string& sName) override ;
bool KeepAllDispAxes( int nSouPhase) override ;
int AddFixture( const std::string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov) override ; int AddFixture( const std::string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov) override ;
bool KeepFixture( int nFxtId, int nSouPhase) override ; bool KeepFixture( int nFxtId, int nSouPhase) override ;
bool RemoveFixture( int nFxtId) override ; bool RemoveFixture( int nFxtId) override ;
@@ -168,9 +157,7 @@ class MachMgr : public IMachMgr
int GetNextFixture( int nFxtId) const override ; int GetNextFixture( int nFxtId) const override ;
bool MoveFixture( int nId, const Vector3d& vtMove) override ; bool MoveFixture( int nId, const Vector3d& vtMove) override ;
bool RotateFixture( int nId, double dDeltaAngDeg) override ; bool RotateFixture( int nId, double dDeltaAngDeg) override ;
bool SetFixtureLink( int nId, const std::string& sTaLink) override ;
bool MoveFixtureMobile( int nId, double dDeltaMov) override ; bool MoveFixtureMobile( int nId, double dDeltaMov) override ;
bool SetFixtureMobile( int nId, double dMov) override ;
// Tools DataBase // Tools DataBase
bool TdbGetToolNewName( std::string& sName) const override ; bool TdbGetToolNewName( std::string& sName) const override ;
bool TdbAddTool( const std::string& sName, int nType) override ; bool TdbAddTool( const std::string& sName, int nType) override ;
@@ -216,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 ;
@@ -285,7 +271,6 @@ class MachMgr : public IMachMgr
int GetPhaseDisposition( int nPhase) const override ; int GetPhaseDisposition( int nPhase) const override ;
bool DispositionSpecialApply( int nId, bool bRecalc) override ; bool DispositionSpecialApply( int nId, bool bRecalc) override ;
bool DispositionSpecialUpdate( int nId) override ; bool DispositionSpecialUpdate( int nId) override ;
bool GetDispositionToolData( int nId, std::string& sName, std::string& sHead, int& nExit, std::string& sTcPos) override ;
// Operations : machinings // Operations : machinings
int AddMachining( const std::string& sName, const std::string& sMachining) override ; int AddMachining( const std::string& sName, const std::string& sMachining) override ;
int AddMachining( const std::string& sName, int nMchType, const std::string& sTool) override ; int AddMachining( const std::string& sName, int nMchType, const std::string& sTool) override ;
@@ -305,24 +290,19 @@ class MachMgr : public IMachMgr
bool MachiningUpdate( bool bPostApply = true) override ; bool MachiningUpdate( bool bPostApply = true) override ;
bool PreparePreviewMachiningTool( void) const override ; bool PreparePreviewMachiningTool( void) const override ;
bool RemovePreviewMachiningTool( void) const override ; bool RemovePreviewMachiningTool( void) const override ;
int GetPreviewMachiningToolStepCount( void) const override ; int PreviewMachiningTool( int nEntId, int nFlag) const override ;
int PreviewMachiningTool( int nEntId, int nStep) const override ;
bool GetMachiningParam( int nType, bool& bVal) const override ; bool GetMachiningParam( int nType, bool& bVal) const override ;
bool GetMachiningParam( int nType, int& nVal) const override ; bool GetMachiningParam( int nType, int& nVal) const override ;
bool GetMachiningParam( int nType, double& dVal) const override ; bool GetMachiningParam( int nType, double& dVal) const override ;
bool GetMachiningParam( int nType, std::string& sVal) const override ; bool GetMachiningParam( int nType, std::string& sVal) const override ;
bool GetMachiningGeometry( SELVECTOR& vIds) const override ; bool GetMachiningGeometry( SELVECTOR& vIds) const override ;
bool GetMachiningSkippedGeometry( SELVECTOR& vIds) const override ;
bool IsMachiningEmpty( void) const override ; bool IsMachiningEmpty( void) const override ;
bool GetMachiningStartPoint( Point3d& ptStart) const override ; bool GetMachiningStartPoint( Point3d& ptStart) const override ;
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 GetClEntAxesStatus( int nEntId, int& nStatus) const override ;
bool GetClEntAxesMask( int nEntId, int& nMask) 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 ;
@@ -341,10 +321,8 @@ 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 GetAllCurrAxesNames( 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 GetCalcTable( std::string& sTable) const override ;
bool GetCalcTool( std::string& sTool) const override ; bool GetCalcTool( std::string& sTool) const override ;
bool GetCalcHead( std::string& sHead) const override ; bool GetCalcHead( std::string& sHead) const override ;
bool GetCalcExit( int& nExit) const override ; bool GetCalcExit( int& nExit) const override ;
@@ -372,11 +350,9 @@ class MachMgr : public IMachMgr
int GetAxisId( const std::string& sAxis) const override ; int GetAxisId( const std::string& sAxis) const override ;
int GetHeadId( const std::string& sHead) const override ; int GetHeadId( const std::string& sHead) const override ;
int GetHeadExitCount( const std::string& sHead) const override ; int GetHeadExitCount( const std::string& sHead) const override ;
int GetExitId( const std::string& sHead, int nExit) const override ;
int GetTcPosId( const std::string& sTcPos) const override ; int GetTcPosId( const std::string& sTcPos) const override ;
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const override ; bool GetAxisToken( const std::string& sAxis, std::string& sToken) const override ;
bool GetAxisType( const std::string& sAxis, bool& bLinear) const override ; bool GetAxisType( const std::string& sAxis, bool& bLinear) const override ;
bool GetAxisDir( const std::string& sAxis, Vector3d& vtDir) const override ;
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const override ; bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const override ;
bool GetAxisOffset( const std::string& sAxis, double& dOffset) const override ; bool GetAxisOffset( const std::string& sAxis, double& dOffset) const override ;
bool SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) override ; bool SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) override ;
@@ -387,7 +363,6 @@ class MachMgr : public IMachMgr
bool ResetAxisPos( const std::string& sAxis) override ; bool ResetAxisPos( const std::string& sAxis) override ;
bool ResetAllAxesPos( void) override ; bool ResetAllAxesPos( void) override ;
bool GetAllTablesNames( STRVECTOR& vNames) const override ; bool GetAllTablesNames( STRVECTOR& vNames) const override ;
bool GetAllAxesNames( STRVECTOR& vNames) const override ;
bool GetAllHeadsNames( STRVECTOR& vNames) const override ; bool GetAllHeadsNames( STRVECTOR& vNames) const override ;
bool GetAllTcPosNames( STRVECTOR& vNames) const override ; bool GetAllTcPosNames( STRVECTOR& vNames) const override ;
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) override ; bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) override ;
@@ -455,13 +430,10 @@ 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 ;
bool GetCurrAxisMax( int nInd, double& dHome) const ;
bool GetCurrAxisMin( int nInd, double& dHome) const ;
const Frame3d& GetCurrLinAxesFrame( void) const ; const Frame3d& GetCurrLinAxesFrame( void) const ;
bool GetCurrIsCenter( void) const ;
bool GetCurrIsRobot( void) const ;
bool ApplyRotAxisBlock( void) ; bool ApplyRotAxisBlock( void) ;
void ClearRotAxisBlock( void) void ClearRotAxisBlock( void)
{ m_vAxisBlock.clear() ; } { m_vAxisBlock.clear() ; }
@@ -483,15 +455,11 @@ class MachMgr : public IMachMgr
bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ; bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
bool SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ; bool SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
bool SimOnCollision( int nCdInd, int nObjInd, int& nErr) ; bool SimOnCollision( int nCdInd, int nObjInd, int& nErr) ;
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag, double dPar1, double dPar2, bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
const INTVECTOR& vVmill, bool bFirst) ;
bool SimEnableToolsForVmill( bool bEnable) ;
int SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ; int SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
bool SimSaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) ;
// Machine // Machine
bool ResetAllAxesPos( bool bStdAxes, bool bDispAxes) ;
bool IsDispositionAxis( const std::string& sAxis, const std::string& sTable = "") const ;
bool GetHeadAbove( const std::string& sHead) const ; bool GetHeadAbove( const std::string& sHead) const ;
double GetDeltaSafeZ( const std::string& sHead) const ;
double GetAngDeltaMinForHome( void) const ; double GetAngDeltaMinForHome( void) const ;
private : private :
@@ -518,7 +486,6 @@ class MachMgr : public IMachMgr
// RawParts // RawParts
int AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol) ; int AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol) ;
int AddRawPart( int nSurfId, Color cCol) ; int AddRawPart( int nSurfId, Color cCol) ;
int AddRawPart( int nSurfUpId, int nSurfDownId, double dHeight, Color cCol) ;
bool SetRawPartCenter( int nRawId) ; bool SetRawPartCenter( int nRawId) ;
bool ResetRawPartCenter( int nRawId) ; bool ResetRawPartCenter( int nRawId) ;
// Parts // Parts
@@ -565,5 +532,5 @@ class MachMgr : public IMachMgr
int m_nCurrDispId ; // identificativo della disposizione corrente int m_nCurrDispId ; // identificativo della disposizione corrente
int m_nCurrMachiningId ; // identificativo della lavorazione corrente int m_nCurrMachiningId ; // identificativo della lavorazione corrente
AXBLOCKVECTOR m_vAxisBlock ; // elenco assi da bloccare AXBLOCKVECTOR m_vAxisBlock ; // elenco assi da bloccare
ISimulator* m_pSimul ; // puntatore al simulatore attivo Simulator* m_pSimul ; // puntatore al simulatore attivo
} ; } ;
+1 -5
View File
@@ -311,11 +311,7 @@ MachMgr::SetLastError( int nErr, const string& sErr)
{ {
m_nLastError = nErr ; m_nLastError = nErr ;
m_sLastError = sErr ; m_sLastError = sErr ;
string sInfo ; string sInfo = m_sLastError + " (" + ToString( nErr) + ")" ;
if ( sErr._Starts_with( "Error"))
sInfo = m_sLastError + " (" + ToString( nErr) + ")" ;
else
sInfo = "Error " + ToString( nErr) + " : " + m_sLastError ;
LOG_ERROR( GetEMkLogger(), sInfo.c_str()) ; LOG_ERROR( GetEMkLogger(), sInfo.c_str()) ;
return true ; return true ;
} }
+4 -61
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.
// //
// //
@@ -16,7 +16,6 @@
#include "DllMain.h" #include "DllMain.h"
#include "MachMgr.h" #include "MachMgr.h"
#include "MachConst.h" #include "MachConst.h"
#include "CamData.h"
using namespace std ; using namespace std ;
@@ -40,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 ;
@@ -52,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 ;
} }
@@ -75,57 +72,3 @@ MachMgr::GetClEntIndex( int nEntId, int& nIndex) const
nIndex = pCamData->GetIndex() ; nIndex = pCamData->GetIndex() ;
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntAxesStatus( int nEntId, int& nStatus) const
{
// default
nStatus = 0 ;
// 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 il tipo di movimento
nStatus = pCamData->GetAxesStatus() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntAxesMask( int nEntId, int& nMask) const
{
// default
nMask = 0 ;
// 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 il tipo di movimento
nMask = pCamData->GetAxesMask() ;
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 ;
}
+2 -7
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2024 // EgalTech 2015-2015
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : MachMgrDBMachinings.cpp Data : 29.03.24 Versione : 2.6d1 // File : MachMgrDBMachinings.cpp Data : 11.11.15 Versione : 1.6k5
// Contenuto : Implementazione gestione DB lavorazioni della classe MachMgr. // Contenuto : Implementazione gestione DB lavorazioni della classe MachMgr.
// //
// //
@@ -304,8 +304,6 @@ MachMgr::MdbSetGeneralParam( int nType, double dVal)
return pMsMgr->SetSafeAggrBottZ( dVal) ; return pMsMgr->SetSafeAggrBottZ( dVal) ;
case MGP_MAXDEPTHSAFE : case MGP_MAXDEPTHSAFE :
return pMsMgr->SetMaxDepthSafe( dVal) ; return pMsMgr->SetMaxDepthSafe( dVal) ;
case MGP_APPROXLINTOL :
return pMsMgr->SetApproxLinTol( dVal) ;
} }
return false ; return false ;
} }
@@ -381,9 +379,6 @@ MachMgr::MdbGetGeneralParam( int nType, double& dVal) const
case MGP_MAXDEPTHSAFE : case MGP_MAXDEPTHSAFE :
dVal = pMsMgr->GetMaxDepthSafe() ; dVal = pMsMgr->GetMaxDepthSafe() ;
return true ; return true ;
case MGP_APPROXLINTOL :
dVal = pMsMgr->GetApproxLinTol() ;
return true ;
} }
return false ; return false ;
} }
+1 -21
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 ;
@@ -667,7 +665,6 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
bool bOk = ExeLuaSetGlobIntVar( "TOOL.TYPE", nType) ; bool bOk = ExeLuaSetGlobIntVar( "TOOL.TYPE", nType) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TIPFEED", dTipFeed) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TIPFEED", dTipFeed) ;
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.USERNOTES", sUserNotes) ;
switch ( nType) { switch ( nType) {
case TT_DRILL_STD : case TT_DRILL_STD :
case TT_DRILL_LONG : case TT_DRILL_LONG :
@@ -697,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) ;
@@ -722,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) ;
@@ -732,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) ;
} }
@@ -761,10 +747,6 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
pTdata->GetParam( TPA_DIAM, dDiam) ; pTdata->GetParam( TPA_DIAM, dDiam) ;
double dDist = 0 ; double dDist = 0 ;
pTdata->GetParam( TPA_DIST, dDist) ; pTdata->GetParam( TPA_DIST, dDist) ;
double dSpeed = 0 ;
pTdata->GetParam( TPA_SPEED, dSpeed) ;
string sUserNotes ;
pTdata->GetParam( TPA_USERNOTES, sUserNotes) ;
// Imposto contesto per il disegno utensile // Imposto contesto per il disegno utensile
if ( ! ExeSetCurrentContext( nToolCtx)) if ( ! ExeSetCurrentContext( nToolCtx))
return TD_INT_ERR ; return TD_INT_ERR ;
@@ -774,8 +756,6 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIST", dDist) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIST", dDist) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ;
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.USERNOTES", sUserNotes) ;
// Eseguo aggiornamento utensile // Eseguo aggiornamento utensile
bOk = bOk && ExeLuaCallFunction( "AdjustCustomTool") ; bOk = bOk && ExeLuaCallFunction( "AdjustCustomTool") ;
// Recupero errore // Recupero errore
+4 -75
View File
@@ -135,52 +135,6 @@ MachMgr::ShowOnlyTable( bool bVal)
return pMch->SetLook( bVal ? MCH_LOOK_TAB : MCH_LOOK_ALL) ; return pMch->SetLook( bVal ? MCH_LOOK_TAB : MCH_LOOK_ALL) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::MoveDispAxis( const string& sName, double dPos)
{
// recupero l'oggetto disposizione corrente
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
if ( pDisp == nullptr)
return GDB_ID_NULL ;
// eseguo l'operazione
return pDisp->MoveAxis( sName, dPos) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::RemoveDispAxis( const string& sName)
{
// recupero l'oggetto disposizione corrente
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
if ( pDisp == nullptr)
return GDB_ID_NULL ;
// eseguo l'operazione
return pDisp->RemoveAxis( sName) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::KeepAllDispAxes( int nSouPhase)
{
// se fase di origine non definita o uguale alla corrente, esco con successo
if ( nSouPhase == 0 || nSouPhase == m_nCurrPhase)
return true ;
// copio il posizionamento
Disposition* pSouDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nSouPhase))) ;
Disposition* pDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( m_nCurrPhase))) ;
if ( pSouDisp == nullptr || pDisp == nullptr)
return false ;
for ( int i = 0 ; ; ++ i) {
string sName ; double dPos ;
if ( pSouDisp->GetMoveAxisData( i, sName, dPos))
pDisp->MoveAxis( sName, dPos) ;
else
break ;
}
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
MachMgr::AddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov) MachMgr::AddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov)
@@ -204,8 +158,8 @@ MachMgr::KeepFixture( int nFxtId, int nSouPhase)
// se fase corrente già presente, non devo fare alcunché // se fase corrente già presente, non devo fare alcunché
if ( find( vPhase.begin(), vPhase.end(), m_nCurrPhase) != vPhase.end()) if ( find( vPhase.begin(), vPhase.end(), m_nCurrPhase) != vPhase.end())
return true ; return true ;
// se fase di origine non definita o uguale alla corrente, esco con successo // se fase di origine non definita, esco con successo
if ( nSouPhase == 0 || nSouPhase == m_nCurrPhase) if ( nSouPhase == 0)
return true ; return true ;
// copio il posizionamento // copio il posizionamento
Disposition* pSouDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nSouPhase))) ; Disposition* pSouDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nSouPhase))) ;
@@ -213,11 +167,10 @@ MachMgr::KeepFixture( int nFxtId, int nSouPhase)
if ( pSouDisp == nullptr || pDisp == nullptr) if ( pSouDisp == nullptr || pDisp == nullptr)
return false ; return false ;
for ( int i = 0 ; ; ++ i) { for ( int i = 0 ; ; ++ i) {
string sName ; int nId ; Point3d ptPos ; double dAngDeg ; double dMov ; string sTaLink ; string sName ; int nId ; Point3d ptPos ; double dAngDeg ; double dMov ;
if ( pSouDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov, sTaLink)) { if ( pSouDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov)) {
if ( nId == nFxtId) { if ( nId == nFxtId) {
pDisp->AddFixture( sName, nId, ptPos, dAngDeg, dMov) ; pDisp->AddFixture( sName, nId, ptPos, dAngDeg, dMov) ;
pDisp->SetFixtureLink( nId, sTaLink) ;
break ; break ;
} }
} }
@@ -301,18 +254,6 @@ MachMgr::RotateFixture( int nId, double dDeltaAngDeg)
return pDisp->RotateFixture( nId, dDeltaAngDeg) ; return pDisp->RotateFixture( nId, dDeltaAngDeg) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::SetFixtureLink( int nId, const string& sTaLink)
{
// recupero l'oggetto disposizione corrente
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
if ( pDisp == nullptr)
return false ;
// eseguo l'operazione
return pDisp->SetFixtureLink( nId, sTaLink) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::MoveFixtureMobile( int nId, double dDeltaMov) MachMgr::MoveFixtureMobile( int nId, double dDeltaMov)
@@ -325,18 +266,6 @@ MachMgr::MoveFixtureMobile( int nId, double dDeltaMov)
return pDisp->MoveFixtureMobile( nId, dDeltaMov) ; return pDisp->MoveFixtureMobile( nId, dDeltaMov) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::SetFixtureMobile( int nId, double dMov)
{
// recupero l'oggetto disposizione corrente
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
if ( pDisp == nullptr)
return false ;
// eseguo l'operazione
return pDisp->SetFixtureMobile( nId, dMov) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::VerifyFixtureInGroup( int nFxtId, bool bLinkedAllowed) const MachMgr::VerifyFixtureInGroup( int nFxtId, bool bLinkedAllowed) const
+2 -10
View File
@@ -18,7 +18,6 @@
#include "MachConst.h" #include "MachConst.h"
#include "Generator.h" #include "Generator.h"
#include "Estimator.h" #include "Estimator.h"
#include "/EgtDev/Include/EGnFileUtils.h"
using namespace std ; using namespace std ;
@@ -26,13 +25,6 @@ using namespace std ;
bool bool
MachMgr::Generate( const string& sCncFile, const string& sInfo) MachMgr::Generate( const string& sCncFile, const string& sInfo)
{ {
// se macchina multiprocesso è necessaria stima speciale
if ( GetCurrMachine() != nullptr && GetCurrMachine()->GetMultiProcess()) {
string sEstFile = ChangeFileExtension( sCncFile, "sest") ;
if ( ! Estimate( sEstFile, sInfo))
return false ;
}
// inizializzazione generatore // inizializzazione generatore
Generator genPP ; Generator genPP ;
if ( ! genPP.Init( this)) { if ( ! genPP.Init( this)) {
@@ -52,13 +44,13 @@ MachMgr::Generate( const string& sCncFile, const string& sInfo)
bool bool
MachMgr::Estimate( const string& sEstFile, const string& sInfo) MachMgr::Estimate( const string& sEstFile, const string& sInfo)
{ {
// inizializzazione stimatore // inizializzazione generatore
Estimator estPP ; Estimator estPP ;
if ( ! estPP.Init( this)) { if ( ! estPP.Init( this)) {
LOG_ERROR( GetEMkLogger(), "Error on Estimate Init") LOG_ERROR( GetEMkLogger(), "Error on Estimate Init")
return false ; return false ;
} }
// esecuzione della stima // esecuzione della generazione
if ( ! estPP.Run( sEstFile, sInfo)) { if ( ! estPP.Run( sEstFile, sInfo)) {
LOG_ERROR( GetEMkLogger(), "Error on Estimate Run") LOG_ERROR( GetEMkLogger(), "Error on Estimate Run")
return false ; return false ;
+21 -80
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)
@@ -268,60 +222,44 @@ MachMgr::VerifyMachGroup( int nId, MachGrp& mgData) const
// verifica della macchina // verifica della macchina
bool bMName = m_pGeomDB->GetInfo( nId, MACH_MACHINE_KEY, mgData.MGeoName) ; bool bMName = m_pGeomDB->GetInfo( nId, MACH_MACHINE_KEY, mgData.MGeoName) ;
// scansiono i sottogruppi // scansiono i sottogruppi
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter))
return false ;
bool bSetup = false ; bool bSetup = false ;
bool bFixt = false ; bool bFixt = false ;
bool bRaw = false ; bool bRaw = false ;
bool bOper = false ; bool bOper = false ;
int nGrpId = m_pGeomDB->GetFirstGroupInGroup( nId) ; bool bIter = pIter->GoToFirstGroupInGroup( nId) ;
while ( nGrpId != GDB_ID_NULL) { while ( bIter) {
string sName ; string sName ;
if ( m_pGeomDB->GetName( nGrpId, sName)) { if ( pIter->GetName( sName)) {
if ( sName == MACH_SETUP_GROUP) { if ( sName == MACH_SETUP_GROUP) {
if ( ! bSetup) if ( ! bSetup)
mgData.SetupGroupId = nGrpId ; mgData.SetupGroupId = pIter->GetId() ;
bSetup = true ; bSetup = true ;
} }
else if ( sName == MACH_FIXT_GROUP) { else if ( sName == MACH_FIXT_GROUP) {
if ( ! bFixt) if ( ! bFixt)
mgData.FixtGroupId = nGrpId ; mgData.FixtGroupId = pIter->GetId() ;
bFixt = true ; bFixt = true ;
} }
else if ( sName == MACH_RAW_GROUP) { else if ( sName == MACH_RAW_GROUP) {
if ( ! bRaw) if ( ! bRaw)
mgData.RawGroupId = nGrpId ; mgData.RawGroupId = pIter->GetId() ;
bRaw = true ; bRaw = true ;
} }
else if ( sName == MACH_OPER_GROUP) { else if ( sName == MACH_OPER_GROUP) {
if ( ! bOper) if ( ! bOper)
mgData.OperGroupId = nGrpId ; mgData.OperGroupId = pIter->GetId() ;
bOper = true ; bOper = true ;
} }
} }
// passo al successivo // passo al successivo
nGrpId = m_pGeomDB->GetNextGroup( nGrpId) ; bIter = pIter->GoToNextGroup() ;
} }
return ( bMName && bSetup && bRaw && bOper) ; return ( bMName && bSetup && bRaw && bOper) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::ChangeMachGroupName( int nId, const string& sNewName)
{
// verifica del gruppo base per le lavorazioni
if ( ! VerifyMachBase())
return false ;
// verifico che il gruppo ricevuto sia corretto
if ( m_pGeomDB->GetParentId( nId) != m_nMachBaseId)
return false ;
// verifico nome non vuoto e non esista già un gruppo con lo stesso nome
if ( &sNewName == nullptr || sNewName.empty() || GetMachGroupId( sNewName) != GDB_ID_NULL)
return false ;
// cambio il nome del gruppo di lavoro
if ( ! m_pGeomDB->SetName( nId, sNewName))
return false ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
string string
MachMgr::GetMachGroupName( int nId) const MachMgr::GetMachGroupName( int nId) const
@@ -360,19 +298,22 @@ 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
int nGrpId = m_pGeomDB->GetFirstGroupInGroup( m_nMachBaseId) ; PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
while ( nGrpId != GDB_ID_NULL) { if ( IsNull( pIter))
return false ;
bool bIter = pIter->GoToFirstGroupInGroup( m_nMachBaseId) ;
while( bIter) {
// verifico il nome // verifico il nome
string sMGroupName ; string sMGroupName ;
if ( m_pGeomDB->GetName( nGrpId, sMGroupName) && EqualNoCase( sMGroupName, sName)) if ( pIter->GetName( sMGroupName) && EqualNoCase( sMGroupName, sName))
return nGrpId ; return pIter->GetId() ;
// passo al successivo // passo al successivo
nGrpId = m_pGeomDB->GetNextGroup( nGrpId) ; bIter = pIter->GoToNextGroup() ;
} }
return GDB_ID_NULL ; return GDB_ID_NULL ;
} }
+18 -94
View File
@@ -274,15 +274,6 @@ MachMgr::GetHeadExitCount( const string& sHead) const
return ( ( pMch != nullptr) ? pMch->GetHeadExitCount( sHead) : 0) ; return ( ( pMch != nullptr) ? pMch->GetHeadExitCount( sHead) : 0) ;
} }
//----------------------------------------------------------------------------
int
MachMgr::GetExitId( const string& sHead, int nExit) const
{
Machine* pMch = GetCurrMachine() ;
// recupero identificativo dell'uscita della testa indicata nella macchina corrente
return ( ( pMch != nullptr) ? pMch->GetExitId( sHead, nExit) : GDB_ID_NULL) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
MachMgr::GetTcPosId( const string& sTcPos) const MachMgr::GetTcPosId( const string& sTcPos) const
@@ -303,6 +294,18 @@ MachMgr::GetHeadAbove( const string& sHead) const
return ( ! m_pGeomDB->GetInfo( GetHeadId( sHead), MCH_ABOVE, bAbove) || bAbove) ; return ( ! m_pGeomDB->GetInfo( GetHeadId( sHead), MCH_ABOVE, bAbove) || bAbove) ;
} }
//----------------------------------------------------------------------------
double
MachMgr::GetDeltaSafeZ( const string& sHead) const
{
if ( m_pGeomDB == nullptr)
return 0 ;
// Leggo da testa Info ZSAFEDELTA
double dDeltaSafeZ = 0 ;
m_pGeomDB->GetInfo( GetHeadId( sHead), MCH_ZSAFEDELTA, dDeltaSafeZ) ;
return dDeltaSafeZ ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
double double
MachMgr::GetAngDeltaMinForHome( void) const MachMgr::GetAngDeltaMinForHome( void) const
@@ -330,15 +333,6 @@ MachMgr::GetAxisType( const string& sAxis, bool& bLinear) const
return ( ( pMch != nullptr) ? pMch->GetAxisType( sAxis, bLinear) : false) ; return ( ( pMch != nullptr) ? pMch->GetAxisType( sAxis, bLinear) : false) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetAxisDir( const string& sAxis, Vector3d& vtDir) const
{
Machine* pMch = GetCurrMachine() ;
// restituisco la direzione dell'asse indicato nella macchina corrente
return ( ( pMch != nullptr) ? pMch->GetAxisDir( sAxis, vtDir) : false) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetAxisInvert( const string& sAxis, bool& bInvert) const MachMgr::GetAxisInvert( const string& sAxis, bool& bInvert) const
@@ -362,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) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -405,27 +399,12 @@ MachMgr::ResetAxisPos( const string& sAxis)
return ( ( pMch != nullptr) ? pMch->ResetAxisPos( sAxis) : false) ; return ( ( pMch != nullptr) ? pMch->ResetAxisPos( sAxis) : false) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::IsDispositionAxis( const string& sAxis, const string& sTable) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->IsDispositionAxis( sAxis, sTable) : false) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::ResetAllAxesPos( void) MachMgr::ResetAllAxesPos( void)
{
return ResetAllAxesPos( true, false) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::ResetAllAxesPos( bool bStdAxes, bool bDispAxes)
{ {
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->ResetAllAxesPos( bStdAxes, bDispAxes) : false) ; return ( ( pMch != nullptr) ? pMch->ResetAllAxesPos() : false) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -555,14 +534,6 @@ MachMgr::SetCalcSolCh( int nScc, bool bExact)
return pMch->SetSolCh( nScc, bExact) ; return pMch->SetSolCh( nScc, bExact) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetCalcTable( string& sTable) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetCurrTable( sTable) : false) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetCalcTool( string& sTool) const MachMgr::GetCalcTool( string& sTool) const
@@ -638,17 +609,6 @@ MachMgr::GetAllTablesNames( STRVECTOR& vNames) const
return ( ( pMch != nullptr) ? pMch->GetAllTablesNames( vNames) : false) ; return ( ( pMch != nullptr) ? pMch->GetAllTablesNames( vNames) : false) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetAllAxesNames( STRVECTOR& vNames) const
{
// pulisco il vettore
vNames.clear() ;
// richiedo elenco assi alla macchina corrente
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetAllAxesNames( vNames) : false) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetAllHeadsNames( STRVECTOR& vNames) const MachMgr::GetAllHeadsNames( STRVECTOR& vNames) const
@@ -689,10 +649,10 @@ MachMgr::GetCurrRotAxes( void) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetAllCurrAxesNames( STRVECTOR& vAxName) const MachMgr::GetAllCurrAxesName( STRVECTOR& vAxName) const
{ {
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetAllCurrAxesNames( vAxName) : false) ; return ( ( pMch != nullptr) ? pMch->GetAllCurrAxesName( vAxName) : false) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -711,22 +671,6 @@ MachMgr::GetCurrAxisHomePos( int nInd, double& dHome) const
return ( ( pMch != nullptr) ? pMch->GetCurrAxisHomePos( nInd, dHome) : false) ; return ( ( pMch != nullptr) ? pMch->GetCurrAxisHomePos( nInd, dHome) : false) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetCurrAxisMax( int nInd, double& dMax) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetCurrAxisMax( nInd, dMax) : false) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCurrAxisMin( int nInd, double& dMin) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetCurrAxisMin( nInd, dMin) : false) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const Frame3d& const Frame3d&
MachMgr::GetCurrLinAxesFrame( void) const MachMgr::GetCurrLinAxesFrame( void) const
@@ -739,26 +683,6 @@ MachMgr::GetCurrLinAxesFrame( void) const
return pMch->GetCurrLinAxesFrame() ; return pMch->GetCurrLinAxesFrame() ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetCurrIsCenter( void) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_CENTER) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCurrIsRobot( void) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_ROBOT) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA, MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
@@ -803,7 +727,7 @@ MachMgr::GetCalcTipFromPositions( double dX, double dY, double dZ, double dAngA,
{ {
DBLVECTOR vAng( 2) ; vAng[0] = dAngA ; vAng[1] = dAngB ; DBLVECTOR vAng( 2) ; vAng[0] = dAngA ; vAng[1] = dAngB ;
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, false, ptTip) : false) ; return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, ptTip) : false) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -812,7 +736,7 @@ MachMgr::GetCalcTipFromPositions( double dX, double dY, double dZ, const DBLVECT
bool bOverall, bool bBottom, Point3d& ptTip) const bool bOverall, bool bBottom, Point3d& ptTip) const
{ {
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, false, ptTip) : false) ; return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, ptTip) : false) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
+2 -47
View File
@@ -601,7 +601,6 @@ MachMgr::AddDisposition( const string& sName)
m_pGeomDB->SetUserObj( nId, pDisp) ; m_pGeomDB->SetUserObj( nId, pDisp) ;
pDisp->Init( this) ; pDisp->Init( this) ;
pDisp->SetPhase( m_nCurrPhase) ; pDisp->SetPhase( m_nCurrPhase) ;
ResetAllAxesPos( false, true) ;
return nId ; return nId ;
} }
@@ -673,18 +672,6 @@ MachMgr::DispositionSpecialUpdate( int nId)
return pDisp->SpecialUpdate() ; return pDisp->SpecialUpdate() ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetDispositionToolData( int nId, string& sName, string& sHead, int& nExit, string& sTcPos)
{
// recupero la disposizione
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nId)) ;
if ( pDisp == nullptr)
return false ;
// recupero i dati utensile
return pDisp->GetToolData( sName, sHead, nExit, sTcPos) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Machinings // Machinings
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -1135,23 +1122,7 @@ MachMgr::RemovePreviewMachiningTool( void) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
MachMgr::GetPreviewMachiningToolStepCount( void) const MachMgr::PreviewMachiningTool( int nEntId, int nFlag) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return 0 ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return 0 ;
// eseguo
return pMch->GetToolPreviewStepCount() ;
}
//----------------------------------------------------------------------------
int
MachMgr::PreviewMachiningTool( int nEntId, int nStep) const
{ {
// recupero la lavorazione corrente // recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ; int nCurrMchId = GetCurrMachining() ;
@@ -1162,7 +1133,7 @@ MachMgr::PreviewMachiningTool( int nEntId, int nStep) const
if ( pMch == nullptr) if ( pMch == nullptr)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// eseguo // eseguo
return pMch->ToolPreview( nEntId, nStep) ; return pMch->ToolPreview( nEntId, nFlag) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -1261,22 +1232,6 @@ MachMgr::GetMachiningGeometry( SELVECTOR& vIds) const
return pMch->GetGeometry( vIds) ; return pMch->GetGeometry( vIds) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetMachiningSkippedGeometry( SELVECTOR& vIds) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// restituisco la geometria non lavorata
return pMch->GetSkippedGeometry( vIds) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::IsMachiningEmpty( void) const MachMgr::IsMachiningEmpty( void) const
+136 -412
View File
@@ -29,7 +29,6 @@
#include "/EgtDev/Include/EGkStmStandard.h" #include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStmFromCurves.h" #include "/EgtDev/Include/EGkStmFromCurves.h"
#include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EXeConst.h"
using namespace std ; using namespace std ;
@@ -97,7 +96,7 @@ MachMgr::AddRawPart( const Point3d& ptOrig, double dLen, double dWidth, double d
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ; m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
// creo solido e outline // creo solido e outline
bOk = bOk && ModifyRawPart( nRawId, ptOrig, dLen, dWidth, dHeight, cCol) ; bOk = bOk && ModifyRawPart( nRawId, ptOrig, dLen, dWidth, dHeight, cCol) ;
// se qualcosa è andato storto, cancello tutto // se qualcosa è andato storto, cancello tutto
if ( ! bOk) { if ( ! bOk) {
m_pGeomDB->Erase( nRawId) ; m_pGeomDB->Erase( nRawId) ;
return GDB_ID_NULL ; return GDB_ID_NULL ;
@@ -113,7 +112,7 @@ MachMgr::ModifyRawPart( int nRawId, const Point3d& ptOrig, double dLen, double d
// le dimensioni non possono essere nulle // le dimensioni non possono essere nulle
if ( dLen < EPS_SMALL || dWidth < EPS_SMALL || dHeight < EPS_SMALL) if ( dLen < EPS_SMALL || dWidth < EPS_SMALL || dHeight < EPS_SMALL)
return false ; return false ;
// verifica validità grezzo // verifica validità grezzo
if ( ! VerifyRawPart( nRawId)) if ( ! VerifyRawPart( nRawId))
return false ; return false ;
// creo il solido // creo il solido
@@ -172,7 +171,7 @@ MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color
// verifico il gruppo dei grezzi nella macchinata corrente // verifico il gruppo dei grezzi nella macchinata corrente
if ( GetCurrRawGroupId() == GDB_ID_NULL) if ( GetCurrRawGroupId() == GDB_ID_NULL)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// verifico che il pezzo non sia già usato nella macchinata corrente // verifico che il pezzo non sia già usato nella macchinata corrente
if ( m_pGeomDB->GetParentId( nPartId) != GDB_ID_ROOT) if ( m_pGeomDB->GetParentId( nPartId) != GDB_ID_ROOT)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero il tipo di oggetto per definire il grezzo // recupero il tipo di oggetto per definire il grezzo
@@ -181,7 +180,7 @@ MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color
Point3d ptRef ; Point3d ptRef ;
// costruzione del grezzo // costruzione del grezzo
int nRawId = GDB_ID_NULL ; int nRawId = GDB_ID_NULL ;
// se grezzo da superficie (per ora senza possibilità di offset) // se grezzo da superficie (per ora senza possibilità di offset)
if ( ( nGtype & GEO_SURF) != 0) { if ( ( nGtype & GEO_SURF) != 0) {
// inserisco il grezzo // inserisco il grezzo
nRawId = AddRawPart( nCrvSrfId, cCol) ; nRawId = AddRawPart( nCrvSrfId, cCol) ;
@@ -285,7 +284,7 @@ MachMgr::AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight,
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ; m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
// creo solido e outline // creo solido e outline
bOk = bOk && ModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ; bOk = bOk && ModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ;
// se qualcosa è andato storto, cancello tutto // se qualcosa è andato storto, cancello tutto
if ( ! bOk) { if ( ! bOk) {
m_pGeomDB->Erase( nRawId) ; m_pGeomDB->Erase( nRawId) ;
return GDB_ID_NULL ; return GDB_ID_NULL ;
@@ -298,7 +297,7 @@ MachMgr::AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight,
bool bool
MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol) MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol)
{ {
// verifica validità grezzo // verifica validità grezzo
if ( ! VerifyRawPart( nRawId)) if ( ! VerifyRawPart( nRawId))
return false ; return false ;
// recupero il riferimento della curva // recupero il riferimento della curva
@@ -322,7 +321,7 @@ MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, d
// la schiaccio a Z = 0 // la schiaccio a Z = 0
if ( ! pMyCrv->Scale( Frame3d(), 1, 1, 0)) if ( ! pMyCrv->Scale( Frame3d(), 1, 1, 0))
return false ; return false ;
// se non è chiusa, la chiudo // se non è chiusa, la chiudo
pMyCrv->Close() ; pMyCrv->Close() ;
// la oriento in senso CCW // la oriento in senso CCW
double dAreaXY ; double dAreaXY ;
@@ -376,11 +375,11 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
if ( nRawGroupId == GDB_ID_NULL) if ( nRawGroupId == GDB_ID_NULL)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero l'ingombro della superficie in globale // recupero l'ingombro della superficie in globale
BBox3d b3Surf ; BBox3d b3Crv ;
if ( ! m_pGeomDB->GetGlobalBBox( nSurfId, b3Surf)) if ( ! m_pGeomDB->GetGlobalBBox( nSurfId, b3Crv))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// inserisco il gruppo del grezzo nella macchinata // inserisco il gruppo del grezzo nella macchinata
Frame3d frRaw( b3Surf.GetMin()) ; Frame3d frRaw( b3Crv.GetMin()) ;
int nRawId = m_pGeomDB->AddGroup( GDB_ID_NULL, nRawGroupId, frRaw) ; int nRawId = m_pGeomDB->AddGroup( GDB_ID_NULL, nRawGroupId, frRaw) ;
if ( nRawId == GDB_ID_NULL) if ( nRawId == GDB_ID_NULL)
return GDB_ID_NULL ; return GDB_ID_NULL ;
@@ -457,11 +456,11 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
int nCrvId = ( bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pCrvCompo)) : GDB_ID_NULL) ; int nCrvId = ( bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pCrvCompo)) : GDB_ID_NULL) ;
bOk = bOk && ( nCrvId != GDB_ID_NULL) ; bOk = bOk && ( nCrvId != GDB_ID_NULL) ;
// assegno il nome alla curva // assegno il nome alla curva
bOk = bOk && m_pGeomDB->SetName( nCrvId, MACH_RAW_OUTLINE) ; bOk = bOk && m_pGeomDB->SetName( nCrvId, MACH_RAW_SOLID) ;
// assegno il colore alla curva // assegno il colore alla curva
bOk = bOk && m_pGeomDB->SetMaterial( nCrvId, cCol) ; bOk = bOk && m_pGeomDB->SetMaterial( nCrvId, cCol) ;
} }
// se qualcosa è andato storto, cancello tutto // se qualcosa è andato storto, cancello tutto
if ( ! bOk) { if ( ! bOk) {
m_pGeomDB->Erase( nRawId) ; m_pGeomDB->Erase( nRawId) ;
return GDB_ID_NULL ; return GDB_ID_NULL ;
@@ -472,156 +471,6 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
return nRawId ; return nRawId ;
} }
//----------------------------------------------------------------------------
int
MachMgr::AddRawPart( int nSfrUpId, int nSfrDownId, double dHeight, Color cCol)
{
// recupero il gruppo dei grezzi nella macchinata corrente
int nRawGroupId = GetCurrRawGroupId() ;
if ( nRawGroupId == GDB_ID_NULL)
return GDB_ID_NULL ;
// recupero l'ingombro della superficie up in globale
BBox3d b3Surf ;
if ( ! m_pGeomDB->GetGlobalBBox( nSfrUpId, b3Surf))
return GDB_ID_NULL ;
// inserisco il gruppo del grezzo nella macchinata
Frame3d frRaw( b3Surf.GetMin()) ;
int nRawId = m_pGeomDB->AddGroup( GDB_ID_NULL, nRawGroupId, frRaw) ;
if ( nRawId == GDB_ID_NULL)
return GDB_ID_NULL ;
// assegno il nome al gruppo
bool bOk = m_pGeomDB->SetName( nRawId, MACH_RAW_PART) ;
// assegno la fase al gruppo
bOk = bOk && m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
// recupero il frame originale della superficie up ( deve essere lo stesso della down)
Frame3d frSurf ;
bOk = bOk && m_pGeomDB->GetGlobFrame( nSfrUpId, frSurf) ;
// creo il volume in modo approssimativo a partire dalle due superfici considerando soltanto un'approssimazione dei bordi esterni
// regione up
PtrOwner<ISurfFlatRegion> pSurfUp( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrUpId))) ;
bOk = bOk && ( ! IsNull( pSurfUp)) ;
// calcolo offset e contro-offset per unificare i chunk ed eliminare eventuali rientranze nella superficie
double dOffs = 8 ;
bOk = bOk && pSurfUp->Offset( dOffs, ICurve::OFF_FILLET) ;
bOk = bOk && pSurfUp->Offset( -dOffs, ICurve::OFF_FILLET) ;
// recupero il chunk di area maggiore
int nKMax = 0 ;
if ( bOk && pSurfUp->GetChunkCount() > 1) {
double dAreaMax = -1 ;
for ( int k = 0 ; k < pSurfUp->GetChunkCount() ; k ++) {
PtrOwner<ISurfFlatRegion> pSfrChunk( pSurfUp->CloneChunk( k)) ;
double dArea = -1 ; pSfrChunk->GetGrossArea( dArea) ;
if ( dArea > dAreaMax) {
nKMax = k ;
dAreaMax = dArea ;
}
}
}
PtrOwner<ICurve> pCrvUp ;
bOk = bOk && pCrvUp.Set( pSurfUp->GetLoop( nKMax, 0)) ;
bOk = bOk && ( ! IsNull( pCrvUp)) ;
// regione down
PtrOwner<ISurfFlatRegion> pSurfDown( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrDownId))) ;
bOk = bOk && ( ! IsNull( pSurfDown)) ;
bOk = bOk && pSurfDown->Offset( dOffs, ICurve::OFF_FILLET) ;
bOk = bOk && pSurfDown->Offset( -dOffs, ICurve::OFF_FILLET) ;
nKMax = 0 ;
if ( bOk && pSurfDown->GetChunkCount() > 1) {
double dAreaMax = -1 ;
for ( int k = 0 ; k < pSurfDown->GetChunkCount() ; k ++) {
PtrOwner<ISurfFlatRegion> pSfrChunk( pSurfDown->CloneChunk( k)) ;
double dArea = -1 ; pSfrChunk->GetGrossArea( dArea) ;
if ( dArea > dAreaMax) {
nKMax = k ;
dAreaMax = dArea ;
}
}
}
PtrOwner<ICurveComposite> pCrvDown ;
bOk = bOk && pCrvDown.Set( ConvertCurveToComposite( pSurfDown->GetLoop( nKMax, 0))) ;
bOk = bOk && ( ! IsNull( pCrvDown)) ;
// sposto il punto di inizio il più vicino possibile a quello della curva up per migliorare il calcolo della rigata
if ( bOk) {
Point3d ptS ; pCrvUp->GetStartPoint( ptS) ;
DistPointCurve distPC( ptS, *pCrvDown) ;
double dPar ; int nFlag ;
bOk = bOk && distPC.GetParamAtMinDistPoint( 0, dPar, nFlag) ;
bOk = bOk && pCrvDown->ChangeStartPoint( dPar) ;
}
// volume
PtrOwner<ISurfTriMesh> pStmRaw ;
bOk = bOk && pStmRaw.Set( GetSurfTriMeshByFlatContour( pCrvUp)) ;
bOk = bOk && ( ! IsNull( pStmRaw)) ;
PtrOwner<ISurfTriMesh> pStmLat ;
bOk = bOk && pStmLat.Set( GetSurfTriMeshRuled( pCrvDown, pCrvUp, ISurfTriMesh::RLT_MINDIST)) ;
bOk = bOk && ( ! IsNull( pStmLat)) ;
bOk = bOk && pStmRaw->DoSewing( *pStmLat) ;
PtrOwner<ISurfTriMesh> pStmDown ;
bOk = bOk && pStmDown.Set( GetSurfTriMeshByFlatContour( pCrvDown)) ;
bOk = bOk && pStmDown->Invert() ;
bOk = bOk && pStmRaw->DoSewing( *pStmDown) ;
bOk = bOk && pStmRaw->DoCompacting() ;
bOk = bOk && pStmRaw->Repair() ;
bOk = bOk && pStmRaw->LocToLoc( frSurf, frRaw) ;
int nId = bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pStmRaw)) : GDB_ID_NULL ;
bOk = bOk && ( nId != GDB_ID_NULL) ;
// assegno il nome al solido
bOk = bOk && m_pGeomDB->SetName( nId, MACH_RAW_SOLID) ;
// assegno il colore al solido
bOk = bOk && m_pGeomDB->SetMaterial( nId, cCol) ;
// rendo visibile il solido
bOk = bOk && m_pGeomDB->SetStatus( nId, GDB_ST_ON) ;
// calcolo il punto centro del solido
bOk = bOk && SetRawPartCenter( nRawId) ;
if ( bOk) {
// costruisco la curva di contorno
PtrOwner<ISurfFlatRegion> pSfrUp( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrUpId))) ;
PtrOwner<ISurfFlatRegion> pSfrDown( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrDownId))) ;
bOk = bOk && ( ! IsNull( pSfrUp)) && ( ! IsNull( pSfrDown)) ;
if ( bOk)
pSfrUp->Add( *pSfrDown) ;
PtrOwner<ICurve> pCrv ;
bOk = bOk && pCrv.Set( pSfrUp->GetLoop( 0, 0)) ;
bOk = bOk && ( ! IsNull( pCrv)) ;
bOk = bOk && pCrv->LocToLoc( frSurf, frRaw) ;
int nLoop = bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pCrv)) : GDB_ID_NULL ;
bOk = bOk && ( nLoop != GDB_ID_NULL) ;
bOk = bOk && ExeMove( {nLoop}, -dHeight * Z_AX, RTY_LOC) ;
// assegno il nome alla curva
bOk = bOk && m_pGeomDB->SetName( nLoop, MACH_RAW_OUTLINE) ;
// assegno il colore alla curva
bOk = bOk && m_pGeomDB->SetMaterial( nLoop, cCol) ;
// recupero le superfici up e down
int nSurfUpId = ( bOk ? m_pGeomDB->CopyGlob( nSfrUpId, GDB_ID_NULL, nRawId) : GDB_ID_NULL) ;
bOk = bOk && ( nSurfUpId != GDB_ID_NULL) ;
bOk = bOk && m_pGeomDB->SetName( nSurfUpId, MACH_RAW_UP_REG) ;
bOk = bOk && m_pGeomDB->SetMaterial( nSurfUpId, cCol) ;
bOk = bOk && m_pGeomDB->SetStatus( nSurfUpId, GDB_ST_OFF) ;
int nSurfDownId = ( bOk ? m_pGeomDB->CopyGlob( nSfrDownId, GDB_ID_NULL, nRawId) : GDB_ID_NULL) ;
bOk = bOk && ( nSurfDownId != GDB_ID_NULL) ;
bOk = bOk && m_pGeomDB->SetName( nSurfDownId, MACH_RAW_DOWN_REG) ;
bOk = bOk && m_pGeomDB->SetMaterial( nSurfDownId, cCol) ;
bOk = bOk && m_pGeomDB->SetStatus( nSurfDownId, GDB_ST_OFF) ;
}
// se qualcosa è andato storto, cancello tutto
if ( ! bOk) {
m_pGeomDB->Erase( nRawId) ;
return GDB_ID_NULL ;
}
// tutto ok
return nRawId ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dHeight) MachMgr::ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dHeight)
@@ -629,7 +478,7 @@ MachMgr::ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dH
// le nuove dimensioni non possono essere nulle // le nuove dimensioni non possono essere nulle
if ( dLength < EPS_SMALL || dWidth < EPS_SMALL || dHeight < EPS_SMALL) if ( dLength < EPS_SMALL || dWidth < EPS_SMALL || dHeight < EPS_SMALL)
return false ; return false ;
// verifica validità grezzo // verifica validità grezzo
if ( ! VerifyRawPart( nRawId)) if ( ! VerifyRawPart( nRawId))
return false ; return false ;
// recupero il solido del grezzo // recupero il solido del grezzo
@@ -671,10 +520,10 @@ MachMgr::ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dH
bool bool
MachMgr::ModifyRawPartHeight( int nRawId, double dHeight) MachMgr::ModifyRawPartHeight( int nRawId, double dHeight)
{ {
// la nuova altezza non può essere nulla // la nuova altezza non può essere nulla
if ( dHeight < EPS_SMALL) if ( dHeight < EPS_SMALL)
return false ; return false ;
// verifica validità grezzo // verifica validità grezzo
if ( ! VerifyRawPart( nRawId)) if ( ! VerifyRawPart( nRawId))
return false ; return false ;
// recupero il solido del grezzo // recupero il solido del grezzo
@@ -703,10 +552,10 @@ MachMgr::GetRawPartPhases( int nRawId, INTVECTOR& vPhase) const
{ {
// pulisco parametro di ritorno // pulisco parametro di ritorno
vPhase.clear() ; vPhase.clear() ;
// verifica validità grezzo // verifica validità grezzo
if ( ! VerifyRawPart( nRawId)) if ( ! VerifyRawPart( nRawId))
return false ; return false ;
// recupero le fasi in cui è presente il grezzo (se manca è fase 1) // recupero le fasi in cui è presente il grezzo (se manca è fase 1)
if ( ! m_pGeomDB->GetInfo( nRawId, MACH_RAW_PHASE, vPhase) || vPhase.empty()) if ( ! m_pGeomDB->GetInfo( nRawId, MACH_RAW_PHASE, vPhase) || vPhase.empty())
vPhase.emplace_back( 1) ; vPhase.emplace_back( 1) ;
return true ; return true ;
@@ -716,11 +565,11 @@ MachMgr::GetRawPartPhases( int nRawId, INTVECTOR& vPhase) const
bool bool
MachMgr::KeepRawPart( int nRawId, int nSouPhase) MachMgr::KeepRawPart( int nRawId, int nSouPhase)
{ {
// verifico validità e recupero fasi in cui è presente // verifico validità e recupero fasi in cui è presente
INTVECTOR vPhase ; INTVECTOR vPhase ;
if ( ! GetRawPartPhases( nRawId, vPhase)) if ( ! GetRawPartPhases( nRawId, vPhase))
return false ; return false ;
// se fase corrente già presente, non devo fare alcunché // se fase corrente già presente, non devo fare alcunché
if ( find( vPhase.begin(), vPhase.end(), m_nCurrPhase) != vPhase.end()) if ( find( vPhase.begin(), vPhase.end(), m_nCurrPhase) != vPhase.end())
return true ; return true ;
// aggiungo la fase corrente // aggiungo la fase corrente
@@ -737,8 +586,8 @@ MachMgr::KeepRawPart( int nRawId, int nSouPhase)
return false ; return false ;
if ( ! SwapRawPartParts( nRawId, true)) if ( ! SwapRawPartParts( nRawId, true))
return false ; return false ;
// se fase di origine non definita o uguale alla corrente, esco con successo // se fase di origine non definita, esco con successo
if ( nSouPhase == 0 || nSouPhase == m_nCurrPhase) if ( nSouPhase == 0)
return true ; return true ;
// copio il posizionamento // copio il posizionamento
Disposition* pSouDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nSouPhase))) ; Disposition* pSouDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nSouPhase))) ;
@@ -772,11 +621,10 @@ MachMgr::KeepRawPart( int nRawId, int nSouPhase)
bool bool
MachMgr::VerifyRawPartPhase( int nRawId, int nPhase) const MachMgr::VerifyRawPartPhase( int nRawId, int nPhase) const
{ {
// verifico validità e recupero fasi in cui è presente // verifico validità e recupero fasi in cui è presente
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()) ;
} }
@@ -784,11 +632,11 @@ MachMgr::VerifyRawPartPhase( int nRawId, int nPhase) const
bool bool
MachMgr::RemoveRawPartFromCurrPhase( int nRawId) MachMgr::RemoveRawPartFromCurrPhase( int nRawId)
{ {
// verifico validità e recupero fasi in cui è presente // verifico validità e recupero fasi in cui è presente
INTVECTOR vPhase ; INTVECTOR vPhase ;
if ( ! GetRawPartPhases( nRawId, vPhase)) if ( ! GetRawPartPhases( nRawId, vPhase))
return false ; return false ;
// se non appartiene alla fase corrente, non devo fare alcunché // se non appartiene alla fase corrente, non devo fare alcunché
auto iIter = find( vPhase.begin(), vPhase.end(), m_nCurrPhase) ; auto iIter = find( vPhase.begin(), vPhase.end(), m_nCurrPhase) ;
if ( iIter == vPhase.end()) if ( iIter == vPhase.end())
return true ; return true ;
@@ -815,7 +663,7 @@ MachMgr::RemoveRawPartFromCurrPhase( int nRawId)
bool bool
MachMgr::RemoveRawPart( int nRawId) MachMgr::RemoveRawPart( int nRawId)
{ {
// verifica validità grezzo // verifica validità grezzo
if ( ! VerifyRawPart( nRawId)) if ( ! VerifyRawPart( nRawId))
return false ; return false ;
// tolgo dalle disposizioni in cui compare gli eventuali movimenti registrati di questo grezzo // tolgo dalle disposizioni in cui compare gli eventuali movimenti registrati di questo grezzo
@@ -839,7 +687,7 @@ MachMgr::VerifyRawPart( int nRawId, bool bLinkedAllowed) const
int nRawGroupId = GetCurrRawGroupId() ; int nRawGroupId = GetCurrRawGroupId() ;
if ( nRawGroupId != GDB_ID_NULL && m_pGeomDB->GetParentId( nRawId) == nRawGroupId) if ( nRawGroupId != GDB_ID_NULL && m_pGeomDB->GetParentId( nRawId) == nRawGroupId)
return true ; return true ;
// se consentito linkaggio ed il grezzo è linkato ad un gruppo della macchina corrente, va bene // se consentito linkaggio ed il grezzo è linkato ad un gruppo della macchina corrente, va bene
if ( bLinkedAllowed) { if ( bLinkedAllowed) {
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
if ( pMch != nullptr && pMch->IsLinkedRawPart( nRawId)) if ( pMch != nullptr && pMch->IsLinkedRawPart( nRawId))
@@ -959,12 +807,12 @@ MachMgr::ResetRawPartCenter( int nRawId)
bool bool
MachMgr::GetRawPartCenter( int nRawId, Point3d& ptCen) MachMgr::GetRawPartCenter( int nRawId, Point3d& ptCen)
{ {
// verifica validità grezzo // verifica validità grezzo
if ( ! VerifyRawPart( nRawId)) if ( ! VerifyRawPart( nRawId))
return false ; return false ;
// cerco di recuperare l'oggetto // cerco di recuperare l'oggetto
int nGPntId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_CENTER) ; int nGPntId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_CENTER) ;
// ne verifico la validità // ne verifico la validità
int nMode ; int nMode ;
if ( nGPntId == GDB_ID_NULL || if ( nGPntId == GDB_ID_NULL ||
! m_pGeomDB->GetMode( nGPntId, nMode) || nMode != GDB_MD_STD) { ! m_pGeomDB->GetMode( nGPntId, nMode) || nMode != GDB_MD_STD) {
@@ -992,7 +840,7 @@ MachMgr::GetRawPartCenter( int nRawId, Point3d& ptCen)
bool bool
MachMgr::GetRawPartBBox( int nRawId, BBox3d& b3Raw) MachMgr::GetRawPartBBox( int nRawId, BBox3d& b3Raw)
{ {
// verifica validità grezzo // verifica validità grezzo
if ( ! VerifyRawPart( nRawId)) if ( ! VerifyRawPart( nRawId))
return false ; return false ;
// recupero solido del grezzo // recupero solido del grezzo
@@ -1000,103 +848,6 @@ MachMgr::GetRawPartBBox( int nRawId, BBox3d& b3Raw)
return m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw) ; return m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw) ;
} }
//---------------------------------------------------------------------------
static bool
AssociateSurfs( IGeomDB* pGeomDB, int nSurfUpId, int nSurfDownId, vector<pair<int,int>>& vRawSurfs)
{
// vRawSurfs contiene tutte le coppie ( id regioneUp, id regioneDown) che definiscono i nuovi grezzi
vRawSurfs.clear() ;
int nUpCnt = ExeSurfFrChunkCount( nSurfUpId) ;
int nDownCnt = ExeSurfFrChunkCount( nSurfDownId) ;
// se non sono stati creati più grezzi
if ( nUpCnt == 1 || nDownCnt == 1) {
vRawSurfs.emplace_back( nSurfUpId, nSurfDownId) ;
return true ;
}
int nUpFirstId = ExeExplodeSurface( nSurfUpId, &nUpCnt) ;
int nDownFirstId = ExeExplodeSurface( nSurfDownId, &nDownCnt) ;
// ad ogni chunk della regione up associo i chunk corrispondenti della regione down
INTVECTOR vChunks( nUpCnt, GDB_ID_NULL) ;
for ( int nIdD = nDownFirstId ; nIdD < nDownFirstId + nDownCnt ; nIdD ++) {
ISurfFlatRegion* pSfrD = GetSurfFlatRegion( pGeomDB->GetGeoObj( nIdD)) ;
if ( pSfrD == nullptr)
return false ;
BBox3d bBoxD ; ExeGetBBox( nIdD, BBF_STANDARD, bBoxD) ;
// inidividuo il chunk della superficie up che interagisce maggiormente con il chunk corrente della superficie down
int k = -1 ;
double dMaxArea = -1 ;
for ( int j = 0 ; j < nUpCnt ; j ++) {
BBox3d bBoxU ; ExeGetBBox( nUpFirstId + j, BBF_STANDARD, bBoxU) ;
if ( bBoxU.OverlapsXY( bBoxD)) {
PtrOwner<ISurfFlatRegion> pSfrU( CloneSurfFlatRegion( pGeomDB->GetGeoObj( nUpFirstId + j))) ;
if ( IsNull( pSfrU))
return false ;
// le due superfici sono nello stesso frame
pSfrU->Intersect( *pSfrD) ;
double dArea = -1 ; pSfrU->GetArea( dArea) ;
if ( dArea > dMaxArea) {
k = j ;
dMaxArea = dArea ;
}
}
}
// aggiorno le superfici con l'associazione trovata
if ( k == -1)
return false ;
if ( vChunks[k] == GDB_ID_NULL)
vChunks[k] = nIdD ;
else {
ExeSurfFrAdd( vChunks[k], nIdD) ;
ExeErase( {nIdD}) ;
}
}
// controllo per ogni chunk della superficie up il corrispondente della nuova superficie down
for ( int i = 0 ; i < nUpCnt ; i ++) {
ISurfFlatRegion* pSfrU = GetSurfFlatRegion( pGeomDB->GetGeoObj( nUpFirstId + i)) ;
if ( pSfrU == nullptr)
return false ;
BBox3d bBoxU ; ExeGetBBox( nUpFirstId + i, BBF_STANDARD, bBoxU) ;
// individuo il chunk della superficie down che interagisce maggiormente con il chunk corrente della superficie up
int k = -1 ;
double dMaxArea = -1 ;
for ( int j = 0 ; j < int( vChunks.size()) ; j ++) {
BBox3d bBoxD ; ExeGetBBox( vChunks[j], BBF_STANDARD, bBoxD) ;
// se i box interferiscono allora verifico di quanto si sovrappongono le due regioni
if ( bBoxD.OverlapsXY( bBoxU)) {
PtrOwner<ISurfFlatRegion> pSfrD( CloneSurfFlatRegion( pGeomDB->GetGeoObj( vChunks[j]))) ;
if ( IsNull( pSfrD))
return false ;
pSfrD->Intersect( *pSfrU) ;
double dArea = -1 ; pSfrD->GetArea( dArea) ;
if ( dArea > dMaxArea) {
k = j ;
dMaxArea = dArea ;
}
}
}
if ( k == -1)
return false ;
// se è la stessa associazione individuata da vChunks allora aggiorno il vettore finale dei grezzi
if ( k == i)
vRawSurfs.emplace_back( nUpFirstId + i, vChunks[i]) ;
else {
// altrimenti unisco le regioni associate appena individuate sia per la superficie up sia per la down
ExeSurfFrAdd( nUpFirstId + k, nUpFirstId + i) ;
ExeErase( {nUpFirstId + i}) ;
ExeSurfFrAdd( vChunks[k], vChunks[i]) ;
ExeErase( {vChunks[i]}) ;
}
}
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId) MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
@@ -1120,6 +871,7 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
BBox3d b3Raw ; BBox3d b3Raw ;
if ( ! m_pGeomDB->GetGlobalBBox( nRawSolId, b3Raw)) if ( ! m_pGeomDB->GetGlobalBBox( nRawSolId, b3Raw))
return GDB_ID_NULL ; return GDB_ID_NULL ;
double dZmin = b3Raw.GetMin().z ;
double dHeight = b3Raw.GetMax().z - b3Raw.GetMin().z ; double dHeight = b3Raw.GetMax().z - b3Raw.GetMin().z ;
// il colore del grezzo // il colore del grezzo
Color cCol = AQUA ; Color cCol = AQUA ;
@@ -1128,31 +880,19 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
Frame3d frRaw ; Frame3d frRaw ;
if ( ! m_pGeomDB->GetGroupGlobFrame( nRawId, frRaw)) if ( ! m_pGeomDB->GetGroupGlobFrame( nRawId, frRaw))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// creo la regione del grezzo a partire dal suo contorno
// recupero il contorno // recupero il contorno
int nOutCrvId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_OUTLINE) ; int nOutCrvId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_OUTLINE) ;
if ( nOutCrvId == GDB_ID_NULL) if ( nOutCrvId == GDB_ID_NULL)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// creo la regione
// creo le regioni inferiore e superiore del grezzo da aggiornare con le lavorazioni INTVECTOR vCrvIds ;
int nSfrDownId = GDB_ID_NULL, nSfrUpId = GDB_ID_NULL ; vCrvIds.emplace_back( nOutCrvId) ;
int nSfrDownOrigId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_DOWN_REG) ; int nSfrId = ExeCreateSurfFlatRegion( nRawId, vCrvIds, nullptr) ;
int nSfrUpOrigId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_UP_REG) ; if ( nSfrId == GDB_ID_NULL)
if ( nSfrDownOrigId == GDB_ID_NULL || nSfrUpOrigId == GDB_ID_NULL) { return GDB_ID_NULL ;
// se le regioni del grezzo di partenza non sono definite, le creo a partire dall'outline m_pGeomDB->SetLevel( nSfrId, GDB_LV_TEMP) ;
nSfrDownId = ExeCreateSurfFlatRegion( nRawId, {nOutCrvId}, nullptr) ;
if ( nSfrDownId == GDB_ID_NULL)
return GDB_ID_NULL ;
nSfrUpId = ExeCopyGlob( nSfrDownId, nRawId, GDB_LAST_SON) ;
if ( nSfrUpId == GDB_ID_NULL)
return GDB_ID_NULL ;
ExeMove( { nSfrUpId}, dHeight * Z_AX, RTY_LOC) ;
}
else {
nSfrDownId = ExeCopyGlob( nSfrDownOrigId, nRawId, GDB_LAST_SON) ;
nSfrUpId = ExeCopyGlob( nSfrUpOrigId, nRawId, GDB_LAST_SON) ;
if ( nSfrDownId == GDB_ID_NULL || nSfrUpId == GDB_ID_NULL)
return GDB_ID_NULL ;
}
// se esiste il kerf, ne creo la regione // se esiste il kerf, ne creo la regione
PtrOwner<ISurfFlatRegion> pSfrKerf ; PtrOwner<ISurfFlatRegion> pSfrKerf ;
@@ -1167,8 +907,7 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
} }
// recupero le regioni delle lavorazioni // recupero le regioni delle lavorazioni
INTVECTOR vMchRRegUp ; INTVECTOR vMchRReg ;
INTVECTOR vMchRRegDown ;
for ( auto nMchId : vMchId) { for ( auto nMchId : vMchId) {
// recupero gruppo preview lavorazioni nella lavorazione // recupero gruppo preview lavorazioni nella lavorazione
int nPVGrp = m_pGeomDB->GetFirstNameInGroup( nMchId, MCH_PV) ; int nPVGrp = m_pGeomDB->GetFirstNameInGroup( nMchId, MCH_PV) ;
@@ -1176,110 +915,94 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// se vuoto, cerco il rimando al preview nel pezzo // se vuoto, cerco il rimando al preview nel pezzo
if ( m_pGeomDB->GetGroupObjs( nPVGrp) == 0 && if ( m_pGeomDB->GetGroupObjs( nPVGrp) == 0 &&
! m_pGeomDB->GetInfo( nPVGrp, MCH_PV_KEY_RELOCATE, nPVGrp)) ! m_pGeomDB->GetInfo( nPVGrp, MCH_PV_KEY_RELOCATE, nPVGrp))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// ciclo sui percorsi utensile (CL) // ciclo sui percorsi utensile (CL)
int nClId = m_pGeomDB->GetFirstGroupInGroup( nPVGrp) ; int nClId = m_pGeomDB->GetFirstGroupInGroup( nPVGrp) ;
while ( nClId != GDB_ID_NULL) { while ( nClId != GDB_ID_NULL) {
// lavorazioni per regione inferiore // tagli ridotti
int nCrDownId = m_pGeomDB->GetFirstNameInGroup( nClId, MCH_PV_DOWN_RAWCUT) ; int nCrId = m_pGeomDB->GetFirstNameInGroup( nClId, MCH_PV_RRCUT) ;
// se non esiste la regione inferiore la lavorazione non è passante quindi può essere ignorata while ( nCrId != GDB_ID_NULL) {
if ( nCrDownId != GDB_ID_NULL) { vMchRReg.emplace_back( nCrId) ;
while ( nCrDownId != GDB_ID_NULL) { nCrId = m_pGeomDB->GetNextName( nCrId, MCH_PV_RRCUT) ;
vMchRRegDown.emplace_back( nCrDownId) ; }
nCrDownId = m_pGeomDB->GetNextName( nCrDownId, MCH_PV_DOWN_RAWCUT) ;
}
// lavorazioni per regione superiore
int nCrUpId = m_pGeomDB->GetFirstNameInGroup( nClId, MCH_PV_UP_RAWCUT) ;
while ( nCrUpId != GDB_ID_NULL) {
vMchRRegUp.emplace_back( nCrUpId) ;
nCrUpId = m_pGeomDB->GetNextName( nCrUpId, MCH_PV_UP_RAWCUT) ;
}
}
// passo al successivo percorso utensile // passo al successivo percorso utensile
nClId = m_pGeomDB->GetNextGroup( nClId) ; nClId = m_pGeomDB->GetNextGroup( nClId) ;
} }
} }
// sottraggo le lavorazioni alle superfici del grezzo // sottraggo queste regioni a quella del grezzo
for ( auto nMchRReg : vMchRRegUp) for ( auto nMchRReg : vMchRReg) {
ExeSurfFrSubtract( nSfrUpId, nMchRReg) ; ExeSurfFrSubtract( nSfrId, nMchRReg) ;
for ( auto nMchRReg : vMchRRegDown) }
ExeSurfFrSubtract( nSfrDownId, nMchRReg) ;
// classifico i chunks della regione up e down per individuare le regioni che definiscono i nuovi grezzi
vector<pair<int,int>> vSurfRaws ;
AssociateSurfs( m_pGeomDB, nSfrUpId, nSfrDownId, vSurfRaws) ;
// creo i grezzi risultanti // creo i grezzi risultanti
INTVECTOR vNewIds ; // creo i nuovi grezzi
for ( int i = 0 ; i < int( vSurfRaws.size()) ; i++) { INTVECTOR vNewIds ;
int nCount ;
// aggiungo il grezzo int nChunk = 0 ;
int nId = AddRawPart( vSurfRaws[i].first, vSurfRaws[i].second, dHeight, cCol) ; int nFirstLoopId = ExeExtractSurfFrChunkLoops( nSfrId, nChunk, nRawId, &nCount) ;
m_pGeomDB->Erase( vSurfRaws[i].first) ; while ( nFirstLoopId != GDB_ID_NULL) {
m_pGeomDB->Erase( vSurfRaws[i].second) ; // !!! in attesa di gestire i grezzi con i buchi !!!
if ( nId == GDB_ID_NULL) // cancello le eventuali curve successive (sono i loop interni ovvero i buchi)
return GDB_ID_NULL ; for ( int i = 1 ; i < nCount ; ++ i) {
vNewIds.emplace_back( nId) ; m_pGeomDB->Erase( nFirstLoopId + i) ;
}
// imposto lo stato del contorno di questo grezzo come quello del grezzo di partenza // dichiaro temporanea la curva
int nStat = GDB_ST_ON ; m_pGeomDB->SetLevel( nFirstLoopId, GDB_LV_TEMP) ;
if ( m_pGeomDB->GetStatus( nOutCrvId, nStat) && nStat == GDB_ST_OFF) // creo il grezzo
m_pGeomDB->SetStatus( m_pGeomDB->GetFirstNameInGroup( nId, MACH_RAW_OUTLINE), nStat) ; int nId = AddRawPart( nFirstLoopId, 0, dZmin, dHeight, cCol) ;
// assegno la fase al gruppo if ( nId == GDB_ID_NULL)
m_pGeomDB->SetInfo( nId, MACH_RAW_PHASE, m_nCurrPhase) ; return GDB_ID_NULL ;
// se esiste il kerf uso questa curva per creare il kerf del nuovo grezzo vNewIds.emplace_back( nId) ;
if ( ! IsNull( pSfrKerf)) { // imposto lo stato del contorno di questo grezzo come quello del grezzo di partenza
// riferimento del nuovo grezzo int nStat = GDB_ST_ON ;
Frame3d frNewRaw ; if ( m_pGeomDB->GetStatus( nOutCrvId, nStat) && nStat == GDB_ST_OFF)
if ( ! m_pGeomDB->GetGroupGlobFrame( nId, frNewRaw)) m_pGeomDB->SetStatus( m_pGeomDB->GetFirstNameInGroup( nId, MACH_RAW_OUTLINE), nStat) ;
return GDB_ID_NULL ; // assegno la fase al gruppo
// considero il nuovo kerf come la regione superiore del nuovo grezzo m_pGeomDB->SetInfo( nId, MACH_RAW_PHASE, m_nCurrPhase) ;
int nSfrUpId = m_pGeomDB->GetFirstNameInGroup( nId, MACH_RAW_UP_REG) ; // se esiste il kerf uso questa curva per creare il kerf del nuovo grezzo
if ( nSfrUpId == GDB_ID_NULL) if ( ! IsNull( pSfrKerf)) {
return GDB_ID_NULL ; // creo la regione con la curva
PtrOwner<ISurfFlatRegion> pSfrNewKerf( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrUpId))) ; SurfFlatRegionByContours SfrCntr ;
if ( IsNull( pSfrNewKerf)) SfrCntr.AddCurve( GetCurve( m_pGeomDB->RemoveGeoObjAndErase( nFirstLoopId))) ;
return GDB_ID_NULL ; PtrOwner<ISurfFlatRegion> pSfrNewKerf( SfrCntr.GetSurf()) ;
// porto nello stesso riferimento del grezzo originale if ( IsNull( pSfrNewKerf))
pSfrNewKerf->LocToLoc( frNewRaw, frRaw) ; return GDB_ID_NULL ;
// la limito con la regione di kerf precedente ( va bene anche se fallisce) // la limito con la regione di kerf precedente (va bene anche se fallisce)
pSfrNewKerf->Intersect( *pSfrKerf) ; pSfrNewKerf->Intersect( *pSfrKerf) ;
// se risultato non vuoto // se risultato non vuoto
if ( pSfrNewKerf->IsValid()) { if ( pSfrNewKerf->IsValid()) {
// la porto dal riferimento del grezzo originale al riferimento di questo grezzo // riferimento del nuovo grezzo
pSfrNewKerf->LocToLoc( frRaw, frNewRaw) ; Frame3d frNewRaw ;
// recupero il contorno esterno del chunk più grande e lo inserisco come kerf del nuovo grezzo if ( ! m_pGeomDB->GetGroupGlobFrame( nId, frNewRaw))
double dAreaMax = -1 ; return GDB_ID_NULL ;
int nKMax = 0 ; // la porto dal riferimento del grezzo originale al riferimento di questo grezzo
for ( int k = 0 ; k < pSfrNewKerf->GetChunkCount() ; k ++) { pSfrNewKerf->LocToLoc( frRaw, frNewRaw) ;
PtrOwner<ISurfFlatRegion> pSfrChunk( pSfrNewKerf->CloneChunk( k)) ; // la porto sulla faccia sopra del grezzo
double dArea = -1 ; pSfrChunk->GetGrossArea( dArea) ; pSfrNewKerf->Translate( Vector3d( 0, 0, dHeight)) ;
if ( dArea > dAreaMax) { // recupero il contorno e lo inserisco come kerf del nuovo grezzo
nKMax = k ; PtrOwner<ICurve> pCrv( pSfrNewKerf->GetLoop( 0, 0)) ;
dAreaMax = dArea ; int nNewKerfId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nId, Release( pCrv)) ;
} if ( nNewKerfId == GDB_ID_NULL)
} return GDB_ID_NULL ;
PtrOwner<ICurve> pCrv( pSfrNewKerf->GetLoop( nKMax, 0)) ; m_pGeomDB->CopyMaterial( nKerfId, nNewKerfId) ;
if ( IsNull( pCrv)) m_pGeomDB->SetName( nNewKerfId, MACH_RAW_KERF) ;
return GDB_ID_NULL ; }
int nNewKerfId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nId, Release( pCrv)) ; }
if ( nNewKerfId == GDB_ID_NULL) // altrimenti la cancello
return GDB_ID_NULL ; else
m_pGeomDB->CopyMaterial( nKerfId, nNewKerfId) ; m_pGeomDB->Erase( nFirstLoopId) ;
m_pGeomDB->SetName( nNewKerfId, MACH_RAW_KERF) ; // passo alla prossima curva
} ++ nChunk ;
} nFirstLoopId = ExeExtractSurfFrChunkLoops( nSfrId, nChunk, nRawId, &nCount) ;
} }
// cancello la regione
// cancello le regioni usate per i conti m_pGeomDB->Erase( nSfrId) ;
m_pGeomDB->Erase( nSfrUpId) ;
m_pGeomDB->Erase( nSfrDownId) ;
// verifico esista almeno un nuovo grezzo // verifico esista almeno un nuovo grezzo
if ( vNewIds.empty()) if ( vNewIds.empty())
return GDB_ID_NULL ; return GDB_ID_NULL ;
// inserisco i pezzi del grezzo originale nei nuovi grezzi // inserisco i pezzi del grezzo originale nei nuovi grezzi
int nGroupId = m_pGeomDB->GetFirstGroupInGroup( nRawId) ; int nGroupId = m_pGeomDB->GetFirstGroupInGroup( nRawId) ;
while ( nGroupId != GDB_ID_NULL) { while ( nGroupId != GDB_ID_NULL) {
@@ -1289,31 +1012,32 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
// scambio con pezzo // scambio con pezzo
int nPartId = SwapRawPartPart( nNewGroupId, true) ; int nPartId = SwapRawPartPart( nNewGroupId, true) ;
// verifico se il pezzo sta nel grezzo // verifico se il pezzo sta nel grezzo
int nLayerId = m_pGeomDB->GetFirstNameInGroup( nPartId, NST_PARTREG_LAYER) ; int nLayerId = m_pGeomDB->GetFirstNameInGroup( nPartId, NST_EXT_LAYER) ;
if ( nLayerId == GDB_ID_NULL || m_pGeomDB->GetGdbType( nLayerId) != GDB_TY_GROUP) if ( nLayerId == GDB_ID_NULL || m_pGeomDB->GetGdbType( nLayerId) != GDB_TY_GROUP)
nLayerId = m_pGeomDB->GetFirstGroupInGroup( nPartId) ; nLayerId = m_pGeomDB->GetFirstGroupInGroup( nPartId) ;
// cerco la regione del pezzo int nEntId = m_pGeomDB->GetFirstInGroup( nLayerId) ;
int nEntId = m_pGeomDB->GetFirstInGroup( nLayerId) ; int nEntGeoType = m_pGeomDB->GetGeoType( nEntId) ;
while ( nEntId != GDB_ID_NULL) { Point3d ptTest ;
int nEntGeoType = m_pGeomDB->GetGeoType( nEntId) ; if ( ( ( nEntGeoType & GEO_CURVE) != 0 && ExeMidPoint( nEntId, nNewId, ptTest)) ||
if ( nEntGeoType == SRF_FLATRGN) ( ( nEntGeoType & GEO_CURVE) == 0 && ExeCenterPoint( nEntId, nNewId, ptTest))) {
break ;
nEntId = m_pGeomDB->GetNext( nEntId) ;
}
if ( nEntId != GDB_ID_NULL) {
// verifico se è interna al grezzo
int nOutCrvId = m_pGeomDB->GetFirstNameInGroup( nNewId, MACH_RAW_OUTLINE) ; int nOutCrvId = m_pGeomDB->GetFirstNameInGroup( nNewId, MACH_RAW_OUTLINE) ;
BBox3d b3Raw ; m_pGeomDB->GetGlobalBBox( nOutCrvId, b3Raw) ; BBox3d b3Raw ; m_pGeomDB->GetGlobalBBox( nOutCrvId, b3Raw) ;
double dRawDiam = 0 ; b3Raw.GetDiameter( dRawDiam) ; double dRawDiam = 0 ; b3Raw.GetDiameter( dRawDiam) ;
BBox3d b3Part ; m_pGeomDB->GetGlobalBBox( nEntId, b3Part) ; BBox3d b3Part ; m_pGeomDB->GetGlobalBBox( nEntId, b3Part) ;
double dPartDiam = 0 ; b3Part.GetDiameter( dPartDiam) ; double dPartDiam = 0 ; b3Part.GetDiameter( dPartDiam) ;
if ( dRawDiam > 0.9 * dPartDiam) { if ( dRawDiam > 0.9 * dPartDiam) {
int nSfrUp = m_pGeomDB->GetFirstNameInGroup( nNewId, MACH_RAW_UP_REG) ; ICurve* pCurve = GetCurve( m_pGeomDB->GetGeoObj( nOutCrvId)) ;
if ( ! ExeSurfFrTestExternal( nSfrUp, nEntId, EPS_SMALL)) if ( pCurve != nullptr) {
break ; int nSide ;
} double dDist ;
} DistPointCurve distPC( ptTest, *pCurve) ;
if ( distPC.GetDist( dDist) &&
( dDist < 100 * EPS_SMALL ||
( distPC.GetSideAtMinDistPoint( 0, Z_AX, nSide) && nSide != MDS_RIGHT)))
break ;
}
}
}
// altrimenti scambio pezzo ed elimino gruppo // altrimenti scambio pezzo ed elimino gruppo
nNewGroupId = SwapRawPartPart( nPartId, false) ; nNewGroupId = SwapRawPartPart( nPartId, false) ;
m_pGeomDB->Erase( nNewGroupId) ; m_pGeomDB->Erase( nNewGroupId) ;
@@ -1321,5 +1045,5 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
nGroupId = m_pGeomDB->GetNextGroup( nGroupId) ; nGroupId = m_pGeomDB->GetNextGroup( nGroupId) ;
} }
return vNewIds[0] ; return vNewIds[0] ;
} }
-8
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)
@@ -155,7 +148,6 @@ MachMgr::UpdateCurrSetup( void)
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr) if ( pMch == nullptr)
return false ; return false ;
pMch->ResetCurrTool() ;
return pMch->LoadAllTools() ; return pMch->LoadAllTools() ;
} }
+5 -34
View File
@@ -16,8 +16,7 @@
#include "DllMain.h" #include "DllMain.h"
#include "MachMgr.h" #include "MachMgr.h"
#include "MachConst.h" #include "MachConst.h"
#include "SimulatorSP.h" #include "Simulator.h"
#include "SimulatorMP.h"
using namespace std ; using namespace std ;
@@ -28,12 +27,7 @@ MachMgr::SimInit( void)
// alloco o rialloco il simulatore // alloco o rialloco il simulatore
if ( m_pSimul != nullptr) if ( m_pSimul != nullptr)
delete m_pSimul ; delete m_pSimul ;
if ( GetCurrMachine() == nullptr) m_pSimul = new( nothrow) Simulator ;
return false ;
if ( GetCurrMachine()->GetMultiProcess( 2))
m_pSimul = CreateSimulatorMP() ;
else
m_pSimul = CreateSimulatorSP() ;
if ( m_pSimul == nullptr) if ( m_pSimul == nullptr)
return false ; return false ;
// lo inizializzo // lo inizializzo
@@ -189,25 +183,13 @@ MachMgr::SimOnCollision( int nCdInd, int nObjInd, int& nErr)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::SimSetToolForVmill( const string& sTool, const string& sHead, int nExit, int nFlag, double dPar1, double dPar2, MachMgr::SimSetToolForVmill( const string& sTool, const string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst)
const INTVECTOR& vVmill, bool bFirst)
{ {
// verifico simulatore // verifico simulatore
if ( m_pSimul == nullptr) if ( m_pSimul == nullptr)
return false ; return false ;
// imposto utensile per Vmill // imposto utensile per Vmill
return m_pSimul->SetToolForVmill( sTool, sHead, nExit, nFlag, dPar1, dPar2, vVmill, bFirst) ; return m_pSimul->SetToolForVmill( sTool, sHead, nExit, vVmill, bFirst) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimEnableToolsForVmill( bool bEnable)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// imposto abilitazione Vmill
return m_pSimul->EnableToolsForVmill( bEnable) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -216,18 +198,7 @@ MachMgr::SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
{ {
// verifico simulatore // verifico simulatore
if ( m_pSimul == nullptr) if ( m_pSimul == nullptr)
return SIM_AXMV_RES_ERR ; return false ;
// lancio movimento assi // lancio movimento assi
return m_pSimul->MoveAxes( nMoveType, vAxNaEpSt) ; return m_pSimul->MoveAxes( nMoveType, vAxNaEpSt) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::SimSaveCmd( int nType, int nPar, const string& sPar, const string& sPar2)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// salvo il comando
return m_pSimul->SaveCmd( nType, nPar, sPar, sPar2) ;
}
+16 -87
View File
@@ -41,8 +41,6 @@ Machine::Machine( void)
m_dExitMaxAdjust = EPS_SMALL ; m_dExitMaxAdjust = EPS_SMALL ;
m_dExitMaxRotAdj = 10 * EPS_ANG_SMALL ; m_dExitMaxRotAdj = 10 * EPS_ANG_SMALL ;
m_dAngDeltaMinForHome = INFINITO ; m_dAngDeltaMinForHome = INFINITO ;
m_nMultiProcess = 0 ;
m_nNewLinkMgr = 0 ;
m_nCalcTabId = GDB_ID_NULL ; m_nCalcTabId = GDB_ID_NULL ;
m_nCalcHeadId = GDB_ID_NULL ; m_nCalcHeadId = GDB_ID_NULL ;
m_nCalcExitId = GDB_ID_NULL ; m_nCalcExitId = GDB_ID_NULL ;
@@ -60,8 +58,6 @@ Machine::Machine( void)
m_nHeadRotAxes = 0 ; m_nHeadRotAxes = 0 ;
m_nHeadSpecRotAxis = -1 ; m_nHeadSpecRotAxis = -1 ;
m_frLinAx.Reset( false) ; m_frLinAx.Reset( false) ;
m_frRobot.Reset( false) ;
m_nCalcChainType = KIN_CHAIN_NONE ;
m_nMachineLook = MCH_LOOK_NONE ; m_nMachineLook = MCH_LOOK_NONE ;
} }
@@ -144,9 +140,7 @@ Machine::Init( const string& sMachineName, const string& sMachineDir, MachMgr* p
// imposto stato di visualizzazione // imposto stato di visualizzazione
m_nMachineLook = ( bOk ? MCH_LOOK_ALL : MCH_LOOK_NONE) ; m_nMachineLook = ( bOk ? MCH_LOOK_ALL : MCH_LOOK_NONE) ;
// metto tutti gli assi in posizione home // metto tutti gli assi in posizione home
bOk = bOk && ResetAllAxesPos( true, true) ; bOk = bOk && ResetAllAxesPos() ;
// reset catena cinematica corrente
m_nCalcChainType = KIN_CHAIN_NONE ;
return bOk ; return bOk ;
} }
@@ -215,7 +209,7 @@ Machine::AdjustAuxGeometry( const STRVECTOR& vsAux, int nLay)
bool bool
Machine::LoadMachineTable( const string& sName, const string& sParent, int nType, Machine::LoadMachineTable( const string& sName, const string& sParent, int nType,
const Point3d& ptRef1, double dCoeffX, double dCoeffY, double dCoeffZ, const Point3d& ptRef1, double dCoeffX, double dCoeffY, double dCoeffZ,
const STRVECTOR& vsColl, const string& sGeo, const STRVECTOR& vsAux) const string& sGeo, const STRVECTOR& vsAux)
{ {
// recupero pezzo e layer della geometria originale della tavola // recupero pezzo e layer della geometria originale della tavola
string sPart, sLay ; string sPart, sLay ;
@@ -254,7 +248,7 @@ Machine::LoadMachineTable( const string& sName, const string& sParent, int nType
Table* pTab = new(nothrow) Table ; Table* pTab = new(nothrow) Table ;
if ( pTab == nullptr) if ( pTab == nullptr)
return false ; return false ;
pTab->Set( sName, nType, ptRef1, b3Area1, vsColl) ; pTab->Set( sName, nType, ptRef1, b3Area1) ;
m_pGeomDB->SetUserObj( nLay, pTab) ; m_pGeomDB->SetUserObj( nLay, pTab) ;
// lo inserisco nel dizionario dei gruppi della macchina // lo inserisco nel dizionario dei gruppi della macchina
return m_mapGroups.emplace( sName, nLay).second ; return m_mapGroups.emplace( sName, nLay).second ;
@@ -447,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 ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -472,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 ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -550,7 +528,7 @@ Machine::LoadMachineStdHead( const string& sName, const string& sParent, const s
Head* pHead = new(nothrow) Head ; Head* pHead = new(nothrow) Head ;
if ( pHead == nullptr) if ( pHead == nullptr)
return false ; return false ;
pHead->Set( sName, MCH_HT_STD, 1, sHSet, 0, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ; pHead->Set( sName, MCH_HT_STD, 1, sHSet, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
m_pGeomDB->SetUserObj( nLay, pHead) ; m_pGeomDB->SetUserObj( nLay, pHead) ;
// aggiorno la testa capostipite // aggiorno la testa capostipite
if ( ! AddHeadToSet( sHSet, sName)) if ( ! AddHeadToSet( sHSet, sName))
@@ -570,7 +548,7 @@ Machine::LoadMachineStdHead( const string& sName, const string& sParent, const s
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const string& sHSet, Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const string& sHSet,
int nSelectType, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir, const MUEXITVECTOR& vMuExit, 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 string& sGeo, const STRVECTOR& vsAux) const string& sGeo, const STRVECTOR& vsAux)
{ {
@@ -599,8 +577,7 @@ Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const
Head* pHead = new(nothrow) Head ; Head* pHead = new(nothrow) Head ;
if ( pHead == nullptr) if ( pHead == nullptr)
return false ; return false ;
pHead->Set( sName, MCH_HT_MULTI, int( vMuExit.size()), sHSet, nSelectType, pHead->Set( sName, MCH_HT_MULTI, int( vMuExit.size()), sHSet, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
m_pGeomDB->SetUserObj( nLay, pHead) ; m_pGeomDB->SetUserObj( nLay, pHead) ;
// aggiorno la testa capostipite // aggiorno la testa capostipite
if ( ! AddHeadToSet( sHSet, sName)) if ( ! AddHeadToSet( sHSet, sName))
@@ -647,7 +624,7 @@ Machine::LoadMachineSpecialHead( const string& sName, const string& sParent, con
Head* pHead = new(nothrow) Head ; Head* pHead = new(nothrow) Head ;
if ( pHead == nullptr) if ( pHead == nullptr)
return false ; return false ;
pHead->Set( sName, MCH_HT_SPECIAL, 1, sHSet, 0, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ; pHead->Set( sName, MCH_HT_SPECIAL, 1, sHSet, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
m_pGeomDB->SetUserObj( nLay, pHead) ; m_pGeomDB->SetUserObj( nLay, pHead) ;
// aggiorno la testa capostipite // aggiorno la testa capostipite
if ( ! AddHeadToSet( sHSet, sName)) if ( ! AddHeadToSet( sHSet, sName))
@@ -666,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 ;
@@ -708,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
@@ -983,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) ;
@@ -1005,8 +940,8 @@ Machine::CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit)
m_pGeomDB->SetName( nGT, sName) ; m_pGeomDB->SetName( nGT, sName) ;
// copio le info // copio le info
m_pGeomDB->CopyAllInfoFrom( nGT, nT) ; m_pGeomDB->CopyAllInfoFrom( nGT, nT) ;
// assegno info per eventuale movimento (sempre in Z globale) // assegno info per eventuale movimento
m_pGeomDB->SetInfo( nGT, MCH_EXIT_VAL, 0) ; m_pGeomDB->SetInfo( nGT, "Val", 0) ;
// installo e inizializzo il gestore dell'uscita // installo e inizializzo il gestore dell'uscita
Exit* pExit = new(nothrow) Exit ; Exit* pExit = new(nothrow) Exit ;
if ( pExit == nullptr) if ( pExit == nullptr)
@@ -1041,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 ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -1069,8 +1000,6 @@ Machine::SetLook( int nFlag)
nTabId = GetFirstTable() ; nTabId = GetFirstTable() ;
if ( nTabId == GDB_ID_NULL) if ( nTabId == GDB_ID_NULL)
return false ; return false ;
// il gruppo tavola corrente deve essere sempre visibile
m_pGeomDB->SetStatus( nTabId, GDB_ST_ON) ;
// nascondo o visualizzo i fratelli e tutti i fratelli degli ascendenti della tavola // nascondo o visualizzo i fratelli e tutti i fratelli degli ascendenti della tavola
bool bTabOnly = ( nFlag != MCH_LOOK_ALL) ; bool bTabOnly = ( nFlag != MCH_LOOK_ALL) ;
int nTabCurrId = nTabId ; int nTabCurrId = nTabId ;
+27 -60
View File
@@ -50,46 +50,25 @@ class Machine
int GetAxisId( const std::string& sAxis) const int GetAxisId( const std::string& sAxis) const
{ int nId = GetGroup( sAxis) ; { int nId = GetGroup( sAxis) ;
return ( IsAxisGroup( nId) ? nId : GDB_ID_NULL) ; } return ( IsAxisGroup( nId) ? nId : GDB_ID_NULL) ; }
bool GetAxisName( int nAxId, std::string& sAxis) const ;
int GetHeadId( const std::string& sHead) const int GetHeadId( const std::string& sHead) const
{ int nId = GetGroup( sHead) ; { int nId = GetGroup( sHead) ;
return ( IsHeadGroup( nId) ? nId : GDB_ID_NULL) ; } return ( IsHeadGroup( nId) ? nId : GDB_ID_NULL) ; }
int GetExitId( const std::string& sHead, int nExit) const int GetExitId( const std::string& sHead, int nExit) const
{ int nHeadId = GetHeadId( sHead) ; { int nHeadId = GetHeadId( sHead) ;
int nId = ( m_pGeomDB != nullptr ? m_pGeomDB->GetFirstNameInGroup( nHeadId, MCH_EXIT + ToString( nExit)) : GDB_ID_NULL) ; int nId = ( m_pGeomDB != nullptr ? m_pGeomDB->GetFirstNameInGroup( nHeadId, MCH_EXIT + ToString( nExit)) : GDB_ID_NULL) ;
return ( IsExitGroup( nId) ? nId : GDB_ID_NULL) ; } return ( IsExitGroup( nId) ? nId : GDB_ID_NULL) ; }
int GetTcPosId( const std::string& sTcPos) const int GetTcPosId( const std::string& sTcPos) const
{ int nId = GetGroup( sTcPos) ; { int nId = GetGroup( sTcPos) ;
return ( IsTcPosGroup( nId) ? nId : GDB_ID_NULL) ; } return ( IsTcPosGroup( nId) ? nId : GDB_ID_NULL) ; }
bool IsBaseGroup( int nGroup) const ;
bool IsAxisGroup( int nGroup) const
{ return ( GetAxis( nGroup) != nullptr) ; }
bool IsLinearAxisGroup( int nGroup) const ;
bool IsRotaryAxisGroup( int nGroup) const ;
bool IsTableGroup( int nGroup) const
{ return ( GetTable( nGroup) != nullptr) ; }
bool IsHeadGroup( int nGroup) const
{ return ( GetHead( nGroup) != nullptr) ; }
bool IsTcPosGroup( int nGroup) const
{ return ( GetTcPos( nGroup) != nullptr) ; }
bool IsExitGroup( int nGroup) const
{ return ( GetExit( nGroup) != nullptr) ; }
bool GetAllAxesIds( INTVECTOR& vIds) const ;
bool GetAllTablesNames( STRVECTOR& vNames) const ; bool GetAllTablesNames( STRVECTOR& vNames) const ;
bool GetAllAxesNames( STRVECTOR& vNames) const ;
bool GetAllHeadsNames( STRVECTOR& vNames) const ; bool GetAllHeadsNames( STRVECTOR& vNames) const ;
bool GetAllTcPosNames( STRVECTOR& vNames) const ; bool GetAllTcPosNames( STRVECTOR& vNames) const ;
int GetFirstTable( void) const ; int GetFirstTable( void) const ;
int GetHeadExitCount( const std::string& sHead) const ; int GetHeadExitCount( const std::string& sHead) const ;
int GetHeadExitPosDirAux( const std::string& sHead, int nExit, Point3d& ptPos, Vector3d& vtDir, Vector3d& vtAux) const ; int GetHeadExitPosDirAux( const std::string& sHead, int nExit, Point3d& ptPos, Vector3d& vtDir, Vector3d& vtAux) const ;
int GetHeadSolCh( const std::string& sHead) const ; int GetHeadSolCh( const std::string& sHead) const ;
int GetHeadSelectType(const std::string& sHead) const ;
double GetAngDeltaMinForHome( void) const double GetAngDeltaMinForHome( void) const
{ return m_dAngDeltaMinForHome ; } { return m_dAngDeltaMinForHome ; }
bool GetMultiProcess( int nOpt = 1) const
{ return ( m_nMultiProcess >= nOpt) ; }
bool GetNewLinkMgr( int nOpt = 1) const
{ return ( m_nNewLinkMgr >= nOpt) ; }
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) ; bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) ;
bool GetLoadedTool( const std::string& sHead, int nExit, std::string& sTool) const ; bool GetLoadedTool( const std::string& sHead, int nExit, std::string& sTool) const ;
bool UnloadTool( const std::string& sHead, int nExit) ; bool UnloadTool( const std::string& sHead, int nExit) ;
@@ -102,16 +81,13 @@ 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 GetAxisDir( const std::string& sAxis, Vector3d& vtDir) const ; bool SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) ;
bool SetAxisPos( const std::string& sAxis, double dVal, bool bInStroke = true, 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 ;
bool GetAxisHomePos( const std::string& sAxis, double& dHomeVal) const ; bool GetAxisHomePos( const std::string& sAxis, double& dHomeVal) const ;
bool IsDispositionAxis( int nAxisId, int nTableId = GDB_ID_NULL) const ;
bool IsDispositionAxis( const std::string& sAxis, const std::string& sTable = "") const ;
bool ResetAxisPos( const std::string& sAxis) ; bool ResetAxisPos( const std::string& sAxis) ;
bool ResetAllAxesPos( bool bStdAxes, bool bDispAxes) ; bool ResetAllAxesPos( void) ;
bool SetCurrTable( const std::string& sTable) ; bool SetCurrTable( const std::string& sTable) ;
bool ResetCurrTable( void) ; bool ResetCurrTable( void) ;
int GetCurrTable( void) const ; int GetCurrTable( void) const ;
@@ -119,8 +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 GetCurrTableCollGroups( INTVECTOR& vIds) 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 ;
@@ -130,7 +105,6 @@ class Machine
int GetCurrExit( void) const ; int GetCurrExit( void) const ;
bool GetCurrExit( int& nExit) const ; bool GetCurrExit( int& nExit) const ;
bool GetCurrHeadCollGroups( INTVECTOR& vIds) const ; bool GetCurrHeadCollGroups( INTVECTOR& vIds) const ;
bool IsCurrToolFloating( void) const ;
double GetCurrRot1W( void) const double GetCurrRot1W( void) const
{ return m_dCalcRot1W ; } { return m_dCalcRot1W ; }
bool GetCurrMaxDeltaR2OnFirst( void) const bool GetCurrMaxDeltaR2OnFirst( void) const
@@ -146,32 +120,25 @@ class Machine
int GetCurrLinAxes( void) const ; int GetCurrLinAxes( void) const ;
int GetCurrRotAxes( void) const ; int GetCurrRotAxes( void) const ;
bool GetCurrAxisName( int nInd, std::string& sAxName) const ; bool GetCurrAxisName( int nInd, std::string& sAxName) const ;
bool GetAllCurrAxesNames( STRVECTOR& vAxName) const ; bool GetAllCurrAxesName( STRVECTOR& vAxName) const ;
bool GetCurrAxisToken( int nInd, std::string& sAxToken) const ; bool GetCurrAxisToken( int nInd, std::string& sAxToken) const ;
bool GetAllCurrAxesTokens( STRVECTOR& vAxToken) const ; bool GetAllCurrAxesToken( STRVECTOR& vAxToken) const ;
bool GetCurrAxisType( int nInd, bool& bLinear, bool& bHead) 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
{ return m_frLinAx ; } { return m_frLinAx ; }
int GetCurrKinematicChainType( void) const
{ return m_nCalcChainType ; }
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA, bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ; int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ;
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA, bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ; int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
bool GetPositions( const Point3d& ptP, const DBLVECTOR& vAng, bool GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
int& nStat, double& dX, double& dY, double& dZ) const ; int& nStat, double& dX, double& dY, double& dZ) const ;
bool GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
bool GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
Point3d& ptNose) const ; Point3d& ptNose) const ;
bool GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
bool bOverall, bool bBottom, bool bBack, Point3d& ptTip) const ; bool bBottom, bool bOverall, Point3d& ptTip) const ;
bool GetToolDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const ; bool GetToolDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const ;
bool GetAuxDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const ; bool GetAuxDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const ;
bool GetPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ; bool GetPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ;
@@ -182,7 +149,7 @@ class Machine
bool VerifyAngleOutstroke( int nInd, double dAng) const ; bool VerifyAngleOutstroke( int nInd, double dAng) const ;
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const ; bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const ;
bool ExistProtectedAreas( void) const ; bool ExistProtectedAreas( void) const ;
bool VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int nLinkType, int& nStat) ; bool VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat) ;
bool VerifyOutstroke( const std::string& sAxName, double dVal) const ; bool VerifyOutstroke( const std::string& sAxName, double dVal) const ;
std::string GetOutstrokeInfo( bool bMM = true) const ; std::string GetOutstrokeInfo( bool bMM = true) const ;
void ResetOutstrokeInfo( void) const void ResetOutstrokeInfo( void) const
@@ -223,7 +190,7 @@ class Machine
bool AdjustAuxGeometry( const STRVECTOR& vsAux, int nLay) ; bool AdjustAuxGeometry( const STRVECTOR& vsAux, int nLay) ;
bool LoadMachineTable( const std::string& sName, const std::string& sParent, int nType, bool LoadMachineTable( const std::string& sName, const std::string& sParent, int nType,
const Point3d& ptRef1, double dCoeffX, double dCoeffY, double dCoeffZ, const Point3d& ptRef1, double dCoeffX, double dCoeffY, double dCoeffZ,
const STRVECTOR& vsColl, const std::string& sGeo, const STRVECTOR& vsAux) ; const std::string& sGeo, const STRVECTOR& vsAux) ;
bool AdjustTable( int nLay, const Point3d& ptRef1) ; bool AdjustTable( int nLay, const Point3d& ptRef1) ;
bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken, bool bInvert, bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken, bool bInvert,
double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
@@ -239,25 +206,35 @@ class Machine
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 LoadMachineMultiHead( const std::string& sName, const std::string& sParent, const std::string& sHSet, bool LoadMachineMultiHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
int nSelectType, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir, const MUEXITVECTOR& vMuExit, 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 LoadMachineSpecialHead( const std::string& sName, const std::string& sParent, const std::string& sHSet, bool LoadMachineSpecialHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
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 ;
Axis* GetAxis( int nGroup) const ; Axis* GetAxis( int nGroup) const ;
bool IsAxisGroup( int nGroup) const
{ return ( GetAxis( nGroup) != nullptr) ; }
bool IsLinearAxisGroup( int nGroup) const ;
bool IsRotaryAxisGroup( int nGroup) const ;
Table* GetTable( int nGroup) const ; Table* GetTable( int nGroup) const ;
bool IsTableGroup( int nGroup) const
{ return ( GetTable( nGroup) != nullptr) ; }
Head* GetHead( int nGroup) const ; Head* GetHead( int nGroup) const ;
bool IsHeadGroup( int nGroup) const
{ return ( GetHead( nGroup) != nullptr) ; }
TcPos* GetTcPos( int nGroup) const ; TcPos* GetTcPos( int nGroup) const ;
bool IsTcPosGroup( int nGroup) const
{ return ( GetTcPos( nGroup) != nullptr) ; }
Exit* GetExit( int nGroup) const ; Exit* GetExit( int nGroup) const ;
bool IsExitGroup( int nGroup) const
{ return ( GetExit( nGroup) != nullptr) ; }
bool AddHeadToSet( const std::string& sHSet, const std::string& sName) ; bool AddHeadToSet( const std::string& sHSet, const std::string& sName) ;
const STRVECTOR& GetHSet( const std::string& sHead) const ; const STRVECTOR& GetHSet( const std::string& sHead) const ;
bool EnableHeadInSet( const std::string& sHead) ; bool EnableHeadInSet( const std::string& sHead) ;
@@ -266,7 +243,6 @@ class Machine
bool AdjustExitFrames( int nLay, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir) ; bool AdjustExitFrames( int nLay, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir) ;
bool CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit) ; bool CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit) ;
bool ModifyMachineExitPosition( const std::string& sHead, int nExit, const Point3d& ptPos) ; bool ModifyMachineExitPosition( const std::string& sHead, int nExit, const Point3d& ptPos) ;
bool ClearKinematicChain( void) ;
bool CalculateKinematicChain( void) ; bool CalculateKinematicChain( void) ;
bool AddKinematicAxis( bool bOnHead, int nId) ; bool AddKinematicAxis( bool bOnHead, int nId) ;
bool GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA, bool GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
@@ -302,8 +278,6 @@ class Machine
double m_dExitMaxAdjust ; // massimo aggiustamento uscita da geometria a descrizione cinematica double m_dExitMaxAdjust ; // massimo aggiustamento uscita da geometria a descrizione cinematica
double m_dExitMaxRotAdj ; // massima rotazione di aggiustamento uscita da geometria a descrizione cinematica double m_dExitMaxRotAdj ; // massima rotazione di aggiustamento uscita da geometria a descrizione cinematica
double m_dAngDeltaMinForHome ; // minima differenza angolare da valore precedente per scegliere di stare vicino a home double m_dAngDeltaMinForHome ; // minima differenza angolare da valore precedente per scegliere di stare vicino a home
int m_nMultiProcess ; // codice di macchina multi-processo (con stima speciale e simulazione ad hoc)
int m_nNewLinkMgr ; // codice del nuovo gestore link tra lavorazioni (0=vecchio, 1=nuovo)
INTVECTOR m_vLinkedRawParts ; // elenco dei grezzi agganciati a gruppi della macchina INTVECTOR m_vLinkedRawParts ; // elenco dei grezzi agganciati a gruppi della macchina
INTVECTOR m_vLinkedFixtures ; // elenco dei bloccaggi agganciati a gruppi della macchina INTVECTOR m_vLinkedFixtures ; // elenco dei bloccaggi agganciati a gruppi della macchina
INTVECTOR m_vLinkedParts ; // elenco dei pezzi agganciati a gruppi della macchina INTVECTOR m_vLinkedParts ; // elenco dei pezzi agganciati a gruppi della macchina
@@ -331,10 +305,6 @@ class Machine
KINAXISVECTOR m_vCalcLinAx ; // vettore assi lineari attivi per calcoli KINAXISVECTOR m_vCalcLinAx ; // vettore assi lineari attivi per calcoli
KINAXISVECTOR m_vCalcRotAx ; // vettore assi rotanti attivi per calcoli KINAXISVECTOR m_vCalcRotAx ; // vettore assi rotanti attivi per calcoli
Frame3d m_frLinAx ; // sistema di riferimento definito dagli assi lineari Frame3d m_frLinAx ; // sistema di riferimento definito dagli assi lineari
Frame3d m_frRobot ; // sistema di riferimento canonico del robot
int m_nCalcChainType ; // tipologia testa attiva (nulla, centro di lavoro o robot)
Point3d m_ptWristCen ; // centro del polso sferico nel riferimento testa/uscita di calcolo
Vector3d m_vtWristRef ; // direzione del polso sferico nel riferimento testa/uscita di calcolo
mutable OutStroke m_OutstrokeInfo ; // informazioni su ultima extra corsa mutable OutStroke m_OutstrokeInfo ; // informazioni su ultima extra corsa
// stato di visualizzazione // stato di visualizzazione
int m_nMachineLook ; // stato di visualizzazione della macchina int m_nMachineLook ; // stato di visualizzazione della macchina
@@ -353,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) ;
@@ -388,9 +356,8 @@ class Machine
static int LuaEmtOnCollision( lua_State* L) ; static int LuaEmtOnCollision( lua_State* L) ;
static int LuaEmtSetToolForVmill( lua_State* L) ; static int LuaEmtSetToolForVmill( lua_State* L) ;
static int LuaEmtAddToolForVmill( lua_State* L) ; static int LuaEmtAddToolForVmill( lua_State* L) ;
static int LuaEmtEnableToolsForVmill( lua_State* L) ;
static int LuaEmtMoveAxes( lua_State* L) ; static int LuaEmtMoveAxes( lua_State* L) ;
static int LuaEmtSaveCmd( lua_State* L) ;
} ; } ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
+17 -125
View File
@@ -19,54 +19,9 @@
#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 ;
//----------------------------------------------------------------------------
bool
Machine::GetAllAxesIds( INTVECTOR& vIds) const
{
// reset lista identificativi
vIds.clear() ;
// ricerca degli assi
for ( const auto& snGro : m_mapGroups) {
if ( IsAxisGroup( snGro.second))
vIds.push_back( snGro.second) ;
}
// se richiesto, ordino alfabeticamente
sort( vIds.begin(), vIds.end()) ;
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetAllAxesNames( STRVECTOR& vNames) const
{
// reset lista nomi
vNames.clear() ;
// ricerca degli assi
for ( const auto& snGro : m_mapGroups) {
if ( IsAxisGroup( snGro.second))
vNames.push_back( snGro.first) ;
}
// se richiesto, ordino alfabeticamente
sort( vNames.begin(), vNames.end()) ;
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetAxisName( int nAxId, string& sName) const
{
// recupero il relativo gestore
const Axis* pAx = GetAxis( nAxId) ;
if ( pAx == nullptr)
return false ;
// recupero il token dell'asse
sName = pAx->GetName() ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::GetAxisToken( const string& sAxis, string& sToken) const Machine::GetAxisToken( const string& sAxis, string& sToken) const
@@ -75,7 +30,7 @@ Machine::GetAxisToken( const string& sAxis, string& sToken) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il relativo gestore // recupero il relativo gestore
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero il token dell'asse // recupero il token dell'asse
@@ -91,7 +46,7 @@ Machine::GetAxisInvert( const string& sAxis, bool& bInvert) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il relativo gestore // recupero il relativo gestore
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero il flag di inversione dell'asse in visualizzazione // recupero il flag di inversione dell'asse in visualizzazione
@@ -107,7 +62,7 @@ Machine::GetAxisOffset( const string& sAxis, double& dOffset) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il relativo gestore // recupero il relativo gestore
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero il valore di offset dell'asse in visualizzazione // recupero il valore di offset dell'asse in visualizzazione
@@ -123,7 +78,7 @@ Machine::GetAxisType( const string& sAxis, bool& bLinear) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il relativo gestore // recupero il relativo gestore
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero il tipo dell'asse // recupero il tipo dell'asse
@@ -133,23 +88,7 @@ Machine::GetAxisType( const string& sAxis, bool& bLinear) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::GetAxisDir( const string& sAxis, Vector3d& vtDir) const Machine::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero il relativo gestore
const Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr)
return false ;
// recupero la direzione dell'asse
vtDir = pAx->GetDir() ;
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* pdNewVal)
{ {
// controllo GeomDB // controllo GeomDB
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
@@ -166,15 +105,6 @@ Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* p
double dCurrVal = pAx->GetCurrVal() ; double dCurrVal = pAx->GetCurrVal() ;
// limiti della corsa // limiti della corsa
STROKE Stroke = pAx->GetStroke() ; STROKE Stroke = pAx->GetStroke() ;
// se rotante e corrente, verifico se ci sono limitazioni aggiuntive (dalla testa)
if ( ! bLinear) {
for ( const auto& CalcRotAx : m_vCalcRotAx) {
if ( CalcRotAx.nGrpId == nAxGrp) {
Stroke.Min = max( Stroke.Min, CalcRotAx.stroke.Min) ;
Stroke.Max = min( Stroke.Max, CalcRotAx.stroke.Max) ;
}
}
}
// recupero il vettore dell'asse // recupero il vettore dell'asse
int nV = m_pGeomDB->GetFirstNameInGroup( nAxGrp, sAxis) ; int nV = m_pGeomDB->GetFirstNameInGroup( nAxGrp, sAxis) ;
const IGeoVector3d* pGV = GetGeoVector3d( m_pGeomDB->GetGeoObj( nV)) ; const IGeoVector3d* pGV = GetGeoVector3d( m_pGeomDB->GetGeoObj( nV)) ;
@@ -183,9 +113,11 @@ Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* p
Point3d ptPos = pGV->GetBase() ; Point3d ptPos = pGV->GetBase() ;
Vector3d vtDir = pGV->GetVector() ; Vector3d vtDir = pGV->GetVector() ;
vtDir.Normalize() ; vtDir.Normalize() ;
// se richiesto, limito il movimento alla corsa dell'asse // limito il movimento alla corsa dell'asse
if ( bInStroke) if ( dVal > Stroke.Max)
dVal = Clamp( dVal, Stroke.Min, 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)) ;
@@ -206,7 +138,7 @@ Machine::GetAxisPos( const string& sAxis, double& dVal) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il relativo gestore // recupero il relativo gestore
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero la posizione corrente // recupero la posizione corrente
@@ -222,7 +154,7 @@ Machine::GetAxisMin( const string& sAxis, double& dMin) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il gestore dell'asse // recupero il gestore dell'asse
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero il minimo // recupero il minimo
@@ -238,7 +170,7 @@ Machine::GetAxisMax( const string& sAxis, double& dMax) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il gestore dell'asse // recupero il gestore dell'asse
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero il massimo // recupero il massimo
@@ -254,7 +186,7 @@ Machine::GetAxisHomePos( const string& sAxis, double& dHomeVal) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il gestore dell'asse // recupero il gestore dell'asse
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero la posizione home // recupero la posizione home
@@ -262,42 +194,6 @@ Machine::GetAxisHomePos( const string& sAxis, double& dHomeVal) const
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
Machine::IsDispositionAxis( int nAxisId, int nTableId) const
{
// se direttamente dipendente dalla tavola
int nParentId = m_pGeomDB->GetParentId( nAxisId) ;
if ( ( nTableId != GDB_ID_NULL && nParentId == nTableId) || IsTableGroup( nParentId))
return true ;
// altrimenti deve dipendere da asse dipendente dalla tavola
if ( ! IsAxisGroup( nParentId))
return false ;
int nGrParId = m_pGeomDB->GetParentId( nParentId) ;
return ( ( nTableId != GDB_ID_NULL && nGrParId == nTableId) || IsTableGroup( nGrParId)) ;
}
//----------------------------------------------------------------------------
bool
Machine::IsDispositionAxis( const string& sAxis, const string& sTable) const
{
if ( m_pGeomDB == nullptr)
return false ;
// recupero Id asse
int nAxId = GetAxisId( sAxis) ;
if ( nAxId == GDB_ID_NULL)
return false ;
// recupero eventuale Id tavola
int nTabId = GDB_ID_NULL ;
if ( ! sTable.empty()) {
nTabId = GetTableId( sTable) ;
if ( nTabId == GDB_ID_NULL)
return false ;
}
// eseguo
return IsDispositionAxis( nAxId, nTabId) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::ResetAxisPos( const string& sAxis) Machine::ResetAxisPos( const string& sAxis)
@@ -315,17 +211,13 @@ Machine::ResetAxisPos( const string& sAxis)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::ResetAllAxesPos( bool bStdAxes, bool bDispAxes) Machine::ResetAllAxesPos( void)
{ {
// ciclo sui gruppi della macchina // ciclo sui gruppi della macchina
for ( auto Iter = m_mapGroups.cbegin() ; Iter != m_mapGroups.cend() ; ++ Iter) { for ( auto Iter = m_mapGroups.cbegin() ; Iter != m_mapGroups.cend() ; ++ Iter) {
if ( IsAxisGroup( Iter->second)) { if ( IsAxisGroup( Iter->second)) {
if ( ( bStdAxes && bDispAxes) || if ( ! ResetAxisPos( Iter->first))
( bStdAxes && ! IsDispositionAxis( Iter->first)) || return false ;
( bDispAxes && IsDispositionAxis( Iter->first))) {
if ( ! ResetAxisPos( Iter->first))
return false ;
}
} }
} }
return true ; return true ;
+71 -447
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
@@ -48,7 +45,6 @@ static const string EVAR_R1 = ".R1" ; // (num) valore del pri
static const string EVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante static const string EVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante
static const string EVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante static const string EVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante
static const string EVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante static const string EVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante
static const string EVAR_LINKTYPE = ".LINKTYPE" ; // (int) tipo collegamento (0=No, 1=Inizio, 2=Fine, 3=Link))
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok) static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string EVAR_STAT = ".STAT" ; // OUT (int) codice di stato ( 0 = ok) static const string EVAR_STAT = ".STAT" ; // OUT (int) codice di stato ( 0 = ok)
static const string EVAR_AUXINFO = ".AUXINFO" ; // OUT (string) stringa con info ausiliarie static const string EVAR_AUXINFO = ".AUXINFO" ; // OUT (string) stringa con info ausiliarie
@@ -72,15 +68,12 @@ Machine::SetCurrTable( const string& sTable)
m_nCalcTabId = GDB_ID_NULL ; m_nCalcTabId = GDB_ID_NULL ;
return false ; return false ;
} }
// il gruppo tavola corrente deve essere sempre visibile
m_pGeomDB->SetStatus( m_nCalcTabId, GDB_ST_ON) ;
// lancio eventuale funzione lua di personalizzazione // lancio eventuale funzione lua di personalizzazione
if ( LuaExistsFunction( ON_SET_TABLE)) { if ( LuaExistsFunction( ON_SET_TABLE)) {
// salvo eventuale variabile EMC_VAR già presente // salvo eventuale variabile EMC_VAR già presente
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) ;
@@ -174,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
@@ -205,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
@@ -215,31 +201,6 @@ Machine::GetCurrTableIsTilting( bool& bTilting, Vector3d& vtTiltingAx) const
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
Machine::GetCurrTableCollGroups( INTVECTOR& vIds) const
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero la tavola corrente
Table* pTab = GetTable( m_nCalcTabId) ;
if ( pTab == nullptr)
return false ;
// recupero stringhe con gruppi ausiliari di collisione
const STRVECTOR& vsColl = pTab->GetCollGroups() ;
for ( const auto& sColl : vsColl) {
string sGrp, sSub ;
Split( sColl, "/", true, sGrp, sSub) ;
int nId = GetGroup( sGrp) ;
if ( ! sSub.empty() && nId != GDB_ID_NULL)
nId = m_pGeomDB->GetFirstNameInGroup( nId, sSub) ;
if ( nId != GDB_ID_NULL)
vIds.push_back( nId) ;
}
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit) Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
@@ -277,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()) {
@@ -296,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))
@@ -337,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) ;
@@ -345,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) ;
@@ -481,20 +438,11 @@ Machine::GetCurrHeadCollGroups( INTVECTOR& vIds) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::IsCurrToolFloating( void) const Machine::CalculateKinematicChain( void)
{ {
// controllo GeomDB // controllo GeomDB
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// leggo info con tipo
string sType ;
return ( m_pGeomDB->GetInfo( m_nCalcToolId, TTH_TYPE, sType) && sType == TTH_TYPE_FLOAT) ;
}
//----------------------------------------------------------------------------
bool
Machine::ClearKinematicChain( void)
{
// azzero tutti gli assi della catena cinematica // azzero tutti gli assi della catena cinematica
m_nTabLinAxes = 0 ; m_nTabLinAxes = 0 ;
m_nTabRotAxes = 0 ; m_nTabRotAxes = 0 ;
@@ -503,27 +451,14 @@ Machine::ClearKinematicChain( void)
m_nHeadSpecRotAxis = -1 ; m_nHeadSpecRotAxis = -1 ;
m_vCalcLinAx.clear() ; m_vCalcLinAx.clear() ;
m_vCalcRotAx.clear() ; m_vCalcRotAx.clear() ;
m_frLinAx.Reset( false) ;
m_frRobot.Reset( false) ;
m_nCalcChainType = KIN_CHAIN_NONE ;
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::CalculateKinematicChain( void)
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// azzero tutti gli assi della catena cinematica
ClearKinematicChain() ;
// recupero gli assi di tavola // recupero gli assi di tavola
if ( m_nCalcTabId == GDB_ID_NULL) if ( m_nCalcTabId == GDB_ID_NULL)
return false ; return false ;
int nTParId = m_pGeomDB->GetParentId( m_nCalcTabId) ; int nTParId = m_pGeomDB->GetParentId( m_nCalcTabId) ;
if ( nTParId == GDB_ID_NULL) if ( nTParId == GDB_ID_NULL)
return false ; return false ;
m_nTabLinAxes = 0 ;
m_nTabRotAxes = 0 ;
while ( IsAxisGroup( nTParId)) { while ( IsAxisGroup( nTParId)) {
if ( ! AddKinematicAxis( false, nTParId)) if ( ! AddKinematicAxis( false, nTParId))
return false ; return false ;
@@ -535,75 +470,14 @@ Machine::CalculateKinematicChain( void)
int nHParId = m_pGeomDB->GetParentId( m_nCalcHeadId) ; int nHParId = m_pGeomDB->GetParentId( m_nCalcHeadId) ;
if ( nHParId == GDB_ID_NULL) if ( nHParId == GDB_ID_NULL)
return false ; return false ;
m_nHeadLinAxes = 0 ;
m_nHeadRotAxes = 0 ;
while ( IsAxisGroup( nHParId)) { while ( IsAxisGroup( nHParId)) {
if ( ! AddKinematicAxis( true, nHParId)) if ( ! AddKinematicAxis( true, nHParId))
return false ; return false ;
nHParId = m_pGeomDB->GetParentId( nHParId) ; nHParId = m_pGeomDB->GetParentId( nHParId) ;
} }
// se non ci sono assi, né lineari né rotanti, sicuramente errore
if ( m_nTabLinAxes == 0 && m_nHeadLinAxes == 0 &&
m_nTabRotAxes == 0 && m_nHeadRotAxes == 0) {
LOG_ERROR( GetEMkLogger(), "Errors in Axes : none have been found")
return false ;
}
// se nessun asse lineare deve essere un robot (in futuro va permesso un lineare di tavola)
if ( m_nTabLinAxes == 0 && m_nHeadLinAxes == 0) {
// verifico ci siano 6 assi rotanti tutti di testa (in futuro va permesso un rotante di tavola)
if ( m_nTabRotAxes != 0 || m_nHeadRotAxes != 6) {
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : number or type")
return false ;
}
// riordino gli assi rotanti
swap( m_vCalcRotAx[0], m_vCalcRotAx[5]) ;
swap( m_vCalcRotAx[1], m_vCalcRotAx[4]) ;
swap( m_vCalcRotAx[2], m_vCalcRotAx[3]) ;
// determino il riferimento canonico del robot
if ( ! m_frRobot.Set( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, m_vCalcRotAx[3].vtDir)) {
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : impossible canonic frame")
return false ;
}
// porto tutti gli assi cinematici e i dati testa nel riferimento canonico
for ( int i = 0 ; i < m_nHeadRotAxes ; ++ i) {
m_vCalcRotAx[i].ptPos.ToLoc( m_frRobot) ;
m_vCalcRotAx[i].vtDir.ToLoc( m_frRobot) ;
}
m_ptCalcPos.ToLoc( m_frRobot) ;
m_vtCalcDir.ToLoc( m_frRobot) ;
m_vtCalcADir.ToLoc( m_frRobot) ;
// direzione assi rotanti deve essere Z Y Y X Y X
if ( ! m_vCalcRotAx[0].vtDir.IsZ() ||
! m_vCalcRotAx[1].vtDir.IsY() ||
! m_vCalcRotAx[2].vtDir.IsY() ||
! m_vCalcRotAx[3].vtDir.IsX() ||
! m_vCalcRotAx[4].vtDir.IsY() ||
! m_vCalcRotAx[5].vtDir.IsX()) {
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not ZYY-XYX")
return false ;
}
// verifico che gli ultimi 3 assi formino un polso sferico (ovvero passino per uno stesso punto)
if ( abs( m_vCalcRotAx[3].ptPos.y - m_vCalcRotAx[5].ptPos.y) > EPS_SMALL ||
abs( m_vCalcRotAx[3].ptPos.z - m_vCalcRotAx[5].ptPos.z) > EPS_SMALL ||
abs( m_vCalcRotAx[4].ptPos.z - m_vCalcRotAx[3].ptPos.z) > EPS_SMALL) {
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not spherical Wrist")
return false ;
}
// calcolo il centro del polso in coordinate globali (R5.x, R6.y, R5.z)
Point3d ptCenG( m_vCalcRotAx[4].ptPos.x, m_vCalcRotAx[5].ptPos.y, m_vCalcRotAx[4].ptPos.z) ;
// recupero il riferimento dell'uscita (da posizione, direzione utensile e direzione ausiliaria)
Frame3d frExit ;
if ( ! frExit.Set( m_ptCalcPos, m_vtCalcDir, m_vtCalcADir))
return false ;
// calcolo il centro del polso in locale a questo riferimento
m_ptWristCen = GetToLoc( ptCenG, frExit) ;
// calcolo la direzione di riferimento del polso in locale a questo riferimento
m_vtWristRef = GetToLoc( m_vCalcRotAx[5].vtDir, frExit) ;
// dichiaro tipo robot
m_nCalcChainType = KIN_CHAIN_ROBOT ;
return true ;
}
// verifiche sugli assi lineari : // verifiche sugli assi lineari :
// aggiusto gli indici di ordine sulla sua catena cinematica (1-based) // aggiusto gli indici di ordine sulla sua catena cinematica (1-based)
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) { for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
@@ -613,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())
@@ -642,6 +514,7 @@ Machine::CalculateKinematicChain( void)
} }
// verifiche sugli assi rotanti : // verifiche sugli assi rotanti :
bool bOk = false ;
// aggiusto gli indici di ordine sulla sua catena cinematica (1-based) // aggiusto gli indici di ordine sulla sua catena cinematica (1-based)
for ( int i = 0 ; i < int( m_vCalcRotAx.size()) ; ++ i) { for ( int i = 0 ; i < int( m_vCalcRotAx.size()) ; ++ i) {
if ( m_vCalcRotAx[i].bHead) if ( m_vCalcRotAx[i].bHead)
@@ -651,7 +524,7 @@ Machine::CalculateKinematicChain( void)
} }
// se 0 o 1 va bene // se 0 o 1 va bene
if ( m_vCalcRotAx.size() <= 1) if ( m_vCalcRotAx.size() <= 1)
; bOk = true ;
// se 2 va bene // se 2 va bene
else if ( m_vCalcRotAx.size() == 2) { else if ( m_vCalcRotAx.size() == 2) {
// se entrambi di testa devo invertirne l'ordine // se entrambi di testa devo invertirne l'ordine
@@ -665,6 +538,7 @@ Machine::CalculateKinematicChain( void)
m_vCalcRotAx[1].stroke.Max = min( m_vCalcRotAx[1].stroke.Max, pHead->GetRot2Stroke().Max) ; m_vCalcRotAx[1].stroke.Max = min( m_vCalcRotAx[1].stroke.Max, pHead->GetRot2Stroke().Max) ;
} }
} }
bOk = true ;
} }
// se 3 va bene ( uno dovrà poi avere valore assegnato) // se 3 va bene ( uno dovrà poi avere valore assegnato)
else if ( m_vCalcRotAx.size() == 3) { else if ( m_vCalcRotAx.size() == 3) {
@@ -687,13 +561,10 @@ Machine::CalculateKinematicChain( void)
m_vCalcRotAx[n2ndHeadRotAx].stroke.Max = min( m_vCalcRotAx[n2ndHeadRotAx].stroke.Max, pHead->GetRot2Stroke().Max) ; m_vCalcRotAx[n2ndHeadRotAx].stroke.Max = min( m_vCalcRotAx[n2ndHeadRotAx].stroke.Max, pHead->GetRot2Stroke().Max) ;
} }
} }
bOk = true ;
} }
// se più di 3 if ( ! bOk)
else {
// altrimenti non ancora gestito, quindi errore
LOG_ERROR( GetEMkLogger(), "Rotary Axes not manageable")
return false ; return false ;
}
// verifico esistenza eventuale asse rotante speciale di testa // verifico esistenza eventuale asse rotante speciale di testa
if ( m_nHeadRotAxes > 0 && m_nHeadLinAxes > 0) { if ( m_nHeadRotAxes > 0 && m_nHeadLinAxes > 0) {
// indice di posizione primo asse di testa // indice di posizione primo asse di testa
@@ -729,9 +600,11 @@ Machine::CalculateKinematicChain( void)
} }
} }
} }
// dichiaro tipo centro di lavoro
m_nCalcChainType = KIN_CHAIN_CENTER ;
return true ; return true ;
// altrimenti non ancora gestito, quindi errore
LOG_ERROR( GetEMkLogger(), "Rotary Axes not manageable")
return false ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -1078,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)) {
@@ -1129,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
@@ -1152,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
@@ -1197,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
@@ -1303,10 +1176,6 @@ Machine::GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& v
vtNew.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ; vtNew.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
} }
// nel caso di robot devo passare dal riferimento canonico robot a quello di macchina
if ( m_nCalcChainType == KIN_CHAIN_ROBOT)
vtNew.ToGlob( m_frRobot) ;
return true ; return true ;
} }
@@ -1344,46 +1213,26 @@ Machine::GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
// la posizione deve essere espressa rispetto allo ZERO MACCHINA // la posizione deve essere espressa rispetto allo ZERO MACCHINA
// è espressa nel riferimento di macchina (tiene conto delle sole traslazioni e rotazioni di testa) // è espressa nel riferimento di macchina (tiene conto delle sole traslazioni e rotazioni di testa)
// verifico dimensione vettore angoli rispetto al numero di assi rotanti // aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa
if ( vAng.size() < m_vCalcRotAx.size()) ptNose = m_ptCalcPos ;
return false ; for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
// se asse di testa non speciale
// se centro di lavoro if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
if ( m_nCalcChainType == KIN_CHAIN_CENTER) { ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
// aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa
ptNose = m_ptCalcPos ;
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
// se asse di testa non speciale
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
// aggiorno posizione testa con assi lineari di testa
DBLVECTOR vMov( {dX, dY, dZ}) ;
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
if ( m_vCalcLinAx[i].bHead)
ptNose += m_vCalcLinAx[i].vtDir * vMov[i] ;
}
// eseguo rotazione eventuale asse rotante speciale di testa
if ( m_nHeadSpecRotAxis != -1) {
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
return false ;
int i = m_nHeadSpecRotAxis ;
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
} }
// se robot // aggiorno posizione testa con assi lineari di testa
else if ( m_nCalcChainType == KIN_CHAIN_ROBOT) { DBLVECTOR vMov( {dX, dY, dZ}) ;
// aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
ptNose = m_ptCalcPos ; if ( m_vCalcLinAx[i].bHead)
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) { ptNose += m_vCalcLinAx[i].vtDir * vMov[i] ;
// se asse di testa }
if ( m_vCalcRotAx[i].bHead) // eseguo rotazione eventuale asse rotante speciale di testa
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ; if ( m_nHeadSpecRotAxis != -1) {
} if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
return false ;
int i = m_nHeadSpecRotAxis ;
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
} }
// altrimenti errore
else
return false ;
return true ; return true ;
} }
@@ -1391,84 +1240,38 @@ Machine::GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng, Machine::GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
bool bOverall, bool bBottom, bool bBack, Point3d& ptTip) const bool bOverall, bool bBottom, Point3d& ptTip) const
{ {
// la posizione deve essere espressa rispetto allo ZERO MACCHINA // la posizione deve essere espressa rispetto allo ZERO MACCHINA
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di testa) // è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di testa)
// se bBack vero, allora è nel riferimento pezzo
// verifico dimensione vettore angoli rispetto al numero di assi rotanti // aggiorno posizione tip utensile a riposo mediante ciclo inverso sugli assi rotanti di testa
if ( vAng.size() < m_vCalcRotAx.size()) ptTip = m_ptCalcPos - m_vtCalcDir * m_dCalcTLen ;
return false ; for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
// se asse di testa non speciale
// se centro di lavoro if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
if ( m_nCalcChainType == KIN_CHAIN_CENTER) { ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
// aggiorno posizione tip utensile a riposo mediante ciclo inverso sugli assi rotanti di testa
ptTip = m_ptCalcPos - m_vtCalcDir * m_dCalcTLen ;
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
// se asse di testa non speciale
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
// aggiorno posizione tip utensile con assi lineari di testa
DBLVECTOR vMov( {dX, dY, dZ}) ;
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
if ( m_vCalcLinAx[i].bHead)
ptTip += m_vCalcLinAx[i].vtDir * vMov[i] ;
}
// eseguo rotazione eventuale asse rotante speciale di testa
if ( m_nHeadSpecRotAxis != -1) {
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
return false ;
int i = m_nHeadSpecRotAxis ;
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
} }
// se robot // aggiorno posizione tip utensile con assi lineari di testa
else if ( m_nCalcChainType == KIN_CHAIN_ROBOT) { DBLVECTOR vMov( {dX, dY, dZ}) ;
// aggiorno posizione tip utensile a riposo mediante ciclo inverso sugli assi rotanti di testa for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
ptTip = m_ptCalcPos - m_vtCalcDir * m_dCalcTLen ; if ( m_vCalcLinAx[i].bHead)
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) { ptTip += m_vCalcLinAx[i].vtDir * vMov[i] ;
// se asse di testa
if ( m_vCalcRotAx[i].bHead)
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
} }
// altrimenti errore // eseguo rotazione eventuale asse rotante speciale di testa
else if ( m_nHeadSpecRotAxis != -1) {
return false ; if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
return false ;
// nel caso di robot devo passare dal riferimento canonico robot a quello di macchina int i = m_nHeadSpecRotAxis ;
if ( m_nCalcChainType == KIN_CHAIN_ROBOT) ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
ptTip.ToGlob( m_frRobot) ;
// Se richiesto nel riferimento pezzo
if ( bBack) {
// ciclo sugli assi lineari di tavola all'indietro
DBLVECTOR vMov( {dX, dY, dZ}) ;
for ( int i = int( m_vCalcLinAx.size()) ; i > 0 ; -- i) {
if ( ! m_vCalcLinAx[i-1].bHead)
ptTip += m_vCalcLinAx[i-1].vtDir * ( vMov[i-1] - m_vCalcLinAx[i-1].dHomeVal) ;
}
// ciclo sugli assi rotanti di tavola all'indietro !!! NON VERIFICATO !!!
for ( int i = int( m_vCalcRotAx.size()) ; i > 0 ; -- i) {
if ( ! m_vCalcRotAx[i-1].bHead)
ptTip.Rotate( m_vCalcRotAx[i-1].ptPos, m_vCalcRotAx[i-1].vtDir, -vAng[i-1]) ;
}
} }
// Se richiesto ingombro totale o punto sotto del tip utensile // Se richiesto ingombro totale o punto sotto del tip utensile
if ( bOverall || bBottom) { if ( bOverall || bBottom) {
// calcolo la direzione fresa // calcolo la direzione fresa
Vector3d vtDirT ; Vector3d vtDirT ;
if ( bBack) { if ( ! GetDirection( m_vtCalcDir, vAng, vtDirT))
if ( ! GetBackDirection( m_vtCalcDir, vAng, vtDirT)) return false ;
return false ;
}
else {
if ( ! GetDirection( m_vtCalcDir, vAng, vtDirT))
return false ;
}
// se richiesto ingombro totale // se richiesto ingombro totale
if ( bOverall) if ( bOverall)
ptTip -= vtDirT * max( m_dCalcTOvLen - m_dCalcTLen, 0.) ; ptTip -= vtDirT * max( m_dCalcTOvLen - m_dCalcTLen, 0.) ;
@@ -1671,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 ;
} }
@@ -1740,7 +1546,7 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng
} }
// verifica delle aree protette // verifica delle aree protette
if ( nStat == 0) if ( nStat == 0)
return const_cast<Machine*>( this)->VerifyProtectedAreas( dX, dY, dZ, vAng, 0, nStat) ; return const_cast<Machine*>( this)->VerifyProtectedAreas( dX, dY, dZ, vAng, nStat) ;
return true ; return true ;
} }
@@ -1754,26 +1560,18 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int nLinkType, int& nStat) Machine::VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat)
{ {
// se non esiste funzione gestione aree protette, non devo fare alcunchè // se non esiste funzione gestione aree protette, non devo fare alcunchè
if ( ! LuaExistsFunction( ON_VERIFY_PROTECTEDAREAS)) if ( ! LuaExistsFunction( ON_VERIFY_PROTECTEDAREAS))
return true ; return true ;
// se non è collegamento e aree protette solo per questi, non devo fare alcunchè
if ( nLinkType == 0 && m_nNewLinkMgr == 1)
return true ;
// default // default
bool bOk = true ; bool bOk = true ;
int nErr = 99 ; int nErr = 99 ;
// salvo eventuale variabile EMC_VAR già presente // salvo eventuale variabile EMC_VAR già presente
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ; bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
// definisco variabili (nelle disposizioni l'utensile non è definito e non ha nome) // definisco variabili
string sTool, sHead ; int nExit ;
bOk = bOk && LuaCreateGlobTable( EMC_VAR) ; bOk = bOk && LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
bOk = bOk && GetCurrHead( sHead) && LuaSetGlobVar( EMC_VAR + EVAR_HEAD, sHead) ;
bOk = bOk && GetCurrExit( nExit) && LuaSetGlobVar( EMC_VAR + EVAR_EXIT, nExit) ;
bOk = bOk && ( GetCurrTool( sTool) || true) && LuaSetGlobVar( EMC_VAR + EVAR_TOOL, sTool) ;
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) ;
@@ -1785,7 +1583,6 @@ Machine::VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR&
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_R3, vAng[2]) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_R3, vAng[2]) ;
if ( vAng.size() >= 4) if ( vAng.size() >= 4)
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_R4, vAng[3]) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_R4, vAng[3]) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_LINKTYPE, nLinkType) ;
// chiamo funzione // chiamo funzione
bOk = bOk && LuaCallFunction( ON_VERIFY_PROTECTEDAREAS) ; bOk = bOk && LuaCallFunction( ON_VERIFY_PROTECTEDAREAS) ;
// recupero il risultato // recupero il risultato
@@ -1905,7 +1702,7 @@ Machine::GetCurrAxisName( int nInd, string& sAxName) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::GetAllCurrAxesNames( STRVECTOR& vAxName) const Machine::GetAllCurrAxesName( STRVECTOR& vAxName) const
{ {
vAxName.clear() ; vAxName.clear() ;
bool bOk = true ; bool bOk = true ;
@@ -1954,7 +1751,7 @@ Machine::GetCurrAxisToken( int nInd, string& sAxToken) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::GetAllCurrAxesTokens( STRVECTOR& vAxToken) const Machine::GetAllCurrAxesToken( STRVECTOR& vAxToken) const
{ {
vAxToken.clear() ; vAxToken.clear() ;
bool bOk = true ; bool bOk = true ;
@@ -1977,25 +1774,6 @@ Machine::GetAllCurrAxesTokens( STRVECTOR& vAxToken) const
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
bool
Machine::GetCurrAxisType( int nInd, bool& bLinear, bool& bHead) const
{
int nLinAxes = int( m_vCalcLinAx.size()) ;
int nRotAxes = int( m_vCalcRotAx.size()) ;
if ( nInd >= 0 && nInd < nLinAxes) {
bLinear = true ;
bHead = m_vCalcLinAx[nInd].bHead ;
return true ;
}
else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) {
bLinear = false ;
bHead = m_vCalcRotAx[nInd-nLinAxes].bHead ;
return true ;
}
return false ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::GetCurrAxisMin( int nInd, double& dMin) const Machine::GetCurrAxisMin( int nInd, double& dMin) const
@@ -2042,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
@@ -2135,111 +1867,3 @@ Machine::GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const
} }
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
bool
Machine::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const
{
// pulisco il risultato
vAng1.clear() ;
vAng2.clear() ;
// porto i dati nel riferimento robot
Point3d ptPL = GetToLoc( ptP, m_frRobot) ;
Vector3d vtDirTL = GetToLoc( vtDirT, m_frRobot) ;
Vector3d vtDirAL = GetToLoc( vtDirA, m_frRobot) ;
// riferimento utensile
Frame3d frTool ;
frTool.Set( ORIG, vtDirTL, vtDirAL) ;
// deduco la posizione richiesta del centro del polso
Point3d ptCen = ptPL + m_ptWristCen.x * frTool.VersX() +
m_ptWristCen.y * frTool.VersY() +
( m_dCalcTLen + m_ptWristCen.z) * frTool.VersZ() ;
// deduco la direzione richiesta del centro del polso
Vector3d vtCen = m_vtWristRef.x * frTool.VersX() +
m_vtWristRef.y * frTool.VersY() +
m_vtWristRef.z * frTool.VersZ() ;
// calcolo il primo asse rotante
Vector3d vtArm = ptCen - m_vCalcRotAx[0].ptPos ;
double dAng1 ; bool bDet1 ;
if ( ! X_AX.GetRotation( vtArm, m_vCalcRotAx[0].vtDir, EPS_SMALL, dAng1, bDet1) || ! bDet1) {
LOG_ERROR( GetEMkLogger(), "Error : direction unreachable (robot)")
return false ;
}
vAng1.push_back( dAng1) ;
vAng2.push_back( dAng1) ;
// calcolo secondo e terzo asse rotante
Point3d ptR2 = m_vCalcRotAx[1].ptPos ;
ptR2.Rotate( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, dAng1) ;
Vector3d vtR2 = m_vCalcRotAx[1].vtDir ;
vtR2.Rotate( m_vCalcRotAx[0].vtDir, dAng1) ;
Vector3d vtR2Cen = ptCen - ( ptR2 + ( ptCen - ptR2) * vtR2 * vtR2) ;
double dDistR2Cen = vtR2Cen.Len() ;
double dDistR2R3 = m_vCalcRotAx[2].ptPos.z - m_vCalcRotAx[1].ptPos.z ;
Vector3d vtR3R5 = m_vCalcRotAx[4].ptPos - m_vCalcRotAx[2].ptPos ; vtR3R5.y = 0 ;
double dDistR3R5 = vtR3R5.Len() ;
double dAngR3R5 = atan2( vtR3R5.z, vtR3R5.x) * RADTODEG ;
double dCosB = ( dDistR2R3 * dDistR2R3 + dDistR2Cen * dDistR2Cen - dDistR3R5 * dDistR3R5) / ( 2 * dDistR2R3 * dDistR2Cen) ;
double dCosC = ( dDistR3R5 * dDistR3R5 + dDistR2Cen * dDistR2Cen - dDistR2R3 * dDistR2R3) / ( 2 * dDistR3R5 * dDistR2Cen) ;
if ( abs( dCosB) > 1 || abs( dCosC) > 1) {
LOG_ERROR( GetEMkLogger(), "Error : position unreachable (robot)")
return false ;
}
double dAngB = acos( dCosB) * RADTODEG ;
double dAng2 ; bool bDet2 ;
if ( ! Z_AX.GetRotation( vtR2Cen, vtR2, EPS_SMALL, dAng2, bDet2) || ! bDet2) {
LOG_ERROR( GetEMkLogger(), "Error : R2 not calculable (robot)")
return false ;
}
dAng2 -= dAngB ;
vAng1.push_back( dAng2) ;
vAng2.push_back( dAng2) ;
double dAngC = acos( dCosC) * RADTODEG ;
double dAng3 = dAngB + dAngC + dAngR3R5 - ANG_RIGHT ;
vAng1.push_back( dAng3) ;
vAng2.push_back( dAng3) ;
// calcolo i primi due assi rotanti del polso
Frame3d frWrist ;
frWrist.Set( m_vCalcRotAx[3].ptPos, m_vCalcRotAx[3].vtDir, m_vCalcRotAx[4].vtDir ^ m_vCalcRotAx[3].vtDir) ;
frWrist.Rotate( m_vCalcRotAx[2].ptPos, m_vCalcRotAx[2].vtDir, dAng3) ;
frWrist.Rotate( m_vCalcRotAx[1].ptPos, m_vCalcRotAx[1].vtDir, dAng2) ;
frWrist.Rotate( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, dAng1) ;
Vector3d vtCenL = GetToLoc( vtCen, frWrist) ;
double dAng4, dAng5 ;
vtCenL.ToSpherical( nullptr, &dAng5, &dAng4) ;
if ( dAng4 > ANG_STRAIGHT)
dAng4 -= ANG_FULL ;
if ( dAng4 > ANG_RIGHT) {
dAng4 -= ANG_STRAIGHT ;
dAng5 = -dAng5 ;
}
else if ( dAng4 < -ANG_RIGHT) {
dAng4 += ANG_STRAIGHT ;
dAng5 = -dAng5 ;
}
vAng1.push_back( dAng4) ;
vAng1.push_back( dAng5) ;
vAng2.push_back( dAng4 + ( dAng4 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT)) ;
vAng2.push_back( -dAng5) ;
// calcolo il terzo asse rotante del polso
Vector3d vtR6 = m_vCalcRotAx[5].vtDir ;
for ( int i = 4; i >= 0 ; --i)
vtR6.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
Vector3d vtTool = m_vtCalcDir ;
for ( int i = 4; i >= 0 ; --i)
vtTool.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
double dAng6 ; bool bDet6 ;
if ( ! vtTool.GetRotation( vtDirTL, vtR6, EPS_SMALL, dAng6, bDet6) || ! bDet6) {
Vector3d vtAux = m_vtCalcADir ;
for ( int i = 4; i >= 0 ; --i)
vtAux.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
if ( ! vtAux.GetRotation( vtDirAL, vtR6, EPS_SMALL, dAng6, bDet6) || ! bDet6) {
LOG_ERROR( GetEMkLogger(), "Error : R6 not calculable (robot)")
return false ;
}
}
vAng1.push_back( dAng6) ;
vAng2.push_back( dAng6 + ( dAng6 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT)) ;
return true ;
}
+1 -15
View File
@@ -98,18 +98,6 @@ Machine::GetHeadSolCh( const string& sHead) const
return pHead->GetSolCh() ; return pHead->GetSolCh() ;
} }
//----------------------------------------------------------------------------
int
Machine::GetHeadSelectType( const string& sHead) const
{
// recupero testa
Head* pHead = GetHead( GetGroup( sHead)) ;
if ( pHead == nullptr)
return MCH_SCC_NONE ;
// recupero tipo di selezione delle uscite della testa
return pHead->GetSelectType() ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::LoadTool( const string& sHead, int nExit, const string& sTool) Machine::LoadTool( const string& sHead, int nExit, const string& sTool)
@@ -182,7 +170,7 @@ Machine::LoadTool( Exit* pExit, const string& sTool)
if ( nSolidId == GDB_ID_NULL) if ( nSolidId == GDB_ID_NULL)
return false ; return false ;
// sposto eventuali info relative al porta utensile (ToolHolder) nel gruppo SOLID // sposto eventuali info relative al porta utensile (ToolHolder) nel gruppo SOLID
double dVal ; string sVal ; double dVal ;
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_BASE, dVal)) if ( m_pGeomDB->GetInfo( nTGrpId, TTH_BASE, dVal))
m_pGeomDB->SetInfo( nSolidId, TTH_BASE, dVal) ; m_pGeomDB->SetInfo( nSolidId, TTH_BASE, dVal) ;
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_LEN, dVal)) if ( m_pGeomDB->GetInfo( nTGrpId, TTH_LEN, dVal))
@@ -191,8 +179,6 @@ Machine::LoadTool( Exit* pExit, const string& sTool)
m_pGeomDB->SetInfo( nSolidId, TTH_DIAM, dVal) ; m_pGeomDB->SetInfo( nSolidId, TTH_DIAM, dVal) ;
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_STEM_DIAM, dVal)) if ( m_pGeomDB->GetInfo( nTGrpId, TTH_STEM_DIAM, dVal))
m_pGeomDB->SetInfo( nSolidId, TTH_STEM_DIAM, dVal) ; m_pGeomDB->SetInfo( nSolidId, TTH_STEM_DIAM, dVal) ;
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_TYPE, sVal))
m_pGeomDB->SetInfo( nSolidId, TTH_TYPE, sVal) ;
// sposto il gruppo SOLID nell'uscita ed elimino la sua vecchia base // sposto il gruppo SOLID nell'uscita ed elimino la sua vecchia base
m_pGeomDB->RelocateGlob( nSolidId, nExGrp, GDB_FIRST_SON) ; m_pGeomDB->RelocateGlob( nSolidId, nExGrp, GDB_FIRST_SON) ;
m_pGeomDB->Erase( nTGrpId) ; m_pGeomDB->Erase( nTGrpId) ;
+26 -220
View File
@@ -1,15 +1,13 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2024 // EgalTech 2015-2021
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : MachineLua.cpp Data : 01.09.24 Versione : 2.6i1 // File : MachineLua.cpp Data : 14.10.21 Versione : 2.3j5
// Contenuto : Implementazione gestione macchina : funzioni Lua. // Contenuto : Implementazione gestione macchina : funzioni Lua.
// //
// //
// //
// Modifiche : 06.05.15 DS Creazione modulo. // Modifiche : 06.05.15 DS Creazione modulo.
// 26.04.20 DS Aggiunta gestione TcPos. // 26.04.20 DS Aggiunta gestione TcPos.
// 05.08.24 DS Aggiunta gestione SpecialEstimate.
// 01.09.24 DS SpecialEstimate è diventato MultiProcess.
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -36,8 +34,6 @@ static const string FLD_AXISMAXROTADJ = "AxisMaxRotAdj" ;
static const string FLD_EXITMAXADJUST = "ExitMaxAdjust" ; static const string FLD_EXITMAXADJUST = "ExitMaxAdjust" ;
static const string FLD_EXITMAXROTADJ = "ExitMaxRotAdj" ; static const string FLD_EXITMAXROTADJ = "ExitMaxRotAdj" ;
static const string FLD_ANGDELTAMINFORHOME = "AngDeltaMinForHome" ; static const string FLD_ANGDELTAMINFORHOME = "AngDeltaMinForHome" ;
static const string FLD_MULTIPROCESS = "MultiProcess" ;
static const string FLD_NEWLINKMGR = "NewLinkMgr" ;
static const string FLD_NAME = "Name" ; static const string FLD_NAME = "Name" ;
static const string FLD_PARENT = "Parent" ; static const string FLD_PARENT = "Parent" ;
static const string FLD_GEO = "Geo" ; static const string FLD_GEO = "Geo" ;
@@ -48,14 +44,12 @@ 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" ;
static const string FLD_HOME = "Home" ; static const string FLD_HOME = "Home" ;
static const string FLD_ADJUSTAUX = "AdjustAux" ; static const string FLD_ADJUSTAUX = "AdjustAux" ;
static const string FLD_HSET = "HSet" ; static const string FLD_HSET = "HSet" ;
static const string FLD_SEL_TYPE = "SelType" ;
static const string FLD_TDIR = "TDir" ; static const string FLD_TDIR = "TDir" ;
static const string FLD_ADIR = "ADir" ; static const string FLD_ADIR = "ADir" ;
static const string FLD_ROT1W = "Rot1W" ; static const string FLD_ROT1W = "Rot1W" ;
@@ -63,7 +57,6 @@ static const string FLD_MAXDELTAR2ON1 = "MaxDeltaR2OnFirst" ;
static const string FLD_ROT2STROKE = "Rot2Stroke" ; static const string FLD_ROT2STROKE = "Rot2Stroke" ;
static const string FLD_SOLCH = "SolCh" ; static const string FLD_SOLCH = "SolCh" ;
static const string FLD_OTHCOLL = "OthColl" ; static const string FLD_OTHCOLL = "OthColl" ;
static const string FLD_COLL = "Coll" ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
Machine* Machine::m_pMchLua = nullptr ; Machine* Machine::m_pMchLua = nullptr ;
@@ -143,12 +136,8 @@ Machine::LuaInit( const string& sMachineName)
m_LuaMgr.RegisterFunction( "EmtSetToolForVmill", Machine::LuaEmtSetToolForVmill) ; m_LuaMgr.RegisterFunction( "EmtSetToolForVmill", Machine::LuaEmtSetToolForVmill) ;
// registro la funzione di impostazione di utensile aggiuntivo per virtual milling in simulazione // registro la funzione di impostazione di utensile aggiuntivo per virtual milling in simulazione
m_LuaMgr.RegisterFunction( "EmtAddToolForVmill", Machine::LuaEmtAddToolForVmill) ; m_LuaMgr.RegisterFunction( "EmtAddToolForVmill", Machine::LuaEmtAddToolForVmill) ;
// registro la funzione per abilitare/disabilitare l'esecuzione del virtual milling
m_LuaMgr.RegisterFunction( "EmtEnableToolsForVmill", Machine::LuaEmtEnableToolsForVmill) ;
// registro la funzione di movimento assi in simulazione // registro la funzione di movimento assi in simulazione
m_LuaMgr.RegisterFunction( "EmtMoveAxes", Machine::LuaEmtMoveAxes) ; m_LuaMgr.RegisterFunction( "EmtMoveAxes", Machine::LuaEmtMoveAxes) ;
// registro la funzione di salvataggio comandi in simulazione MP
m_LuaMgr.RegisterFunction( "EmtSaveCmd", Machine::LuaEmtSaveCmd) ;
return true ; return true ;
} }
@@ -348,13 +337,6 @@ Machine::LuaEmtGeneral( lua_State* L)
// lettura eventuale campo 'AngDeltaForHome' dalla tabella (default INFINITO) // lettura eventuale campo 'AngDeltaForHome' dalla tabella (default INFINITO)
double dAngDeltaMinForHome = INFINITO ; double dAngDeltaMinForHome = INFINITO ;
LuaGetTabFieldParam( L, 1, FLD_ANGDELTAMINFORHOME, dAngDeltaMinForHome) ; LuaGetTabFieldParam( L, 1, FLD_ANGDELTAMINFORHOME, dAngDeltaMinForHome) ;
// lettura eventuale campo 'MultiProcess' dalla tabella (0=no, 1=si, 2=si con simulazione MP)
int nMultiProcess = 0 ;
LuaGetTabFieldParam( L, 1, FLD_MULTIPROCESS, nMultiProcess) ;
// lettura eventuale campo 'NewLinkMgr' dalla tabella (0=old, 1 =new)
int nNewLinkMgr = 0 ;
LuaGetTabFieldParam( L, 1, FLD_NEWLINKMGR, nNewLinkMgr) ;
// pulizia stack
LuaClearStack( L) ; LuaClearStack( L) ;
// info // info
@@ -404,11 +386,6 @@ Machine::LuaEmtGeneral( lua_State* L)
// imposto minima differenza angolare da posizione precedente per stare vivino a posizione home // imposto minima differenza angolare da posizione precedente per stare vivino a posizione home
m_pMchLua->m_dAngDeltaMinForHome = dAngDeltaMinForHome ; m_pMchLua->m_dAngDeltaMinForHome = dAngDeltaMinForHome ;
// imposto codice per macchina multiprocesso
m_pMchLua->m_nMultiProcess = nMultiProcess ;
// imposto codice per gestione link tra lavorazioni
m_pMchLua->m_nNewLinkMgr = nNewLinkMgr ;
return 0 ; return 0 ;
} }
@@ -473,9 +450,6 @@ Machine::LuaEmtTable( lua_State* L)
// lettura eventuale campo 'Scale' dalla tabella // lettura eventuale campo 'Scale' dalla tabella
double vScale[3] = {1.0, 1.0, 1.0} ; double vScale[3] = {1.0, 1.0, 1.0} ;
LuaGetTabFieldParam( L, 1, FLD_SCALE, vScale) ; LuaGetTabFieldParam( L, 1, FLD_SCALE, vScale) ;
// lettura eventuale campo 'Coll' dalla tabella
STRVECTOR vsColl ;
LuaGetTabFieldParam( L, 1, FLD_COLL, vsColl) ;
// lettura campo 'Geo' dalla tabella // lettura campo 'Geo' dalla tabella
string sGeo ; string sGeo ;
LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo) LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
@@ -493,7 +467,7 @@ Machine::LuaEmtTable( lua_State* L)
return luaL_error( L, " Unknown Machine") ; return luaL_error( L, " Unknown Machine") ;
// carico i dati della tavola // carico i dati della tavola
if ( ! m_pMchLua->LoadMachineTable( sName, sParent, nType, Ref1, vScale[0], vScale[1], vScale[2], vsColl, sGeo, vsAux)) if ( ! m_pMchLua->LoadMachineTable( sName, sParent, nType, Ref1, vScale[0], vScale[1], vScale[2], sGeo, vsAux))
return luaL_error( L, " Load Machine Table failed") ; return luaL_error( L, " Load Machine Table failed") ;
// restituisco l'indice della tavola // restituisco l'indice della tavola
@@ -685,12 +659,9 @@ Machine::LuaEmtMultiHead( lua_State* L)
// lettura campo 'HSet' dalla tabella // lettura campo 'HSet' dalla tabella
string sHSet ; string sHSet ;
LuaCheckTabFieldParam( L, 1, FLD_HSET, sHSet) LuaCheckTabFieldParam( L, 1, FLD_HSET, sHSet)
// lettura eventuale campo tipo di selezione ammessa per le uscite
int nSelectType = MCH_SLT_FIXEDEXITS ;
LuaGetTabFieldParam( L, 1, FLD_SEL_TYPE, nSelectType) ;
// lettura campo 'ExitNbr' dalla tabella // 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) ;
@@ -705,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)
@@ -740,9 +711,9 @@ Machine::LuaEmtMultiHead( lua_State* L)
return luaL_error( L, " Unknown Machine") ; return luaL_error( L, " Unknown Machine") ;
// carico i dati della testa multipla // carico i dati della testa multipla
if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, nSelectType, 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) ;
@@ -826,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))
@@ -882,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) ;
@@ -1458,7 +1347,7 @@ Machine::LuaEmtOnCollision( lua_State* L)
int int
Machine::LuaEmtSetToolForVmill( lua_State* L) Machine::LuaEmtSetToolForVmill( lua_State* L)
{ {
// 4 o 7 parametri : sTool, sHead, nExit, vVmill [, nFlag , dPar1, dPar2] // 4 parametri : sTool, sHead, nExit, vVmill
string sTool ; string sTool ;
LuaGetParam( L, 1, sTool) ; LuaGetParam( L, 1, sTool) ;
string sHead ; string sHead ;
@@ -1467,19 +1356,12 @@ Machine::LuaEmtSetToolForVmill( lua_State* L)
LuaGetParam( L, 3, nExit) ; LuaGetParam( L, 3, nExit) ;
INTVECTOR vVmill ; INTVECTOR vVmill ;
LuaGetParam( L, 4, vVmill) ; LuaGetParam( L, 4, vVmill) ;
int nFlag = 0 ;
LuaGetParam( L, 5, nFlag) ;
double dPar1 = 0 ;
LuaGetParam( L, 6, dPar1) ;
double dPar2 = 0 ;
LuaGetParam( L, 7, dPar2) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico ci sia una macchina attiva // verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr) if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ; return luaL_error( L, " Unknown Machine") ;
// imposto dati primo utensile per virtual milling in simulazione // imposto dati primo utensile per virtual milling in simulazione
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, vVmill, true)) ;
m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, nFlag, dPar1, dPar2, vVmill, true)) ;
// assegno risultato // assegno risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -1489,7 +1371,7 @@ Machine::LuaEmtSetToolForVmill( lua_State* L)
int int
Machine::LuaEmtAddToolForVmill( lua_State* L) Machine::LuaEmtAddToolForVmill( lua_State* L)
{ {
// 4 o 7 parametri : sTool, sHead, nExit, vVmill [, nFlag, dPar1, dPar2] // 4 parametri : sTool, sHead, nExit, vVmill
string sTool ; string sTool ;
LuaGetParam( L, 1, sTool) ; LuaGetParam( L, 1, sTool) ;
string sHead ; string sHead ;
@@ -1498,37 +1380,12 @@ Machine::LuaEmtAddToolForVmill( lua_State* L)
LuaGetParam( L, 3, nExit) ; LuaGetParam( L, 3, nExit) ;
INTVECTOR vVmill ; INTVECTOR vVmill ;
LuaGetParam( L, 4, vVmill) ; LuaGetParam( L, 4, vVmill) ;
int nFlag = 0 ;
LuaGetParam( L, 5, nFlag) ;
double dPar1 = 0 ;
LuaGetParam( L, 6, dPar1) ;
double dPar2 = 0 ;
LuaGetParam( L, 7, dPar2) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico ci sia una macchina attiva // verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr) if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ; return luaL_error( L, " Unknown Machine") ;
// imposto dati utensile aggiuntivo per virtual milling in simulazione // imposto dati utensile aggiuntivo per virtual milling in simulazione
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, vVmill, false)) ;
m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, nFlag, dPar1, dPar2, vVmill, false)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtEnableToolsForVmill( lua_State* L)
{
// 1 parametro : bEnable
bool bEnable = false ;
LuaGetParam( L, 1, bEnable) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// imposto abilitazione utensili per virtual milling in simulazione
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimEnableToolsForVmill( bEnable)) ;
// assegno risultato // assegno risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -1538,12 +1395,19 @@ Machine::LuaEmtEnableToolsForVmill( 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 = 0 ; int nMoveType ;
LuaGetParam( L, 1, nMoveType) ; LuaCheckParam( L, 1, nMoveType)
string sAx1 ;
LuaCheckParam( L, 2, sAx1) ;
double dEnd1 ;
LuaCheckParam( L, 3, dEnd1) ;
double dStep1 ;
LuaCheckParam( L, 4, dStep1) ;
SAMVECTOR vAxNaEpSt ; SAMVECTOR vAxNaEpSt ;
for ( int i = 0 ; i < 10 ; ++ i) { vAxNaEpSt.emplace_back( sAx1, dEnd1, dStep1) ;
int nInd = 2 + 3 * i ; for ( int i = 0 ; i < 4 ; ++ i) {
int nInd = 5 + 3 * i ;
string sAxN ; string sAxN ;
double dEndN ; double dEndN ;
double dStepN ; double dStepN ;
@@ -1563,65 +1427,7 @@ Machine::LuaEmtMoveAxes( lua_State* L)
// assegno risultato // assegno risultato
if ( nRes == SIM_AXMV_RES_STOP) if ( nRes == SIM_AXMV_RES_STOP)
return luaL_error( L, "STOP") ; return luaL_error( L, "STOP") ;
else { else
LuaSetParam( L, ( nRes == SIM_AXMV_RES_OK)) ; LuaSetParam( L, ( nRes == SIM_AXMV_RES_OK)) ;
LuaSetParam( L, m_pMchLua->GetMultiProcess()) ;
}
return 2 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtSaveCmd( lua_State* L)
{
// parametri : nType,
int nType = 0 ;
LuaGetParam( L, 1, nType) ;
int nPar = 0 ;
LuaGetParam( L, 2, nPar) ;
string sPar ;
LuaGetParam( L, 3, sPar) ;
string sPar2 ;
if ( nType == 4) {
switch ( lua_type( L, 4)) {
case LUA_TNIL :
nPar = 0 ;
break ;
case LUA_TBOOLEAN :
{ nPar = 1 ;
bool bVal ;
LuaGetParam( L, 4, bVal) ;
sPar2 = ( bVal ? "1" : "0") ;
} break ;
case LUA_TNUMBER :
if ( lua_isinteger( L, 4)) {
nPar = 2 ;
int nVal ;
LuaGetParam( L, 4, nVal) ;
sPar2 = ToString( nVal) ;
}
else {
nPar = 3 ;
double dVal ;
LuaGetParam( L, 4, dVal) ;
sPar2 = ToString( dVal, 9) ;
}
break ;
case LUA_TSTRING :
{ nPar = 4 ;
LuaGetParam( L, 4, sPar2) ;
} break ;
default :
return luaL_error( L, " Unknown Type") ;
}
}
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// salvo il comando
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimSaveCmd( nType, nPar, sPar, sPar2)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
} }
+4 -17
View File
@@ -15,7 +15,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "MachMgr.h" #include "MachMgr.h"
#include "DllMain.h" #include "DllMain.h"
#include "CamData.h"
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h" #include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkCurveLine.h" #include "/EgtDev/Include/EGkCurveLine.h"
@@ -32,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 ;
@@ -45,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 ||
@@ -72,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)) ;
} }
@@ -88,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 ;
@@ -103,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 ||
@@ -130,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)) ;
} }
@@ -146,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 ;
@@ -163,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 ||
@@ -190,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)) ;
} }
@@ -206,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 ;
@@ -229,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 ||
@@ -264,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 -18
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2024 // EgalTech 2015-2015
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : MachineStruConst.h Data : 15.01.24 Versione : 2.5l6 // File : MachineStruConst.h Data : 25.05.15 Versione : 1.6e7
// Contenuto : Strutture e costanti di macchina. // Contenuto : Strutture e costanti di macchina.
// //
// //
@@ -88,18 +88,6 @@ enum MchHeadType { MCH_HT_NONE = 0,
MCH_HT_MULTI = 2, MCH_HT_MULTI = 2,
MCH_HT_SPECIAL = 3} ; MCH_HT_SPECIAL = 3} ;
//----------------------------------------------------------------------------
// Tipo di selezione ammessa per le uscite
enum MchSelType { MCH_SLT_FIXEDEXITS = 0,
MCH_SLT_ONEEXIT = 1,
MCH_SLT_MULTIEXITS = 2} ;
//----------------------------------------------------------------------------
// Tipo della catena cinematica
enum KinChainType { KIN_CHAIN_NONE = 0,
KIN_CHAIN_CENTER = 1,
KIN_CHAIN_ROBOT = 2} ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Identificativo iniziale riferimenti di tavola // Identificativo iniziale riferimenti di tavola
const std::string MCH_TREF = "R" ; const std::string MCH_TREF = "R" ;
@@ -153,7 +141,3 @@ const std::string MCH_AGB_ENCV = "AGB_ENCV" ;
// Info in rinvio rotante da sotto per definire la direzione di approccio preferenziale (consentito delta max di 95deg) // Info in rinvio rotante da sotto per definire la direzione di approccio preferenziale (consentito delta max di 95deg)
const std::string MCH_AGB_MDIR = "AGB_MDIR" ; const std::string MCH_AGB_MDIR = "AGB_MDIR" ;
const double MCH_AGB_DELTAMAX_MDIR = cos( 95 * DEGTORAD) ; const double MCH_AGB_DELTAMAX_MDIR = cos( 95 * DEGTORAD) ;
//----------------------------------------------------------------------------
// Info di uscita per indicare quanto mossa lungo la sua Z locale
const std::string MCH_EXIT_VAL = "Val" ;
+67 -193
View File
@@ -148,15 +148,6 @@ Machining::PrepareToolPreview( void) const
int nId = m_pGeomDB->CopyGlob( nHeadId, GDB_ID_NULL, nStId) ; int nId = m_pGeomDB->CopyGlob( nHeadId, GDB_ID_NULL, nStId) ;
m_pGeomDB->SetMode( nId, GDB_MD_STD) ; m_pGeomDB->SetMode( nId, GDB_MD_STD) ;
m_pGeomDB->SetStatus( nId, GDB_ST_OFF) ; m_pGeomDB->SetStatus( nId, GDB_ST_OFF) ;
// elimino eventuali gruppi opportunamente indicati
int nSubId = m_pGeomDB->GetFirstGroupInGroup( nId) ;
while ( nSubId != GDB_ID_NULL) {
int nNextSubId = m_pGeomDB->GetNextGroup( nSubId) ;
bool bShow = true ;
if ( m_pGeomDB->GetInfo( nSubId, KEY_PREVIEWSHOW, bShow) && ! bShow)
m_pGeomDB->Erase( nSubId) ;
nSubId = nNextSubId ;
}
return ( nId != GDB_ID_NULL) ; return ( nId != GDB_ID_NULL) ;
} }
@@ -176,125 +167,68 @@ Machining::RemoveToolPreview( void) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Machining::GetToolPreviewStepCount( void) const GetToolPreviewNext( IGeomDB* pGeomDB, int nEntId, int nParentId)
{
// verifico validità gestori DB geometrico e CAM
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
return 0 ;
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
if ( nClId == GDB_ID_NULL)
return 0 ;
// determino il numero di entità di tutti i sottogruppi, escludendo CLIMB e RISE
int nCount = 0 ;
int nPxId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
while ( nPxId != GDB_ID_NULL) {
// aggiungo tutte le entità del truppo
nCount += m_pGeomDB->GetGroupObjs( nPxId) ;
// tolgo le entità CLIMB
int nClimbId = m_pGeomDB->GetFirstNameInGroup( nPxId, MCH_CL_CLIMB) ;
while ( nClimbId != GDB_ID_NULL) {
-- nCount ;
nClimbId = m_pGeomDB->GetNextName( nClimbId, MCH_CL_CLIMB) ;
}
// tolgo le entità RISE
int nRiseId = m_pGeomDB->GetFirstNameInGroup( nPxId, MCH_CL_RISE) ;
while ( nRiseId != GDB_ID_NULL) {
-- nCount ;
nRiseId = m_pGeomDB->GetNextName( nRiseId, MCH_CL_RISE) ;
}
// passo al successivo sottogruppo
nPxId = m_pGeomDB->GetNextGroup( nPxId) ;
}
return nCount ;
}
//----------------------------------------------------------------------------
int
Machining::GetToolPreviewNext( int nEntId, int nParentId, int nStId) const
{ {
// recupero la successiva // recupero la successiva
int nNewId = (( nEntId != GDB_ID_NULL) ? m_pGeomDB->GetNext( nEntId) : m_pGeomDB->GetFirstInGroup( nParentId)) ; int nNewId = (( nEntId != GDB_ID_NULL) ? pGeomDB->GetNext( nEntId) : pGeomDB->GetFirstInGroup( nParentId)) ;
int nNewParentId = nParentId ; int nNewParentId = nParentId ;
// ciclo nei gruppi successivi // ciclo nei gruppi successivi
do { do {
// ciclo nel gruppo // ciclo nel gruppo
while ( nNewId != GDB_ID_NULL) { while ( nNewId != GDB_ID_NULL) {
string sName ; m_pGeomDB->GetName( nNewId, sName) ; string sName ; pGeomDB->GetName( nNewId, sName) ;
if ( sName != MCH_CL_CLIMB && sName != MCH_CL_RISE) if ( sName != MCH_CL_CLIMB && sName != MCH_CL_RISE)
break ; break ;
nNewId = m_pGeomDB->GetNext( nNewId) ; nNewId = pGeomDB->GetNext( nNewId) ;
} }
// se trovata, esco // se trovata, esco
if ( nNewId != GDB_ID_NULL) { if ( nNewId != GDB_ID_NULL)
// se prima entità, eventuale attivazione uscite di gruppo a forare
if ( nEntId == GDB_ID_NULL && m_pGeomDB->ExistsInfo( nNewParentId, KEY_DRACEX)) {
INTVECTOR vActExit ;
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit))
ActivateDrillingUnit( nStId, vActExit) ;
}
return nNewId ; return nNewId ;
}
// passo al gruppo successivo
nNewParentId = m_pGeomDB->GetNextGroup( nNewParentId) ;
// eventuale attivazione uscite di gruppo a forare
if ( m_pGeomDB->ExistsInfo( nNewParentId, KEY_DRACEX)) {
INTVECTOR vActExit ;
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit))
ActivateDrillingUnit( nStId, vActExit) ;
}
// recupero la prima entità del successivo gruppo // recupero la prima entità del successivo gruppo
nNewId = m_pGeomDB->GetFirstInGroup( nNewParentId) ; nNewParentId = pGeomDB->GetNextGroup( nNewParentId) ;
nNewId = pGeomDB->GetFirstInGroup( nNewParentId) ;
} while ( nNewId != GDB_ID_NULL) ; } while ( nNewId != GDB_ID_NULL) ;
return GDB_ID_NULL ; return GDB_ID_NULL ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Machining::GetToolPreviewPrev( int nEntId, int nParentId, int nStId) const GetToolPreviewPrev( IGeomDB* pGeomDB, int nEntId, int nParentId)
{ {
// recupero la precedente // recupero la precedente
int nNewId = (( nEntId != GDB_ID_NULL) ? m_pGeomDB->GetPrev( nEntId) : m_pGeomDB->GetLastInGroup( nParentId)) ; int nNewId = (( nEntId != GDB_ID_NULL) ? pGeomDB->GetPrev( nEntId) : pGeomDB->GetLastInGroup( nParentId)) ;
int nNewParentId = nParentId ; int nNewParentId = nParentId ;
// ciclo nei gruppi precedenti // ciclo nei gruppi precedenti
do { do {
// ciclo nel gruppo // ciclo nel gruppo
while ( nNewId != GDB_ID_NULL) { while ( nNewId != GDB_ID_NULL) {
string sName ; m_pGeomDB->GetName( nNewId, sName) ; string sName ; pGeomDB->GetName( nNewId, sName) ;
if ( sName != MCH_CL_CLIMB && sName != MCH_CL_RISE) if ( sName != MCH_CL_CLIMB && sName != MCH_CL_RISE)
break ; break ;
nNewId = m_pGeomDB->GetPrev( nNewId) ; nNewId = pGeomDB->GetPrev( nNewId) ;
} }
// se trovata, esco // se trovata, esco
if ( nNewId != GDB_ID_NULL) if ( nNewId != GDB_ID_NULL)
return nNewId ; return nNewId ;
// passo al gruppo precedente
nNewParentId = m_pGeomDB->GetPrevGroup( nNewParentId) ;
// eventuale attivazione uscite di gruppo a forare
if ( m_pGeomDB->ExistsInfo( nNewParentId, KEY_DRACEX)) {
INTVECTOR vActExit ;
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit))
ActivateDrillingUnit( nStId, vActExit) ;
}
// recupero l'ultima entità del precedente gruppo // recupero l'ultima entità del precedente gruppo
nNewId = m_pGeomDB->GetLastInGroup( nNewParentId) ; nNewParentId = pGeomDB->GetPrevGroup( nNewParentId) ;
nNewId = pGeomDB->GetLastInGroup( nNewParentId) ;
} while ( nNewId != GDB_ID_NULL) ; } while ( nNewId != GDB_ID_NULL) ;
return GDB_ID_NULL ; return GDB_ID_NULL ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Machining::ToolPreview( int nEntId, int nStep) const Machining::ToolPreview( int nEntId, int nFlag) const
{ {
// verifico validità gestori DB geometrico e CAM // verifico validità gestori DB geometrico e CAM
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr) if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero la testa nel gruppo per anteprima utensile // recupero la testa nel gruppo per anteprima utensile
int nStId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST)) ; int nId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST)) ;
if ( nStId == GDB_ID_NULL) if ( nId == GDB_ID_NULL)
return GDB_ID_NULL ; return GDB_ID_NULL ;
m_pGeomDB->SetStatus( nStId, GDB_ST_OFF) ; m_pGeomDB->SetStatus( nId, GDB_ST_OFF) ;
// recupero gruppo per geometria di lavorazione (Cutter Location) // recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ; int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
if ( nClId == GDB_ID_NULL) if ( nClId == GDB_ID_NULL)
@@ -305,11 +239,11 @@ Machining::ToolPreview( int nEntId, int nStep) const
// recupero il gruppo di appartenenza // recupero il gruppo di appartenenza
nParentId = m_pGeomDB->GetFirstGroupInGroup( nClId) ; nParentId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
// se richiesta successiva // se richiesta successiva
if ( nStep > 0) if ( nFlag == MCH_TPM_AFTER)
nEntId = GetToolPreviewNext( nEntId, nParentId, nStId) ; nEntId = GetToolPreviewNext( m_pGeomDB, nEntId, nParentId) ;
// se richiesta precedente // se richiesta precedente
else if ( nStep < 0) else if ( nFlag == MCH_TPM_BEFORE)
nEntId = GetToolPreviewPrev( nEntId, nParentId, nStId) ; nEntId = GetToolPreviewPrev( m_pGeomDB, nEntId, nParentId) ;
// altrimenti richiesta corrente // altrimenti richiesta corrente
else else
nEntId = GDB_ID_NULL ; nEntId = GDB_ID_NULL ;
@@ -317,39 +251,21 @@ Machining::ToolPreview( int nEntId, int nStep) const
// altrimenti // altrimenti
else { else {
// verifico che l'entità stia in un sottogruppo di CL // verifico che l'entità stia in un sottogruppo di CL
nParentId = m_pGeomDB->GetParentId( nEntId) ; nParentId = m_pGeomDB->GetParentId( nEntId) ;
if ( m_pGeomDB->GetParentId( nParentId) == nClId) { if ( m_pGeomDB->GetParentId( nParentId) == nClId) {
// se richiesta successiva // se richiesta successiva
if ( nStep > 0) { if ( nFlag == MCH_TPM_AFTER)
while ( nStep > 0) { nEntId = GetToolPreviewNext( m_pGeomDB, nEntId, nParentId) ;
int nOldId = nEntId ;
nEntId = GetToolPreviewNext( nEntId, nParentId, nStId) ;
-- nStep ;
if ( nEntId == GDB_ID_NULL) {
nEntId = nOldId ;
break ;
}
}
}
// se richiesta precedente // se richiesta precedente
else if ( nStep < 0) { else if ( nFlag == MCH_TPM_BEFORE)
while ( nStep < 0) { nEntId = GetToolPreviewPrev( m_pGeomDB, nEntId, nParentId) ;
int nOldId = nEntId ;
nEntId = GetToolPreviewPrev( nEntId, nParentId, nStId) ;
++ nStep ;
if ( nEntId == GDB_ID_NULL) {
nEntId = nOldId ;
break ;
}
}
}
} }
else else
nEntId = GDB_ID_NULL ; nEntId = GDB_ID_NULL ;
} }
// se esiste il gruppo genitore, visualizzo testa preview // se esiste il gruppo genitore, visualizzo testa preview
if ( nParentId != GDB_ID_NULL) if ( nParentId != GDB_ID_NULL)
m_pGeomDB->SetStatus( nStId, GDB_ST_ON) ; m_pGeomDB->SetStatus( nId, GDB_ST_ON) ;
// recupero i dati di questa entità // recupero i dati di questa entità
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ; const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr) if ( pCamData == nullptr)
@@ -359,76 +275,34 @@ Machining::ToolPreview( int nEntId, int nStep) const
Vector3d vtTool = pCamData->GetToolDir() ; Vector3d vtTool = pCamData->GetToolDir() ;
Vector3d vtBAux = pCamData->GetBackAuxDir() ; Vector3d vtBAux = pCamData->GetBackAuxDir() ;
// dati correnti testa/uscita // dati correnti testa/uscita
int nExitId = m_pGeomDB->GetFirstNameInGroup( nStId, MCH_EXIT + ToString( GetExitNbr())) ; int nExitId = m_pGeomDB->GetFirstNameInGroup( nId, MCH_EXIT + ToString( GetExitNbr())) ;
Frame3d frExit ; Frame3d frExit ;
m_pGeomDB->GetGroupGlobFrame( nExitId, frExit) ; m_pGeomDB->GetGroupGlobFrame( nExitId, frExit) ;
// correggo eventuale movimento di disattivazione sempre in Z globale
double dVal ;
if ( m_pGeomDB->GetInfo( nExitId, MCH_EXIT_VAL, dVal))
frExit.Translate( -dVal * Z_AX) ;
Point3d ptOrig = frExit.Orig() ; Point3d ptOrig = frExit.Orig() ;
Vector3d vtDir = frExit.VersZ() ; Vector3d vtDir = frExit.VersZ() ;
Vector3d vtAux ; Vector3d vtAux ;
int nAvId = m_pGeomDB->GetFirstNameInGroup( nStId, MCH_AUX_VECT) ; int nAvId = m_pGeomDB->GetFirstNameInGroup( nId, MCH_AUX_VECT) ;
ExeStartVector( nAvId, GDB_ID_ROOT, vtAux) ; ExeStartVector( nAvId, GDB_ID_ROOT, vtAux) ;
// rototraslo opportunamente // rototraslo opportunamente
Frame3d frHead ; Frame3d frHead ;
m_pGeomDB->GetGroupGlobFrame( nStId, 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) ;
frHead.ToLoc( frRef) ; frHead.ToLoc( frRef) ;
frHead.ToGlob( frShow) ; frHead.ToGlob( frShow) ;
*(m_pGeomDB->GetGroupFrame( nStId)) = frHead ; *(m_pGeomDB->GetGroupFrame( nId)) = frHead ;
return nEntId ; return nEntId ;
} }
//----------------------------------------------------------------------------
bool
Machining::ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const
{
// recupero la macchina corrente
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// costanti
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_VER = ".VER" ; // IN (string) versione della Dll
static const string EVAR_HEADID = ".HEADID" ; // IN (int) identificativo testa
static const string EVAR_DRACEX = ".DRACEX" ; // IN (ints) vettore indici uscite attive
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok, > 0 errore)
static const string ON_ACTIVATE_DRILLING_UNIT = "OnActivateDrillingUnit" ;
// se non esiste la funzione, esco
if ( ! pMch->LuaExistsFunction( ON_ACTIVATE_DRILLING_UNIT))
return true ;
// eseguo l'azione
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEADID, nHeadId) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_DRACEX, vActExit) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_ACTIVATE_DRILLING_UNIT) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
// reset
bOk = pMch->LuaResetGlobVar( EMC_VAR) && bOk ;
// segnalo errori
return ( bOk && nErr == 0) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machining::PostApply( string& sErr) Machining::PostApply( string& sErr)
@@ -445,39 +319,39 @@ Machining::PostApply( string& sErr)
static const string EVAR_MSG = ".MSG" ; // OUT (string) stringa di errore ( opzionale) static const string EVAR_MSG = ".MSG" ; // OUT (string) stringa di errore ( opzionale)
static const string ON_POST_APPLY = "OnPostApplyMachining" ; static const string ON_POST_APPLY = "OnPostApplyMachining" ;
// se non esiste la funzione, esco
if ( ! pMch->LuaExistsFunction( ON_POST_APPLY))
return true ;
// eseguo l'azione // eseguo l'azione
bool bOk = true ; if ( pMch->LuaExistsFunction( ON_POST_APPLY)) {
int nErr = 99 ; bool bOk = true ;
// imposto valori parametri int nErr = 99 ;
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ; // imposto valori parametri
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PHASE, m_nPhase) ; bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_MCHID, m_nOwnerId) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PHASE, m_nPhase) ;
// eseguo bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_MCHID, m_nOwnerId) ;
bOk = bOk && pMch->LuaCallFunction( ON_POST_APPLY, false) ; // eseguo
// recupero valori parametri obbligatori bOk = bOk && pMch->LuaCallFunction( ON_POST_APPLY, false) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ; // recupero valori parametri obbligatori
// recupero valori parametri opzionali bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
string sMsg ; // recupero valori parametri opzionali
bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MSG, sMsg) ; string sMsg ;
// reset bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MSG, sMsg) ;
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ; // reset
// segnalo errori bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
if ( ! bOk || nErr > 0) { // segnalo errori
bOk = false ; if ( ! bOk || nErr > 0) {
sErr = sMsg ; bOk = false ;
if ( IsEmptyOrSpaces( sErr)) sErr = sMsg ;
sErr = " Error in " + ON_POST_APPLY + " (" + ToString( nErr) + ")" ; if ( IsEmptyOrSpaces( sErr))
sErr = " Error in " + ON_POST_APPLY + " (" + ToString( nErr) + ")" ;
}
// recupero eventuale warning
else if ( nErr < 0) {
string sOut = sMsg ;
if ( IsEmptyOrSpaces( sOut))
sOut = " Warning in " + ON_POST_APPLY + " (" + ToString( abs( nErr)) + ")" ;
m_pMchMgr->SetWarning( abs( nErr), sOut) ;
}
return bOk ;
} }
// recupero eventuale warning else
else if ( nErr < 0) { return true ;
string sOut = sMsg ; }
if ( IsEmptyOrSpaces( sOut))
sOut = " Warning in " + ON_POST_APPLY + " (" + ToString( abs( nErr)) + ")" ;
m_pMchMgr->SetWarning( abs( nErr), sOut) ;
}
return bOk ;
}
+1 -9
View File
@@ -43,25 +43,17 @@ class Machining : public Operation
virtual bool UpdateToolData( bool* pbChanged = nullptr) = 0 ; virtual bool UpdateToolData( bool* pbChanged = nullptr) = 0 ;
virtual const ToolData& GetToolData( void) const = 0 ; virtual const ToolData& GetToolData( void) const = 0 ;
virtual bool GetGeometry( SELVECTOR& vIds) const = 0 ; virtual bool GetGeometry( SELVECTOR& vIds) const = 0 ;
virtual bool GetSkippedGeometry( SELVECTOR& vIds) const
{ vIds.clear() ; return false ; }
public : public :
bool GetStartPoint( Point3d& ptStart) const ; bool GetStartPoint( Point3d& ptStart) const ;
bool GetEndPoint( Point3d& ptEnd) const ; bool GetEndPoint( Point3d& ptEnd) const ;
bool PrepareToolPreview( void) const ; bool PrepareToolPreview( void) const ;
int ToolPreview( int nEntId, int nFlag) const ;
bool RemoveToolPreview( void) const ; bool RemoveToolPreview( void) const ;
int GetToolPreviewStepCount( void) const ;
int ToolPreview( int nEntId, int nStep) const ;
bool ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const ;
protected : protected :
Machining( void) ; Machining( void) ;
bool PostApply( std::string& sErr) ; bool PostApply( std::string& sErr) ;
private :
int GetToolPreviewNext( int nEntId, int nParentId, int nStId) const ;
int GetToolPreviewPrev( int nEntId, int nParentId, int nStId) const ;
} ; } ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
+1 -10
View File
@@ -103,11 +103,7 @@ GetMachiningTitle( int nMchType)
"SawRoughing", "SawRoughing",
"SawFinishing", "SawFinishing",
"GenMachining", "GenMachining",
"Chiseling", "Chiseling"} ;
"SurfRoughing",
"SurfFinishing",
"Waterjetting",
"5AxisMilling"} ;
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_FIVEAXISMILLING : return MchTitle[13] ;
} }
return MchTitle[0] ; return MchTitle[0] ;
} }
+3 -27
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2024 // EgalTech 2015-2022
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : MachiningsMgr.cpp Data : 29.03.24 Versione : 2.6d1 // File : MachiningsMgr.cpp Data : 04.02.22 Versione : 2.4b1
// Contenuto : Implementazione gestore database lavorazioni. // Contenuto : Implementazione gestore database lavorazioni.
// //
// //
@@ -16,7 +16,6 @@
// 22.06.20 DS Agg. per nuovi parametri attacco tagli di lama (MF_CURR_VER = 1010). // 22.06.20 DS Agg. per nuovi parametri attacco tagli di lama (MF_CURR_VER = 1010).
// 09.11.20 DS Agg. per nuovi parametri tagli di lama (MF_CURR_VER = 1011). // 09.11.20 DS Agg. per nuovi parametri tagli di lama (MF_CURR_VER = 1011).
// 04.02.22 DS Agg. per nuovi parametri svuotature con epicicli (MF_CURR_VER = 1012). // 04.02.22 DS Agg. per nuovi parametri svuotature con epicicli (MF_CURR_VER = 1012).
// 29.03.24 DS Agg. parametro APPROX_LINTOL (MF_CURR_VER = 1013).
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -43,7 +42,7 @@ const string MF_HEADER = "[HEADER]" ;
const string MF_VERSION = "VERSION" ; const string MF_VERSION = "VERSION" ;
const string MF_TOTAL = "TOTAL" ; const string MF_TOTAL = "TOTAL" ;
const string MF_SIZE = "SIZE" ; const string MF_SIZE = "SIZE" ;
const int MF_CURR_VER = 1013 ; const int MF_CURR_VER = 1012 ;
const string MF_GENERAL = "[GENERAL]" ; const string MF_GENERAL = "[GENERAL]" ;
const string MF_3AXCOMP = "3AXCOMP" ; const string MF_3AXCOMP = "3AXCOMP" ;
const bool MF_CURR_3AXCOMP = false ; const bool MF_CURR_3AXCOMP = false ;
@@ -65,8 +64,6 @@ const string MF_INTSAWARCMAXSIDEANG = "INTSAWARCMAXSIDEANG" ;
const double MF_CURR_INTSAWARCMAXSIDEANG = 45 ; const double MF_CURR_INTSAWARCMAXSIDEANG = 45 ;
const string MF_SPLITARCS = "SPLITARCS" ; const string MF_SPLITARCS = "SPLITARCS" ;
const int MF_CURR_SPLITARCS = SPLAR_NEVER ; const int MF_CURR_SPLITARCS = SPLAR_NEVER ;
const string MF_APPROX_LINTOL = "APPROX_LINTOL" ;
const double MF_CURR_APPROX_LINTOL = 0.05 ;
const string MF_MAXDEPTHSAFE = "MAXDEPTHSAFE" ; const string MF_MAXDEPTHSAFE = "MAXDEPTHSAFE" ;
const double MF_CURR_MAXDEPTHSAFE = 2.0 ; const double MF_CURR_MAXDEPTHSAFE = 2.0 ;
@@ -88,7 +85,6 @@ MachiningsMgr::MachiningsMgr( void)
m_dExtSawArcMinRad = MF_CURR_EXTSAWARCMINRAD ; m_dExtSawArcMinRad = MF_CURR_EXTSAWARCMINRAD ;
m_dIntSawArcMaxSideAng = MF_CURR_INTSAWARCMAXSIDEANG ; m_dIntSawArcMaxSideAng = MF_CURR_INTSAWARCMAXSIDEANG ;
m_nSplitArcs = MF_CURR_SPLITARCS ; m_nSplitArcs = MF_CURR_SPLITARCS ;
m_dApproxLinTol = MF_CURR_APPROX_LINTOL ;
m_dMaxDepthSafe = MF_CURR_MAXDEPTHSAFE ; m_dMaxDepthSafe = MF_CURR_MAXDEPTHSAFE ;
} }
@@ -316,8 +312,6 @@ MachiningsMgr::LoadGeneral( Scanner& TheScanner, bool& bEnd)
bOk = FromString( sVal, m_dIntSawArcMaxSideAng) ; bOk = FromString( sVal, m_dIntSawArcMaxSideAng) ;
else if ( ToUpper( sKey) == MF_SPLITARCS) else if ( ToUpper( sKey) == MF_SPLITARCS)
bOk = FromString( sVal, m_nSplitArcs) ; bOk = FromString( sVal, m_nSplitArcs) ;
else if ( ToUpper( sKey) == MF_APPROX_LINTOL)
bOk = FromString( sVal, m_dApproxLinTol) ;
else if ( ToUpper( sKey) == MF_MAXDEPTHSAFE) else if ( ToUpper( sKey) == MF_MAXDEPTHSAFE)
bOk = FromString( sVal, m_dMaxDepthSafe) ; bOk = FromString( sVal, m_dMaxDepthSafe) ;
else else
@@ -505,10 +499,6 @@ MachiningsMgr::SaveGeneral( Writer& TheWriter) const
sOut = MF_MAXDEPTHSAFE + "=" + ToString( m_dMaxDepthSafe) ; sOut = MF_MAXDEPTHSAFE + "=" + ToString( m_dMaxDepthSafe) ;
bOk = bOk && TheWriter.OutText( sOut) ; bOk = bOk && TheWriter.OutText( sOut) ;
} }
if ( m_nDbVer >= 1013) {
sOut = MF_APPROX_LINTOL + "=" + ToString( m_dApproxLinTol) ;
bOk = bOk && TheWriter.OutText( sOut) ;
}
return bOk ; return bOk ;
} }
@@ -1185,20 +1175,6 @@ MachiningsMgr::SetSplitArcs( int nFlag)
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
MachiningsMgr::SetApproxLinTol( double dLinTol)
{
// verifico non sia inferiore al minimo
dLinTol = max( dLinTol, EPS_SMALL) ;
// se cambiato, salvo e setto modifica
if ( abs( dLinTol - m_dApproxLinTol) > EPS_SMALL) {
m_dApproxLinTol = dLinTol ;
m_bModified = true ;
}
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachiningsMgr::SetMaxDepthSafe( double dSafe) MachiningsMgr::SetMaxDepthSafe( double dSafe)
+2 -6
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2024 // EgalTech 2015-2015
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : MachiningsMgr.h Data : 29.03.24 Versione : 2.6d1 // File : MachiningsMgr.h Data : 02.06.15 Versione : 1.6f1
// Contenuto : Dichiarazione della classe MachiningsMgr. // Contenuto : Dichiarazione della classe MachiningsMgr.
// //
// //
@@ -79,9 +79,6 @@ class MachiningsMgr
bool SetSplitArcs( int nFlag) ; bool SetSplitArcs( int nFlag) ;
int GetSplitArcs( void) const int GetSplitArcs( void) const
{ return m_nSplitArcs ; } { return m_nSplitArcs ; }
bool SetApproxLinTol( double dLinTol) ;
double GetApproxLinTol( void) const
{ return m_dApproxLinTol ; }
bool SetMaxDepthSafe( double dSafe) ; bool SetMaxDepthSafe( double dSafe) ;
double GetMaxDepthSafe( void) const double GetMaxDepthSafe( void) const
{ return m_dMaxDepthSafe ; } { return m_dMaxDepthSafe ; }
@@ -134,6 +131,5 @@ class MachiningsMgr
double m_dExtSawArcMinRad ; double m_dExtSawArcMinRad ;
double m_dIntSawArcMaxSideAng ; double m_dIntSawArcMaxSideAng ;
int m_nSplitArcs ; int m_nSplitArcs ;
double m_dApproxLinTol ;
double m_dMaxDepthSafe ; double m_dMaxDepthSafe ;
} ; } ;
+845 -1852
View File
File diff suppressed because it is too large Load Diff
+13 -39
View File
@@ -85,7 +85,7 @@ class Milling : public Machining
bool AdjustPathDrawForSaw( int nClPathId) ; bool AdjustPathDrawForSaw( int nClPathId) ;
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) const ; bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) const ;
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ; bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
bool GenerateMillingPv( int nPathId, const ICurveComposite* pCompo, double dRbDist, double dDepth) ; bool GenerateMillingPv( int nPathId, const ICurveComposite* pCompo) ;
bool AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, bool AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ; double dDepth, double dElev, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, bool AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev,
@@ -96,26 +96,21 @@ class Milling : public Machining
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ; double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, bool AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ; double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bOutStart, bool bAboveStart, bool bFirst, bool bSplitArcs) ; 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 bFirst, bool bSplitArcs, bool bAddInsert = false) ;
bool AddDirectApproach( const Point3d& ptP, bool bSplitArcs) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bAboveEnd, bool bSplitArcs) ; 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 bAddExtract = false) ;
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) ;
@@ -124,14 +119,11 @@ class Milling : public Machining
bool AddTabsLine( const ICurveLine* pLine, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ; bool AddTabsLine( const ICurveLine* pLine, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
bool AddTabsArc( const ICurveArc* pArc, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ; bool AddTabsArc( const ICurveArc* pArc, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
double GetRadiusForStartEndElevation( bool bExtra = true) const ; double GetRadiusForStartEndElevation( bool bExtra = true) const ;
bool GetSimplePointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtRetr) const ; bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, double dSafeZ) const ;
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtRetr, double dSafeZ) const ;
bool GetPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool) const ; bool GetPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
bool GetPointBelowRaw( const Point3d& ptP, const Vector3d& vtTool) const ; bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU) ;
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) ; Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU) ;
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) const ; bool CalcOffset( ICurveComposite* pCompo, double dSignOffs) ;
bool CalcOffset( ICurveComposite* pCompo, double dSignOffs) const ;
bool TrimExtendCurveToClosedStm( ICurveComposite* pCompo, int nCstmId, bool bInvert) ;
private : private :
double GetSpeed() const double GetSpeed() const
@@ -153,18 +145,6 @@ 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
{ 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) ; }
double GetLeadInOutToler( void) const
{ return ( m_bTHoldFloating ? LIO_ELEV_FLOAT : LIO_ELEV_TOL) ; }
friend class LeadIOStatus ; friend class LeadIOStatus ;
private : private :
@@ -174,22 +154,16 @@ class Milling : public Machining
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
bool m_bTHoldFloating ; // flag di portautensili flottante
int m_nStatus ; // stato di aggiornamento della lavorazione int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nMills ; // numero di percorsi di lavoro generati int m_nMills ; // numero di percorsi di lavoro generati
bool m_bStepOn ; // flag per indicare che effettivamente si lavora a step bool m_bStepOn ; // flag per indicare che effettivamente si lavora a step
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
Vector3d m_vtStartDir ; // direzione iniziale del percorso in elaborazione
Vector3d m_vtEndDir ; // direzione finale del percorso in elaborazione
} ; } ;
+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)) ; }
+18 -47
View File
@@ -523,15 +523,13 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento // verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged && if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) { ( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione // confermo i percorsi di lavorazione
m_nMortises = nCurrMortises ; m_nMortises = nCurrMortises ;
string sLog = string( "Mortising apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ; LOG_DBG_INFO( GetEMkLogger(), "Mortising apply skipped : status already ok") ;
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente // eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply)) if ( ! Update( bPostApply))
return false ; return false ;
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ; LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo // esco con successo
return true ; return true ;
@@ -636,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) ;
@@ -646,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") ;
@@ -817,39 +812,15 @@ Mortising::UpdateToolData( bool* pbChanged)
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ; ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr) if ( pTMgr == nullptr)
return false ; return false ;
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome) // recupero l'utensile nel DB utensili
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) { if ( pTdata == nullptr)
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ; return false ;
if ( pTdata == nullptr) // verifico se sono diversi (ad esclusione del nome)
return false ; m_TParams.m_sName = pTdata->m_sName ;
m_Params.m_ToolUuid = m_TParams.m_Uuid ; bool bChanged = ! SameTool( m_TParams, *pTdata) ;
}
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri // 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 (" +
@@ -1022,7 +993,7 @@ Mortising::GetCurve( SelData Id)
else else
nToolDir = TOOL_PAR_SLANT ; nToolDir = TOOL_PAR_SLANT ;
int nFaceUse = ( m_Params.m_nFaceUse & 31) ; int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, V_NULL, m_TParams.m_dThick, 2) ; AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, m_TParams.m_dThick, 2) ;
// la restituisco // la restituisco
return Release( pCrvCompo) ; return Release( pCrvCompo) ;
} }
@@ -1325,7 +1296,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
return false ; return false ;
// eventuale imposizione massima elevazione da note utente // eventuale imposizione massima elevazione da note utente
double dMaxElev ; double dMaxElev ;
if ( GetValInNotes( m_Params.m_sUserNotes, "MaxElev", dMaxElev) && dElev > dMaxElev) if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxElev="), dMaxElev) && dElev > dMaxElev)
dElev = dMaxElev ; dElev = dMaxElev ;
// ingombro aggiuntivo da larghezza sega a catena quando inclinata rispetto al movimento // ingombro aggiuntivo da larghezza sega a catena quando inclinata rispetto al movimento
@@ -1336,7 +1307,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
// affondamento speciale da note utente (!!! da trasformare in parametro come gli altri !!!) // affondamento speciale da note utente (!!! da trasformare in parametro come gli altri !!!)
int nPlunge = 0 ; int nPlunge = 0 ;
GetValInNotes( m_Params.m_sUserNotes, "Plunge", nPlunge) ; FromString( ExtractInfo( m_Params.m_sUserNotes, "Plunge="), nPlunge) ;
// verifico che lo step dell'utensile sia sensato // verifico che lo step dell'utensile sia sensato
double dOkStep = ( nPlunge == MORTISE_PLUNGE_STEP ? m_Params.m_dStep : 0) ; double dOkStep = ( nPlunge == MORTISE_PLUNGE_STEP ? m_Params.m_dStep : 0) ;
@@ -1563,11 +1534,11 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
double dDelta = dElev - dDepth ; double dDelta = dElev - dDepth ;
// determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione // determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
double dSafeZ = GetSafeZ() + GetDeltaSafeZ( vtTool) ; 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) ;
@@ -1576,7 +1547,7 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
int nFirstFlag = ( bFirst ? 1 : 0) ; int nFirstFlag = ( bFirst ? 1 : 0) ;
SetFlag( nFirstFlag) ; SetFlag( nFirstFlag) ;
Point3d ptP1 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + dStartElev + dSafeZ) ; Point3d ptP1 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + dStartElev + dSafeZ) ;
int nStart = AddRapidStartOrMove( ptP1, bFirst) ; int nStart = ( bFirst ? AddRapidStart( ptP1) : AddRapidMove( ptP1)) ;
if ( nStart == GDB_ID_NULL) if ( nStart == GDB_ID_NULL)
return false ; return false ;
SetFlag( 0) ; SetFlag( 0) ;
@@ -1672,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)) ; }
+805 -2358
View File
File diff suppressed because it is too large Load Diff
+21 -148
View File
@@ -14,15 +14,14 @@
#pragma once #pragma once
#include "MachMgr.h"
#include "MachConst.h" #include "MachConst.h"
#include "MachineStruConst.h" #include "MachineStruConst.h"
#include "CamData.h"
#include "/EgtDev/Include/EGkPoint3d.h" #include "/EgtDev/Include/EGkPoint3d.h"
#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"
class MachMgr ;
class CamData ; class CamData ;
class ICurve ; class ICurve ;
class ICurveComposite ; class ICurveComposite ;
@@ -44,7 +43,7 @@ class Operation : public IUserObj
virtual int GetPhase( void) const virtual int GetPhase( void) const
{ return m_nPhase ; } { return m_nPhase ; }
virtual bool RemoveHome( void) ; virtual bool RemoveHome( void) ;
std::string GetName( void) const ; std::string GetName( void) const ;
public : public :
virtual int GetType( void) const = 0 ; virtual int GetType( void) const = 0 ;
@@ -62,98 +61,25 @@ class Operation : public IUserObj
{ return true ; } { return true ; }
virtual bool AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) const virtual bool AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) const
{ return true ; } { return true ; }
virtual bool NeedSplit( bool bSplit = true, bool bFeed = true) const
{ return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot())) ; }
virtual double GetMaxSplitLen( bool bSplit = true, bool bFeed = true) const
{ return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot()) ? ( bFeed ? 5 : 50) : 0) ; }
virtual double GetSafeZ( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 100 ; // MF_CURR_SAFEZ in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ; }
virtual double GetSafeAggrBottZ( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 10 ; // MF_CURR_SAFEAGGRBOTTZ in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ; }
virtual double GetExtraLOnCutRegion( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 0 ; // MF_CURR_EXTRALCR in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ; }
virtual double GetExtraROnDrillRegion( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 0 ; // MF_CURR_EXTRARDR in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetExtraROnDrillRegion() ; }
virtual double GetHoleDiamToler( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 10 * EPS_SMALL ; // MF_CURR_HOLEDTOL in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ; }
virtual double GetExtSawArcMinRad( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 200 ; // MF_CURR_EXTSAWARCMINRAD in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetExtSawArcMinRad() ; }
virtual double GetIntSawArcMaxSideAng( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 45 ; // MF_CURR_INTSAWARCMAXSIDEANG in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetIntSawArcMaxSideAng() ; }
virtual bool GetSplitArcs( const Vector3d& vtTool) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot() ||
m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return true ;
int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ;
return ( nSplitArcs == SPLAR_ALWAYS ||
( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtTool.IsZplus()) ||
( nSplitArcs == SPLAR_GEN_PLANE && vtTool.IsGeneric())) ; }
virtual double GetApproxLinTol( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 50 * EPS_SMALL ; // MF_APPROX_LINTOL in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetApproxLinTol() ; }
virtual double GetMaxDepthSafe( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 2 ; // MF_CURR_MAXDEPTHSAFE in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetMaxDepthSafe() ; }
protected : protected :
Operation( void) ; Operation( void) ;
protected :
struct Position {
int nSide ;
DBLVECTOR vAxis ;
int nFlag ;
int nFlag2 ;
int nMask ;
std::string sInfo ;
Position() : nSide( 0), nFlag( 0), nFlag2( 0), nMask( -1) {}
} ;
typedef std::vector<Position> POSVECTOR ;
protected : protected :
bool UpdateFollowingOperationsStatus( int nModif) ; bool UpdateFollowingOperationsStatus( int nModif) ;
bool GetElevation( int nPhase, const Point3d& ptP, bool GetElevation( int nPhase, const Point3d& ptP,
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& ptP, const Vector3d& vtTool, double dRad, double dLen, double dSafeDist,
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 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 GetAggrBottDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double dEncSafeH, 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 ;
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand, bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
@@ -163,21 +89,18 @@ 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 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, const Vector3d& vtFaceUse, bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, double dToolThick, int nGrade = 3) ;
double dToolThick, int nGrade = 3) ;
bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ; bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ;
bool ApproxWithLines( ICurveComposite* pCompo, bool bFeed = true) const ; bool ApproxWithLines( ICurveComposite* pCompo) const ;
bool VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) const ; bool VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) const ;
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 ;
@@ -193,64 +116,33 @@ 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 CalculateClPathCenterAxesValues( 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) ;
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
bool CalculateRotAxesValues( bool bFirst, const Vector3d& vtTool, const Vector3d& vtAux,
double dRot1W, bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec, DBLVECTOR& vAxRot) ;
bool VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec,
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal,
int nCnt, int nEntId, double dRot1W, int nMoveType, bool& bAdded, bool& bAxError) ;
bool CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ; bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
bool ManageProtectedAreas( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, Operation* pPrevOp, Operation* pNextOp, bool& bClimbDone) ; bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
bool AdjustOneStartEndMovement( 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 ;
bool AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, bool RemoveClimb( int nClPathId) ;
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "") ; bool AddRise( DBLVECTOR& vAxVal, double dDelta = - 1, int nClPathId = GDB_ID_NULL, bool bZHomeDown = false) ;
bool RemoveClimb( int nClPathId = GDB_ID_NULL) ; bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, int nFlag = 0) ;
bool AddRise( DBLVECTOR& vAxVal, double dDelta = NAN, int nClPathId = GDB_ID_NULL, int nToMinMaxZ = 0) ;
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL,
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "") ;
bool RemoveRise( int nClPathId = GDB_ID_NULL) ; bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
bool AddHome( void) ; bool AddHome( void) ;
bool RemoveClimbRiseHome( void) ;
bool AddRobotClimb( int nEntId, double dDeltaZ = NAN) ;
bool CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const Vector3d& vtA, double dDeltaZ,
DBLVECTOR& vAx, double* pdNewDeltaZ = nullptr) const ;
bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const ; bool 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 ;
double GetDeltaSafeZ( const Vector3d& vtTool) 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 ;
int SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ; bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ; bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, DBLVECTOR& vAxNew, bool& bModif) ;
bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nOutstroke, int nLinkType,
POSVECTOR& vNewPos) ;
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ; bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
bool IsAggrBottom( const std::string& sHead) const ;
private :
bool GetAxisMidForTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nAxisOrder, Machine* pMch,
DBLVECTOR& vAxMid) const ;
bool OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
Machine* pMch, const INTVECTOR& vRawId, const INTVECTOR& vFxtId) const ;
protected : protected :
int m_nOwnerId ; // identificativo dell'oggetto geometrico possessore int m_nOwnerId ; // identificativo dell'oggetto geometrico possessore
@@ -266,7 +158,6 @@ class Operation : public IUserObj
bool SetCorrAuxDir( const Vector3d& vtDir) ; bool SetCorrAuxDir( const Vector3d& vtDir) ;
bool SetFeed( double dFeed) ; bool SetFeed( double dFeed) ;
bool SetFlag( int nFlag) ; bool SetFlag( int nFlag) ;
bool SetFlagOnLastMove( int nFlag) ;
bool SetFlag2( int nFlag2) ; bool SetFlag2( int nFlag2) ;
bool SetIndex( int nIndex) ; bool SetIndex( int nIndex) ;
bool GetCurrPos( Point3d& ptCurr) const bool GetCurrPos( Point3d& ptCurr) const
@@ -281,26 +172,12 @@ class Operation : public IUserObj
int AddRapidStart( const Point3d& ptP, const std::string& sName) ; int AddRapidStart( const Point3d& ptP, const std::string& sName) ;
int AddRapidMove( const Point3d& ptP) ; int AddRapidMove( const Point3d& ptP) ;
int AddRapidMove( const Point3d& ptP, const std::string& sName) ; int AddRapidMove( const Point3d& ptP, const std::string& sName) ;
int AddRapidMove( const Point3d& ptP, bool bSplit) ;
int AddRapidMove( const Point3d& ptP, bool bSplit, const std::string& sName) ;
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst)
{ return ( bFirst ? AddRapidStart( ptP) : AddRapidMove( ptP)) ; }
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst, const std::string& sName)
{ return ( bFirst ? AddRapidStart( ptP, sName) : AddRapidMove( ptP, sName)) ; }
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst, bool bSplit)
{ return ( bFirst ? AddRapidStart( ptP) : AddRapidMove( ptP, bSplit)) ; }
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst, bool bSplit, const std::string& sName)
{ return ( bFirst ? AddRapidStart( ptP, sName) : AddRapidMove( ptP, bSplit, sName)) ; }
int AddLinearMove( const Point3d& ptP) ; int AddLinearMove( const Point3d& ptP) ;
int AddLinearMove( const Point3d& ptP, const std::string& sName) ; int AddLinearMove( const Point3d& ptP, const std::string& sName) ;
int AddLinearMove( const Point3d& ptP, bool bSplit) ;
int AddLinearMove( const Point3d& ptP, bool bSplit, const std::string& sName) ;
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN) ; int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN) ;
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, const std::string& sName) ; int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, const std::string& sName) ;
int AddCurveMove( const ICurve* pCrv) ; int AddCurveMove( const ICurve* pCrv, bool bOnlySimple = false) ;
int AddCurveMove( const ICurve* pCrv, const std::string& sName) ; int AddCurveMove( const ICurve* pCrv, const std::string& sName, bool bOnlySimple = false) ;
int AddCurveMove( const ICurve* pCrv, bool bSplit) ;
int AddCurveMove( const ICurve* pCrv, bool bSplit, const std::string& sName) ;
bool ResetMoveData( void) ; bool ResetMoveData( void) ;
protected : protected :
@@ -326,8 +203,4 @@ inline Operation* GetOperation( IUserObj* pUserObj)
// tipo posizione utensile // tipo posizione utensile
enum { TOOL_PARAL = 1, TOOL_ORTHO = 2, TOOL_ORTUP = 3, TOOL_PAR_SLANT= 4} ; enum { TOOL_PARAL = 1, TOOL_ORTHO = 2, TOOL_ORTUP = 3, TOOL_PAR_SLANT= 4} ;
// tipo di utilizzo contorno faccia // tipo di utilizzo contorno faccia
enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6, FACE_CONT = 7, FACE_VERSOR = 8} ; enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6, FACE_CONT = 7} ;
// risultato di SpecialTestCollisionAvoid
enum { SCAV_ERROR = -1, SCAV_COLLIDE = 0, SCAV_AVOID = 1, SCAV_TOTEST = 2} ;
// ordine di movimento assi nei link
enum { LKAO_INTERP = 0, LKAO_HEAD_BEFORE = -1, LKAO_HEAD_AFTER = +1, LKAO_HEAD_BOTH = 11} ;
+6 -123
View File
@@ -82,18 +82,6 @@ Operation::SetFlag( int nFlag)
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
Operation::SetFlagOnLastMove( int nFlag)
{
int nLastEntId = m_pGeomDB->GetLastInGroup( m_nPathId) ;
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nLastEntId)) ;
if ( pCamData == nullptr)
return false ;
pCamData->SetFlag( nFlag) ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Operation::SetFlag2( int nFlag2) Operation::SetFlag2( int nFlag2)
@@ -212,46 +200,6 @@ Operation::AddRapidMove( const Point3d& ptP, const string& sName)
return nId ; return nId ;
} }
//----------------------------------------------------------------------------
int
Operation::AddRapidMove( const Point3d& ptP, bool bSplit)
{
// se non richiesta spezzatura con massima lunghezza, emissione normale
if ( ! NeedSplit( bSplit))
return AddRapidMove( ptP) ;
// altrimenti opportuna spezzatura
Point3d ptS ;
if ( ! GetCurrPos( ptS))
return GDB_ID_NULL ;
double dLen = Dist( ptS, ptP) ;
double dStep = GetMaxSplitLen( true, false) ;
int nStep = int( dLen / dStep + 0.999) ;
int nFirstId = GDB_ID_NULL ;
for ( int i = 1 ; i <= nStep ; ++ i) {
int nId = AddRapidMove( Media( ptS, ptP, i * 1.0 / nStep)) ;
if ( nId == GDB_ID_NULL)
return GDB_ID_NULL ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nId ;
SetFlag( 0) ;
SetFlag2( 0) ;
}
return nFirstId ;
}
//----------------------------------------------------------------------------
int
Operation::AddRapidMove( const Point3d& ptP, bool bSplit, const string& sName)
{
int nFirstId = AddRapidMove( ptP, bSplit) ;
int nId = nFirstId ;
while ( nId != GDB_ID_NULL) {
m_pGeomDB->SetName( nId, sName) ;
nId = m_pGeomDB->GetNext( nId) ;
}
return nFirstId ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Operation::AddLinearMove( const Point3d& ptP) Operation::AddLinearMove( const Point3d& ptP)
@@ -310,44 +258,6 @@ Operation::AddLinearMove( const Point3d& ptP, const string& sName)
return nId ; return nId ;
} }
//----------------------------------------------------------------------------
int
Operation::AddLinearMove( const Point3d& ptP, bool bSplit)
{
// se non richiesta spezzatura con massima lunghezza, emissione normale
if ( ! NeedSplit( bSplit))
return AddLinearMove( ptP) ;
// altrimenti opportuna spezzatura
Point3d ptS ;
if ( ! GetCurrPos( ptS))
return GDB_ID_NULL ;
double dLen = Dist( ptS, ptP) ;
double dStep = GetMaxSplitLen( true, true) ;
int nStep = int( dLen / dStep + 0.999) ;
int nFirstId = GDB_ID_NULL ;
for ( int i = 1 ; i <= nStep ; ++ i) {
int nId = AddLinearMove( Media( ptS, ptP, i * 1.0 / nStep)) ;
if ( nId == GDB_ID_NULL)
return GDB_ID_NULL ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nId ;
}
return nFirstId ;
}
//----------------------------------------------------------------------------
int
Operation::AddLinearMove( const Point3d& ptP, bool bSplit, const string& sName)
{
int nFirstId = AddLinearMove( ptP, bSplit) ;
int nId = nFirstId ;
while ( nId != GDB_ID_NULL) {
m_pGeomDB->SetName( nId, sName) ;
nId = m_pGeomDB->GetNext( nId) ;
}
return nFirstId ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN) Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN)
@@ -424,7 +334,7 @@ Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Operation::AddCurveMove( const ICurve* pCrv) Operation::AddCurveMove( const ICurve* pCrv, bool bOnlySimple)
{ {
// verifico che la curva esista // verifico che la curva esista
if ( pCrv == nullptr) if ( pCrv == nullptr)
@@ -445,8 +355,8 @@ Operation::AddCurveMove( const ICurve* pCrv)
pArc->GetEndPoint( ptP3) ; pArc->GetEndPoint( ptP3) ;
return AddArcMove( ptP3, ptCen, dAngCen, vtN) ; return AddArcMove( ptP3, ptCen, dAngCen, vtN) ;
} }
// se arco o curva composita // se ammesse curve composite
else if ( pCrv->GetType() == CRV_ARC || pCrv->GetType() == CRV_COMPO) { else if ( ! bOnlySimple) {
// in ogni caso, converto in archi e rette // in ogni caso, converto in archi e rette
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ; PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( ! pCompo->AddCurve( *pCrv)) if ( ! pCompo->AddCurve( *pCrv))
@@ -485,43 +395,16 @@ Operation::AddCurveMove( const ICurve* pCrv)
} }
return nFirstId ; return nFirstId ;
} }
// altre curve non ammesse // altrimenti
else else
return GDB_ID_NULL ; return GDB_ID_NULL ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Operation::AddCurveMove( const ICurve* pCrv, const string& sName) Operation::AddCurveMove( const ICurve* pCrv, const string& sName, bool bOnlySimple)
{ {
int nFirstId = AddCurveMove( pCrv) ; int nFirstId = AddCurveMove( pCrv, bOnlySimple) ;
int nId = nFirstId ;
while ( nId != GDB_ID_NULL) {
m_pGeomDB->SetName( nId, sName) ;
nId = m_pGeomDB->GetNext( nId) ;
}
return nFirstId ;
}
//----------------------------------------------------------------------------
int
Operation::AddCurveMove( const ICurve* pCrv, bool bSplit)
{
// se non richiesta spezzatura, emissione normale
if ( ! bSplit)
return AddCurveMove( pCrv) ;
// altrimenti opportuna spezzatura
PtrOwner<ICurveComposite> pCompo ;
if ( ! pCompo.Set( ConvertCurveToComposite( pCrv->Clone())) || ! ApproxWithLines( pCompo))
return false ;
return AddCurveMove( pCompo) ;
}
//----------------------------------------------------------------------------
int
Operation::AddCurveMove( const ICurve* pCrv, bool bSplit, const string& sName)
{
int nFirstId = AddCurveMove( pCrv, bSplit) ;
int nId = nFirstId ; int nId = nFirstId ;
while ( nId != GDB_ID_NULL) { while ( nId != GDB_ID_NULL) {
m_pGeomDB->SetName( nId, sName) ; m_pGeomDB->SetName( nId, sName) ;
+4 -10
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2017-2024 // EgalTech 2017-2019
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : OperationConst.h Data : 22.05.24 Versione : 2.6e5 // File : OperationConst.h Data : 08.07.19 Versione : 2.1g2
// Contenuto : Costanti per le operazioni. // Contenuto : Costanti per le operazioni.
// //
// //
@@ -9,7 +9,6 @@
// Modifiche : 17.08.17 DS Creazione modulo. // Modifiche : 17.08.17 DS Creazione modulo.
// 25.05.19 DS Aggiunte SurfRoughing e SurfFinishing. // 25.05.19 DS Aggiunte SurfRoughing e SurfFinishing.
// 25.05.19 DS Aggiunta WaterJetting. // 25.05.19 DS Aggiunta WaterJetting.
// 22.05.24 DS Aggiunta FiveAxisMilling.
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -18,7 +17,6 @@
#include "/EgtDev/Include/EMkOperationConst.h" #include "/EgtDev/Include/EMkOperationConst.h"
#include <string> #include <string>
#define POCKETING_NT 0
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static const std::string s_OpeClass[] = {"", static const std::string s_OpeClass[] = {"",
@@ -34,8 +32,7 @@ static const std::string s_OpeClass[] = {"",
"EMkChiseling", "EMkChiseling",
"EMkSurfRoughing", "EMkSurfRoughing",
"EMkSurfFinishing", "EMkSurfFinishing",
"EMkWaterJetting", "EMkWaterJetting"} ;
"EMkFiveAxisMilling"} ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Dal tipo numerico restituisce la classe della operazione // Dal tipo numerico restituisce la classe della operazione
@@ -56,7 +53,6 @@ GetOperationClass( int nOpeType)
case OPER_SURFROUGHING : return s_OpeClass[11] ; case OPER_SURFROUGHING : return s_OpeClass[11] ;
case OPER_SURFFINISHING : return s_OpeClass[12] ; case OPER_SURFFINISHING : return s_OpeClass[12] ;
case OPER_WATERJETTING : return s_OpeClass[13] ; case OPER_WATERJETTING : return s_OpeClass[13] ;
case OPER_FIVEAXISMILLING : return s_OpeClass[14] ;
} }
return s_OpeClass[0] ; return s_OpeClass[0] ;
} }
@@ -92,8 +88,6 @@ GetOperationType( const std::string& sOpeClass)
return OPER_SURFFINISHING ; return OPER_SURFFINISHING ;
else if ( sOpeClass == s_OpeClass[13]) else if ( sOpeClass == s_OpeClass[13])
return OPER_WATERJETTING ; return OPER_WATERJETTING ;
else if ( sOpeClass == s_OpeClass[14])
return OPER_FIVEAXISMILLING ;
else else
return OPER_NULL ; return OPER_NULL ;
} }
+44 -169
View File
@@ -45,17 +45,12 @@ static const std::string GVAR_EMPTY = ".EMPTY" ; // (bool) flag disp
static const std::string GVAR_SBH = ".SBH" ; // (bool) flag disposizione con operazioni manuali static const std::string GVAR_SBH = ".SBH" ; // (bool) flag disposizione con operazioni manuali
static const std::string GVAR_TABNAME = ".TABNAME" ; // (string) nome tavola static const std::string GVAR_TABNAME = ".TABNAME" ; // (string) nome tavola
static const std::string GVAR_TABORI1 = ".TABORI1" ; // (Point3d) prima origine di tavola static const std::string GVAR_TABORI1 = ".TABORI1" ; // (Point3d) prima origine di tavola
static const std::string GVAR_TAIND = ".TAIND" ; // (int) indice asse tavola
static const std::string GVAR_TANAME = ".TANAME" ; // (string) nome asse tavola
static const std::string GVAR_TAPOS = ".TAPOS" ; // (double) posizione asse tavola
static const std::string GVAR_TAMOVED = ".TAMOVED" ; // (bool) flag asse tavola con movimento
static const std::string GVAR_FIXID = ".FIXID" ; // (int) identificativo bloccaggio (fixture) static const std::string GVAR_FIXID = ".FIXID" ; // (int) identificativo bloccaggio (fixture)
static const std::string GVAR_FIXIND = ".FIXIND" ; // (int) indice bloccaggio static const std::string GVAR_FIXIND = ".FIXIND" ; // (int) indice bloccaggio
static const std::string GVAR_FIXNAME = ".FIXNAME" ; // (string) nome bloccaggio static const std::string GVAR_FIXNAME = ".FIXNAME" ; // (string) nome bloccaggio
static const std::string GVAR_FIXPOS = ".FIXPOS" ; // (Point3d) posizione bloccaggio static const std::string GVAR_FIXPOS = ".FIXPOS" ; // (Point3d) posizione bloccaggio
static const std::string GVAR_FIXANG = ".FIXANG" ; // (num) angolo di rotazione bloccaggio static const std::string GVAR_FIXANG = ".FIXANG" ; // (num) angolo di rotazione bloccaggio
static const std::string GVAR_FIXMOB = ".FIXMOB" ; // (num) movimento eventuale parte mobile del bloccaggio static const std::string GVAR_FIXMOB = ".FIXMOB" ; // (num) movimento eventuale parte mobile del bloccaggio
static const std::string GVAR_FIXTAL = ".FIXTAL" ; // (string) nome dell'asse di tavola a cui è fissato
static const std::string GVAR_RAWID = ".RAWID" ; // (int) identificativo grezzo static const std::string GVAR_RAWID = ".RAWID" ; // (int) identificativo grezzo
static const std::string GVAR_RAWIND = ".RAWIND" ; // (int) indice movimento del grezzo static const std::string GVAR_RAWIND = ".RAWIND" ; // (int) indice movimento del grezzo
static const std::string GVAR_RAWTYPE = ".RAWTYPE" ; // (int) tipo di movimento del grezzo static const std::string GVAR_RAWTYPE = ".RAWTYPE" ; // (int) tipo di movimento del grezzo
@@ -65,8 +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_TFLOAT = ".TFLOAT" ; // (bool) flag per utensile flottante
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
@@ -96,7 +89,6 @@ static const std::string GVAR_PMAX = ".PMAX" ; // (Point3d) punto mas
static const std::string GVAR_PAXMIN = ".PAXMIN" ; // (double/s) minimo di ingombro degli assi del percorso di lavorazione static const std::string GVAR_PAXMIN = ".PAXMIN" ; // (double/s) minimo di ingombro degli assi del percorso di lavorazione
static const std::string GVAR_PAXMAX = ".PAXMAX" ; // (double/s) massimo di ingombro degli assi del percorso di lavorazione static const std::string GVAR_PAXMAX = ".PAXMAX" ; // (double/s) massimo di ingombro degli assi del percorso di lavorazione
static const std::string GVAR_ELEV = ".ELEV" ; // (double) massima elevazione static const std::string GVAR_ELEV = ".ELEV" ; // (double) massima elevazione
static const std::string GVAR_DRACEX = ".DRACEX" ; // (int/s) vettore delle uscite selezionate (per gruppi a forare)
static const std::string GVAR_AUXTOT = ".AUXTOT" ; // (int) numero totale dati ausiliari inizio/fine percorso di lavorazione static const std::string GVAR_AUXTOT = ".AUXTOT" ; // (int) numero totale dati ausiliari inizio/fine percorso di lavorazione
static const std::string GVAR_AUXIND = ".AUXIND" ; // (int) indice dato ausiliario inizio/fine percorso di lavorazione static const std::string GVAR_AUXIND = ".AUXIND" ; // (int) indice dato ausiliario inizio/fine percorso di lavorazione
static const std::string GVAR_AUX = ".AUX" ; // (string) dato ausiliario inizio/fine percorso di lavorazione static const std::string GVAR_AUX = ".AUX" ; // (string) dato ausiliario inizio/fine percorso di lavorazione
@@ -110,9 +102,6 @@ static const std::string GVAR_R1 = ".R1" ; // (num) valore de
static const std::string GVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante static const std::string GVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante
static const std::string GVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante static const std::string GVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante
static const std::string GVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante static const std::string GVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante
static const std::string GVAR_R5 = ".R5" ; // (num) valore del quinto asse rotante
static const std::string GVAR_R6 = ".R6" ; // (num) valore del sesto asse rotante
static const std::string GVAR_R7 = ".R7" ; // (num) valore del settimo asse rotante
static const std::string GVAR_C1 = ".C1" ; // (num) valore del primo asse lineare per centro arco static const std::string GVAR_C1 = ".C1" ; // (num) valore del primo asse lineare per centro arco
static const std::string GVAR_C2 = ".C2" ; // (num) valore del secondo asse lineare per centro arco static const std::string GVAR_C2 = ".C2" ; // (num) valore del secondo asse lineare per centro arco
static const std::string GVAR_C3 = ".C3" ; // (num) valore del terzo asse lineare per centro arco static const std::string GVAR_C3 = ".C3" ; // (num) valore del terzo asse lineare per centro arco
@@ -128,20 +117,6 @@ static const std::string GVAR_R1P = ".R1p" ; // (num) valore pr
static const std::string GVAR_R2P = ".R2p" ; // (num) valore precedente del secondo asse rotante static const std::string GVAR_R2P = ".R2p" ; // (num) valore precedente del secondo asse rotante
static const std::string GVAR_R3P = ".R3p" ; // (num) valore precedente del terzo asse rotante static const std::string GVAR_R3P = ".R3p" ; // (num) valore precedente del terzo asse rotante
static const std::string GVAR_R4P = ".R4p" ; // (num) valore precedente del quarto asse rotante static const std::string GVAR_R4P = ".R4p" ; // (num) valore precedente del quarto asse rotante
static const std::string GVAR_R5P = ".R5p" ; // (num) valore precedente del quinto asse rotante
static const std::string GVAR_R6P = ".R6p" ; // (num) valore precedente del sesto asse rotante
static const std::string GVAR_R7P = ".R7p" ; // (num) valore precedente del settimo asse rotante
static const std::string GVAR_MOVESUCC = ".MOVESUCC" ; // (int) tipo del movimento successivo (0,1,2,3)
static const std::string GVAR_L1S = ".L1s" ; // (num) valore successivo del primo asse lineare
static const std::string GVAR_L2S = ".L2s" ; // (num) valore successivo del secondo asse lineare
static const std::string GVAR_L3S = ".L3s" ; // (num) valore successivo del terzo asse lineare
static const std::string GVAR_R1S = ".R1s" ; // (num) valore successivo del primo asse rotante
static const std::string GVAR_R2S = ".R2s" ; // (num) valore successivo del secondo asse rotante
static const std::string GVAR_R3S = ".R3s" ; // (num) valore successivo del terzo asse rotante
static const std::string GVAR_R4S = ".R4s" ; // (num) valore successivo del quarto asse rotante
static const std::string GVAR_R5S = ".R5s" ; // (num) valore successivo del quinto asse rotante
static const std::string GVAR_R6S = ".R6s" ; // (num) valore successivo del sesto asse rotante
static const std::string GVAR_R7S = ".R7s" ; // (num) valore successivo del settimo asse rotante
static const std::string GVAR_L1T = ".L1t" ; // (string) token del primo asse lineare static const std::string GVAR_L1T = ".L1t" ; // (string) token del primo asse lineare
static const std::string GVAR_L2T = ".L2t" ; // (string) token del secondo asse lineare static const std::string GVAR_L2T = ".L2t" ; // (string) token del secondo asse lineare
static const std::string GVAR_L3T = ".L3t" ; // (string) token del terzo asse lineare static const std::string GVAR_L3T = ".L3t" ; // (string) token del terzo asse lineare
@@ -149,9 +124,6 @@ static const std::string GVAR_R1T = ".R1t" ; // (string) token del
static const std::string GVAR_R2T = ".R2t" ; // (string) token del secondo asse rotante static const std::string GVAR_R2T = ".R2t" ; // (string) token del secondo asse rotante
static const std::string GVAR_R3T = ".R3t" ; // (string) token del terzo asse rotante static const std::string GVAR_R3T = ".R3t" ; // (string) token del terzo asse rotante
static const std::string GVAR_R4T = ".R4t" ; // (string) token del quarto asse rotante static const std::string GVAR_R4T = ".R4t" ; // (string) token del quarto asse rotante
static const std::string GVAR_R5T = ".R5t" ; // (string) token del quinto asse rotante
static const std::string GVAR_R6T = ".R6t" ; // (string) token del sesto asse rotante
static const std::string GVAR_R7T = ".R7t" ; // (string) token del settimo asse rotante
static const std::string GVAR_C1T = ".C1t" ; // (string) token del primo asse lineare per centro arco static const std::string GVAR_C1T = ".C1t" ; // (string) token del primo asse lineare per centro arco
static const std::string GVAR_C2T = ".C2t" ; // (string) token del secondo asse lineare per centro arco static const std::string GVAR_C2T = ".C2t" ; // (string) token del secondo asse lineare per centro arco
static const std::string GVAR_C3T = ".C3t" ; // (string) token del terzo asse lineare per centro arco static const std::string GVAR_C3T = ".C3t" ; // (string) token del terzo asse lineare per centro arco
@@ -166,9 +138,6 @@ static const std::string GVAR_R1N = ".R1n" ; // (string) nome del
static const std::string GVAR_R2N = ".R2n" ; // (string) nome del secondo asse rotante static const std::string GVAR_R2N = ".R2n" ; // (string) nome del secondo asse rotante
static const std::string GVAR_R3N = ".R3n" ; // (string) nome del terzo asse rotante static const std::string GVAR_R3N = ".R3n" ; // (string) nome del terzo asse rotante
static const std::string GVAR_R4N = ".R4n" ; // (string) nome del quarto asse rotante static const std::string GVAR_R4N = ".R4n" ; // (string) nome del quarto asse rotante
static const std::string GVAR_R5N = ".R5n" ; // (string) nome del quinto asse rotante
static const std::string GVAR_R6N = ".R6n" ; // (string) nome del sesto asse rotante
static const std::string GVAR_R7N = ".R7n" ; // (string) nome del settimo asse rotante
static const std::string GVAR_MASK = ".MASK" ; // (int) mask associato ai movimenti in rapido static const std::string GVAR_MASK = ".MASK" ; // (int) mask associato ai movimenti in rapido
static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento
static const std::string GVAR_FLAG2 = ".FLAG2" ; // (int) secondo flag associato ad ogni movimento static const std::string GVAR_FLAG2 = ".FLAG2" ; // (int) secondo flag associato ad ogni movimento
@@ -191,10 +160,6 @@ static const std::string GVAR_SIMUISTAT = ".SIMUISTAT" ; // (num) stato sim
static const std::string GVAR_SAFEDIST = ".SAFEDIST" ; // (num) distanza di sicurezza per verifica di collisione static const std::string GVAR_SAFEDIST = ".SAFEDIST" ; // (num) distanza di sicurezza per verifica di collisione
static const std::string GVAR_SIMVMID = ".SIMVMID" ; // (int) identificativo grezzo Vmill in collisione static const std::string GVAR_SIMVMID = ".SIMVMID" ; // (int) identificativo grezzo Vmill in collisione
static const std::string GVAR_SIMCOBIND = ".SIMCOBIND" ; // (int) indice oggetto in collisione static const std::string GVAR_SIMCOBIND = ".SIMCOBIND" ; // (int) indice oggetto in collisione
static const std::string GVAR_MPSIM = ".MPSIM" ; // (bool) flag simulazione multiprocesso
static const std::string GVAR_MPSEST = ".MPSEST" ; // (string) path del file di stima speciale per simulazione multiprocesso
static const std::string GVAR_RECORD = ".RECORD" ; // (bool) flag modalità registrazione comandi in simulazione
static const std::string GVAR_OPERID = ".OPERID" ; // (int/s) identificativi ordinati operazioni per simulazione multiprocesso
// Funzioni generazione // Funzioni generazione
static const std::string ON_START = "OnStart" ; static const std::string ON_START = "OnStart" ;
static const std::string ON_END = "OnEnd" ; static const std::string ON_END = "OnEnd" ;
@@ -204,7 +169,6 @@ static const std::string ON_TOOL_DATA = "OnToolData" ;
static const std::string ON_DISPOSITION_START = "OnDispositionStart" ; static const std::string ON_DISPOSITION_START = "OnDispositionStart" ;
static const std::string ON_DISPOSITION_END = "OnDispositionEnd" ; static const std::string ON_DISPOSITION_END = "OnDispositionEnd" ;
static const std::string ON_TABLE_DATA = "OnTableData" ; static const std::string ON_TABLE_DATA = "OnTableData" ;
static const std::string ON_TABLE_AXIS_DATA = "OnTableAxisData" ;
static const std::string ON_FIXTURE_DATA = "OnFixtureData" ; static const std::string ON_FIXTURE_DATA = "OnFixtureData" ;
static const std::string ON_RAWMOVE_DATA = "OnRawMoveData" ; static const std::string ON_RAWMOVE_DATA = "OnRawMoveData" ;
static const std::string ON_TOOL_SELECT = "OnToolSelect" ; static const std::string ON_TOOL_SELECT = "OnToolSelect" ;
@@ -227,7 +191,6 @@ static const std::string ON_ESTIM_TOOL_DATA = "OnEstimToolData" ;
static const std::string ON_ESTIM_DISPOSITION_START = "OnEstimDispositionStart" ; static const std::string ON_ESTIM_DISPOSITION_START = "OnEstimDispositionStart" ;
static const std::string ON_ESTIM_DISPOSITION_END = "OnEstimDispositionEnd" ; static const std::string ON_ESTIM_DISPOSITION_END = "OnEstimDispositionEnd" ;
static const std::string ON_ESTIM_TABLE_DATA = "OnEstimTableData" ; static const std::string ON_ESTIM_TABLE_DATA = "OnEstimTableData" ;
static const std::string ON_ESTIM_TABLE_AXIS_DATA = "OnEstimTableAxisData" ;
static const std::string ON_ESTIM_FIXTURE_DATA = "OnEstimFixtureData" ; static const std::string ON_ESTIM_FIXTURE_DATA = "OnEstimFixtureData" ;
static const std::string ON_ESTIM_RAWMOVE_DATA = "OnEstimRawMoveData" ; static const std::string ON_ESTIM_RAWMOVE_DATA = "OnEstimRawMoveData" ;
static const std::string ON_ESTIM_TOOL_SELECT = "OnEstimToolSelect" ; static const std::string ON_ESTIM_TOOL_SELECT = "OnEstimToolSelect" ;
@@ -242,8 +205,6 @@ static const std::string ON_ESTIM_RAPID = "OnEstimRapid" ;
static const std::string ON_ESTIM_LINEAR = "OnEstimLinear" ; static const std::string ON_ESTIM_LINEAR = "OnEstimLinear" ;
static const std::string ON_ESTIM_ARC = "OnEstimArc" ; static const std::string ON_ESTIM_ARC = "OnEstimArc" ;
// Funzioni simulazione // Funzioni simulazione
static const std::string ON_SIMUL_INIT = "OnSimulInit" ;
static const std::string ON_SIMUL_EXIT = "OnSimulExit" ;
static const std::string ON_SIMUL_START = "OnSimulStart" ; static const std::string ON_SIMUL_START = "OnSimulStart" ;
static const std::string ON_SIMUL_END = "OnSimulEnd" ; static const std::string ON_SIMUL_END = "OnSimulEnd" ;
static const std::string ON_SIMUL_DISPOSITION_STARTING = "OnSimulDispositionStarting" ; static const std::string ON_SIMUL_DISPOSITION_STARTING = "OnSimulDispositionStarting" ;
@@ -265,150 +226,64 @@ static const std::string ON_RESET_MACHINE = "OnResetMachine" ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline std::string inline std::string
GetGlobVarAxisValue( int nAx, const std::string& sVar = GLOB_VAR, bool bIsRobot = false) GetGlobVarAxisValue( int nAx, const std::string& sVar = GLOB_VAR)
{ {
if ( ! bIsRobot) { switch ( nAx) {
switch ( nAx) { case 1 : return ( sVar + GVAR_L1) ;
case 1 : return ( sVar + GVAR_L1) ; case 2 : return ( sVar + GVAR_L2) ;
case 2 : return ( sVar + GVAR_L2) ; case 3 : return ( sVar + GVAR_L3) ;
case 3 : return ( sVar + GVAR_L3) ; case 4 : return ( sVar + GVAR_R1) ;
case 4 : return ( sVar + GVAR_R1) ; case 5 : return ( sVar + GVAR_R2) ;
case 5 : return ( sVar + GVAR_R2) ; case 6 : return ( sVar + GVAR_R3) ;
case 6 : return ( sVar + GVAR_R3) ; case 7 : return ( sVar + GVAR_R4) ;
case 7 : return ( sVar + GVAR_R4) ; default : return "" ;
default : return "" ; }
}
}
else {
switch ( nAx) {
case 1 : return ( sVar + GVAR_R1) ;
case 2 : return ( sVar + GVAR_R2) ;
case 3 : return ( sVar + GVAR_R3) ;
case 4 : return ( sVar + GVAR_R4) ;
case 5 : return ( sVar + GVAR_R5) ;
case 6 : return ( sVar + GVAR_R6) ;
case 7 : return ( sVar + GVAR_R7) ;
default : return "" ;
}
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline std::string inline std::string
GetGlobVarAxisPrev( int nAx, const std::string& sVar = GLOB_VAR, bool bIsRobot = false) GetGlobVarAxisPrev( int nAx, const std::string& sVar = GLOB_VAR)
{ {
if ( ! bIsRobot) { switch ( nAx) {
switch ( nAx) { case 1 : return ( sVar + GVAR_L1P) ;
case 1 : return ( sVar + GVAR_L1P) ; case 2 : return ( sVar + GVAR_L2P) ;
case 2 : return ( sVar + GVAR_L2P) ; case 3 : return ( sVar + GVAR_L3P) ;
case 3 : return ( sVar + GVAR_L3P) ; case 4 : return ( sVar + GVAR_R1P) ;
case 4 : return ( sVar + GVAR_R1P) ; case 5 : return ( sVar + GVAR_R2P) ;
case 5 : return ( sVar + GVAR_R2P) ; case 6 : return ( sVar + GVAR_R3P) ;
case 6 : return ( sVar + GVAR_R3P) ; case 7 : return ( sVar + GVAR_R4P) ;
case 7 : return ( sVar + GVAR_R4P) ; default : return "" ;
default : return "" ; }
}
}
else {
switch ( nAx) {
case 1 : return ( sVar + GVAR_R1P) ;
case 2 : return ( sVar + GVAR_R2P) ;
case 3 : return ( sVar + GVAR_R3P) ;
case 4 : return ( sVar + GVAR_R4P) ;
case 5 : return ( sVar + GVAR_R5P) ;
case 6 : return ( sVar + GVAR_R6P) ;
case 7 : return ( sVar + GVAR_R7P) ;
default : return "" ;
}
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline std::string inline std::string
GetGlobVarAxisNext( int nAx, const std::string& sVar = GLOB_VAR, bool bIsRobot = false) GetGlobVarAxisToken( int nAx)
{ {
if ( ! bIsRobot) { switch ( nAx) {
switch ( nAx) { case 1 : return ( GLOB_VAR + GVAR_L1T) ;
case 1 : return ( sVar + GVAR_L1S) ; case 2 : return ( GLOB_VAR + GVAR_L2T) ;
case 2 : return ( sVar + GVAR_L2S) ; case 3 : return ( GLOB_VAR + GVAR_L3T) ;
case 3 : return ( sVar + GVAR_L3S) ; case 4 : return ( GLOB_VAR + GVAR_R1T) ;
case 4 : return ( sVar + GVAR_R1S) ; case 5 : return ( GLOB_VAR + GVAR_R2T) ;
case 5 : return ( sVar + GVAR_R2S) ; case 6 : return ( GLOB_VAR + GVAR_R3T) ;
case 6 : return ( sVar + GVAR_R3S) ; case 7 : return ( GLOB_VAR + GVAR_R4T) ;
case 7 : return ( sVar + GVAR_R4S) ; default : return "" ;
default : return "" ; }
}
}
else {
switch ( nAx) {
case 1 : return ( sVar + GVAR_R1S) ;
case 2 : return ( sVar + GVAR_R2S) ;
case 3 : return ( sVar + GVAR_R3S) ;
case 4 : return ( sVar + GVAR_R4S) ;
case 5 : return ( sVar + GVAR_R5S) ;
case 6 : return ( sVar + GVAR_R6S) ;
case 7 : return ( sVar + GVAR_R7S) ;
default : return "" ;
}
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline std::string inline std::string
GetGlobVarAxisToken( int nAx, bool bIsRobot = false) GetGlobVarAxisName( int nAx)
{ {
if ( ! bIsRobot) { switch ( nAx) {
switch ( nAx) { case 1 : return ( GLOB_VAR + GVAR_L1N) ;
case 1 : return ( GLOB_VAR + GVAR_L1T) ; case 2 : return ( GLOB_VAR + GVAR_L2N) ;
case 2 : return ( GLOB_VAR + GVAR_L2T) ; case 3 : return ( GLOB_VAR + GVAR_L3N) ;
case 3 : return ( GLOB_VAR + GVAR_L3T) ; case 4 : return ( GLOB_VAR + GVAR_R1N) ;
case 4 : return ( GLOB_VAR + GVAR_R1T) ; case 5 : return ( GLOB_VAR + GVAR_R2N) ;
case 5 : return ( GLOB_VAR + GVAR_R2T) ; case 6 : return ( GLOB_VAR + GVAR_R3N) ;
case 6 : return ( GLOB_VAR + GVAR_R3T) ; case 7 : return ( GLOB_VAR + GVAR_R4N) ;
case 7 : return ( GLOB_VAR + GVAR_R4T) ; default : return "" ;
default : return "" ; }
}
}
else {
switch ( nAx) {
case 1 : return ( GLOB_VAR + GVAR_R1T) ;
case 2 : return ( GLOB_VAR + GVAR_R2T) ;
case 3 : return ( GLOB_VAR + GVAR_R3T) ;
case 4 : return ( GLOB_VAR + GVAR_R4T) ;
case 5 : return ( GLOB_VAR + GVAR_R5T) ;
case 6 : return ( GLOB_VAR + GVAR_R6T) ;
case 7 : return ( GLOB_VAR + GVAR_R7T) ;
default : return "" ;
}
}
}
//----------------------------------------------------------------------------
inline std::string
GetGlobVarAxisName( int nAx, bool bIsRobot = false)
{
if ( ! bIsRobot) {
switch ( nAx) {
case 1 : return ( GLOB_VAR + GVAR_L1N) ;
case 2 : return ( GLOB_VAR + GVAR_L2N) ;
case 3 : return ( GLOB_VAR + GVAR_L3N) ;
case 4 : return ( GLOB_VAR + GVAR_R1N) ;
case 5 : return ( GLOB_VAR + GVAR_R2N) ;
case 6 : return ( GLOB_VAR + GVAR_R3N) ;
case 7 : return ( GLOB_VAR + GVAR_R4N) ;
default : return "" ;
}
}
else {
switch ( nAx) {
case 1 : return ( GLOB_VAR + GVAR_R1N) ;
case 2 : return ( GLOB_VAR + GVAR_R2N) ;
case 3 : return ( GLOB_VAR + GVAR_R3N) ;
case 4 : return ( GLOB_VAR + GVAR_R4N) ;
case 5 : return ( GLOB_VAR + GVAR_R5N) ;
case 6 : return ( GLOB_VAR + GVAR_R6N) ;
case 7 : return ( GLOB_VAR + GVAR_R7N) ;
default : return "" ;
}
}
} }
+4308 -1955
View File
File diff suppressed because it is too large Load Diff
+67 -43
View File
@@ -19,6 +19,7 @@
#include "/EgtDev/Include/EGkCurveComposite.h" #include "/EgtDev/Include/EGkCurveComposite.h"
#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"
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class Pocketing : public Machining class Pocketing : public Machining
@@ -68,38 +69,64 @@ class Pocketing : public Machining
private : private :
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ; bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ; bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen = nullptr) ; bool SetCurveAllTempProp( int nCrvId, ICurve* pCurve) ;
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 ICurveComposite* pCompo) ; bool GeneratePocketingPv( int nPathId, const ISurfFlatRegion* pSrfPock) ;
bool AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dOkStep, bool bSplitArcs, int nPathId) ; bool ModifyCurveToSmooted( ICurveComposite* pCrvOffset, double dRightPer, double dleftPer) ;
bool CalcZigZag( const ICurveComposite* pOffs, ICRVCOMPOPOVECTOR& vpCrvs) ;
bool OptimizedZigZag( int nPathId, const Vector3d& vtTool, double dDepth, double dSafeZ, // ===== ZigZag =====
Frame3d& frPocket, bool& bOptimizedZigZag, ICRVCOMPOPOVECTOR& vpCrvs, double& dOffs) ; bool AddZigZag( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev, double dOkStep,
bool ZigZagOptimizedNoClosedEdges( ICurveComposite* pCrvPocket, bool& bOptimizedZigZag, Vector3d& vtDir, double& dOffs) ; bool bSplitArcs, int nPathId) ;
bool ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClosedId, bool& bOptimizedZigZag, Vector3d& vtDir, double& dOffs) ; bool CalcZigZag( const ISurfFlatRegion* pSrfZigZag, ICRVCOMPOPOVECTOR& vpCrvs) ;
bool CalcBoundedZigZagLink( ICurveLine* pCrv1, ICurveLine* pCrv2, ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink, int nIndexCut = 3) ;
bool OptimizedZigZag( ISurfFlatRegion* pSrf, const Vector3d & vtTool, double dDepth, double dSafeZ, Frame3d & frPocket, bool & bOptimizedZigZag,
ICRVCOMPOPOVECTOR & vpCrvs) ;
bool ZigZagOptimizedNoClosedEdges( ICurveComposite* pCrvPocket, bool& bOptimizedZigZag, Vector3d& vtDir) ;
bool ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClosedId, bool& bOptimizedZigZag, Vector3d& vtDir) ;
bool ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag, bool ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag,
bool& bOpposite, Vector3d& vtDir, double& dOffs) ; bool& bOpposite, Vector3d& vtDir) ;
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( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr, bool GetUnclearedRegion( ICRVCOMPOPOVECTOR& vFirstOffs, ICRVCOMPOPOVECTOR& vCrvs, ICURVEPOVECTOR& vLinks, ISurfFlatRegion* pSrfToCut) ;
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ; // ==================
bool AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bMidOpen, // ==== OneWay ======
const Point3d& ptMidOpen, const Vector3d& vtMidOut, int nPathId) ; bool AddOneWay( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr, // ==================
double dDepth, double dElev, double dOkStep, bool bSplitArcs, int nPathId) ;
bool CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs, // ==== SpiralIn/Out ====
ICurveComposite* pMCrv, ICurveComposite* pRCrv, int nPathId, bool& bOptimizedTrap) ; bool AddSpiralIn( const ISurfFlatRegion* pSrfPock, const PNTVECTOR vPtStart, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth,
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const ICurve* pCrvBound, double dElev, double dOkStep, bool bSplitArcs, BOOLVECTOR vbMidOpen, PNTVECTOR vPtMidOpen, VCT3DVECTOR vVtMidOut, int nPathId) ;
ICurveComposite* pCrvLink) ; bool AddSpiralOut( const ISurfFlatRegion* pSrfpock, const PNTVECTOR vPtStart, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev,
double dOkStep, bool bSplitArcs, int nPathId) ;
bool CalcSpiral( const ISurfFlatRegion* pSrfChunk, int nReg, Point3d ptStart, bool bSplitArcs, ICurveComposite* pMCrv, ICurveComposite* pRCrv, int nPathId,
bool& bOptimizedTrap) ;
bool RemoveExtraParts( ISurfFlatRegion* pSrfToCut, ICRVCOMPOPOVECTOR& vOffs, ICRVCOMPOPOVECTOR& vOffsClosedCurves, ICRVCOMPOPOVECTOR& vOffsFirstCurve,
ICURVEPOVECTOR& vLinks) ;
bool RemoveExtraPartByMedialAxis( ISurfFlatRegion* pChunkToCut, ICRVCOMPOPOVECTOR& vOffsFirstCurve, int& nOptFlag, Point3d& ptCentroid,
ICurveComposite* pCrvPath) ;
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink) ;
bool CalcBoundedSmootedLink( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd, double dParMeet,
ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink) ;
bool ModifyBiArc( ICurve* pCrvBiArc, double dCutToll, ICurveComposite* pNewCrv) ;
bool CutCurveByOffsets( ICurveComposite* pCurve, ICRVCOMPOPOVECTOR& vOffs) ;
bool GetCurveWeightInfo( ICurveComposite* pCrvCompo, double dMaxLen, double& dToTRot, int& nSmallArcs, int& nSmallLines) ;
bool ChoosePath( ICurveComposite* pCrv1, ICurveComposite* pCrv2, int nP, double dPerP, double dMaxLen, int& nC) ;
bool CutCurveToConnect( ICurveComposite* pCrvS, ICurveComposite* pCrvE, ICRVCOMPOPOVECTOR& vOffs, ICRVCOMPOPOVECTOR& vOffIslands,
ICurveComposite* pCrvLink, double dLenPercS = 0.01, double dLenPercE = 0.01, int nMaxIter = 2) ;
bool GetNewCurvetWithCentroid( ICurveComposite* pCrvH1, ICurveComposite* pCrvH2, Point3d& ptC, bool bCir, ICRVCOMPOPOVECTOR& VFirstOff,
ICurveComposite* pCrvNewCurve) ;
bool GetNewCurvetWithPath( ICurveComposite* pCrvH1, ICurveComposite* pCrvH2, ICurveComposite* pCrvPath, ICRVCOMPOPOVECTOR& VFirstOff, ICRVCOMPOPOVECTOR& VoffsCl,
ICurveComposite* pCrvNewCurve) ;
bool ManageSmoothAndAutoInters( ICurveComposite* pCrv, ICurveComposite* pCrvPath, ICurveComposite* pPath1, ICurveComposite* pPath2, ICRVCOMPOPOVECTOR& vOffsCL) ;
bool 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,
@@ -112,35 +139,33 @@ class Pocketing : public Machining
bool SpecialAdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, const ICurveComposite* pCrvPocket) ; bool SpecialAdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, 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& bIsOutsideRaw) ; bool ComputeTrapezoidSpiralLeadInLeadOut( ICurveComposite * pCompo, const Vector3d& vtMainDir, bool bLeadIn, const Vector3d& vtTool, double dDepth,
bool& bIsOutsideRaw) ;
// ==================
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ; bool 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,
double dElev, double dAppr, bool bSplitArcs, bool bOutStart) ; double dElev, double dAppr, bool bOutStart) ;
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bSplitArcs, bool bOutStart = false) ; double dElev, double dAppr, bool bOutStart = false) ;
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bSplitArcs) ; double dElev, double dAppr) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bSplitArcs) ; double dElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN, bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
const ICurveComposite* pRCrv, Point3d& ptP1) const ; const ICurveComposite* pRCrv, Point3d& ptP1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN, bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
const ICurveComposite* pCompo, 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, const ICurveComposite* pRCrv, bool bSplitArcs, Point3d& ptP1, double& dElev, bool bNoneForced = false) ;
Point3d& ptP1, double& dElev) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced,
Point3d& ptP1, double& dElev, bool& bOppositeHome) ;
double GetRadiusForStartEndElevation( void) const ; double GetRadiusForStartEndElevation( void) const ;
bool GetForcedClosed( void) ;
bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ; bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ;
bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ; bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ;
bool AdjustContourStart( ICurveComposite* pCompo) ; bool AdjustContourStart( ICurveComposite* pCompo) ;
bool VerifyLeadInHelix( const ICurveComposite* pCompo, const Point3d& ptCen, double dRad) const ; bool VerifyLeadInHelix( ISurfFlatRegion* pSrfChunk, const Point3d& ptCen, double dRad) const ;
bool VerifyLeadInZigZag( const ICurveComposite* pCompo, const Point3d& ptPa, const Point3d& ptPb) 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) ; bool CalcDistanceFromRawSurface( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist, Vector3d& vtNorm) ;
private : private :
@@ -166,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) &&
@@ -187,11 +212,10 @@ class Pocketing : public Machining
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
double m_dOpenMinSafe ; // minima distanza di sicurezza di attacco su lato aperto POLYLINEVECTOR m_VplIsland ; // vettore che contiene le curve che descrivono le isole
} ; } ;
+1 -2
View File
@@ -397,8 +397,7 @@ bool
PocketingData::VerifySubType( int nVal) const PocketingData::VerifySubType( int nVal) const
{ {
return ( nVal == POCKET_SUB_ZIGZAG || nVal == POCKET_SUB_ONEWAY || return ( nVal == POCKET_SUB_ZIGZAG || nVal == POCKET_SUB_ONEWAY ||
nVal == POCKET_SUB_SPIRALIN || nVal == POCKET_SUB_SPIRALOUT || nVal == POCKET_SUB_SPIRALIN || nVal == POCKET_SUB_SPIRALOUT) ;
nVal == POCKET_SUB_CONFORMAL_ZIGZAG || nVal == POCKET_SUB_CONFORMAL_ONEWAY) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
+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)) ; }
-3969
View File
File diff suppressed because it is too large Load Diff
-198
View File
@@ -1,198 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2017-2017
//----------------------------------------------------------------------------
// File :Pocketing.h Data : 04.02.17 Versione : 1.8b1
// Contenuto : Dichiarazione della classe Pocketing.
//
//
//
// Modifiche : 04.02.17 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Machining.h"
#include "PocketingData.h"
#include "ToolData.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
// struttura informazioni sui singoli percorsi
struct PathInfoPO {
bool bOutStart ; // flag per entrata da fuori
bool bSingleCrv ; // se percorso formato da una curva singola ( in generale per SubSteps)
bool bOptTrap ; // flag per casi ottimizzati a trapezio ( per Spiral)
bool bIsZigZagOneWayBorder ; // curve di bordo dei lati chiusi ( per ZigZag e OneWay)
PtrOwner<ICurveComposite> pCrvPath ; // percorso del centro utensile
PtrOwner<ICurveComposite> pCrvRet ; // curva di ritorno per LeadIn/Out a guida
} ;
// tipo percorso
typedef std::vector<PathInfoPO> PATHINFOPOVECTOR ;
// struttura informazioni per Step/SubSteps complessivi
struct StepInfoPO {
double dDepth ; // profondità dello step attuale
double dRelativeDepth ; // profondità relativa allo step al di sopra
PtrOwner<ISurfFlatRegion> pSfrPock ; // regione piana di svuotatura
PtrOwner<ISurfFlatRegion> pSfrLimit ; // regione piana da non svuotare
PATHINFOPOVECTOR vPaths ; // percorsi di Pocketing
} ;
// tipo step
typedef std::vector<StepInfoPO> STEPINFOPOVECTOR ;
//----------------------------------------------------------------------------
class PocketingNT : public Machining
{
public : // IUserObj
PocketingNT* Clone( void) const override ;
const std::string& GetClassName( void) const override ;
bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
bool ToSave( void) const override
{ return true ; }
bool Save( int nBaseId, STRVECTOR& vString) const override ;
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
public : // Operation
int GetType( void) const override
{ return OPER_POCKETING ; }
bool IsEmpty( void) const override
{ return ( m_nPockets == 0) ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
protected : // Operation
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
public : // Machining
bool Prepare( const std::string& sMillName) override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool SetGeometry( const SELVECTOR& vIds) override ;
bool Preview( bool bRecalc) override ;
bool Apply( bool bRecalc, bool bPostApply) override ;
bool Update( bool bPostApply) override ;
bool GetParam( int nType, bool& bVal) const override ;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
public :
PocketingNT( void) ;
private :
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen = nullptr) ;
bool SetSfrLoopsAllTempProp( int nSfrId, ISurfFlatRegion* pSfr) ;
bool ResetCurveAllTempProp( ICurve* pCurve) ;
bool Chain( int nGrpDestId) ;
ISurfTriMesh* GetRaw( void) ;
ISurfTriMesh* GetExtrusionStm( const ISurfFlatRegion* pSfr, const Vector3d& vtTrasl, const Vector3d& vtExtr) ;
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) ;
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmExtrusion) ;
bool CalcLimitRegion( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrRaw, ISurfFlatRegion* pSfrLimit) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dLen, double& dElev) ;
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
bool GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) ;
bool CalcPaths( STEPINFOPOVECTOR& vStepInfo) ;
bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dElev, double dStep, bool bSplitArcs) ;
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) ;
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;
bool AddEpicycles( ICurveComposite * pCompo, ICurveComposite * pCrv, ICurveComposite * pCrvBound = nullptr) ;
bool CalcBoundedLinkWithBiArcs( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd,
const ICurve* pCrvBound, ICurveComposite* pCrvLink) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bSplitArcs, bool bOutStart) ;
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bSplitArcs, bool bOutStart = false) ;
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bSplitArcs) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bSplitArcs) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtTool, const ICurveComposite* pCrvPath, Point3d& ptP1) ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
const ISurfFlatRegion* pSfr, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
bool bNoneForced, bool bSkipControl) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1) ;
double GetRadiusForStartEndElevation( void) ;
bool GetForcedClosed( void) ;
bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ;
bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ;
bool AdjustContourStart( ICurveComposite* pCompo) ;
bool CheckSafetyLinearLink( const Point3d& ptCurr, const ISurfFlatRegion* pSfrLimit, const Vector3d& vtTool,
const Point3d& ptDest, bool& bSafe) ;
bool VerifyLeadInHelix( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptCen, double dHelixRad) ;
bool VerifyLeadInZigZag( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptPa, const Point3d& ptPb) ;
bool CalcDistanceFromRawSurface( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist, Vector3d& vtNorm) ;
// debug
void _debug_draw_sfr( const ISurfFlatRegion* pSfr, bool bUniform) ;
void _debug_draw_loop( const ICurveComposite* pCrvCompo, bool bUniform) ;
private :
double GetSpeed( void) const
{ return ( IsNullAngValue( m_Params.m_dSpeed) ? m_TParams.m_dSpeed : m_Params.m_dSpeed) ; }
double GetFeed( void) const
{ return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
double GetStartFeed( void) const
{ return ( IsNullLenValue( m_Params.m_dStartFeed) ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
double GetEndFeed( void) const
{ return ( IsNullLenValue( m_Params.m_dEndFeed) ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
double GetTipFeed( void) const
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
double GetOffsL( void) const
{ return ( IsUnknownValue( m_Params.m_dOffsL) ? m_TParams.m_dOffsL : m_Params.m_dOffsL) ; }
double GetOffsR( void) const
{ return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
double GetSideStep( void) const
{ return Clamp( m_Params.m_dSideStep, std::min( 0.1 * m_TParams.m_dDiam, 1.0), m_TParams.m_dDiam) ; }
int GetLeadInType( void) const
{ if ( m_Params.m_dLiTang < std::min( 0.1 * m_TParams.m_dDiam, 1.0))
return POCKET_LI_NONE ;
if ( m_Params.m_nLeadInType != POCKET_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL)
return POCKET_LI_NONE ;
return m_Params.m_nLeadInType ; }
bool LeadInRawIsOk( void) const
{ if ( m_TParams.m_nType != TT_MILL_NOTIP)
return true ;
return (( GetLeadInType() == POCKET_LI_ZIGZAG || GetLeadInType() == POCKET_LI_HELIX) &&
m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
int GetLeadOutType( void) const
{ if ( m_Params.m_dLoTang < std::min( 0.1 * m_TParams.m_dDiam, 1.0))
return POCKET_LO_NONE ;
return m_Params.m_nLeadOutType ; }
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
PocketingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
double m_dTHoldBase ; // posizione base del porta-utensile
double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile
double m_dMaxHelixRad ; // raggio massimo attacco ad elica nel caso di cerchi
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nPockets ; // numero di percorsi di svuotatura generati
bool m_bTiltingTab ; // flag utilizzo tavola basculante
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
bool m_bAboveHead ; // flag utilizzo testa da sopra
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
bool m_bOpenOutRaw ; // flag forzatura lati aperti sempre fuori dal grezzo
double m_dOpenMinSafe ; // minima distanza di sicurezza di attacco su lato aperto
bool _m_Debug = false ; // _debug
} ;
+37 -161
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 ;
} }
@@ -171,7 +165,7 @@ Processor::VerifySetup( void)
string sErr = "Error with setup :" ; string sErr = "Error with setup :" ;
for ( const auto& sTmp : vsErr) for ( const auto& sTmp : vsErr)
sErr += " " + sTmp ; sErr += " " + sTmp ;
m_pMchMgr->SetLastError( 1002, sErr) ; m_pMchMgr->SetLastError( 1001, sErr) ;
return false ; return false ;
} }
@@ -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))
@@ -207,7 +201,7 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
return false ; return false ;
// Se utensile non definito o cambiato, emetto selezione nuovo utensile // Se utensile non definito o cambiato, emetto selezione nuovo utensile
if ( m_sTool.empty() || m_sTool != m_sPrevTool) { if ( m_sTool.empty() || m_sTool != m_sPrevTool) {
if ( ! OnToolSelect( sTool, sHead, nExit, sTcPos, false)) if ( ! OnToolSelect( sTool, sHead, nExit, sTcPos))
return false ; return false ;
} }
} }
@@ -224,38 +218,6 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
if ( ! OnTableData( sTable, ptOri1)) if ( ! OnTableData( sTable, ptOri1))
return false ; return false ;
// Recupero assi tavola mossi nella disposizione
INTVECTOR vMovAxId ;
for ( int i = 0 ; ; ++ i) {
string sName ;
double dPos ;
if ( pDisp->GetMoveAxisData( i, sName, dPos)) {
int nAxId = m_pMachine->GetAxisId( sName) ;
if ( nAxId != GDB_ID_NULL)
vMovAxId.emplace_back( nAxId) ;
}
else
break ;
}
// Emetto posizioni assi di tavola
INTVECTOR vAxisId ;
m_pMachine->GetAllAxesIds( vAxisId) ;
int nTableId = m_pMachine->GetTableId( sTable) ;
int nInd = 0 ;
for ( int nAxId : vAxisId) {
string sName ;
double dPos ;
if ( m_pMachine->IsDispositionAxis( nAxId, nTableId) &&
m_pMachine->GetAxisName( nAxId, sName) &&
m_pMachine->GetAxisPos( sName, dPos)) {
++ nInd ;
bool bMoved = ( std::find( vMovAxId.begin(), vMovAxId.end(), nAxId) != vMovAxId.end()) ;
if ( ! OnTableAxisData( nInd, sName, dPos, bMoved))
return false ;
}
}
// Emetto dati bloccaggi // Emetto dati bloccaggi
for ( int i = 0 ; ; ++ i) { for ( int i = 0 ; ; ++ i) {
string sName ; string sName ;
@@ -263,9 +225,8 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
Point3d ptPos ; Point3d ptPos ;
double dAngDeg ; double dAngDeg ;
double dMov ; double dMov ;
string sTaLink ; if ( pDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov)) {
if ( pDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov, sTaLink)) { if ( ! OnFixtureData( nId, i + 1, sName, ptPos, dAngDeg, dMov))
if ( ! OnFixtureData( nId, i + 1, sName, ptPos, dAngDeg, dMov, sTaLink))
return false ; return false ;
} }
else else
@@ -279,7 +240,7 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
Point3d ptPos ; Point3d ptPos ;
int nFlag ; int nFlag ;
if ( pDisp->GetMoveRawData( i, nRawId, nType, ptPos, nFlag)) { if ( pDisp->GetMoveRawData( i, nRawId, nType, ptPos, nFlag)) {
if ( ! OnRawMoveData( nRawId, i + 1, nType, ptPos, nFlag)) if ( ! OnRawMoveData( nRawId, i + 1, nType, ptPos, nFlag))
return false ; return false ;
} }
else else
@@ -355,8 +316,7 @@ Processor::ProcessMachining( int nOpId, int nOpInd)
m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, nExit) ; m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, nExit) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TCPOS, sTcPos) ; m_pMchMgr->TdbGetCurrToolParam( TPA_TCPOS, sTcPos) ;
} }
bool bFloating = m_pMachine->IsCurrToolFloating() ; if ( ! OnToolSelect( sTool, sHead, nExit, sTcPos))
if ( ! OnToolSelect( sTool, sHead, nExit, sTcPos, bFloating))
return false ; return false ;
} }
@@ -420,15 +380,11 @@ Processor::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
// Recupero massima elevazione // Recupero massima elevazione
double dElev = 0 ; double dElev = 0 ;
m_pGeomDB->GetInfo( nClPathId, KEY_ELEV, dElev) ; m_pGeomDB->GetInfo( nClPathId, KEY_ELEV, dElev) ;
// recupero eventuale attivazione uscite (gruppi a forare)
INTVECTOR vActiveExit ;
m_pGeomDB->GetInfo( nClPathId, KEY_DRACEX, vActiveExit) ;
// Recupero il numero di eventi ausiliari iniziali // Recupero il numero di eventi ausiliari iniziali
int nAS = 0 ; int nAS = 0 ;
m_pGeomDB->GetInfo( nClPathId, KEY_AS_TOT, nAS) ; m_pGeomDB->GetInfo( nClPathId, KEY_AS_TOT, nAS) ;
// Emetto inizio percorso di lavoro // Emetto inizio percorso di lavoro
if ( ! OnPathStart( nClPathId, nClPathInd, nAS, ptStart, ptEnd, vtExtr, if ( ! OnPathStart( nClPathId, nClPathInd, nAS, ptStart, ptEnd, vtExtr, ptMin, ptMax, vAxMin, vAxMax, dElev))
ptMin, ptMax, vAxMin, vAxMax, dElev, vActiveExit))
return false ; return false ;
// Emissione eventuali dati ausiliari di inizio // Emissione eventuali dati ausiliari di inizio
@@ -452,7 +408,7 @@ Processor::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
// processo l'entità // processo l'entità
if ( ! ProcessClEnt( nEntId, nEntInd, nClPathId, nClPathInd, nOpId, nOpInd)) if ( ! ProcessClEnt( nEntId, nEntInd, nClPathId, nClPathInd, nOpId, nOpInd))
bOk = false ; bOk = false ;
// passo all'entità successiva // passo all'entità successivo
nEntId = m_pGeomDB->GetNext( nEntId) ; nEntId = m_pGeomDB->GetNext( nEntId) ;
} }
@@ -487,24 +443,19 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
if ( pCamData == nullptr || pCamData->GetAxesStatus() != CamData::AS_OK) if ( pCamData == nullptr || pCamData->GetAxesStatus() != CamData::AS_OK)
return false ; return false ;
const DBLVECTOR& AxesEnd = pCamData->GetAxesVal() ; const DBLVECTOR& AxesEnd = pCamData->GetAxesVal() ;
int nMove = pCamData->GetMoveType() ;
// Recupero i dati Cam del movimento successivo del percorso (se esiste)
CamData* pNextCamData = GetCamData( m_pGeomDB->GetUserObj( m_pGeomDB->GetNext( nEntId))) ;
int nMoveNext = ( pNextCamData != nullptr ? pNextCamData->GetMoveType() : -1) ;
DBLVECTOR AxesNull ;
const DBLVECTOR& AxesNext = ( pNextCamData != nullptr ? pNextCamData->GetAxesVal() : AxesNull) ;
// Emetto movimento // Emetto movimento
int nMove = pCamData->GetMoveType() ;
switch ( nMove) { switch ( nMove) {
case 0 : // rapido case 0 : // rapido
if ( ! OnRapid( nEntId, nEntInd, nMove, AxesEnd, pCamData->GetAxesMask(), if ( ! OnRapid( nEntId, nEntInd, nMove, AxesEnd, pCamData->GetAxesMask(),
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(), pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext)) pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
return false ; return false ;
break ; break ;
case 1 : // linea case 1 : // linea
if ( ! OnLinear( nEntId, nEntInd, nMove, AxesEnd, if ( ! OnLinear( nEntId, nEntInd, nMove, AxesEnd,
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(), pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext)) pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
return false ; return false ;
break ; break ;
case 2 : // arco CW case 2 : // arco CW
@@ -514,7 +465,7 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
if ( ! OnArc( nEntId, nEntInd, nMove, AxesEnd, if ( ! OnArc( nEntId, nEntInd, nMove, AxesEnd,
pCamData->GetAxesCen(), ptMid, pCamData->GetAxesRad(), pCamData->GetAxesAngCen(), pCamData->GetAxesCen(), ptMid, pCamData->GetAxesRad(), pCamData->GetAxesAngCen(),
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(), pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext)) pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
return false ; return false ;
break ; break ;
} }
@@ -564,8 +515,8 @@ bool
Processor::UpdateAxes( void) Processor::UpdateAxes( void)
{ {
// Carico i nomi degli assi macchina attivi // Carico i nomi degli assi macchina attivi
return m_pMachine->GetAllCurrAxesNames( m_AxesName) && return m_pMachine->GetAllCurrAxesName( m_AxesName) &&
m_pMachine->GetAllCurrAxesTokens( m_AxesToken) ; m_pMachine->GetAllCurrAxesToken( m_AxesToken) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -619,7 +570,7 @@ Processor::OnProgramStart( const string& sMachName, const string& sCncFile, cons
// apro il file di output // apro il file di output
bool bOk = m_pMachine->WriterOpen( sCncFile) ; bool bOk = m_pMachine->WriterOpen( sCncFile) ;
if ( ! bOk) if ( ! bOk)
m_pMchMgr->SetLastError( 1003, "Error opening Cnc file") ; m_pMchMgr->SetLastError( 1002, "Error opening Cnc file") ;
// assegno nome macchina // assegno nome macchina
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MACHNAME, sMachName) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MACHNAME, sMachName) ;
// assegno nome file // assegno nome file
@@ -652,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 ;
@@ -661,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 ;
@@ -686,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) ;
@@ -725,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) ;
@@ -734,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) ;
@@ -774,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) ;
@@ -844,24 +790,10 @@ Processor::OnTableData( const string& sName, const Point3d& ptOri1)
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
bool
Processor::OnTableAxisData( int nAxisInd, const string& sName, double dPos, bool bMoved)
{
// assegno dati movimento asse di tavola
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TAIND, nAxisInd) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TANAME, sName) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TAPOS, dPos) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TAMOVED, bMoved) ;
// chiamo la funzione di gestione dati movimento asse di tavola
bOk = bOk && CallOnTableAxisData() ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Processor::OnFixtureData( int nFixId, int nFixInd, const string& sName, const Point3d& ptPos, Processor::OnFixtureData( int nFixId, int nFixInd, const string& sName, const Point3d& ptPos,
double dAngDeg, double dMov, const string& sTaLink) double dAngDeg, double dMov)
{ {
// assegno dati bloccaggio // assegno dati bloccaggio
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXID, nFixId) ; bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXID, nFixId) ;
@@ -870,10 +802,6 @@ Processor::OnFixtureData( int nFixId, int nFixInd, const string& sName, const Po
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXPOS, ptPos) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXPOS, ptPos) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXANG, dAngDeg) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXANG, dAngDeg) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXMOB, dMov) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXMOB, dMov) ;
if ( ! IsEmptyOrSpaces( sTaLink))
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXTAL, sTaLink) ;
else
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_FIXTAL) ;
// chiamo la funzione di gestione dati bloccaggio // chiamo la funzione di gestione dati bloccaggio
bOk = bOk && CallOnFixtureData() ; bOk = bOk && CallOnFixtureData() ;
return bOk ; return bOk ;
@@ -881,11 +809,11 @@ Processor::OnFixtureData( int nFixId, int nFixInd, const string& sName, const Po
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Processor::OnRawMoveData( int nRawId, int nRawMoveInd, int nType, const Point3d& ptPos, int nFlag) Processor::OnRawMoveData( int nRawId, int RawMoveInd, int nType, const Point3d& ptPos, int nFlag)
{ {
// assegno dati bloccaggio // assegno dati bloccaggio
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWID, nRawId) ; bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWID, nRawId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWIND, nRawMoveInd) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWIND, RawMoveInd) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWTYPE, nType) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWTYPE, nType) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWPOS, ptPos) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWPOS, ptPos) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWFLAG, nFlag) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWFLAG, nFlag) ;
@@ -896,25 +824,23 @@ Processor::OnRawMoveData( int nRawId, int nRawMoveInd, int nType, const Point3d&
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Processor::OnToolSelect( const string& sTool, const string& sHead, int nExit, const string& sTcPos, bool bFloating) Processor::OnToolSelect( const string& sTool, const string& sHead, int nExit, const string& sTcPos)
{ {
// assegno il nome dell'utensile, la testa, l'uscita e l'eventuale posizione nel toolchanger // assegno il nome dell'utensile, la testa, l'uscita e l'eventuale posizione nel toolchanger
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TOOL, sTool) ; bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TOOL, sTool) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_HEAD, sHead) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_HEAD, sHead) ;
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) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TFLOAT, bFloating) ;
// assegno il token e il nome degli assi // assegno il token e il nome degli assi
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
int nNumAxes = int( m_AxesName.size()) ; int nNumAxes = int( m_AxesName.size()) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) { for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes) { if ( i <= nNumAxes) {
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisToken( i, bIsRobot), m_AxesToken[i-1]) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisToken(i), m_AxesToken[i-1]) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisName( i, bIsRobot), m_AxesName[i-1]) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisName(i), m_AxesName[i-1]) ;
} }
else { else {
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisToken( i, bIsRobot)) ; bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisToken(i)) ;
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisName( i, bIsRobot)) ; bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisName(i)) ;
} }
} }
// chiamo la funzione di selezione utensile // chiamo la funzione di selezione utensile
@@ -973,7 +899,7 @@ Processor::OnMachiningEnd( void)
bool bool
Processor::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd, Processor::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax, const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev)
{ {
// assegno identificativo e indice percorso di lavorazione // assegno identificativo e indice percorso di lavorazione
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ; bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
@@ -992,8 +918,6 @@ Processor::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& p
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PAXMAX, vAxMax) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PAXMAX, vAxMax) ;
// assegno la massima elevazione // assegno la massima elevazione
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ELEV, dElev) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ELEV, dElev) ;
// assegno uscite attive per gruppi a forare
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DRACEX, vActiveExit) ;
// chiamo la funzione di inizio percorso di lavorazione // chiamo la funzione di inizio percorso di lavorazione
bOk = bOk && CallOnPathStart() ; bOk = bOk && CallOnPathStart() ;
return bOk ; return bOk ;
@@ -1038,7 +962,7 @@ Processor::OnPathEndAux( int nInd, const string& sAE)
bool bool
Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask, Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) int nFlag, int nFlag2, int nIndex)
{ {
// cancello variabili estranee // cancello variabili estranee
ResetArcData() ; ResetArcData() ;
@@ -1048,13 +972,12 @@ Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd
// assegno il tipo di movimento // assegno il tipo di movimento
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
// assegno il valore degli assi // assegno il valore degli assi
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
int nNumAxes = int( AxesEnd.size()) ; int nNumAxes = int( AxesEnd.size()) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) { for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes) if ( i <= nNumAxes)
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot), AxesEnd[i-1]) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue(i), AxesEnd[i-1]) ;
else else
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot)) ; bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue(i)) ;
} }
// assegno la mascheratura degli assi // assegno la mascheratura degli assi
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MASK, nAxesMask) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MASK, nAxesMask) ;
@@ -1070,21 +993,6 @@ Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
// assegno il valore dell'indice // assegno il valore dell'indice
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
if ( nMoveNext != -1) {
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes)
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot), AxesNext[i-1]) ;
else
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
}
else {
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_MOVESUCC) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i)
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
// chiamo la funzione di movimento in rapido // chiamo la funzione di movimento in rapido
bOk = bOk && CallOnRapid() ; bOk = bOk && CallOnRapid() ;
return bOk ; return bOk ;
@@ -1094,7 +1002,7 @@ Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd
bool bool
Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) double dFeed, int nFlag, int nFlag2, int nIndex)
{ {
// cancello variabili estranee // cancello variabili estranee
ResetArcData() ; ResetArcData() ;
@@ -1104,13 +1012,12 @@ Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEn
// assegno il tipo di movimento // assegno il tipo di movimento
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
// assegno il valore degli assi // assegno il valore degli assi
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
int nNumAxes = int( AxesEnd.size()) ; int nNumAxes = int( AxesEnd.size()) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) { for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes) if ( i <= nNumAxes)
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot), AxesEnd[i-1]) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue(i), AxesEnd[i-1]) ;
else else
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot)) ; bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue(i)) ;
} }
// assegno il valore del versore utensile // assegno il valore del versore utensile
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIR, vtTool) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIR, vtTool) ;
@@ -1126,21 +1033,6 @@ Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEn
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
// assegno il valore dell'indice // assegno il valore dell'indice
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
if ( nMoveNext != -1) {
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes)
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot), AxesNext[i-1]) ;
else
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
}
else {
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_MOVESUCC) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i)
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
// chiamo la funzione di movimento in rapido // chiamo la funzione di movimento in rapido
bOk = bOk && CallOnLinear() ; bOk = bOk && CallOnLinear() ;
return bOk ; return bOk ;
@@ -1151,7 +1043,7 @@ bool
Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen, const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) double dFeed, int nFlag, int nFlag2, int nIndex)
{ {
// assegno Id e indice entità di movimento // assegno Id e indice entità di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ; bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ;
@@ -1159,13 +1051,12 @@ Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
// assegno il tipo di movimento // assegno il tipo di movimento
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
// assegno il valore degli assi // assegno il valore degli assi
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
int nNumAxes = int( AxesEnd.size()) ; int nNumAxes = int( AxesEnd.size()) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) { for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes) if ( i <= nNumAxes)
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot), AxesEnd[i-1]) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue(i), AxesEnd[i-1]) ;
else else
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot)) ; bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue(i)) ;
} }
// assegno le coordinate del centro // assegno le coordinate del centro
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_C1, ptCen.x) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_C1, ptCen.x) ;
@@ -1193,21 +1084,6 @@ Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
// assegno il valore dell'indice // assegno il valore dell'indice
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
if ( nMoveNext != -1) {
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes)
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot), AxesNext[i-1]) ;
else
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
}
else {
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_MOVESUCC) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i)
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
// chiamo la funzione di movimento in rapido // chiamo la funzione di movimento in rapido
bOk = bOk && CallOnArc() ; bOk = bOk && CallOnArc() ;
return bOk ; return bOk ;
+7 -9
View File
@@ -42,34 +42,33 @@ class Processor
bool OnProgramStart( const std::string& sMachName, const std::string& sCncFile, const std::string& sInfo, bool bSetup) ; bool OnProgramStart( const std::string& sMachName, const std::string& sCncFile, const std::string& sInfo, bool bSetup) ;
bool OnProgramEnd( void) ; bool OnProgramEnd( void) ;
bool ProcessToolData( void) ; bool ProcessToolData( void) ;
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos, bool bFloating) ; bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos) ;
bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos) ; bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos) ;
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase, bool bEmpty, bool bSomeByHand) ; bool OnDispositionStart( int nOpId, int nOpInd, int nPhase, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionEnd( void) ; bool OnDispositionEnd( void) ;
bool OnTableData( const std::string& sName, const Point3d& ptOri1) ; bool OnTableData( const std::string& sName, const Point3d& ptOri1) ;
bool OnTableAxisData( int nAxisInd, const std::string& sName, double dPos, bool bMoved) ;
bool OnFixtureData( int nFixId, int nFixInd, const std::string& sName, bool OnFixtureData( int nFixId, int nFixInd, const std::string& sName,
const Point3d& ptPos, double dAngDeg, double dMov, const std::string& sTaLink) ; const Point3d& ptPos, double dAngDeg, double dMov) ;
bool OnRawMoveData( int nRawId, int nRawMoveInd, int nType, const Point3d& ptPos, int nFlag) ; bool OnRawMoveData( int nRawId, int RawMoveInd, int nType, const Point3d& ptPos, int nFlag) ;
bool OnMachiningStart( int nOpId, int nOpInd, double dSpeed, const Point3d& ptMin, const Point3d& ptMax, bool OnMachiningStart( int nOpId, int nOpInd, double dSpeed, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ; const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
bool OnMachiningEnd( void) ; bool OnMachiningEnd( void) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd, bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax, const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ; const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev) ;
bool OnPathEnd( int nAE) ; bool OnPathEnd( int nAE) ;
bool OnPathStartAux( int nInd, const std::string& sAS) ; bool OnPathStartAux( int nInd, const std::string& sAS) ;
bool OnPathEndAux( int nInd, const std::string& sAE) ; bool OnPathEndAux( int nInd, const std::string& sAE) ;
bool OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask, bool OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ; int nFlag, int nFlag2, int nIndex) ;
bool OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, bool OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ; double dFeed, int nFlag, int nFlag2, int nIndex) ;
bool OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, bool OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen, const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ; double dFeed, int nFlag, int nFlag2, int nIndex) ;
bool ResetArcData( void) ; bool ResetArcData( void) ;
protected : protected :
@@ -81,7 +80,6 @@ class Processor
virtual bool CallOnDispositionStart( void) = 0 ; virtual bool CallOnDispositionStart( void) = 0 ;
virtual bool CallOnDispositionEnd( void) = 0 ; virtual bool CallOnDispositionEnd( void) = 0 ;
virtual bool CallOnTableData( void) = 0 ; virtual bool CallOnTableData( void) = 0 ;
virtual bool CallOnTableAxisData( void) = 0 ;
virtual bool CallOnFixtureData( void) = 0 ; virtual bool CallOnFixtureData( void) = 0 ;
virtual bool CallOnRawMoveData( void) = 0 ; virtual bool CallOnRawMoveData( void) = 0 ;
virtual bool CallOnToolSelect( void) = 0 ; virtual bool CallOnToolSelect( void) = 0 ;
+28 -69
View File
@@ -498,15 +498,13 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento // verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged && if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) { ( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione // confermo i percorsi di lavorazione
m_nCuts = nCurrCuts ; m_nCuts = nCurrCuts ;
string sLog = string( "SawFinishing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ; LOG_DBG_INFO( GetEMkLogger(), "SawFinishing apply skipped : status already ok") ;
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente // eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply)) if ( ! Update( bPostApply))
return false ; return false ;
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ; LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo // esco con successo
return true ; return true ;
@@ -609,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) ;
@@ -796,39 +791,15 @@ SawFinishing::UpdateToolData( bool* pbChanged)
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ; ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr) if ( pTMgr == nullptr)
return false ; return false ;
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome) // recupero l'utensile nel DB utensili
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) { if ( pTdata == nullptr)
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ; return false ;
if ( pTdata == nullptr) // verifico se sono diversi (ad esclusione del nome)
return false ; m_TParams.m_sName = pTdata->m_sName ;
m_Params.m_ToolUuid = m_TParams.m_Uuid ; bool bChanged = ! SameTool( m_TParams, *pTdata) ;
}
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri // 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 (" +
@@ -988,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 ;
@@ -1331,7 +1302,7 @@ SawFinishing::CalculateStraightAcrossToolPath( int nAuxId, int nClId)
// se ZigZag aggiungo risalita // se ZigZag aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG) { if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG) {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// aggiungo retrazione // aggiungo retrazione
@@ -1593,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 ;
@@ -1652,7 +1611,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
double dEndElev = 0 ; double dEndElev = 0 ;
GetElevation( m_nPhase, ptPrev, vtPrev, dEndElev) ; GetElevation( m_nPhase, ptPrev, vtPrev, dEndElev) ;
// aggiungo retrazione // aggiungo retrazione
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
if ( ! AddRetract( ptPrev, vtPrev, dSafeZ, dEndElev, dAppr)) if ( ! AddRetract( ptPrev, vtPrev, dSafeZ, dEndElev, dAppr))
return false ; return false ;
@@ -1676,7 +1635,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
// se ZigZag aggiungo risalita // se ZigZag aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG) { if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG) {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// recupero punto e versore correzione finali // recupero punto e versore correzione finali
@@ -1995,7 +1954,7 @@ SawFinishing::CalcAlongVerticalCuts( ICurve* pSect, int nUmin, int nUmax, const
// se ZigZag e non centrato aggiungo risalita // se ZigZag e non centrato aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) { if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// aggiungo retrazione // aggiungo retrazione
@@ -2082,7 +2041,7 @@ SawFinishing::CalcAlongStdCuts( ICurve* pSect, double dUmin, double dUmax,
// se ZigZag e non centrato aggiungo risalita // se ZigZag e non centrato aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) { if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// aggiungo retrazione // aggiungo retrazione
@@ -2100,7 +2059,7 @@ SawFinishing::CalcAlongOneWayCut( const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bVert) const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bVert)
{ {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
@@ -2149,7 +2108,7 @@ SawFinishing::CalcAlongZigZagCut( const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bVert, bool bFirst) const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bVert, bool bFirst)
{ {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
@@ -2266,7 +2225,7 @@ SawFinishing::CalcAcrossOneWayCut( const PolyLine& PL, const Vector3d& vtMove,
const Vector3d& vtTool, const Vector3d& vtCorr, double dRawZ, double dDepth) const Vector3d& vtTool, const Vector3d& vtCorr, double dRawZ, double dDepth)
{ {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
@@ -2323,7 +2282,7 @@ SawFinishing::CalcAcrossZigZagCut( const PolyLine& PL, const Vector3d& vtMove,
const Vector3d& vtTool, const Vector3d& vtCorr, double dRawZ, double dDepth, bool bFirst) const Vector3d& vtTool, const Vector3d& vtCorr, double dRawZ, double dDepth, bool bFirst)
{ {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
@@ -2407,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) ;
@@ -2431,7 +2390,7 @@ SawFinishing::CalcCurvedAlongVerticalCuts( ICurve* pSect, int nUmin, int nUmax,
// se ZigZag e non centrato aggiungo risalita // se ZigZag e non centrato aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) { if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// aggiungo retrazione // aggiungo retrazione
@@ -2482,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) ;
@@ -2506,7 +2465,7 @@ SawFinishing::CalcCurvedAlongStdCuts( ICurve* pSect, double dUmin, double dUmax,
// se ZigZag e non centrato aggiungo risalita // se ZigZag e non centrato aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) { if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// aggiungo retrazione // aggiungo retrazione
@@ -2524,7 +2483,7 @@ bool
SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTool, bool bVert, bool bFirst, double& dEndElev) SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTool, bool bVert, bool bFirst, double& dEndElev)
{ {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// verifico se passata da invertire (indice dispari) // verifico se passata da invertire (indice dispari)
@@ -2700,7 +2659,7 @@ SawFinishing::CalcCurvedAcrossZigZagCut( const PolyLine& PL, const Vector3d& vtM
bool bFirst, bool bCorner) bool bFirst, bool bCorner)
{ {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
+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)) ; }
+16 -45
View File
@@ -481,15 +481,13 @@ SawRoughing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento // verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged && if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) { ( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione // confermo i percorsi di lavorazione
m_nCuts = nCurrCuts ; m_nCuts = nCurrCuts ;
string sLog = string( "SawRoughing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ; LOG_DBG_INFO( GetEMkLogger(), "SawRoughing apply skipped : status already ok") ;
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente // eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply)) if ( ! Update( bPostApply))
return false ; return false ;
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ; LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo // esco con successo
return true ; return true ;
@@ -573,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) ;
@@ -754,39 +749,15 @@ SawRoughing::UpdateToolData( bool* pbChanged)
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ; ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr) if ( pTMgr == nullptr)
return false ; return false ;
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome) // recupero l'utensile nel DB utensili
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) { if ( pTdata == nullptr)
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ; return false ;
if ( pTdata == nullptr) // verifico se sono diversi (ad esclusione del nome)
return false ; m_TParams.m_sName = pTdata->m_sName ;
m_Params.m_ToolUuid = m_TParams.m_Uuid ; bool bChanged = ! SameTool( m_TParams, *pTdata) ;
}
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri // 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 (" +
@@ -946,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 ;
@@ -1336,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 ;
@@ -1566,7 +1537,7 @@ SawRoughing::CalculateOneWayCut( const Point3d& ptStart, const Point3d& ptEnd, c
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast) const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast)
{ {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
@@ -1660,7 +1631,7 @@ SawRoughing::CalculateZigZagCut( const Point3d& ptStart, const Point3d& ptEnd, c
int& nCount) int& nCount)
{ {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
@@ -1871,7 +1842,7 @@ SawRoughing::CalculateCurvedZigZagCut( const ICurve* pCut, const Vector3d& vtToo
int& nCount) int& nCount)
{ {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// verifico se passata da invertire (indice dispari) // verifico se passata da invertire (indice dispari)
+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)) ; }
+107 -213
View File
@@ -4,7 +4,7 @@
// File : Sawing.cpp Data : 24.10.15 Versione : 1.6j3 // File : Sawing.cpp Data : 24.10.15 Versione : 1.6j3
// Contenuto : Implementazione gestione tagli con lama. // Contenuto : Implementazione gestione tagli con lama.
// //
// Note : Questa lavorazione è sempre espressa nel riferimento globale. // Note : Questa lavorazione è sempre espressa nel riferimento globale.
// //
// Modifiche : 07.06.15 DS Creazione modulo. // Modifiche : 07.06.15 DS Creazione modulo.
// //
@@ -16,7 +16,6 @@
#include "MachMgr.h" #include "MachMgr.h"
#include "DllMain.h" #include "DllMain.h"
#include "Sawing.h" #include "Sawing.h"
#include "GeoConst.h"
#include "OperationConst.h" #include "OperationConst.h"
#include "/EgtDev/Include/EXeCmdLogOff.h" #include "/EgtDev/Include/EXeCmdLogOff.h"
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
@@ -99,7 +98,6 @@ Sawing::Clone( void) const
pSaw->m_nPhase = m_nPhase ; pSaw->m_nPhase = m_nPhase ;
pSaw->m_Params = m_Params ; pSaw->m_Params = m_Params ;
pSaw->m_TParams = m_TParams ; pSaw->m_TParams = m_TParams ;
pSaw->m_bDownSE = m_bDownSE ;
pSaw->m_nStatus = m_nStatus ; pSaw->m_nStatus = m_nStatus ;
pSaw->m_nCuts = m_nCuts ; pSaw->m_nCuts = m_nCuts ;
} }
@@ -213,7 +211,6 @@ Sawing::Sawing( void)
m_Params.m_sToolName = "*" ; m_Params.m_sToolName = "*" ;
m_TParams.m_sName = "*" ; m_TParams.m_sName = "*" ;
m_TParams.m_sHead = "*" ; m_TParams.m_sHead = "*" ;
m_bDownSE = false ;
m_nStatus = MCH_ST_TO_VERIFY ; m_nStatus = MCH_ST_TO_VERIFY ;
m_nCuts = 0 ; m_nCuts = 0 ;
} }
@@ -535,15 +532,15 @@ Sawing::SetParam( int nType, const string& sVal)
bool bool
Sawing::SetGeometry( const SELVECTOR& vIds) Sawing::SetGeometry( const SELVECTOR& vIds)
{ {
// verifico validità gestore DB geometrico // verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// reset della geometria corrente // reset della geometria corrente
m_vId.clear() ; m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili // verifico che gli identificativi rappresentino delle entità ammissibili
int nType = GEO_NONE ; int nType = GEO_NONE ;
for ( const auto& Id : vIds) { for ( const auto& Id : vIds) {
// test sull'entità // test sull'entità
int nSubs ; int nSubs ;
if ( ! VerifyGeometry( Id, nSubs, nType)) { if ( ! VerifyGeometry( Id, nSubs, nType)) {
string sInfo = "Warning in Sawing : Skipped entity " + ToString( Id) ; string sInfo = "Warning in Sawing : Skipped entity " + ToString( Id) ;
@@ -566,14 +563,14 @@ Sawing::Preview( bool bRecalc)
// reset numero tagli nella lavorazione // reset numero tagli nella lavorazione
m_nCuts = 0 ; m_nCuts = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo // verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId)) if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ; return false ;
// recupero gruppo per geometria ausiliaria // recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ; int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
bool bChain = false ; bool bChain = false ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
if ( nAuxId == GDB_ID_NULL) { if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ; nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL) if ( nAuxId == GDB_ID_NULL)
@@ -606,7 +603,7 @@ Sawing::Preview( bool bRecalc)
// recupero gruppo per anteprima di lavorazione (PreView) // recupero gruppo per anteprima di lavorazione (PreView)
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ; int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
if ( nPvId == GDB_ID_NULL) { if ( nPvId == GDB_ID_NULL) {
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ; nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nPvId == GDB_ID_NULL) if ( nPvId == GDB_ID_NULL)
@@ -636,7 +633,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
int nCurrCuts = m_nCuts ; int nCurrCuts = m_nCuts ;
m_nCuts = 0 ; m_nCuts = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo // verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId)) if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ; return false ;
@@ -649,15 +646,13 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento // verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged && if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) { ( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione // confermo i percorsi di lavorazione
m_nCuts = nCurrCuts ; m_nCuts = nCurrCuts ;
string sLog = string( "Sawing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ; LOG_DBG_INFO( GetEMkLogger(), "Sawing apply skipped : status already ok") ;
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente // eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply)) if ( ! Update( bPostApply))
return false ; return false ;
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ; LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo // esco con successo
return true ; return true ;
@@ -667,7 +662,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria ausiliaria // recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ; int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
bool bChain = false ; bool bChain = false ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
if ( nAuxId == GDB_ID_NULL) { if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ; nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL) if ( nAuxId == GDB_ID_NULL)
@@ -692,14 +687,9 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
if ( ! VerifySideAngle()) if ( ! VerifySideAngle())
return false ; return false ;
// verifiche per attacchi/uscite senza approcci e retrazioni
int nDownSE = 0 ;
GetValInNotes( m_Params.m_sUserNotes, "DownSE", nDownSE) ;
m_bDownSE = ( nDownSE != 0 && m_Params.m_nStepType == SAW_ST_TOANDFROM) ;
// recupero gruppo per geometria di lavorazione (Cutter Location) // recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ; int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
if ( nClId == GDB_ID_NULL) { if ( nClId == GDB_ID_NULL) {
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ; nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nClId == GDB_ID_NULL) if ( nClId == GDB_ID_NULL)
@@ -742,7 +732,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
bool bool
Sawing::Update( bool bPostApply) Sawing::Update( bool bPostApply)
{ {
// verifico validità gestore DB geometrico e Id del gruppo // verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId)) if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ; return false ;
@@ -752,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) ;
@@ -804,7 +791,7 @@ Sawing::Update( bool bPostApply)
bool bool
Sawing::AdjustFeeds( void) Sawing::AdjustFeeds( void)
{ {
// controlli su GeomDB e simili non ripetuti perchè già fatti // controlli su GeomDB e simili non ripetuti perchè già fatti
// recupero gruppo della geometria di lavorazione (Cutter Location) // recupero gruppo della geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ; int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
@@ -814,11 +801,11 @@ Sawing::AdjustFeeds( void)
// ciclo sui gruppi CL // ciclo sui gruppi CL
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ; int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
while ( nClPathId != GDB_ID_NULL) { while ( nClPathId != GDB_ID_NULL) {
// ciclo su tutte le entità del percorso CL // ciclo su tutte le entità del percorso CL
for ( int nEntId = m_pGeomDB->GetFirstInGroup( nClPathId) ; for ( int nEntId = m_pGeomDB->GetFirstInGroup( nClPathId) ;
nEntId != GDB_ID_NULL ; nEntId != GDB_ID_NULL ;
nEntId = m_pGeomDB->GetNext( nEntId)) { nEntId = m_pGeomDB->GetNext( nEntId)) {
// recupero i dati Cam dell'entità // recupero i dati Cam dell'entità
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ; CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr) if ( pCamData == nullptr)
continue ; continue ;
@@ -1038,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 (" +
@@ -1085,7 +1052,7 @@ Sawing::UpdateToolData( bool* pbChanged)
bool bool
Sawing::GetGeometry( SELVECTOR& vIds) const Sawing::GetGeometry( SELVECTOR& vIds) const
{ {
// restituisco l'elenco delle entità // restituisco l'elenco delle entità
vIds = m_vId ; vIds = m_vId ;
return true ; return true ;
} }
@@ -1108,7 +1075,7 @@ Sawing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ; const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
if ( pGObj == nullptr) if ( pGObj == nullptr)
return false ; return false ;
// se ammesse curve ed è tale // se ammesse curve ed è tale
if ( ( nType == GEO_NONE || nType == GEO_CURVE) && ( pGObj->GetType() & GEO_CURVE) != 0) { if ( ( nType == GEO_NONE || nType == GEO_CURVE) && ( pGObj->GetType() & GEO_CURVE) != 0) {
nType = GEO_CURVE ; nType = GEO_CURVE ;
const ICurve* pCurve = nullptr ; const ICurve* pCurve = nullptr ;
@@ -1132,7 +1099,7 @@ Sawing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
} }
return ( pCurve != nullptr) ; return ( pCurve != nullptr) ;
} }
// se altrimenti ammesse superfici trimesh ed è tale // se altrimenti ammesse superfici trimesh ed è tale
else if ( ( nType == GEO_NONE || nType == GEO_SURF) && pGObj->GetType() == SRF_TRIMESH) { else if ( ( nType == GEO_NONE || nType == GEO_SURF) && pGObj->GetType() == SRF_TRIMESH) {
nType = GEO_SURF ; nType = GEO_SURF ;
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ; const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
@@ -1152,7 +1119,7 @@ Sawing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
} }
return true ; return true ;
} }
// se altrimenti ammesse regioni ed è tale // se altrimenti ammesse regioni ed è tale
else if ( ( nType == GEO_NONE || nType == GEO_SURF) && pGObj->GetType() == SRF_FLATRGN) { else if ( ( nType == GEO_NONE || nType == GEO_SURF) && pGObj->GetType() == SRF_FLATRGN) {
nType = GEO_SURF ; nType = GEO_SURF ;
const ISurfFlatRegion* pReg = ::GetSurfFlatRegion( pGObj) ; const ISurfFlatRegion* pReg = ::GetSurfFlatRegion( pGObj) ;
@@ -1255,7 +1222,7 @@ Sawing::GetCurve( SelData Id)
pCrvCompo->ToGlob( frGlob) ; pCrvCompo->ToGlob( frGlob) ;
vtN.ToGlob( frGlob) ; vtN.ToGlob( frGlob) ;
// sistemazioni varie // sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, 0, 1) ; AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 0, 1) ;
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino // aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
if ( m_Params.m_nWorkSide == SAW_WS_CENTER) if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
m_Params.m_nWorkSide = SAW_WS_RIGHT ; m_Params.m_nWorkSide = SAW_WS_RIGHT ;
@@ -1289,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() ;
@@ -1304,7 +1271,7 @@ Sawing::GetCurve( SelData Id)
pCrvCompo->ToGlob( frGlob) ; pCrvCompo->ToGlob( frGlob) ;
vtN.ToGlob( frGlob) ; vtN.ToGlob( frGlob) ;
// sistemazioni varie // sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, 0, 1) ; AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 0, 1) ;
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino // aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
if ( m_Params.m_nWorkSide == SAW_WS_CENTER) if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
m_Params.m_nWorkSide = SAW_WS_RIGHT ; m_Params.m_nWorkSide = SAW_WS_RIGHT ;
@@ -1345,7 +1312,7 @@ Sawing::Chain( int nGrpDestId)
for ( const auto& Id : m_vId) { for ( const auto& Id : m_vId) {
// prendo curva // prendo curva
vpCrvs.emplace_back( GetCurve( Id)) ; vpCrvs.emplace_back( GetCurve( Id)) ;
// ne verifico la validità // ne verifico la validità
if ( IsNull( vpCrvs.back())) { if ( IsNull( vpCrvs.back())) {
string sInfo = "Warning in Sawing : Skipped entity " + ToString( Id) ; string sInfo = "Warning in Sawing : Skipped entity " + ToString( Id) ;
m_pMchMgr->SetWarning( 2251, sInfo) ; m_pMchMgr->SetWarning( 2251, sInfo) ;
@@ -1487,7 +1454,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
// recupero gruppo per geometria temporanea // recupero gruppo per geometria temporanea
const string GRP_TEMP = "Temp" ; const string GRP_TEMP = "Temp" ;
int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ; int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
if ( nTempId == GDB_ID_NULL) { if ( nTempId == GDB_ID_NULL) {
nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ; nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nTempId == GDB_ID_NULL) if ( nTempId == GDB_ID_NULL)
@@ -1511,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
@@ -1552,7 +1519,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
// elaboro la curva composita e la esplodo nelle curve componenti // elaboro la curva composita e la esplodo nelle curve componenti
if ( m_Params.m_nCurveUse == SAW_CRV_APPROX || if ( m_Params.m_nCurveUse == SAW_CRV_APPROX ||
m_Params.m_nCurveUse == SAW_CRV_CONVEX) { m_Params.m_nCurveUse == SAW_CRV_CONVEX) {
// calcolo l'approssimazione lineare con eventuale convessità // calcolo l'approssimazione lineare con eventuale convessità
PolyLine PL ; PolyLine PL ;
int nType = ICurve::APL_STD ; int nType = ICurve::APL_STD ;
if ( m_Params.m_nWorkSide == SAW_WS_LEFT) if ( m_Params.m_nWorkSide == SAW_WS_LEFT)
@@ -1641,7 +1608,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
// flag di curva chiusa // flag di curva chiusa
bool bClosed = pCompo->IsClosed() ; bool bClosed = pCompo->IsClosed() ;
// calcolo gli eventuali punti di perdita di tangenza e di cambio di concavità // calcolo gli eventuali punti di perdita di tangenza e di cambio di concavità
DBLVECTOR vU ; DBLVECTOR vU ;
const double ANG_PERD_TG = 1.0 ; const double ANG_PERD_TG = 1.0 ;
const ICurveArc* pArc = ( bClosed ? GetCurveArc( pCompo->GetLastCurve()) : nullptr) ; const ICurveArc* pArc = ( bClosed ? GetCurveArc( pCompo->GetLastCurve()) : nullptr) ;
@@ -1657,7 +1624,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
nCurrConv = 0 ; nCurrConv = 0 ;
continue ; continue ;
} }
// verifico cambio di concavità e/o lavorazione interna // verifico cambio di concavità e/o lavorazione interna
const ICurve* pCrv = pCompo->GetCurve( i) ; const ICurve* pCrv = pCompo->GetCurve( i) ;
if ( pCrv->GetType() == CRV_ARC) { if ( pCrv->GetType() == CRV_ARC) {
if ( GetCurveArc( pCrv)->GetAngCenter() > 0) { if ( GetCurveArc( pCrv)->GetAngCenter() > 0) {
@@ -1739,7 +1706,7 @@ Sawing::ProcessEntity( const ICurve* pCrvP, const ICurve* pCrvC, const ICurve* p
// altrimenti // altrimenti
else { else {
if ( m_Params.m_nCurveUse == SAW_CRV_KEEP) { if ( m_Params.m_nCurveUse == SAW_CRV_KEEP) {
// determino la convessità // determino la convessità
int nConv = 0 ; int nConv = 0 ;
for ( int i = 0 ; i < pCompo->GetCurveCount() ; ++ i) { for ( int i = 0 ; i < pCompo->GetCurveCount() ; ++ i) {
const ICurveArc* pArc = GetCurveArc( pCompo->GetCurve( i)) ; const ICurveArc* pArc = GetCurveArc( pCompo->GetCurve( i)) ;
@@ -1840,7 +1807,7 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
( m_Params.m_nWorkSide == SAW_WS_RIGHT && dAngCN < - EPS_ANG_SMALL)) ( m_Params.m_nWorkSide == SAW_WS_RIGHT && dAngCN < - EPS_ANG_SMALL))
bExtAngCN = false ; bExtAngCN = false ;
} }
// verifico eventuale attacco speciale a step (se parametri validi e su entità linea singola) // verifico eventuale attacco speciale a step (se parametri validi e su entità linea singola)
double dLiStep = 0 ; double dLiStep = 0 ;
double dLiElev = 0 ; double dLiElev = 0 ;
if ( m_Params.m_dLiTang > 10 * EPS_SMALL && m_Params.m_dLiElev > 10 * EPS_SMALL && if ( m_Params.m_dLiTang > 10 * EPS_SMALL && m_Params.m_dLiElev > 10 * EPS_SMALL &&
@@ -1861,38 +1828,38 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
return true ; return true ;
} }
// 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) ;
if ( FromString( sLen, FvVar.dLenStart)) FromString( sLen, FvVar.dLenStart) ;
FvVar.dLenStart = max( FvVar.dLenStart, 0.) ; FvVar.dLenStart = max( FvVar.dLenStart, 0.) ;
if ( FromString( sPu, FvVar.dPuStart)) FromString( sPu, FvVar.dPuStart) ;
FvVar.dPuStart = max( FvVar.dPuStart, 0.) ; FvVar.dPuStart = max( FvVar.dPuStart, 0.) ;
} }
} }
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) ;
if ( FromString( sLen, FvVar.dLenEnd)) FromString( sLen, FvVar.dLenEnd) ;
FvVar.dLenEnd = max( FvVar.dLenEnd, 0.) ; FvVar.dLenEnd = max( FvVar.dLenEnd, 0.) ;
if ( FromString( sPu, FvVar.dPuEnd)) FromString( sPu, FvVar.dPuEnd) ;
FvVar.dPuEnd = max( FvVar.dPuEnd, 0.) ; FvVar.dPuEnd = max( FvVar.dPuEnd, 0.) ;
} }
} }
// recupero eventuali estensioni dei baffi (whiskers) // recupero eventuali estensioni dei baffi (whiskers)
double dStartWhiskExt = 0 ; double dStartWhiskExt = 0 ;
if ( m_Params.m_nLeadInType == SAW_LI_CENT) if ( m_Params.m_nLeadInType == SAW_LI_CENT)
GetValInNotes( m_Params.m_sUserNotes, "SWE", dStartWhiskExt) ; FromString( ExtractInfo( m_Params.m_sUserNotes, "SWE="), dStartWhiskExt) ;
double dEndWhiskExt = 0 ; double dEndWhiskExt = 0 ;
if ( m_Params.m_nLeadOutType == SAW_LO_CENT) if ( m_Params.m_nLeadOutType == SAW_LO_CENT)
GetValInNotes( m_Params.m_sUserNotes, "EWE", dEndWhiskExt) ; FromString( ExtractInfo( m_Params.m_sUserNotes, "EWE="), dEndWhiskExt) ;
// Se richiesto Preview // Se richiesto Preview
if ( nPvId != GDB_ID_NULL) { if ( nPvId != GDB_ID_NULL) {
@@ -1972,7 +1939,7 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
m_pGeomDB->SetMaterial( nId3, BLUE) ; m_pGeomDB->SetMaterial( nId3, BLUE) ;
// valore di allungamento // valore di allungamento
double dExtraL = GetExtraLOnCutRegion() ; double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
// punti notevoli per regioni // punti notevoli per regioni
Point3d ptRIni = ptIni ; Point3d ptRIni = ptIni ;
@@ -2009,7 +1976,7 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
ptREnd + vtDir * ( dDtEnd + dExtraL) , RTY_LOC) ; ptREnd + vtDir * ( dDtEnd + dExtraL) , RTY_LOC) ;
m_pGeomDB->SetName( nReId, MCH_PV_RLOCUT) ; m_pGeomDB->SetName( nReId, MCH_PV_RLOCUT) ;
m_pGeomDB->SetMaterial( nReId, INVISIBLE) ; m_pGeomDB->SetMaterial( nReId, INVISIBLE) ;
// eventuali ripetizioni in basso per tagli inclinati // eventuali ripetizioni in basso per tagli inclinati
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL) { if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL) {
// lunghezza movimento // lunghezza movimento
@@ -2067,23 +2034,6 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
} }
} }
// creo regioni di lavorazione che interessano le superfici superiore e inferiore del grezzo considerando anche gli
// allungamenti dei baffi
int nSurfUpId = ExeCreateSurfFrRectangle3P( nPxId, ptIni - vtDir * ( dStartWhiskExt + 5 * EPS_SMALL),
ptCross + vtDir * ( dEndWhiskExt + 5 * EPS_SMALL),
ptEnd + vtDir * ( dEndWhiskExt + 5 * EPS_SMALL), RTY_LOC) ;
m_pGeomDB->SetName( nSurfUpId, MCH_PV_UP_RAWCUT) ;
m_pGeomDB->SetMaterial( nSurfUpId, INVISIBLE) ;
// solo se la lavorazione interessa il fondo del grezzo creo la superficie down
if ( dRbHeight < EPS_SMALL) {
int nSurfDownId = m_pGeomDB->CopyGlob( nSurfUpId, GDB_ID_NULL, nPxId) ;
double dMove = dElev + dRbHeight / cos( m_Params.m_dSideAngle * DEGTORAD) ;
Vector3d vtMove = - dMove * vtCorr ; vtMove.z = 0 ;
ExeMove( {nSurfDownId}, vtMove, RTY_LOC) ;
m_pGeomDB->SetName( nSurfDownId, MCH_PV_DOWN_RAWCUT) ;
m_pGeomDB->SetMaterial( nSurfDownId, INVISIBLE) ;
}
// salvo in info gruppo : larghezza XY del taglio, distanza XY tra centro e bordo taglio, extra taglio e quota minima della lama // salvo in info gruppo : larghezza XY del taglio, distanza XY tra centro e bordo taglio, extra taglio e quota minima della lama
m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_WT, vtToolH.LenXY()) ; m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_WT, vtToolH.LenXY()) ;
if ( dLiElev > EPS_SMALL) if ( dLiElev > EPS_SMALL)
@@ -2122,7 +2072,7 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
SetToolDir( vtTool) ; SetToolDir( vtTool) ;
SetCorrAuxDir( vtCorr) ; SetCorrAuxDir( vtCorr) ;
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// distanza di approccio/retrazione // distanza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// flag di taglio inclinato // flag di taglio inclinato
@@ -2138,14 +2088,12 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
} }
if ( dActBstep < EPS_SMALL) if ( dActBstep < EPS_SMALL)
dActBstep = dActStep ; dActBstep = dActStep ;
double dActLstep = GetStepLast() ;
// direzione della linea // direzione della linea
Vector3d vtDir ; pLine->GetStartDir( vtDir) ; Vector3d vtDir ; pLine->GetStartDir( vtDir) ;
// Se una sola passata // Se una sola passata
if ( m_Params.m_nStepType != SAW_ST_TOANDFROM && if ( dActStep < EPS_SMALL || ( dElev - dExtraCut) <= dActStep ||
( dActStep < EPS_SMALL || ( dElev - dExtraCut) <= dActStep || ( ! bSideAng && m_Params.m_dStepLast > EPS_SMALL && ( dElev - dExtraCut) <= m_Params.m_dStepLast)) {
( ! bSideAng && dActLstep > EPS_SMALL && ( dElev - dExtraCut) <= dActLstep))) {
// 1 -> approccio // 1 -> approccio
Point3d ptP1 = pLine->GetStart() - vtDir * m_Params.m_dLiTang ; Point3d ptP1 = pLine->GetStart() - vtDir * m_Params.m_dLiTang ;
if ( ! AddApproach( ptP1, vtCorr, dSafeZ, dElev, dAppr)) if ( ! AddApproach( ptP1, vtCorr, dSafeZ, dElev, dAppr))
@@ -2242,17 +2190,11 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
int nStep = 2 ; int nStep = 2 ;
if ( m_Params.m_nStepType == SAW_ST_ZIGZAG) if ( m_Params.m_nStepType == SAW_ST_ZIGZAG)
nStep = 2 * static_cast<int>( ceil( dCutH / ( dActStep + dActBstep + EPS_SMALL))) ; nStep = 2 * static_cast<int>( ceil( dCutH / ( dActStep + dActBstep + EPS_SMALL))) ;
else {
if ( dActStep < EPS_SMALL)
dActStep = dCutH / nStep ;
if ( dActBstep < EPS_SMALL)
dActBstep = dCutH / nStep ;
}
double dMeanStep = dCutH / nStep ; double dMeanStep = dCutH / nStep ;
double dBstep = dActBstep * 2 * dMeanStep / ( dActStep + dActBstep) ; double dBstep = dActBstep * 2 * dMeanStep / ( dActStep + dActBstep) ;
double dLastStep = dBstep ; double dLastStep = dBstep ;
if ( ! bSideAng && dActLstep > EPS_SMALL) { if ( ! bSideAng && m_Params.m_dStepLast > EPS_SMALL) {
dLastStep = dActLstep ; dLastStep = m_Params.m_dStepLast ;
double dCoeff = ( dCutH - dLastStep) / ( nStep / 2 * dActStep + ( nStep / 2 - 1) * dActBstep) ; double dCoeff = ( dCutH - dLastStep) / ( nStep / 2 * dActStep + ( nStep / 2 - 1) * dActBstep) ;
dMeanStep = dCoeff * ( dActStep + dActBstep) / 2 ; dMeanStep = dCoeff * ( dActStep + dActBstep) / 2 ;
dBstep = dCoeff * dActBstep ; dBstep = dCoeff * dActBstep ;
@@ -2294,8 +2236,8 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
int nStep = static_cast<int>( ceil( dCutH / ( dActStep + EPS_SMALL))) ; int nStep = static_cast<int>( ceil( dCutH / ( dActStep + EPS_SMALL))) ;
double dStep = dCutH / nStep ; double dStep = dCutH / nStep ;
double dLastStep = dStep ; double dLastStep = dStep ;
if ( ! bSideAng && dActLstep > EPS_SMALL) { if ( ! bSideAng && m_Params.m_dStepLast > EPS_SMALL) {
dLastStep = dActLstep ; dLastStep = m_Params.m_dStepLast ;
nStep = static_cast<int>( ceil( ( dCutH - dLastStep) / ( dActStep + EPS_SMALL))) + 1 ; nStep = static_cast<int>( ceil( ( dCutH - dLastStep) / ( dActStep + EPS_SMALL))) + 1 ;
dStep = ( dCutH - dLastStep) / ( nStep - 1) ; dStep = ( dCutH - dLastStep) / ( nStep - 1) ;
} }
@@ -2314,16 +2256,17 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
Point3d ptP3 = pLine->GetEnd() + vtCorr * dDelta ; Point3d ptP3 = pLine->GetEnd() + vtCorr * dDelta ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL) if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ; return false ;
// se non è ultimo passo // se non è ultimo passo
if ( i != 0) { if ( i != 0) {
// movimento di risalita sopra il punto finale // movimento di risalita sopra il punto finale
SetFeed( GetEndFeed()) ; SetFeed( GetEndFeed()) ;
Point3d ptP4 = pLine->GetEnd() + vtCorr * ( dElev + dAppr / vtCorr.z) ; Point3d ptP4 = pLine->GetEnd() + vtCorr * ( dElev + dAppr / vtCorr.z) ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL) if ( AddLinearMove( ptP4) == GDB_ID_NULL)
return false ; return false ;
// movimento di ritorno in rapido sopra il punto iniziale // movimento di ritorno spora il punto iniziale
SetFeed( GetEndFeed()) ;
Point3d ptP5 = pLine->GetStart() + vtCorr * ( dElev + dAppr / vtCorr.z) ; Point3d ptP5 = pLine->GetStart() + vtCorr * ( dElev + dAppr / vtCorr.z) ;
if ( AddRapidMove( ptP5) == GDB_ID_NULL) if ( AddLinearMove( ptP5) == GDB_ID_NULL)
return false ; return false ;
} }
} }
@@ -2356,7 +2299,7 @@ Sawing::ProcessExtCurve( const ICurve* pCrvP, const ICurveComposite* pCrvC, cons
dMinRad = dRad ; dMinRad = dRad ;
} }
} }
if ( dMinRad < GetExtSawArcMinRad()) { if ( dMinRad < m_pMchMgr->GetCurrMachiningsMgr()->GetExtSawArcMinRad()) {
m_pMchMgr->SetWarning( 2258, "Warning in Sawing : Radius too small in ExtSawArc") ; m_pMchMgr->SetWarning( 2258, "Warning in Sawing : Radius too small in ExtSawArc") ;
return true ; return true ;
} }
@@ -2509,8 +2452,8 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL) if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL)
colCut = FUCHSIA ; colCut = FUCHSIA ;
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata // dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
double dExtraL = GetExtraLOnCutRegion() ; double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
// lunghezza taglio parziale // lunghezza taglio parziale
double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0) ; double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0) ;
@@ -2657,17 +2600,6 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
return false ; return false ;
if ( ! ExeSurfFrAdd( nRId, nRsId) || ! ExeSurfFrAdd( nRId, nReId)) if ( ! ExeSurfFrAdd( nRId, nRsId) || ! ExeSurfFrAdd( nRId, nReId))
return false ; return false ;
// creo regioni di lavorazione che interessano le superfici superiore e inferiore del grezzo
int nSurfUpId = m_pGeomDB->CopyGlob( nRrId, GDB_ID_NULL, nPxId) ;
m_pGeomDB->SetName( nSurfUpId, MCH_PV_UP_RAWCUT) ;
m_pGeomDB->SetMaterial( nSurfUpId, INVISIBLE) ;
// solo se lavorazione interessa il fondo del grezzo creo la superficie down
if ( dRbHeight < EPS_SMALL) {
int nSurfDownId = m_pGeomDB->CopyGlob( nSurfUpId, GDB_ID_NULL, nPxId) ;
m_pGeomDB->SetName( nSurfDownId, MCH_PV_DOWN_RAWCUT) ;
m_pGeomDB->SetMaterial( nSurfDownId, INVISIBLE) ;
}
} }
// altrimenti errore // altrimenti errore
@@ -2882,7 +2814,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
SetPathId( nPxId) ; SetPathId( nPxId) ;
SetCorrAuxDir( vtStaCorr) ; SetCorrAuxDir( vtStaCorr) ;
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
@@ -2913,7 +2845,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
CalculateToolAndCorrVersors( vtCurrDir, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtCurrTool, vtCurrCorr) ; CalculateToolAndCorrVersors( vtCurrDir, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtCurrTool, vtCurrCorr) ;
SetToolDir( vtCurrTool) ; SetToolDir( vtCurrTool) ;
SetCorrAuxDir( vtCurrCorr) ; SetCorrAuxDir( vtCurrCorr) ;
if ( AddCurveMove( pSmpCrv) == GDB_ID_NULL) if ( AddCurveMove( pSmpCrv, true) == GDB_ID_NULL)
return false ; return false ;
} }
// 4 -> retrazione // 4 -> retrazione
@@ -2991,7 +2923,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
pCopy->SimpleOffset( dOffs) ; pCopy->SimpleOffset( dOffs) ;
} }
// emissione // emissione
if ( AddCurveMove( pCopy) == GDB_ID_NULL) if ( AddCurveMove( pCopy, true) == GDB_ID_NULL)
return false ; return false ;
} }
} }
@@ -3024,7 +2956,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
// inversione // inversione
pCopy->Invert() ; pCopy->Invert() ;
// emissione // emissione
if ( AddCurveMove( pCopy) == GDB_ID_NULL) if ( AddCurveMove( pCopy, true) == GDB_ID_NULL)
return false ; return false ;
} }
} }
@@ -3091,10 +3023,10 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
pCopy->SimpleOffset( dOffs) ; pCopy->SimpleOffset( dOffs) ;
} }
// emissione // emissione
if ( AddCurveMove( pCopy) == GDB_ID_NULL) if ( AddCurveMove( pCopy, true) == GDB_ID_NULL)
return false ; return false ;
} }
// se non è ultimo passo // se non è ultimo passo
if ( i != 0) { if ( i != 0) {
// ricavo punto di risalita e punto iniziale // ricavo punto di risalita e punto iniziale
Point3d ptP4 ; Point3d ptP4 ;
@@ -3142,7 +3074,7 @@ Sawing::ProcessIntArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve
if ( IsNull( pArc)) if ( IsNull( pArc))
return false ; return false ;
// determino l'inclinazione per ottenere il raggio e ne verifico il limite // determino l'inclinazione per ottenere il raggio e ne verifico il limite
double dMaxSideAng = GetIntSawArcMaxSideAng() + EPS_ANG_SMALL ; double dMaxSideAng = m_pMchMgr->GetCurrMachiningsMgr()->GetIntSawArcMaxSideAng()+ EPS_ANG_SMALL ;
double dSawRad = m_TParams.m_dDiam / 2 ; double dSawRad = m_TParams.m_dDiam / 2 ;
double dRad = pArc->GetRadius() ; double dRad = pArc->GetRadius() ;
double dSinA = dSawRad / dRad ; double dSinA = dSawRad / dRad ;
@@ -3238,7 +3170,7 @@ Sawing::ProcessIntArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve
m_pMchMgr->SetWarning( 2257, "Warning in Sawing : skipped Entity too small") ; m_pMchMgr->SetWarning( 2257, "Warning in Sawing : skipped Entity too small") ;
return true ; return true ;
} }
// ricalcolo i versori fresa alle estremità (potrebbero essere cambiate) // ricalcolo i versori fresa alle estremità (potrebbero essere cambiate)
pArc->GetStartDir( vtStaDirC) ; pArc->GetStartDir( vtStaDirC) ;
pArc->GetMidDir( vtMidDirC) ; pArc->GetMidDir( vtMidDirC) ;
pArc->GetEndDir( vtEndDirC) ; pArc->GetEndDir( vtEndDirC) ;
@@ -3330,8 +3262,8 @@ Sawing::GenerateIntArcPv( const ICurveArc* pArc,
m_pGeomDB->SetName( nId3, MCH_PV_POST_CUT) ; m_pGeomDB->SetName( nId3, MCH_PV_POST_CUT) ;
m_pGeomDB->SetMaterial( nId3, BLUE) ; m_pGeomDB->SetMaterial( nId3, BLUE) ;
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata // dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
double dExtraL = GetExtraLOnCutRegion() ; double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
// regione ridotta di taglio per nesting (escluse parti iniziali e finali) // regione ridotta di taglio per nesting (escluse parti iniziali e finali)
PtrOwner<ICurveComposite> pCmpRr( GenerateIntArcPvTrueCut( pArc, dDeltaInt, dDeltaExt, dExtraL)) ; PtrOwner<ICurveComposite> pCmpRr( GenerateIntArcPvTrueCut( pArc, dDeltaInt, dDeltaExt, dExtraL)) ;
@@ -3384,17 +3316,6 @@ Sawing::GenerateIntArcPv( const ICurveArc* pArc,
if ( ! ExeSurfFrAdd( nRId, nRsId) || ! ExeSurfFrAdd( nRId, nReId)) if ( ! ExeSurfFrAdd( nRId, nRsId) || ! ExeSurfFrAdd( nRId, nReId))
return false ; return false ;
// creo regioni di lavorazione che interessano le superfici superiore e inferiore del grezzo
int nSurfUpId = m_pGeomDB->CopyGlob( nRrId, GDB_ID_NULL, nPxId) ;
m_pGeomDB->SetName( nSurfUpId, MCH_PV_UP_RAWCUT) ;
m_pGeomDB->SetMaterial( nSurfUpId, INVISIBLE) ;
// solo se lavorazione interessa il fondo del grezzo creo la superficie down
if ( dRbHeight < EPS_SMALL) {
int nSurfDownId = m_pGeomDB->CopyGlob( nSurfUpId, GDB_ID_NULL, nPxId) ;
m_pGeomDB->SetName( nSurfDownId, MCH_PV_DOWN_RAWCUT) ;
m_pGeomDB->SetMaterial( nSurfDownId, INVISIBLE) ;
}
// salvo in info gruppo : larghezza XY del taglio, distanza XY tra centro e bordo taglio, extra taglio e quota minima della lama // salvo in info gruppo : larghezza XY del taglio, distanza XY tra centro e bordo taglio, extra taglio e quota minima della lama
m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_WT, dDeltaInt + dDeltaExt) ; m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_WT, dDeltaInt + dDeltaExt) ;
m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_DT, dDeltaT * dLenCoeff) ; m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_DT, dDeltaT * dLenCoeff) ;
@@ -3589,7 +3510,7 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
// Imposto dati comuni // Imposto dati comuni
SetPathId( nPxId) ; SetPathId( nPxId) ;
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
@@ -3627,12 +3548,12 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
else { else {
Point3d ptMid ; Point3d ptMid ;
pArc->GetMidPoint( ptMid) ; pArc->GetMidPoint( ptMid) ;
// prima metà arco // prima metà arco
SetToolDir( vtMidTool) ; SetToolDir( vtMidTool) ;
SetCorrAuxDir( vtMidCorr) ; SetCorrAuxDir( vtMidCorr) ;
if ( AddArcMove( ptMid, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL) if ( AddArcMove( ptMid, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
return false ; return false ;
// seconda metà arco // seconda metà arco
SetToolDir( vtEndTool) ; SetToolDir( vtEndTool) ;
SetCorrAuxDir( vtEndCorr) ; SetCorrAuxDir( vtEndCorr) ;
if ( AddArcMove( ptP3, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL) if ( AddArcMove( ptP3, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
@@ -3713,12 +3634,12 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
pArc->GetMidPoint( ptMid) ; pArc->GetMidPoint( ptMid) ;
ptMid += Z_AX * dDelta ; ptMid += Z_AX * dDelta ;
double dCurrAngCen = dAngCen / 2 * ((( i % 2) == 0) ? -1 : 1) ; double dCurrAngCen = dAngCen / 2 * ((( i % 2) == 0) ? -1 : 1) ;
// prima metà arco // prima metà arco
SetToolDir( vtMidTool) ; SetToolDir( vtMidTool) ;
SetCorrAuxDir( vtMidCorr) ; SetCorrAuxDir( vtMidCorr) ;
if ( AddArcMove( ptMid, ptCen, dCurrAngCen, vtN) == GDB_ID_NULL) if ( AddArcMove( ptMid, ptCen, dCurrAngCen, vtN) == GDB_ID_NULL)
return false ; return false ;
// seconda metà arco // seconda metà arco
SetToolDir( ( ( i % 2) == 0) ? vtStaTool : vtEndTool) ; SetToolDir( ( ( i % 2) == 0) ? vtStaTool : vtEndTool) ;
SetCorrAuxDir( ( ( i % 2) == 0) ? vtStaCorr : vtEndCorr) ; SetCorrAuxDir( ( ( i % 2) == 0) ? vtStaCorr : vtEndCorr) ;
if ( AddArcMove( ptP3, ptCen, dCurrAngCen, vtN) == GDB_ID_NULL) if ( AddArcMove( ptP3, ptCen, dCurrAngCen, vtN) == GDB_ID_NULL)
@@ -3802,18 +3723,18 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
Point3d ptMid ; Point3d ptMid ;
pArc->GetMidPoint( ptMid) ; pArc->GetMidPoint( ptMid) ;
ptMid += Z_AX * dDelta ; ptMid += Z_AX * dDelta ;
// prima metà arco // prima metà arco
SetToolDir( vtMidTool) ; SetToolDir( vtMidTool) ;
SetCorrAuxDir( vtMidCorr) ; SetCorrAuxDir( vtMidCorr) ;
if ( AddArcMove( ptMid, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL) if ( AddArcMove( ptMid, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
return false ; return false ;
// seconda metà arco // seconda metà arco
SetToolDir( vtEndTool) ; SetToolDir( vtEndTool) ;
SetCorrAuxDir( vtEndCorr) ; SetCorrAuxDir( vtEndCorr) ;
if ( AddArcMove( ptP3, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL) if ( AddArcMove( ptP3, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
return false ; return false ;
} }
// se non è ultimo passo // se non è ultimo passo
if ( i != 0) { if ( i != 0) {
// movimento di risalita sopra il punto finale // movimento di risalita sopra il punto finale
SetFeed( GetEndFeed()) ; SetFeed( GetEndFeed()) ;
@@ -3838,16 +3759,8 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
bool bool
Sawing::AddApproach( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr) Sawing::AddApproach( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr)
{ {
// se abilitato approccio diretto fuori dal grezzo (solo per lavorazione ToAndFrom) // se distanza di sicurezza minore di distanza di inizio
if ( m_bDownSE) { if ( dSafeZ < m_Params.m_dStartPos + 10 * EPS_SMALL) {
// 1 -> punto sopra inizio
SetFlag( 1) ;
Point3d ptP1 = ptP + vtCorr * ( dElev / 2 + dAppr / vtCorr.z) ;
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
return false ;
}
// se distanza di sicurezza minore di distanza di inizio
else if ( dSafeZ < m_Params.m_dStartPos + 10 * EPS_SMALL) {
// 1 -> punto sopra inizio // 1 -> punto sopra inizio
SetFlag( 1) ; SetFlag( 1) ;
Point3d ptP1 = ptP + vtCorr * ( dElev + dAppr / vtCorr.z) ; Point3d ptP1 = ptP + vtCorr * ( dElev + dAppr / vtCorr.z) ;
@@ -3873,15 +3786,7 @@ Sawing::AddApproach( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ,
bool bool
Sawing::AddRetract( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr) Sawing::AddRetract( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr)
{ {
// se abilitato retrazione diretta fuori dal grezzo (solo per lavorazione ToAndFrom) if ( dSafeZ < m_Params.m_dStartPos + 10 * EPS_SMALL) {
if ( m_bDownSE) {
// 4 -> movimento di risalita sopra il punto finale
SetFeed( GetEndFeed()) ;
Point3d ptP4 = ptP + vtCorr * ( dElev / 2 + dAppr / vtCorr.z) ;
if ( AddRapidMove( ptP4) == GDB_ID_NULL)
return false ;
}
else if ( dSafeZ < m_Params.m_dStartPos + 10 * EPS_SMALL) {
// 4 -> movimento di risalita sopra il punto finale // 4 -> movimento di risalita sopra il punto finale
SetFeed( GetEndFeed()) ; SetFeed( GetEndFeed()) ;
Point3d ptP4 = ptP + vtCorr * ( dElev + dAppr / vtCorr.z) ; Point3d ptP4 = ptP + vtCorr * ( dElev + dAppr / vtCorr.z) ;
@@ -3907,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) ;
} }
} }
@@ -3951,7 +3845,7 @@ Sawing::CalculateToolAndCorrVersors( const Vector3d& vtTang, int nHeadSide, int
bool bool
Sawing::AdjustForSide( ICurve* pCurve) Sawing::AdjustForSide( ICurve* pCurve)
{ {
// se lato lavoro e lato mandrino coincidono, non devo fare alcunché // se lato lavoro e lato mandrino coincidono, non devo fare alcunché
if ( ( m_Params.m_nWorkSide == SAW_WS_LEFT && m_Params.m_nHeadSide == SAW_HS_LEFT) || if ( ( m_Params.m_nWorkSide == SAW_WS_LEFT && m_Params.m_nHeadSide == SAW_HS_LEFT) ||
( m_Params.m_nWorkSide == SAW_WS_RIGHT && m_Params.m_nHeadSide == SAW_HS_RIGHT)) ( m_Params.m_nWorkSide == SAW_WS_RIGHT && m_Params.m_nHeadSide == SAW_HS_RIGHT))
return true ; return true ;
@@ -3996,7 +3890,7 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
bool& bToSkip, double& dDeltaLiExt, double& dDeltaLoExt) bool& bToSkip, double& dDeltaLiExt, double& dDeltaLoExt)
{ {
// distanza XY tra centro e bordo taglio // distanza XY tra centro e bordo taglio
double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0.5 * m_TParams.m_dDiam) ; double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0) ;
// lunghezza aggiuntiva per attacco speciale a zigzag // lunghezza aggiuntiva per attacco speciale a zigzag
double dDeltaLi = 0 ; double dDeltaLi = 0 ;
if ( dLiElev > EPS_SMALL) if ( dLiElev > EPS_SMALL)
@@ -4032,7 +3926,7 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
for ( int i = 0 ; i < 4 ; ++i) for ( int i = 0 ; i < 4 ; ++i)
dDeltaI = max( dDeltaI, dDist[i]) ; dDeltaI = max( dDeltaI, dDist[i]) ;
if ( m_Params.m_nLeadInType == SAW_LI_EXT_OUT) if ( m_Params.m_nLeadInType == SAW_LI_EXT_OUT)
dDeltaI += dDeltaT + ( m_bDownSE ? MIN_SAFEDIST : 0) ; dDeltaI += dDeltaT ;
dDeltaLiExt = dDeltaI ; dDeltaLiExt = dDeltaI ;
} }
} }
@@ -4056,7 +3950,7 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
for ( int i = 0 ; i < 4 ; ++i) for ( int i = 0 ; i < 4 ; ++i)
dDeltaI = max( dDeltaI, dDist[i]) ; dDeltaI = max( dDeltaI, dDist[i]) ;
if ( m_Params.m_nLeadInType == SAW_LI_EXT_OUT) if ( m_Params.m_nLeadInType == SAW_LI_EXT_OUT)
dDeltaI += dDeltaT + ( m_bDownSE ? MIN_SAFEDIST : 0) ; dDeltaI += dDeltaT ;
dDeltaLiExt = dDeltaI ; dDeltaLiExt = dDeltaI ;
} }
} }
@@ -4091,7 +3985,7 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
for ( int i = 0 ; i < 4 ; ++i) for ( int i = 0 ; i < 4 ; ++i)
dDeltaF = max( dDeltaF, dDist[i]) ; dDeltaF = max( dDeltaF, dDist[i]) ;
if ( m_Params.m_nLeadOutType == SAW_LO_EXT_OUT) if ( m_Params.m_nLeadOutType == SAW_LO_EXT_OUT)
dDeltaF += dDeltaT + ( m_bDownSE ? MIN_SAFEDIST : 0) ; dDeltaF += dDeltaT ;
dDeltaLoExt = dDeltaF ; dDeltaLoExt = dDeltaF ;
} }
} }
@@ -4116,11 +4010,11 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
dDeltaF = max( dDeltaF, dDist[i]) ; dDeltaF = max( dDeltaF, dDist[i]) ;
// se LeadOut EXT_OUT vado all'esterno // se LeadOut EXT_OUT vado all'esterno
if ( m_Params.m_nLeadOutType == SAW_LO_EXT_OUT) if ( m_Params.m_nLeadOutType == SAW_LO_EXT_OUT)
dDeltaF += dDeltaT + ( m_bDownSE ? MIN_SAFEDIST : 0) ; dDeltaF += dDeltaT ;
dDeltaLoExt = dDeltaF ; dDeltaLoExt = dDeltaF ;
} }
} }
// controllo se lunghezza entità accettabile // controllo se lunghezza entità accettabile
const double MIN_LEN = 1 ; const double MIN_LEN = 1 ;
double dLenXY = DistXY( pLine->GetStart(), pLine->GetEnd()) ; double dLenXY = DistXY( pLine->GetStart(), pLine->GetEnd()) ;
if ( dDeltaI + dLenXY + dDeltaF < MIN_LEN) { if ( dDeltaI + dLenXY + dDeltaF < MIN_LEN) {
@@ -4191,7 +4085,7 @@ Sawing::AdjustCurveForEdges( ICurve* pCrv, double dElev, double dLenCoeff,
dDeltaF = dDeltaT ; dDeltaF = dDeltaT ;
} }
dDeltaF *= dLenCoeff ; dDeltaF *= dLenCoeff ;
// controllo se lunghezza entità accettabile // controllo se lunghezza entità accettabile
const double MIN_LEN = 1 ; const double MIN_LEN = 1 ;
double dLenXY ; double dLenXY ;
pCrv->GetLength( dLenXY) ; pCrv->GetLength( dLenXY) ;
-1
View File
@@ -164,7 +164,6 @@ class Sawing : public Machining
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
SawingData m_Params ; // parametri lavorazione SawingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile ToolData m_TParams ; // parametri utensile
bool m_bDownSE ; // flag per attacco/uscita senza risalite se fuori dal grezzo
int m_nStatus ; // stato di aggiornamento della lavorazione int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nCuts ; // numero di tagli generati int m_nCuts ; // numero di tagli generati
} ; } ;
+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 ;
File diff suppressed because it is too large Load Diff
+148 -28
View File
@@ -1,24 +1,25 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2024 // EgalTech 2015-2023
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : Simulator.h Data : 01.09.24 Versione : 2.6i1 // File : Simulator.h Data : 16.01.23 Versione : 2.5a2
// Contenuto : Dichiarazione della classe interfaccia ISimulator. // Contenuto : Dichiarazione della classe Simulator.
// //
// //
// //
// Modifiche : 01.09.24 DS Creazione modulo. // Modifiche : 19.10.15 DS Creazione modulo.
// //
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#pragma once #pragma once
#include "/EgtDev/Include/EGkVector3d.h" #include "CamData.h"
#include "/EgtDev/Include/EMkSimuGenConst.h" #include "/EgtDev/Include/EMkSimuGenConst.h"
#include "/EgtDev/Include/EgtNumCollection.h"
#include <string>
class MachMgr ; class MachMgr ;
class IGeomDB ;
class Machine ;
class PerformanceCounter ;
//------------------------ Struttura per movimento esterno assi -------------- //------------------------ Struttura per movimento esterno assi --------------
struct SimAxMv struct SimAxMv
@@ -37,27 +38,146 @@ enum SimAxMvRes { SIM_AXMV_RES_STOP = -1,
SIM_AXMV_RES_OK = 1} ; SIM_AXMV_RES_OK = 1} ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class __declspec( novtable) ISimulator class Simulator
{ {
public : public :
virtual ~ISimulator( void) {} Simulator( void) ;
virtual bool Init( MachMgr* pMchMgr) = 0 ; ~Simulator( void) ;
virtual bool Start( bool bFirst) = 0 ; bool Init( MachMgr* pMchMgr) ;
virtual bool Move( int& nStatus) = 0 ; bool Start( bool bFirst) ;
virtual bool GoHome( void) = 0 ; bool Move( int& nStatus) ;
virtual bool SetStep( double dStep) = 0 ; bool GoHome( void) ;
virtual bool SetUiStatus( int nUiStatus) = 0 ; bool SetStep( double dStep) ;
virtual bool GetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const = 0 ; bool SetUiStatus( int nUiStatus) ;
virtual bool GetToolInfo( std::string& sName, double& dSpeed) const = 0 ; bool GetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const ;
virtual bool GetOperationInfo( std::string& sName, int& nType) const = 0 ; bool GetToolInfo( std::string& sName, double& dSpeed) const ;
virtual bool GetMoveInfo( int& nGmove, double& dFeed) const = 0 ; bool GetOperationInfo( std::string& sName, int& nType) const ;
virtual bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, bool GetMoveInfo( int& nGmove, double& dFeed) const ;
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) = 0 ; bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
virtual bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) = 0 ; bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
virtual bool OnCollision( int nCdInd, int nObjInd, int& nErr) = 0 ; bool OnCollision( int nCdInd, int nObjInd, int& nErr) ;
virtual bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag, bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) = 0 ; int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
virtual bool EnableToolsForVmill( bool bEnable) = 0 ;
virtual int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) = 0 ; private :
virtual bool SaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) = 0 ; bool UpdateTool( bool bFirst, int& nErr) ;
bool UpdateAxes( void) ;
bool UpdateAxesPos( void) ;
bool ResetInterpolation( void) ;
bool ResetAxes( void) ;
bool ResetAuxAxes( void) ;
private :
bool VerifySetup( void) ;
bool FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus) ;
bool ManageOperationEnd( int& nStatus) ;
bool FindAndManagePathStart( int& nStatus) ;
bool ManagePathEnd( int& nStatus) ;
bool ManagePathStartAux( int& nStatus) ;
bool ManagePathEndAux( int& nStatus) ;
bool ManageMove( int& nStatus) ;
bool ManageSingleMove( int& nStatus, double& dMove) ;
int CalcStatusOnError( int nErr) ;
bool GetHeadCurrPosDirAux( const std::string& sHead, int nExit, Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
bool ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVmAdOffs,
const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
bool NeedCollisionCheck( void) const
{ return ( ! m_CollObj.empty() && ! m_CdId.empty()) ; }
bool Stopped( void)
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
bool OnStart( bool bFirst) ;
bool OnEnd( void) ;
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionEnd( void) ;
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos, bool bFirst, int& nErr) ;
bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos, int& nErr) ;
bool OnMachiningStart( int nOpId, int nOpInd, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
bool OnMachiningEnd( void) ;
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev) ;
bool OnPathEnd( int nAE) ;
bool OnMoveStart( const CamData* pCamData, int& nErr) ;
bool OnMoveEnd( int& nErr) ;
bool OnResetMachine( void) ;
private :
struct CollObj {
int nInd ;
bool bToolOn ;
int nFrameId ;
int nType ;
Vector3d vtMove ;
double dPar1 ;
double dPar2 ;
double dPar3 ;
CollObj( void) : nInd( 0), bToolOn( false), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
CollObj( int nI, bool bTOn, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
: nInd( nI), bToolOn( bTOn), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
} ;
typedef std::vector<CollObj> COBVECTOR ;
struct VmTool
{
std::string sName ;
std::string sHead ;
int nExit ;
double dTdOffs ;
double dAdOffs ;
VmTool( void) : nExit( 0), dTdOffs( 0), dAdOffs( 0) {}
VmTool( std::string sN, std::string sH, int nE, double dT, double dA)
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
} ;
typedef std::vector<VmTool> VMTVECTOR ;
private :
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
Machine* m_pMachine ; // puntatore alla macchina
PerformanceCounter* m_pPerfCnt ; // timer per calcolo FPS
double m_dStep ; // lunghezza di riferimento per la velocità di simulazione
int m_nUiStatus ; // stato simulazione a livello utente
int m_nOpId ; // identificativo della operazione (lavoraz.) corrente
int m_nOpInd ; // contatore della operazione (lavoraz.) corrente
int m_nCLPathId ; // identificativo del percorso di lavoro corrente
int m_nCLPathInd ; // contatore del percorso di lavoro corrente nell'operazione
int m_nEntId ; // identificativo dell'entità corrente
int m_nEntInd ; // contatore dell'entità corrente nel percorso di lavoro
double m_dCoeff ; // coefficiente di esecuzione del movimento corrente (0...1)
int m_nAuxSTot ; // numero totale movimenti ausiliari di inizio percorso
int m_nAuxSInd ; // indice del movimento ausiliario di inizio percorso corrente
int m_nAuxETot ; // numero totale movimenti ausiliari di fine percorso
int m_nAuxEInd ; // indice del movimento ausiliario di fine percorso corrente
std::string m_sTool ; // nome dell'utensile corrente
std::string m_sHead ; // nome della testa corrente
int m_nExit ; // indice dell'uscita corrente
double m_dTDiam ; // diametro dell'utensile corrente
INTVECTOR m_VmId ; // vettore identificativi Zmap per Virtual Milling
INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection
VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling
COBVECTOR m_CollObj ; // vettore oggetti da testare per collisione con grezzo
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
int m_nAxesMask ; // maschera a bit di abilitazione movimento assi (solo se rapido)
bool m_bEnabAxes ; // flag abilitazione movimento assi attivi
bool m_bShowAxes ; // flag visualizzazione assi attivi
STRVECTOR m_AxesName ; // nomi degli assi macchina attivi
STRVECTOR m_AxesToken ; // token degli assi macchina attivi
BOOLVECTOR m_AxesInvert ; // flag di asse con verso invertito degli assi macchina attivi
DBLVECTOR m_AxesOffset ; // valore di offset delgli assi macchina ttivi
BOOLVECTOR m_AxesLinear ; // flag di lineare degli assi macchina attivi
DBLVECTOR m_AxesVal ; // valori degli assi macchina all'inizio del movimento corrente
STRVECTOR m_AuxAxesName ; // nomi degli assi macchina ausiliari abilitati
STRVECTOR m_AuxAxesToken ; // token degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesInvert ; // flag di asse con verso invertito degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesOffset ; // valore di offset degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesLinear ; // flag di lineare degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesVal ; // valori degli assi macchina ausiliari all'inizio del movimento corrente
DBLVECTOR m_AuxAxesEnd ; // valori degli assi macchina ausiliari alla fine del movimento corrente
INTVECTOR m_AuxAxesLink ; // indice + 1 asse principale di aggancio (negativo valore opposto, 0 nessuno)
} ; } ;
-2698
View File
File diff suppressed because it is too large Load Diff
-215
View File
@@ -1,215 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : SimulatorMP.h Data : 01.09.24 Versione : 2.6i1
// Contenuto : Dichiarazione della classe SimulatorMP.
// Simulatore multi-processo.
//
//
// Modifiche : 01.09.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Simulator.h"
#include "CamData.h"
class IGeomDB ;
class Machine ;
class PerformanceCounter ;
//----------------------------------------------------------------------------
ISimulator* CreateSimulatorMP( void) ;
//----------------------------------------------------------------------------
class SimulatorMP : public ISimulator
{
public : // ISimulator
~SimulatorMP( void) override ;
bool Init( MachMgr* pMchMgr) override ;
bool Start( bool bFirst) override ;
bool Move( int& nStatus) override ;
bool GoHome( void) override ;
bool SetStep( double dStep) override ;
bool SetUiStatus( int nUiStatus) override ;
bool GetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const override ;
bool GetToolInfo( std::string& sName, double& dSpeed) const override ;
bool GetOperationInfo( std::string& sName, int& nType) const override ;
bool GetMoveInfo( int& nGmove, double& dFeed) const override ;
bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) override ;
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) override ;
bool OnCollision( int nCdInd, int nObjInd, int& nErr) override ;
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) override ;
bool EnableToolsForVmill( bool bEnable) override ;
int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) override ;
bool SaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) override ;
public :
SimulatorMP( void) ;
private :
bool UpdateMachiningTool( bool bFirst, int& nChangeTool, int& nErr) ;
bool UpdateDispositionTool( bool bFirst, int& nErr) ;
bool UpdateAxes( void) ;
bool UpdateAxesPos( void) ;
bool ResetInterpolation( void) ;
bool ResetAxes( void) ;
bool ResetAuxAxes( void) ;
private :
bool VerifySetup( void) ;
bool FindAndManageOperationStart( bool bStart, bool bFirst, int& nChangeTool, int& nStatus) ;
bool ManageOperationEnd( int& nStatus) ;
bool FindAndManagePathStart( int& nStatus) ;
bool ManagePathEnd( int& nStatus) ;
bool ManagePathStartAux( int& nStatus) ;
bool ManagePathEndAux( int& nStatus) ;
bool ManageMove( int& nStatus) ;
bool ManageSingleMove( int& nStatus, double& dMove) ;
int CalcStatusOnError( int nErr) ;
bool GetHeadCurrPosDirAux( const std::string& sHead, int nExit, Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
bool ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVmAdOffs,
const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
bool NeedCollisionCheck( void) const
{ return ( ! m_CollObj.empty() && ! m_CdId.empty()) ; }
bool Stopped( void)
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
bool SetCollisionMark( int nCdInd, int nObjInd) ;
bool ResetCollisionMark( void) ;
bool CallFunction( const std::string& sFun, bool bSetRecord = false, bool bSetModifiedOff = true) ;
bool OnInit( void) ;
bool OnExit( void) ;
bool OnProgramStart( bool bFirst) ;
bool OnProgramEnd( void) ;
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionEnd( void) ;
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos,
bool bFirst, bool bFloating, int& nErr) ;
bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos, int& nErr) ;
bool OnMachiningStart( int nOpId, int nOpInd, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
bool OnMachiningEnd( void) ;
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
bool OnPathEnd( int nAE) ;
bool OnMoveStart( const CamData* pCamData, const CamData* pNextCamData, int& nErr) ;
bool OnMoveEnd( int& nErr) ;
bool OnResetMachine( void) ;
bool ReadAuxAxesData( int& nErr) ;
bool ExecCmdData( int& nStatus) ;
bool ExecAllCmdData( int& nStatus) ;
private :
struct CollObj {
int nInd ;
bool bToolOn ;
int nFrameId ;
int nType ;
Vector3d vtMove ;
double dPar1 ;
double dPar2 ;
double dPar3 ;
CollObj( void) : nInd( 0), bToolOn( false), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
CollObj( int nI, bool bTOn, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
: nInd( nI), bToolOn( bTOn), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
} ;
typedef std::vector<CollObj> COBVECTOR ;
struct VmTool
{
std::string sName ;
std::string sHead ;
int nExit ;
double dTdOffs ;
double dAdOffs ;
VmTool( void) : nExit( 0), dTdOffs( 0), dAdOffs( 0) {}
VmTool( std::string sN, std::string sH, int nE, double dT, double dA)
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
} ;
typedef std::vector<VmTool> VMTVECTOR ;
enum { SIS_CREATED = 0,
SIS_INITIALIZED = 1,
SIS_READYTOSTART = 2,
SIS_READYTORUN = 3} ;
private :
struct CmdData {
int nType ;
int nMoveType ;
SAMVECTOR vAxNaEpSt ;
int nPar ;
std::string sPar ;
std::string sPar2 ;
CmdData( void) : nType(0) {}
CmdData( int nM, const SAMVECTOR& vAx)
: nType( 1), nMoveType( nM), vAxNaEpSt( vAx) {}
CmdData( int nT, int nP, const std::string& sP, const std::string& sP2)
: nType( nT), nPar( nP), sPar( sP), sPar2( sP2) {}
} ;
typedef std::vector<CmdData> CMDVECTOR ;
private :
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
Machine* m_pMachine ; // puntatore alla macchina
PerformanceCounter* m_pPerfCnt ; // timer per calcolo FPS
std::string m_sSpecEstim ; // path del file con i dati della stima speciale
int m_nStatus ; // stato interno del simulatore (creato, inizializzato, pronto al movimento)
double m_dStep ; // lunghezza di riferimento per la velocità di simulazione
int m_nUiStatus ; // stato simulazione a livello utente
INTVECTOR m_vOperId ; // vettore identificativi operazioni ordinate per simulazione
int m_nOpId ; // identificativo della operazione (lavoraz.) corrente
int m_nOpInd ; // contatore della operazione (lavoraz.) corrente
int m_nCLPathId ; // identificativo del percorso di lavoro corrente
int m_nCLPathInd ; // contatore del percorso di lavoro corrente nell'operazione
int m_nEntId ; // identificativo dell'entità corrente
int m_nEntInd ; // contatore dell'entità corrente nel percorso di lavoro
double m_dCoeff ; // coefficiente di esecuzione del movimento corrente (0...1)
int m_nChangeTool ; // stato di carico e scarico dell'utensile
int m_nAuxSTot ; // numero totale movimenti ausiliari di inizio percorso
int m_nAuxSInd ; // indice del movimento ausiliario di inizio percorso corrente
int m_nAuxETot ; // numero totale movimenti ausiliari di fine percorso
int m_nAuxEInd ; // indice del movimento ausiliario di fine percorso corrente
std::string m_sTool ; // nome dell'utensile corrente
std::string m_sHead ; // nome della testa corrente
int m_nExit ; // indice dell'uscita corrente
double m_dTDiam ; // diametro dell'utensile corrente
bool m_bCutOnTip ; // flag capacità di lavorare di testa dell'utensile corrente
bool m_bEnableVm ; // flag abilitazione Virtual Milling
INTVECTOR m_VmId ; // vettore identificativi Zmap per Virtual Milling
INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection
VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling
COBVECTOR m_CollObj ; // vettore oggetti da testare per collisione con grezzo
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
INTVECTOR m_nCollMarkId ; // elenco oggetti marcati per visualizzare meglio la collisione rilevata
int m_nAxesMask ; // maschera a bit di abilitazione movimento assi (solo se rapido)
bool m_bEnabAxes ; // flag abilitazione movimento assi attivi
bool m_bShowAxes ; // flag visualizzazione assi attivi
STRVECTOR m_AxesName ; // nomi degli assi macchina attivi
STRVECTOR m_AxesToken ; // token degli assi macchina attivi
BOOLVECTOR m_AxesInvert ; // flag di asse con verso invertito degli assi macchina attivi
DBLVECTOR m_AxesOffset ; // valore di offset delgli assi macchina ttivi
BOOLVECTOR m_AxesLinear ; // flag di lineare degli assi macchina attivi
DBLVECTOR m_AxesVal ; // valori degli assi macchina all'inizio del movimento corrente
STRVECTOR m_AuxAxesName ; // nomi degli assi macchina ausiliari abilitati
STRVECTOR m_AuxAxesToken ; // token degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesInvert ; // flag di asse con verso invertito degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesOffset ; // valore di offset degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesLinear ; // flag di lineare degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesVal ; // valori degli assi macchina ausiliari all'inizio del movimento corrente
DBLVECTOR m_AuxAxesEnd ; // valori degli assi macchina ausiliari alla fine del movimento corrente
INTVECTOR m_AuxAxesLink ; // indice + 1 asse principale di aggancio (negativo valore opposto, 0 nessuno)
CMDVECTOR m_CmdData ; // vettore comandi in attesa di esecuzione
int m_nCmdInd ; // indice prossimo comando da eseguire
double m_dCmdCoeff ; // coefficiente di movimento nel comando
} ;
-189
View File
@@ -1,189 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2024
//----------------------------------------------------------------------------
// File : SimulatorSP.h Data : 16.01.23 Versione : 2.5a2
// Contenuto : Dichiarazione della classe Simulator.
//
//
//
// Modifiche : 19.10.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Simulator.h"
#include "CamData.h"
class IGeomDB ;
class Machine ;
class PerformanceCounter ;
//----------------------------------------------------------------------------
ISimulator* CreateSimulatorSP( void) ;
//----------------------------------------------------------------------------
class SimulatorSP : public ISimulator
{
public :
~SimulatorSP( void) override ;
bool Init( MachMgr* pMchMgr) override ;
bool Start( bool bFirst) override ;
bool Move( int& nStatus) override ;
bool GoHome( void) override ;
bool SetStep( double dStep) override ;
bool SetUiStatus( int nUiStatus) override ;
bool GetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const override ;
bool GetToolInfo( std::string& sName, double& dSpeed) const override ;
bool GetOperationInfo( std::string& sName, int& nType) const override ;
bool GetMoveInfo( int& nGmove, double& dFeed) const override ;
bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) override ;
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) override ;
bool OnCollision( int nCdInd, int nObjInd, int& nErr) override ;
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) override ;
bool EnableToolsForVmill( bool bEnable) override ;
int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) override ;
bool SaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) override
{ return false ; }
public :
SimulatorSP( void) ;
private :
bool UpdateTool( bool bFirst, int& nErr) ;
bool UpdateAxes( void) ;
bool UpdateAxesPos( void) ;
bool ResetInterpolation( void) ;
bool ResetAxes( void) ;
bool ResetAuxAxes( void) ;
private :
bool VerifySetup( void) ;
bool FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus) ;
bool ManageOperationEnd( int& nStatus) ;
bool FindAndManagePathStart( int& nStatus) ;
bool ManagePathEnd( int& nStatus) ;
bool ManagePathStartAux( int& nStatus) ;
bool ManagePathEndAux( int& nStatus) ;
bool ManageMove( int& nStatus) ;
bool ManageSingleMove( int& nStatus, double& dMove) ;
int CalcStatusOnError( int nErr) ;
bool GetHeadCurrPosDirAux( const std::string& sHead, int nExit, Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
bool ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVmAdOffs,
const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
bool NeedCollisionCheck( void) const
{ return ( ! m_CollObj.empty() && ! m_CdId.empty()) ; }
bool Stopped( void)
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
bool SetCollisionMark( int nCdInd, int nObjInd) ;
bool ResetCollisionMark( void) ;
bool OnInit( void) ;
bool OnExit( void) ;
bool OnProgramStart( bool bFirst) ;
bool OnProgramEnd( void) ;
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionEnd( void) ;
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos,
bool bFirst, bool bFloating, int& nErr) ;
bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos, int& nErr) ;
bool OnMachiningStart( int nOpId, int nOpInd, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
bool OnMachiningEnd( void) ;
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
bool OnPathEnd( int nAE) ;
bool OnMoveStart( const CamData* pCamData, const CamData* pNextCamData, int& nErr) ;
bool OnMoveEnd( int& nErr) ;
bool OnResetMachine( void) ;
private :
struct CollObj {
int nInd ;
bool bToolOn ;
int nFrameId ;
int nType ;
Vector3d vtMove ;
double dPar1 ;
double dPar2 ;
double dPar3 ;
CollObj( void) : nInd( 0), bToolOn( false), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
CollObj( int nI, bool bTOn, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
: nInd( nI), bToolOn( bTOn), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
} ;
typedef std::vector<CollObj> COBVECTOR ;
struct VmTool
{
std::string sName ;
std::string sHead ;
int nExit ;
double dTdOffs ;
double dAdOffs ;
VmTool( void) : nExit( 0), dTdOffs( 0), dAdOffs( 0) {}
VmTool( std::string sN, std::string sH, int nE, double dT, double dA)
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
} ;
typedef std::vector<VmTool> VMTVECTOR ;
enum { SIS_CREATED = 0,
SIS_INITIALIZED = 1,
SIS_READYTOSTART = 2,
SIS_READYTORUN = 3} ;
private :
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
Machine* m_pMachine ; // puntatore alla macchina
PerformanceCounter* m_pPerfCnt ; // timer per calcolo FPS
int m_nStatus ; // stato interno del simulatore (creato, inizializzato, pronto al movimento)
double m_dStep ; // lunghezza di riferimento per la velocità di simulazione
int m_nUiStatus ; // stato simulazione a livello utente
int m_nOpId ; // identificativo della operazione (lavoraz.) corrente
int m_nOpInd ; // contatore della operazione (lavoraz.) corrente
int m_nCLPathId ; // identificativo del percorso di lavoro corrente
int m_nCLPathInd ; // contatore del percorso di lavoro corrente nell'operazione
int m_nEntId ; // identificativo dell'entità corrente
int m_nEntInd ; // contatore dell'entità corrente nel percorso di lavoro
double m_dCoeff ; // coefficiente di esecuzione del movimento corrente (0...1)
int m_nAuxSTot ; // numero totale movimenti ausiliari di inizio percorso
int m_nAuxSInd ; // indice del movimento ausiliario di inizio percorso corrente
int m_nAuxETot ; // numero totale movimenti ausiliari di fine percorso
int m_nAuxEInd ; // indice del movimento ausiliario di fine percorso corrente
std::string m_sTool ; // nome dell'utensile corrente
std::string m_sHead ; // nome della testa corrente
int m_nExit ; // indice dell'uscita corrente
double m_dTDiam ; // diametro dell'utensile corrente
bool m_bCutOnTip ; // flag capacità di lavorare di testa dell'utensile corrente
bool m_bEnableVm ; // flag abilitazione Virtual Milling
INTVECTOR m_VmId ; // vettore identificativi Zmap per Virtual Milling
INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection
VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling
COBVECTOR m_CollObj ; // vettore oggetti da testare per collisione con grezzo
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
INTVECTOR m_nCollMarkId ; // elenco oggetti marcati per visualizzare meglio la collisione rilevata
int m_nAxesMask ; // maschera a bit di abilitazione movimento assi (solo se rapido)
bool m_bEnabAxes ; // flag abilitazione movimento assi attivi
bool m_bShowAxes ; // flag visualizzazione assi attivi
STRVECTOR m_AxesName ; // nomi degli assi macchina attivi
STRVECTOR m_AxesToken ; // token degli assi macchina attivi
BOOLVECTOR m_AxesInvert ; // flag di asse con verso invertito degli assi macchina attivi
DBLVECTOR m_AxesOffset ; // valore di offset delgli assi macchina ttivi
BOOLVECTOR m_AxesLinear ; // flag di lineare degli assi macchina attivi
DBLVECTOR m_AxesVal ; // valori degli assi macchina all'inizio del movimento corrente
STRVECTOR m_AuxAxesName ; // nomi degli assi macchina ausiliari abilitati
STRVECTOR m_AuxAxesToken ; // token degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesInvert ; // flag di asse con verso invertito degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesOffset ; // valore di offset degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesLinear ; // flag di lineare degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesVal ; // valori degli assi macchina ausiliari all'inizio del movimento corrente
DBLVECTOR m_AuxAxesEnd ; // valori degli assi macchina ausiliari alla fine del movimento corrente
INTVECTOR m_AuxAxesLink ; // indice + 1 asse principale di aggancio (negativo valore opposto, 0 nessuno)
} ;
+662 -3889
View File
File diff suppressed because it is too large Load Diff
+13 -85
View File
@@ -13,39 +13,14 @@
#pragma once #pragma once
#include "set"
#include "Machining.h" #include "Machining.h"
#include "SurfFinishingData.h" #include "SurfFinishingData.h"
#include "ToolData.h" #include "ToolData.h"
#include "MachiningConst.h" #include "MachiningConst.h"
#include "/EgtDev/Include/EGkCurveComposite.h" #include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EgtNumUtils.h" #include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
class ICAvToolSurfTm ; class ICAvToolSurfTm ;
class ISurfFlatRegion ;
class ISurfTriMesh ;
class ICAvParSilhouettesSurfTm ;
class StmFromTriangleSoup ;
// struttura percorsi da calcolare per finiture ottimizzate
struct PATH {
PtrOwner<ICurveComposite> pCrvPath ;
int nType ;
double dSideAng ;
} ;
// vettore associato
typedef std::vector<PATH> VECTORPATHS ;
// struttura per collisioni per finiture ottimizzate
struct CollisionSfr {
PNTUVVECT CollisionInfo ;
bool bInSpiral ;
bool bInZConst ;
} ;
// vettore associato
typedef std::vector<CollisionSfr> VECTORCOLLISIONSFR ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class SurfFinishing : public Machining class SurfFinishing : public Machining
@@ -94,71 +69,27 @@ class SurfFinishing : public Machining
SurfFinishing( void) ; SurfFinishing( void) ;
private : private :
bool MyApply( bool bRecalc, bool bPostApply) ;
bool VerifyGeometry( SelData Id, int& nSubs) ; bool VerifyGeometry( SelData Id, int& nSubs) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ; bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool Chain( int nGrpDestId) ; bool Chain( int nGrpDestId) ;
bool ProcessSfr( int nPathId, int nPvId, int nClId) ; bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool ProcessCrvCompo( int nPathId, int nPvId, int nClId) ; bool AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
bool SimplifyCurve( ICurveComposite* pCompo) const ; const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
bool CalcZConstProjectedLink( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frPocket, double dDepth, double dElev) ;
const Frame3d& frSurf, const Vector3d& vtTool, double dDepth, bool CalcZigZag( const ICurveComposite* pOffs, ICRVCOMPOPOVECTOR& vpCrvs) ;
const Point3d ptStart_forced, const Point3d ptEnd_forced, bool AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
ICurveComposite* pCrv) ; const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
// lavorazioni per superfici double dDepth, double dElev, bool bInVsOut) ;
bool AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock, bool CalcSpiral( const ICurveComposite* pCompo, bool bSplitArcs,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ; ICurveComposite* pMCrv, ICurveComposite* pRCrv) ;
bool AddOneWay( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
bool AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs, bool bInVsOut) ;
bool AddZConst( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
bool AddOptimal( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
// lavorazioni per curve
bool AddProjection( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ICurveComposite* pCompo,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
bool ChooseFinishingForOptimal( const ISurfFlatRegion* pSfr, int nChunk, bool& bSpiral, double& dSideAng) ;
bool OrderOptimalPathsByZLoc( const ISurfFlatRegion* pSfr, VECTORPATHS& vCrvPaths) ;
bool GetSfrBySilhouette( ICAvParSilhouettesSurfTm* pCavParSilh, double dDepth, double dSilTolSamp,
double dSilTolLin, double dSilTolAng, ISurfFlatRegion* pSfrSil) ;
bool ApproxSilhouetteClosedPLForOptimal( PolyLine& PL, double dSampleTol, double dMaxLinTol, double dAngTol, double dLinFeaTol, ICurveComposite* pCompoPL) ;
bool SplitStmTrianglesByClippingAngle( const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
const Vector3d& vtTool, double dDepth, double dClippingAngle, double dTolerAngle,
ISURFTMPOVECTOR& vpStm1, ISURFTMPOVECTOR& vpStm2, double& dMaxFrontTriaRad) const ;
bool GetZConstQuotesInsideSfrParallelToTool( const SURFLOCALVECTOR&, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
const Vector3d& vtTool, std::set<double>& setZAmbiguos) ;
ICAvParSilhouettesSurfTm* GetParSilhouettesForZConst( const ISURFTMPOVECTOR& vStm, const ISurfFlatRegion* pSfr) const ;
ISurfFlatRegion* GetSfrSilhouette( const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frLvl0, double dDepth) const ;
ISurfFlatRegion* GetSfrProjectedStmLoops( const ISURFTMPOVECTOR& vStm, const ISurfFlatRegion* pSfrContour,
const DBLVECTOR& vdLinFeaTol, const DBLVECTOR& vdAngTol, const DBLVECTOR& vdMaxLinTol) const ;
ISurfTriMesh* SplitStmTriaUnderClippingAngle( const SurfLocal SrfLoc, const Vector3d& vtTest, double dClippingAngle,
double dFrontTriaTolerAng, double& dMaxFrontTriaRad) const ;
bool GetOptimalSfr( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfrLoc, const Vector3d& vtTool,
double dDepth, double dElev, ISurfFlatRegion* pSfrSpiral, ISurfFlatRegion* pSfrZConst) const ;
bool CalcZConstSilCrv( ICAvParSilhouettesSurfTm* pCavParSilh, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
const ISurfFlatRegion* pSfrClass, const Vector3d& vtTool, double dDepth, std::vector<ICRVCOMPOPOVECTOR>& vCrvCompo) ;
bool CreateZConstPaths( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, std::vector<ICRVCOMPOPOVECTOR>& vCrvCompo, const Vector3d& vtTool,
const ISurfFlatRegion* pSfr, double dDepth, ICRVCOMPOPOVECTOR& vCrvPath) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ; bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ; bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ; bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ; bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, const Vector3d& vtNorm, Point3d& ptP1) const ; bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN, Point3d& ptP1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, bool bSplitArcs) ; bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN) ;
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, const Vector3d& vtNorm, Point3d& ptP1) const ; bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN, Point3d& ptP1) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Point3d& ptP1, const Vector3d& vtTool, bool bSplitArcs) ;
bool GetLastGoodPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, Point3d& ptP1) const ;
bool GetSurfaceNormalAtPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
const Point3d& ptTool, const Vector3d& vtTool, Vector3d& vtNorm) const ;
bool GetActiveSurfaces( INTVECTOR& vSurfId) const ; bool GetActiveSurfaces( INTVECTOR& vSurfId) const ;
bool MarchingSquares( const VECTORCOLLISIONSFR& vPntM, bool bSpiral, int nStepX, int nStepY, double dClippingAngle,
const Vector3d& vtAxL, const Vector3d& vtMoveL, ICAvToolSurfTm* pCAvTlStm,
ICRVCOMPOPOVECTOR& vCrvCompo) const ;
bool CalcShapedPoint( const PNTUVVECT& myInfoStart, const PNTUVVECT& myInfoEnd, bool bSpiral, const Vector3d& vtAxL,
const Vector3d& vtMoveL, double dClippingAngle, ICAvToolSurfTm* pCAvTlStm, Point3d& ptShaped, int _debug_ind = -1) const ;
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ; double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
double GetRadiusForStartEndElevation( void) const ; double GetRadiusForStartEndElevation( void) const ;
@@ -177,8 +108,6 @@ class SurfFinishing : public Machining
{ return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; } { return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
double GetSideStep( void) const double GetSideStep( void) const
{ return Clamp( m_Params.m_dSideStep, 0.1, m_TParams.m_dTDiam) ; } { return Clamp( m_Params.m_dSideStep, 0.1, m_TParams.m_dTDiam) ; }
int GetLeadInType( void) const ;
int GetLeadOutType( void) const ;
private : private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
@@ -189,5 +118,4 @@ class SurfFinishing : public Machining
double m_dTHoldDiam ; // diametro del porta-utensile double m_dTHoldDiam ; // diametro del porta-utensile
int m_nStatus ; // stato di aggiornamento della lavorazione int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nPaths ; // numero di percorsi di lavoro generati int m_nPaths ; // numero di percorsi di lavoro generati
bool m_bRunning ; // flag di calcoli in corso
} ; } ;
+20 -5
View File
@@ -147,6 +147,7 @@ SurfFinishingData::CopyFrom( const MachiningData* pMdata)
m_nLeadOutType = pSdata->m_nLeadOutType ; m_nLeadOutType = pSdata->m_nLeadOutType ;
m_dLoTang = pSdata->m_dLoTang ; m_dLoTang = pSdata->m_dLoTang ;
m_dLoPerp = pSdata->m_dLoPerp ; m_dLoPerp = pSdata->m_dLoPerp ;
m_nLeadLinkType = pSdata->m_nLeadLinkType ;
m_dApprox = pSdata->m_dApprox ; m_dApprox = pSdata->m_dApprox ;
m_sSysNotes = pSdata->m_sSysNotes ; m_sSysNotes = pSdata->m_sSysNotes ;
m_sUserNotes = pSdata->m_sUserNotes ; m_sUserNotes = pSdata->m_sUserNotes ;
@@ -191,6 +192,7 @@ SurfFinishingData::SameAs(const MachiningData* pMdata) const
m_nLeadOutType == pSdata->m_nLeadOutType && m_nLeadOutType == pSdata->m_nLeadOutType &&
abs( m_dLoTang - pSdata->m_dLoTang) < EPS_MACH_LEN_PAR && abs( m_dLoTang - pSdata->m_dLoTang) < EPS_MACH_LEN_PAR &&
abs( m_dLoPerp - pSdata->m_dLoPerp) < EPS_MACH_LEN_PAR && abs( m_dLoPerp - pSdata->m_dLoPerp) < EPS_MACH_LEN_PAR &&
m_nLeadLinkType == pSdata->m_nLeadLinkType &&
abs( m_dApprox - pSdata->m_dApprox) < EPS_MACH_LEN_PAR && abs( m_dApprox - pSdata->m_dApprox) < EPS_MACH_LEN_PAR &&
m_sSysNotes == pSdata->m_sSysNotes && m_sSysNotes == pSdata->m_sSysNotes &&
m_sUserNotes == pSdata->m_sUserNotes) ; m_sUserNotes == pSdata->m_sUserNotes) ;
@@ -271,7 +273,7 @@ SurfFinishingData::FromString( const string& sString, int& nKey)
bOk = ::FromString( sVal, m_nLeadInType) ; bOk = ::FromString( sVal, m_nLeadInType) ;
break ; break ;
case KEY_LLTY : case KEY_LLTY :
// campo non più usato bOk = ::FromString( sVal, m_nLeadLinkType) ;
break ; break ;
case KEY_LOPR : case KEY_LOPR :
bOk = ::FromString( sVal, m_dLoPerp) ; bOk = ::FromString( sVal, m_dLoPerp) ;
@@ -349,7 +351,7 @@ SurfFinishingData::ToString( int nInd) const
case KEY_LIPR : return ( sSurfFinishingKey[KEY_LIPR] + "=" + ::ToString( m_dLiPerp)) ; case KEY_LIPR : return ( sSurfFinishingKey[KEY_LIPR] + "=" + ::ToString( m_dLiPerp)) ;
case KEY_LITG : return ( sSurfFinishingKey[KEY_LITG] + "=" + ::ToString( m_dLiTang)) ; case KEY_LITG : return ( sSurfFinishingKey[KEY_LITG] + "=" + ::ToString( m_dLiTang)) ;
case KEY_LITY : return ( sSurfFinishingKey[KEY_LITY] + "=" + ::ToString( m_nLeadInType)) ; case KEY_LITY : return ( sSurfFinishingKey[KEY_LITY] + "=" + ::ToString( m_nLeadInType)) ;
case KEY_LLTY : return ( sSurfFinishingKey[KEY_LLTY] + "=" + ::ToString( 0)) ; case KEY_LLTY : return ( sSurfFinishingKey[KEY_LLTY] + "=" + ::ToString( m_nLeadLinkType)) ;
case KEY_LOPR : return ( sSurfFinishingKey[KEY_LOPR] + "=" + ::ToString( m_dLoPerp)) ; case KEY_LOPR : return ( sSurfFinishingKey[KEY_LOPR] + "=" + ::ToString( m_dLoPerp)) ;
case KEY_LOTG : return ( sSurfFinishingKey[KEY_LOTG] + "=" + ::ToString( m_dLoTang)) ; case KEY_LOTG : return ( sSurfFinishingKey[KEY_LOTG] + "=" + ::ToString( m_dLoTang)) ;
case KEY_LOTY : return ( sSurfFinishingKey[KEY_LOTY] + "=" + ::ToString( m_nLeadOutType)) ; case KEY_LOTY : return ( sSurfFinishingKey[KEY_LOTY] + "=" + ::ToString( m_nLeadOutType)) ;
@@ -390,9 +392,7 @@ bool
SurfFinishingData::VerifySubType( int nVal) const SurfFinishingData::VerifySubType( int nVal) const
{ {
return ( nVal == SURFFIN_SUB_ZIGZAG || nVal == SURFFIN_SUB_ONEWAY || return ( nVal == SURFFIN_SUB_ZIGZAG || nVal == SURFFIN_SUB_ONEWAY ||
nVal == SURFFIN_SUB_SPIRALIN || nVal == SURFFIN_SUB_SPIRALOUT || nVal == SURFFIN_SUB_SPIRALIN || nVal == SURFFIN_SUB_SPIRALOUT) ;
nVal == SURFFIN_SUB_Z_CONST || nVal == SURFFIN_SUB_OPTIMAL ||
nVal == SURFFIN_SUB_PROJECT) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -403,6 +403,13 @@ SurfFinishingData::VerifyLeadInType( int nVal) const
nVal == SURFFIN_LI_TANGENT) ; nVal == SURFFIN_LI_TANGENT) ;
} }
//----------------------------------------------------------------------------
bool
SurfFinishingData::VerifyLeadLinkType( int nVal) const
{
return ( nVal == SURFFIN_LL_STD || nVal == SURFFIN_LL_CENT) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
SurfFinishingData::VerifyLeadOutType( int nVal) const SurfFinishingData::VerifyLeadOutType( int nVal) const
@@ -457,6 +464,11 @@ SurfFinishingData::SetParam( int nType, int nVal)
return false ; return false ;
m_nLeadInType = nVal ; m_nLeadInType = nVal ;
return true ; return true ;
case MPA_LEADLINKTYPE :
if ( ! VerifyLeadInType( nVal))
return false ;
m_nLeadLinkType = nVal ;
return true ;
case MPA_LEADOUTTYPE : case MPA_LEADOUTTYPE :
if ( ! VerifyLeadOutType( nVal)) if ( ! VerifyLeadOutType( nVal))
return false ; return false ;
@@ -603,6 +615,9 @@ SurfFinishingData::GetParam( int nType, int& nVal) const
case MPA_LEADINTYPE : case MPA_LEADINTYPE :
nVal = m_nLeadInType ; nVal = m_nLeadInType ;
return true ; return true ;
case MPA_LEADLINKTYPE :
nVal = m_nLeadLinkType ;
return true ;
case MPA_LEADOUTTYPE : case MPA_LEADOUTTYPE :
nVal = m_nLeadOutType ; nVal = m_nLeadOutType ;
return true ; return true ;
+5 -7
View File
@@ -42,6 +42,7 @@ struct SurfFinishingData : public MachiningData
int m_nLeadOutType ; // tipo di uscita (come attacco, nessuno, lineare, tangente, inseguimento) int m_nLeadOutType ; // tipo di uscita (come attacco, nessuno, lineare, tangente, inseguimento)
double m_dLoTang ; // distanza tangente verso fine uscita double m_dLoTang ; // distanza tangente verso fine uscita
double m_dLoPerp ; // distanza perpendicolare verso fine uscita double m_dLoPerp ; // distanza perpendicolare verso fine uscita
int m_nLeadLinkType ; // tipo di collegamento ( centro, fuori)
double m_dApprox ; // valore di approssimazione per superfici double m_dApprox ; // valore di approssimazione per superfici
std::string m_sSysNotes ; // note interne std::string m_sSysNotes ; // note interne
std::string m_sUserNotes ; // note dell'utente std::string m_sUserNotes ; // note dell'utente
@@ -51,7 +52,7 @@ struct SurfFinishingData : public MachiningData
m_dOffsR( UNKNOWN_PAR), m_bInvert( false), m_dOffsR( UNKNOWN_PAR), m_bInvert( false),
m_dStartPos( 0), m_dOverlap(0), m_dSideStep( 0), m_nSubType( 0), m_dSideAngle( 0), m_dStartPos( 0), m_dOverlap(0), m_dSideStep( 0), m_nSubType( 0), m_dSideAngle( 0),
m_nLeadInType( 0), m_dLiTang( 0), m_dLiPerp( 0), m_nLeadInType( 0), m_dLiTang( 0), m_dLiPerp( 0),
m_nLeadOutType( 0), m_dLoTang( 0), m_dLoPerp( 0), m_dApprox( 0) {} m_nLeadOutType( 0), m_dLoTang( 0), m_dLoPerp( 0), m_nLeadLinkType( 0), m_dApprox( 0) {}
SurfFinishingData* Clone( void) const override ; SurfFinishingData* Clone( void) const override ;
bool CopyFrom( const MachiningData* pMdata) override ; bool CopyFrom( const MachiningData* pMdata) override ;
bool SameAs(const MachiningData* pMdata) const override ; bool SameAs(const MachiningData* pMdata) const override ;
@@ -76,15 +77,12 @@ struct SurfFinishingData : public MachiningData
bool VerifySolCh( int nVal) const ; bool VerifySolCh( int nVal) const ;
bool VerifySubType( int nVal) const ; bool VerifySubType( int nVal) const ;
bool VerifyLeadInType( int nVal) const ; bool VerifyLeadInType( int nVal) const ;
bool VerifyLeadLinkType( int nVal) const ;
bool VerifyLeadOutType( int nVal) const ; bool VerifyLeadOutType( int nVal) const ;
} ; } ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
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)) ; }
-3629
View File
File diff suppressed because it is too large Load Diff
-205
View File
@@ -1,205 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : SurfRoughing.h Data : 24.05.24 Versione : 2.6e5
// Contenuto : Dichiarazione della classe SurfRoughing.
//
//
//
// Modifiche : 24.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Machining.h"
#include "SurfRoughingData.h"
#include "ToolData.h"
#include "MachiningConst.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
class ICAvToolSurfTm ;
class ICAvParSilhouettesSurfTm ;
// struttura informazioni sui singoli percorsi
struct PathInfoSR {
bool bOutStart ; // flag per entrata da fuori
bool bSingleCrv ; // se percorso formato da una curva singola ( in generale per SubSteps)
bool bOptTrap ; // flag per casi ottimizzati a trapezio ( per Spiral)
bool bIsZigZagOneWayBorder ; // curve di bordo dei lati chiusi ( per ZigZag e OneWay)
PtrOwner<ICurveComposite> pCrvPath ; // percorso del centro utensile
PtrOwner<ICurveComposite> pCvrRet ; // curva di ritorno per LeadIn/Out a guida
} ;
// tipo percorso
typedef std::vector<PathInfoSR> PATHINFOSRVECTOR ;
// struttura informazioni per Step/SubSteps complessivi
struct StepInfoSR {
double dDepth ; // profondità dello step attuale
double dRelativeDepth ; // profondità relativa allo step al di sopra
double dZlocCoeffFeed ; // coeffiziente riduzione Feed lungo Zloc
int nSubType ; // tipo di lavorazione dello Step corrente
bool bIsExtraStep ; // flag per SubStep o PlaneZStep
bool bInverted ; // se percorsi invertiti
PtrOwner<ISurfFlatRegion> pSfrPock ; // regione piana di svuotatura
PtrOwner<ISurfFlatRegion> pSfrLimit ; // regione piana da non svuotare
PATHINFOSRVECTOR vPaths ; // percorsi di Pocketing
} ;
// tipo step
typedef std::vector<StepInfoSR> STEPINFOSRVECTOR ;
// planeZ detection <SfrFace, dDepth>
typedef std::pair<PtrOwner<ISurfFlatRegion>, double> PLANEZFACE ;
typedef std::vector<PLANEZFACE> PLANEZFACEVECTOR ;
//----------------------------------------------------------------------------
class SurfRoughing : public Machining
{
public : // IUserObj
SurfRoughing* Clone( void) const override ;
const std::string& GetClassName( void) const override ;
bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
bool ToSave( void) const override
{ return true ; }
bool Save( int nBaseId, STRVECTOR& vString) const override ;
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
public : // Operation
int GetType( void) const override
{ return OPER_SURFROUGHING ; }
bool IsEmpty( void) const override
{ return ( m_nPaths == 0) ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
protected : // Operation
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ;
public : // Machining
bool Prepare( const std::string& sSawName) override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool SetGeometry( const SELVECTOR& vIds) override ;
bool Preview( bool bRecalc) override ;
bool Apply( bool bRecalc, bool bPostApply) override ;
bool Update( bool bPostApply) override ;
bool GetParam( int nType, bool& bVal) const override ;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
public :
SurfRoughing( void) ;
private :
bool MyApply( bool bRecalc, bool bPostApply) ;
bool VerifyGeometry( SelData Id, int& nSubs) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool Chain( int nGrpDestId) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool DetectPlaneZ( const CISURFTMPVECTOR& vpStm, const Frame3d& frCompo, const Vector3d& vtTool, PLANEZFACEVECTOR& vPlaneZ,
double dMinDepth, double dMaxDepth) const ;
bool CalcPaths( const INTINTVECTOR& vPocket, STEPINFOSRVECTOR& vStepInfo) const ;
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dLen, double& dElev) const ;
bool AddPocket( const INTINTVECTOR& vPocket, const Vector3d& vtTool, double dElev, double dStep, double dSubStep, bool bSplitArcs) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr, bool bOutStart, bool bAbsFirst) ;
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr, bool bOutMove) ;
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtTool, const ICurveComposite* pCrvPath, Point3d& ptP1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
const ISurfFlatRegion* pSfr, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
bool bNoneForced, bool bSkipControl) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1) ;
ISurfTriMesh* GetRaw( void) const ;
ISurfTriMesh* GetStmOutSideSfr( const ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmRaw, const Vector3d& vtExtr) const ;
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) const ;
ISurfFlatRegion* GetSfrSilhouette( ICAvParSilhouettesSurfTm* pCavParSilh, double dDepth, double Sil_tol, bool& bOk) const ;
bool GetActiveSurfaces( INTVECTOR& vSurfId) const ;
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
double GetRadiusForStartEndElevation( void) const ;
bool ResetCurveAllTempProp( ICurve* pCurve) const ;
bool RemoveChunksUnderTolerance( ISurfFlatRegion* pSfr, double dTol, ISurfFlatRegion* pSfrLimit,
ISurfFlatRegion* pSfrToUpdate = nullptr) const ;
bool CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler) ;
bool ModifySurfForOpenCloseEdges( ISurfFlatRegion* pSfr, const Vector3d& vtTool, const ICurveComposite* pCrvCompo) const ;
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrRef) const ;
bool SimplifyCurve( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvCheck) const ;
bool SimplyfySfr( ISurfFlatRegion* pSfr) const ;
bool CheckSafetyLinearLink( const Point3d& ptCurr, const ISurfFlatRegion* pSfrLimit, const Vector3d& vtTool,
const Point3d& ptDest, bool& bSafe) const ;
bool GetHomogeneousParts( const ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) const ;
bool VerifyLeadInHelix( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptCen, double dHelixRad) const ;
bool VerifyLeadInZigZag( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptPa, const Point3d& ptPb) const ;
private :
double GetSpeed() const
{ return ( IsNullAngValue( m_Params.m_dSpeed) ? m_TParams.m_dSpeed : m_Params.m_dSpeed) ; }
double GetFeed() const
{ return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
double GetAdaptedCoeffFeed( bool bExtraStep, double dDepth, double dStep) const
{ if ( ! bExtraStep || dStep < 10 * EPS_SMALL)
return 1. ;
return ( 1. + ( - dDepth / dStep) - std::floor( - dDepth / dStep)) ; } ;
double GetStartFeed() const
{ return ( IsNullLenValue( m_Params.m_dStartFeed) ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
double GetEndFeed() const
{ return ( IsNullLenValue( m_Params.m_dEndFeed) ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
double GetTipFeed() const
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
double GetOffsR() const
{ double dCurrOffsR = IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR ;
return std::max( 0.1, dCurrOffsR) ; }
double GetOffsL() const
{ return ( IsUnknownValue( m_Params.m_dOffsL) ? m_TParams.m_dOffsL : m_Params.m_dOffsL) ; }
double GetSideStep( void) const
{ return Clamp( m_Params.m_dSideStep, 0.1, m_TParams.m_dTDiam) ; }
int GetLeadInType( void) const
{ if ( m_Params.m_dLiTang < std::min( 0.1 * m_TParams.m_dDiam, 1.0))
return SURFROU_LI_NONE ;
if ( m_Params.m_nLeadInType != SURFROU_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL)
return SURFROU_LI_NONE ;
return m_Params.m_nLeadInType ; }
bool LeadInRawIsOk( void) const
{ if ( m_TParams.m_nType != TT_MILL_NOTIP)
return true ;
return (( GetLeadInType() == SURFROU_LI_ZIGZAG || GetLeadInType() == SURFROU_LI_HELIX) &&
m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
int GetLeadOutType( void) const
{ if ( m_Params.m_dLoTang < std::min( 0.1 * m_TParams.m_dDiam, 1.0))
return SURFROU_LO_NONE ;
return m_Params.m_nLeadOutType ; }
/* debug functions */
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf, Color Col, bool bAlphaCoverage, std::string sName) ;
void DrawFeed( const ICurve* pCrv, double dFeed) ;
void DrawNormalShaderSurfTm( const ISurfTriMesh* pStm, std::string sName) ;
/* end debug functions */
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
SurfRoughingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
double m_dTHoldBase ; // posizione base del porta-utensile
double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nPaths ; // numero di percorsi di lavoro generati
double m_dMaxHelixRad ; // raggio massimo attacco ad elica nel caso di cerchi
double m_dStepToler ; // tolleranza di rimozione chunk per Steps
double m_dSubStepToler ; // tolleranza di rimozione chunk per SubSteps
bool m_bDetectPlaneZ ; // flag per calcolo piani in Zloc di Pocketing
bool m_bRunning ; // flag di calcoli in corso
} ;
-713
View File
@@ -1,713 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : SurfRoughingData.cpp Data : 24.05.24 Versione : 2.6e5
// Contenuto : Implementazione struttura dati lavorazione sgrossatura superfici.
//
//
//
// Modifiche : 24.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "SurfRoughingData.h"
#include "MachiningDataFactory.h"
#include "MachiningConst.h"
#include "/EgtDev/Include/EmkToolConst.h"
#include "/EgtDev/Include/EmkSimuGenConst.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include <array>
#include <cassert>
using namespace std ;
//----------------------------------------------------------------------------
enum nSurfRoughingKey {
KEY_AB = 0,
KEY_AI,
KEY_APPR,
KEY_DH,
KEY_F,
KEY_FE,
KEY_FS,
KEY_FT,
KEY_INV,
KEY_LIEL,
KEY_LITG,
KEY_LITY,
KEY_LOTG,
KEY_LOTY,
KEY_NAME,
KEY_NNS,
KEY_NNU,
KEY_OL,
KEY_OR,
KEY_PS,
KEY_S,
KEY_SA,
KEY_SCC,
KEY_SS,
KEY_SST,
KEY_ST,
KEY_SUBTYPE,
KEY_TNAME,
KEY_TUUID,
KEY_UUID,
KEY_ZZZ} ; // rappresenta il numero di elementi
static const array<string,KEY_ZZZ> sSurfRoughingKey = {
"AB",
"AI",
"APPR",
"DH",
"F",
"FE",
"FS",
"FT",
"INV",
"LIEL",
"LITG",
"LITY",
"LOTG",
"LOTY",
"NAME",
"NNS",
"NNU",
"OL",
"OR",
"PS",
"S",
"SA",
"SCC",
"SS",
"SST",
"ST",
"SUB",
"TN",
"TU",
"UUID"} ;
//----------------------------------------------------------------------------
MCHDATA_REGISTER( MT_SURFROUGHING, "SURFROUGHING", SurfRoughingData) ;
//----------------------------------------------------------------------------
SurfRoughingData*
SurfRoughingData::Clone( void) const
{
// alloco oggetto
SurfRoughingData* pMdata = new(nothrow) SurfRoughingData ;
// copio i dati
if ( pMdata != nullptr) {
if ( ! pMdata->CopyFrom( this)) {
delete pMdata ;
return nullptr ;
}
}
return pMdata ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::CopyFrom( const MachiningData* pMdata)
{
// è inutile copiare se sorgente coincide con destinazione
if ( pMdata == this)
return true ;
// la sorgente deve essere dello stesso tipo
const SurfRoughingData* pSdata = GetSurfRoughingData( pMdata) ;
if ( pSdata == nullptr)
return false ;
// eseguo copia
m_Uuid = pSdata->m_Uuid ;
m_sName = pSdata->m_sName ;
m_ToolUuid = pSdata->m_ToolUuid ;
m_sToolName = pSdata->m_sToolName ;
m_sBlockedAxis = pSdata->m_sBlockedAxis ;
m_sInitAngs = pSdata->m_sInitAngs ;
m_nSolCh = pSdata->m_nSolCh ;
m_dSpeed = pSdata->m_dSpeed ;
m_dFeed = pSdata->m_dFeed ;
m_dEndFeed = pSdata->m_dEndFeed ;
m_dStartFeed = pSdata->m_dStartFeed ;
m_dTipFeed = pSdata->m_dTipFeed ;
m_dOffsR = pSdata->m_dOffsR ;
m_dOffsL = pSdata->m_dOffsL ;
m_bInvert = pSdata->m_bInvert ;
m_sDepth = pSdata->m_sDepth ;
m_dStartPos = pSdata->m_dStartPos ;
m_dStep = pSdata->m_dStep ;
m_dSubStep = pSdata->m_dSubStep ;
m_dSideStep = pSdata->m_dSideStep ;
m_nSubType = pSdata->m_nSubType ;
m_dSideAngle = pSdata->m_dSideAngle ;
m_nLeadInType = pSdata->m_nLeadInType ;
m_dLiElev = pSdata->m_dLiElev ;
m_dLiTang = pSdata->m_dLiTang ;
m_nLeadOutType = pSdata->m_nLeadOutType ;
m_dLoTang = pSdata->m_dLoTang ;
m_dApprox = pSdata->m_dApprox ;
m_sSysNotes = pSdata->m_sSysNotes ;
m_sUserNotes = pSdata->m_sUserNotes ;
return true ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::SameAs(const MachiningData* pMdata) const
{
// se coincide con altro -> uguali
if ( pMdata == this)
return true ;
// se sono di tipo diverso -> diversi
const SurfRoughingData* pSdata = GetSurfRoughingData( pMdata) ;
if ( pSdata == nullptr)
return false ;
// confronto termine a termine
return ( m_Uuid == pSdata->m_Uuid &&
m_sName == pSdata->m_sName &&
m_ToolUuid == pSdata->m_ToolUuid &&
m_sToolName == pSdata->m_sToolName &&
m_sBlockedAxis == pSdata->m_sBlockedAxis &&
m_sInitAngs == pSdata->m_sInitAngs &&
m_nSolCh == pSdata->m_nSolCh &&
abs( m_dSpeed - pSdata->m_dSpeed) < EPS_MACH_ANG_PAR &&
abs( m_dFeed - pSdata->m_dFeed) < EPS_MACH_LEN_PAR &&
abs( m_dEndFeed - pSdata->m_dEndFeed) < EPS_MACH_LEN_PAR &&
abs( m_dStartFeed - pSdata->m_dStartFeed) < EPS_MACH_LEN_PAR &&
abs( m_dTipFeed - pSdata->m_dTipFeed) < EPS_MACH_LEN_PAR &&
abs( m_dOffsR - pSdata->m_dOffsR) < EPS_MACH_LEN_PAR &&
abs( m_dOffsL - pSdata->m_dOffsL) < EPS_MACH_LEN_PAR &&
m_bInvert == pSdata->m_bInvert &&
m_sDepth == pSdata->m_sDepth &&
abs( m_dStartPos - pSdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
abs( m_dStep - pSdata->m_dStep) < EPS_MACH_LEN_PAR &&
abs( m_dSubStep - pSdata->m_dSubStep) < EPS_MACH_LEN_PAR &&
abs( m_dSideStep - pSdata->m_dSideStep) < EPS_MACH_LEN_PAR &&
m_nSubType == pSdata->m_nSubType &&
abs( m_dSideAngle - pSdata->m_dSideAngle) < EPS_MACH_ANG_PAR &&
m_nLeadInType == pSdata->m_nLeadInType &&
abs( m_dLiElev - pSdata->m_dLiElev) < EPS_MACH_LEN_PAR &&
abs( m_dLiTang - pSdata->m_dLiTang) < EPS_MACH_LEN_PAR &&
m_nLeadOutType == pSdata->m_nLeadOutType &&
abs( m_dLoTang - pSdata->m_dLoTang) < EPS_MACH_LEN_PAR &&
abs( m_dApprox - pSdata->m_dApprox) < EPS_MACH_LEN_PAR &&
m_sSysNotes == pSdata->m_sSysNotes &&
m_sUserNotes == pSdata->m_sUserNotes) ;
}
//----------------------------------------------------------------------------
int
SurfRoughingData::GetSize( void) const
{
// in debug verifico validità ultimo campo
assert( sSurfRoughingKey[KEY_UUID] == "UUID") ;
return KEY_ZZZ ;
}
//----------------------------------------------------------------------------
string
SurfRoughingData::GetTitle( void) const
{
return MCHDATA_GETNAME( SurfRoughingData) ;
}
//----------------------------------------------------------------------------
int
FindSurfRoughingKey( const string& sKey)
{
auto TheRange = equal_range( sSurfRoughingKey.cbegin(), sSurfRoughingKey.cend(), sKey) ;
if ( TheRange.first == TheRange.second)
return -1 ;
return int( TheRange.first - sSurfRoughingKey.cbegin()) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::FromString( const string& sString, int& nKey)
{
// separo chiave da valore
string sKey, sVal ;
SplitFirst( sString, "=", sKey, sVal) ;
// riconosco la chiave
nKey = FindSurfRoughingKey( ToUpper( sKey)) ;
bool bOk = ( nKey >= 0) ;
switch ( nKey) {
case KEY_AB :
m_sBlockedAxis = sVal ;
break ;
case KEY_AI :
m_sInitAngs = sVal ;
break ;
case KEY_APPR :
bOk = ::FromString( sVal, m_dApprox) ;
break ;
case KEY_DH :
m_sDepth = sVal ;
if ( m_sDepth.empty())
m_sDepth = "0" ;
break ;
case KEY_F :
bOk = ::FromString( sVal, m_dFeed) ;
break ;
case KEY_FE :
bOk = ::FromString( sVal, m_dEndFeed) ;
break ;
case KEY_FS :
bOk = ::FromString( sVal, m_dStartFeed) ;
break ;
case KEY_FT :
bOk = ::FromString( sVal, m_dTipFeed) ;
break ;
case KEY_INV :
bOk = ::FromString( sVal, m_bInvert) ;
break ;
case KEY_LIEL :
bOk = ::FromString( sVal, m_dLiElev) ;
break ;
case KEY_LITG :
bOk = ::FromString( sVal, m_dLiTang) ;
break ;
case KEY_LITY :
bOk = ::FromString( sVal, m_nLeadInType) ;
break ;
case KEY_LOTG :
bOk = ::FromString( sVal, m_dLoTang) ;
break ;
case KEY_LOTY :
bOk = ::FromString( sVal, m_nLeadOutType) ;
break ;
case KEY_NAME :
m_sName = sVal ;
bOk = ! m_sName.empty() ;
break ;
case KEY_NNS :
m_sSysNotes = sVal ;
break ;
case KEY_NNU :
m_sUserNotes = sVal ;
break ;
case KEY_OR :
bOk = ::FromString( sVal, m_dOffsR) ;
break ;
case KEY_OL :
bOk = ::FromString( sVal, m_dOffsL) ;
break ;
case KEY_PS :
bOk = ::FromString( sVal, m_dStartPos) ;
break ;
case KEY_S :
bOk = ::FromString( sVal, m_dSpeed) ;
break ;
case KEY_SA :
bOk = ::FromString( sVal, m_dSideAngle) ;
break ;
case KEY_SCC :
bOk = ::FromString( sVal, m_nSolCh) ;
break ;
case KEY_SST :
bOk = ::FromString( sVal, m_dSubStep) ;
break ;
case KEY_SS :
bOk = ::FromString( sVal, m_dSideStep) ;
break ;
case KEY_ST :
bOk = ::FromString( sVal, m_dStep) ;
break ;
case KEY_SUBTYPE :
bOk = ::FromString( sVal, m_nSubType) ;
break ;
case KEY_TNAME :
m_sToolName = sVal ;
break ;
case KEY_TUUID :
bOk = ::FromString( sVal, m_ToolUuid) ;
break ;
case KEY_UUID :
bOk = ::FromString( sVal, m_Uuid) ;
break ;
default :
bOk = false ;
break ;
}
return bOk ;
}
//----------------------------------------------------------------------------
string
SurfRoughingData::ToString( int nInd) const
{
switch ( nInd) {
case KEY_AB : return ( sSurfRoughingKey[KEY_AB] + "=" + m_sBlockedAxis) ;
case KEY_AI : return ( sSurfRoughingKey[KEY_AI] + "=" + m_sInitAngs) ;
case KEY_APPR : return ( sSurfRoughingKey[KEY_APPR] + "=" + ::ToString(m_dApprox)) ;
case KEY_DH : return ( sSurfRoughingKey[KEY_DH] + "=" + m_sDepth) ;
case KEY_F : return ( sSurfRoughingKey[KEY_F] + "=" + ::ToString( m_dFeed)) ;
case KEY_FE : return ( sSurfRoughingKey[KEY_FE] + "=" + ::ToString( m_dEndFeed)) ;
case KEY_FS : return ( sSurfRoughingKey[KEY_FS] + "=" + ::ToString( m_dStartFeed)) ;
case KEY_FT : return ( sSurfRoughingKey[KEY_FT] + "=" + ::ToString( m_dTipFeed)) ;
case KEY_INV : return ( sSurfRoughingKey[KEY_INV] + "=" + ::ToString( m_bInvert)) ;
case KEY_LIEL : return ( sSurfRoughingKey[KEY_LIEL] + "=" + ::ToString( m_dLiElev)) ;
case KEY_LITG : return ( sSurfRoughingKey[KEY_LITG] + "=" + ::ToString( m_dLiTang)) ;
case KEY_LITY : return ( sSurfRoughingKey[KEY_LITY] + "=" + ::ToString( m_nLeadInType)) ;
case KEY_LOTG : return ( sSurfRoughingKey[KEY_LOTG] + "=" + ::ToString( m_dLoTang)) ;
case KEY_LOTY : return ( sSurfRoughingKey[KEY_LOTY] + "=" + ::ToString( m_nLeadOutType)) ;
case KEY_NAME : return ( sSurfRoughingKey[KEY_NAME] + "=" + m_sName) ;
case KEY_NNS : return ( sSurfRoughingKey[KEY_NNS] + "=" + m_sSysNotes) ;
case KEY_NNU : return ( sSurfRoughingKey[KEY_NNU] + "=" + m_sUserNotes) ;
case KEY_OL : return ( sSurfRoughingKey[KEY_OL] + "=" + ::ToString( m_dOffsL)) ;
case KEY_OR : return ( sSurfRoughingKey[KEY_OR] + "=" + ::ToString( m_dOffsR)) ;
case KEY_PS : return ( sSurfRoughingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
case KEY_S : return ( sSurfRoughingKey[KEY_S] + "=" + ::ToString( m_dSpeed)) ;
case KEY_SA : return ( sSurfRoughingKey[KEY_SA] + "=" + ::ToString( m_dSideAngle)) ;
case KEY_SCC : return ( sSurfRoughingKey[KEY_SCC] + "=" + ::ToString( m_nSolCh)) ;
case KEY_SST : return ( sSurfRoughingKey[KEY_SST] + "=" + ::ToString( m_dSubStep)) ;
case KEY_SS : return ( sSurfRoughingKey[KEY_SS] + "=" + ::ToString( m_dSideStep)) ;
case KEY_ST : return ( sSurfRoughingKey[KEY_ST] + "=" + ::ToString( m_dStep)) ;
case KEY_SUBTYPE : return ( sSurfRoughingKey[KEY_SUBTYPE] + "=" + ::ToString( m_nSubType)) ;
case KEY_TNAME : return ( sSurfRoughingKey[KEY_TNAME] + "=" + m_sToolName) ;
case KEY_TUUID : return ( sSurfRoughingKey[KEY_TUUID] + "=" + ::ToString( m_ToolUuid)) ;
case KEY_UUID : return ( sSurfRoughingKey[KEY_UUID] + "=" + ::ToString( m_Uuid)) ;
default : return "" ;
}
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::IsOptional( int nKey) const
{
return ( nKey == KEY_LIEL || nKey == KEY_SST) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::VerifySolCh( int nVal) const
{
return IsValidOperationScc( nVal) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::VerifySubType( int nVal) const
{
return ( nVal == SURFROU_SUB_ZIGZAG || nVal == SURFROU_SUB_ONEWAY ||
nVal == SURFROU_SUB_SPIRALIN || nVal == SURFROU_SUB_SPIRALOUT ||
nVal == SURFROU_SUB_CONFORMAL_ZIGZAG || nVal == SURFROU_SUB_CONFORMAL_ONEWAY) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::VerifyLeadInType( int nVal) const
{
return ( nVal == SURFROU_LI_NONE || nVal == SURFROU_LI_GLIDE ||
nVal == SURFROU_LI_ZIGZAG || nVal == SURFROU_LI_HELIX) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::VerifyLeadOutType( int nVal) const
{
return ( nVal == SURFROU_LO_NONE || nVal == SURFROU_LO_GLIDE) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::VerifyTool( const ToolsMgr* pToolsMgr, const string& sVal, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( sVal) ;
if ( pTdata == nullptr)
return false ;
if ( ( pTdata->m_nType & TF_MILL) == 0)
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( m_ToolUuid) ;
return ( pTdata != nullptr) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::SetParam( int nType, bool bVal)
{
switch ( nType) {
case MPA_INVERT :
m_bInvert = bVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::SetParam( int nType, int nVal)
{
switch ( nType) {
case MPA_LEADINTYPE :
if ( ! VerifyLeadInType( nVal))
return false ;
m_nLeadInType = nVal ;
return true ;
case MPA_LEADOUTTYPE :
if ( ! VerifyLeadOutType( nVal))
return false ;
m_nLeadOutType = nVal ;
return true ;
case MPA_SCC :
if ( ! VerifySolCh( nVal))
return false ;
m_nSolCh = nVal ;
return true ;
case MPA_SUBTYPE :
if ( ! VerifySubType( nVal))
return false ;
m_nSubType = nVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::SetParam( int nType, double dVal)
{
switch ( nType) {
case MPA_SPEED :
m_dSpeed = dVal ;
return true ;
case MPA_FEED :
m_dFeed = dVal ;
return true ;
case MPA_STARTFEED :
m_dStartFeed = dVal ;
return true ;
case MPA_ENDFEED :
m_dEndFeed = dVal ;
return true ;
case MPA_TIPFEED :
m_dTipFeed = dVal ;
return true ;
case MPA_OFFSR :
m_dOffsR = dVal ;
return true ;
case MPA_OFFSL :
m_dOffsL = dVal ;
return true ;
case MPA_DEPTH :
m_sDepth = ::ToString( dVal) ;
return true ;
case MPA_STARTPOS :
m_dStartPos = dVal ;
return true ;
case MPA_STEP :
m_dStep = dVal ;
return true ;
case MPA_SUBSTEP :
m_dSubStep = dVal ;
return true ;
case MPA_SIDESTEP :
m_dSideStep = dVal ;
return true ;
case MPA_SIDEANGLE :
m_dSideAngle = dVal ;
return true ;
case MPA_LIELEV :
m_dLiElev = dVal ;
return true ;
case MPA_LITANG :
m_dLiTang = dVal ;
return true ;
case MPA_LOTANG :
m_dLoTang = dVal ;
return true ;
case MPA_APPROX :
m_dApprox = dVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::SetParam( int nType, const string& sVal)
{
switch ( nType) {
case MPA_NAME :
m_sName = sVal ;
return true ;
case MPA_TOOL :
m_sToolName = sVal ;
return true ;
case MPA_DEPTH_STR :
m_sDepth = sVal ;
return true ;
case MPA_TUUID :
return ::FromString( sVal, m_ToolUuid) ;
case MPA_UUID :
return ::FromString( sVal, m_Uuid) ;
case MPA_SYSNOTES :
m_sSysNotes = sVal ;
return true ;
case MPA_USERNOTES :
m_sUserNotes = sVal ;
return true ;
case MPA_INITANGS :
m_sInitAngs = sVal ;
return true ;
case MPA_BLOCKEDAXIS :
m_sBlockedAxis = sVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::ResetTool( void)
{
m_sToolName.clear() ;
m_ToolUuid.Clear() ;
return true ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::GetParam( int nType, bool& bVal) const
{
switch ( nType) {
case MPA_INVERT :
bVal = m_bInvert ;
return true ;
}
bVal = false ;
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::GetParam( int nType, int& nVal) const
{
switch ( nType) {
case MPA_TYPE :
nVal = MT_SURFROUGHING ;
return true ;
case MPA_SUBTYPE :
nVal = m_nSubType ;
return true ;
case MPA_LEADINTYPE :
nVal = m_nLeadInType ;
return true ;
case MPA_LEADOUTTYPE :
nVal = m_nLeadOutType ;
return true ;
case MPA_SCC :
nVal = m_nSolCh ;
return true ;
}
nVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::GetParam( int nType, double& dVal) const
{
switch ( nType) {
case MPA_SPEED :
dVal = m_dSpeed ;
return true ;
case MPA_FEED :
dVal = m_dFeed ;
return true ;
case MPA_STARTFEED :
dVal = m_dStartFeed ;
return true ;
case MPA_ENDFEED :
dVal = m_dEndFeed ;
return true ;
case MPA_TIPFEED :
dVal = m_dTipFeed ;
return true ;
case MPA_OFFSR :
dVal = m_dOffsR ;
return true ;
case MPA_OFFSL :
dVal = m_dOffsL ;
return true ;
case MPA_STARTPOS :
dVal = m_dStartPos ;
return true ;
case MPA_STEP :
dVal = m_dStep ;
return true ;
case MPA_SUBSTEP :
dVal = m_dSubStep ;
return true ;
case MPA_SIDESTEP :
dVal = m_dSideStep ;
return true ;
case MPA_SIDEANGLE :
dVal = m_dSideAngle ;
return true ;
case MPA_LIELEV :
dVal = m_dLiElev ;
return true ;
case MPA_LITANG :
dVal = m_dLiTang ;
return true ;
case MPA_LOTANG :
dVal = m_dLoTang ;
return true ;
case MPA_APPROX :
dVal = m_dApprox ;
return true ;
}
dVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::GetParam( int nType, string& sVal) const
{
switch ( nType) {
case MPA_NAME :
sVal = m_sName ;
return true ;
case MPA_TOOL :
sVal = m_sToolName ;
return true ;
case MPA_DEPTH_STR :
sVal = m_sDepth ;
return true ;
case MPA_TUUID :
sVal = ::ToString( m_ToolUuid) ;
return true ;
case MPA_UUID :
sVal = ::ToString( m_Uuid) ;
return true ;
case MPA_SYSNOTES :
sVal = m_sSysNotes ;
return true ;
case MPA_USERNOTES :
sVal = m_sUserNotes ;
return true ;
case MPA_INITANGS :
sVal = m_sInitAngs ;
return true ;
case MPA_BLOCKEDAXIS :
sVal = m_sBlockedAxis ;
return true ;
}
sVal = "" ;
return false ;
}
-92
View File
@@ -1,92 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : SurfRoughingData.h Data : 24.05.24 Versione : 2.6e5
// Contenuto : Dichiarazione della struct SurfRoughingData e costanti associate.
//
//
//
// Modifiche : 24.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "MachiningData.h"
//----------------------------------------------------------------------------
struct SurfRoughingData : public MachiningData
{
EgtUUID m_ToolUuid ; // identificativo universale dell'utensile
std::string m_sToolName ; // nome dell'utensile
std::string m_sInitAngs ; // angoli iniziali suggeriti (Nome1=val1,Nome2=val2)
std::string m_sBlockedAxis ; // eventuale asse rotante bloccato (Nome=val)
int m_nSolCh ; // criterio scelta soluzione (quando possibili molteplici)
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
double m_dTipFeed ; // velocità di lavorazione di testa ( se 0 da utensile)
double m_dOffsR ; // offset radiale ( se UNKNOWN_PAR da utensile)
double m_dOffsL ; // offset longitudinale ( se UNKNOWN_PAR da utensile)
bool m_bInvert ; // flag di inversione direzione lavorazione
std::string m_sDepth ; // affondamento massimo (espressione numerica)
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
double m_dStep ; // passo di affondamento (0=nessun passo)
double m_dSideStep ; // distanza tra le passate
double m_dSubStep ; // distanza tra le passate intermedie
int m_nSubType ; // tipo di lavorazione ( ZigZag, OneWay, SpiralIn, SpiralOut)
double m_dSideAngle ; // angolo dello ZigZag da X+ locale
int m_nLeadInType ; // tipo di attacco (nessuno, lineare, tangente, inseguimento)
double m_dLiTang ; // distanza tangente da inizio attacco
double m_dLiElev ; // elevazione di uno step di attacco
int m_nLeadOutType ; // tipo di uscita (come attacco, nessuno, lineare, tangente, inseguimento)
double m_dLoTang ; // distanza tangente verso fine uscita
double m_dApprox ; // valore di approssimazione per superfici
std::string m_sSysNotes ; // note interne
std::string m_sUserNotes ; // note dell'utente
SurfRoughingData( void)
: m_ToolUuid(), m_nSolCh( 0), m_dSpeed( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
m_dOffsR( UNKNOWN_PAR), m_dOffsL( UNKNOWN_PAR), m_bInvert( false),
m_dStartPos( 0), m_dStep( 0), m_dSideStep( 0), m_dSubStep( 0), m_nSubType( 0), m_dSideAngle( 0),
m_nLeadInType( 0), m_dLiTang( 0), m_dLiElev( 0),
m_nLeadOutType( 0), m_dLoTang( 0), m_dApprox( 0) {}
SurfRoughingData* Clone( void) const override ;
bool CopyFrom( const MachiningData* pMdata) override ;
bool SameAs(const MachiningData* pMdata) const override ;
int GetType( void) const override
{ return MT_SURFROUGHING ; }
int GetSize( void) const override ;
std::string GetTitle( void) const override ;
bool FromString( const std::string& sString, int& nKey) override ;
std::string ToString( int nInd) const override ;
bool IsOptional( int nKey) const override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool ResetTool( void) override ;
bool GetParam( int nType, bool& bVal) const override;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const override ;
bool VerifyTool( const ToolsMgr* pToolsMgr, const std::string& sVal, const ToolData*& pTdata) const override ;
bool VerifySolCh( int nVal) const ;
bool VerifySubType( int nVal) const ;
bool VerifyLeadInType( int nVal) const ;
bool VerifyLeadLinkType( int nVal) const ;
bool VerifyLeadOutType( int nVal) const ;
} ;
//----------------------------------------------------------------------------
inline const SurfRoughingData* GetSurfRoughingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SURFROUGHING)
return nullptr ;
return ( static_cast<const SurfRoughingData*>( pMdata)) ; }
inline SurfRoughingData* GetSurfRoughingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SURFROUGHING)
return nullptr ;
return ( static_cast<SurfRoughingData*>( pMdata)) ; }
+4 -9
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2024 // EgalTech 2015-2015
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : Table.cpp Data : 19.03.24 Versione : 2.6c2 // File : Table.cpp Data : 25.05.15 Versione : 1.6e7
// Contenuto : Oggetto tavola per gruppo tavola di macchina. // Contenuto : Oggetto tavola per gruppo tavola di macchina.
// //
// //
@@ -45,7 +45,6 @@ Table::Clone( void) const
pTab->m_sName = m_sName ; pTab->m_sName = m_sName ;
pTab->m_nType = m_nType ; pTab->m_nType = m_nType ;
pTab->m_ptRef1 = m_ptRef1 ; pTab->m_ptRef1 = m_ptRef1 ;
pTab->m_vsColl = m_vsColl ;
} }
catch( ...) { catch( ...) {
delete pTab ; delete pTab ;
@@ -64,10 +63,7 @@ Table::Dump( string& sOut, bool bMM, const char* szNewLine) const
sOut += "Id=" + ToString( m_nOwnerId) + szNewLine ; sOut += "Id=" + ToString( m_nOwnerId) + szNewLine ;
sOut += "Name=" + m_sName + szNewLine ; sOut += "Name=" + m_sName + szNewLine ;
sOut += "Type=" + ToString( m_nType) + szNewLine ; sOut += "Type=" + ToString( m_nType) + szNewLine ;
sOut += "Ref1=(" + ToString( GetInUiUnits( m_ptRef1, bMM), 4) + ")" + szNewLine ; sOut += "Ref1=(" + ToString( GetInUiUnits(m_ptRef1, bMM), 4) + ")" + szNewLine ;
sOut += "Area1=(" + ToString( GetInUiUnits( m_b3Area1.GetMin(), bMM), 4) + ";" +
ToString( GetInUiUnits( m_b3Area1.GetMax(), bMM), 4) + szNewLine ;
sOut += "Coll=" + ToString( m_vsColl) + szNewLine ;
return true ; return true ;
} }
@@ -103,12 +99,11 @@ Table::Table( void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Table::Set( const string& sName, int nType, const Point3d& ptRef1, const BBox3d& b3Area1, const STRVECTOR& vsColl) Table::Set( const string& sName, int nType, const Point3d& ptRef1, const BBox3d& b3Area1)
{ {
m_sName = sName ; m_sName = sName ;
m_nType = nType ; m_nType = nType ;
m_ptRef1 = ptRef1 ; m_ptRef1 = ptRef1 ;
m_b3Area1 = b3Area1 ; m_b3Area1 = b3Area1 ;
m_vsColl = vsColl ;
return true ; return true ;
} }
+1 -4
View File
@@ -30,7 +30,7 @@ class Table : public IUserObj
public : public :
Table( void) ; Table( void) ;
bool Set( const std::string& sName, int nType, const Point3d& ptRef1, const BBox3d& b3Area1, const STRVECTOR& vsColl) ; bool Set( const std::string& sName, int nType, const Point3d& ptRef1, const BBox3d& b3Area1) ;
const std::string& GetName( void) const std::string& GetName( void)
{ return m_sName ; } { return m_sName ; }
int GetType( void) int GetType( void)
@@ -39,8 +39,6 @@ class Table : public IUserObj
{ return m_ptRef1 ; } { return m_ptRef1 ; }
const BBox3d& GetArea1( void) const BBox3d& GetArea1( void)
{ return m_b3Area1 ; } { return m_b3Area1 ; }
const STRVECTOR& GetCollGroups( void) const
{ return m_vsColl ; }
private : private :
int m_nOwnerId ; int m_nOwnerId ;
@@ -49,5 +47,4 @@ class Table : public IUserObj
int m_nType ; int m_nType ;
Point3d m_ptRef1 ; Point3d m_ptRef1 ;
BBox3d m_b3Area1 ; BBox3d m_b3Area1 ;
STRVECTOR m_vsColl ;
} ; } ;
+6 -6
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 &&
@@ -108,4 +108,4 @@ SameTool( const ToolData& Td1, const ToolData& Td2, bool bAlsoNameTcPosHeadExit
abs( Td1.m_dMinFeed - Td2.m_dMinFeed) < EPS_FEED && abs( Td1.m_dMinFeed - Td2.m_dMinFeed) < EPS_FEED &&
Td1.m_sSysNotes == Td2.m_sSysNotes && Td1.m_sSysNotes == Td2.m_sSysNotes &&
Td1.m_sUserNotes == Td2.m_sUserNotes) ; Td1.m_sUserNotes == Td2.m_sUserNotes) ;
} }
+12 -21
View File
@@ -551,11 +551,6 @@ ToolsMgr::SaveCurrTool( void)
m_suData.emplace( m_tdCurrTool.m_sName, m_tdCurrTool.m_Uuid) ; m_suData.emplace( m_tdCurrTool.m_sName, m_tdCurrTool.m_Uuid) ;
} }
} }
// se fresa adatto sottotipo a seconda della capacità di lavorare di testa
if ( m_tdCurrTool.m_nType == TT_MILL_STD && m_tdCurrTool.m_dTipFeed < EPS_SMALL)
m_tdCurrTool.m_nType = TT_MILL_NOTIP ;
else if ( m_tdCurrTool.m_nType == TT_MILL_NOTIP && m_tdCurrTool.m_dTipFeed > EPS_SMALL)
m_tdCurrTool.m_nType = TT_MILL_STD ;
// eseguo salvataggio // eseguo salvataggio
m_bModified = true ; m_bModified = true ;
if ( find( m_utModified.begin(), m_utModified.end(), m_tdCurrTool.m_Uuid) == m_utModified.end()) if ( find( m_utModified.begin(), m_utModified.end(), m_tdCurrTool.m_Uuid) == m_utModified.end())
@@ -699,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
@@ -743,11 +734,10 @@ ToolsMgr::GetCurrToolThDiam( double& dThDiam) const
if ( ! m_bCurrTool) if ( ! m_bCurrTool)
return false ; return false ;
// se punta a forare, lama, fresa, mortasatrice/sega a catena o scalpello // se punta a forare, lama, fresa o scalpello
if ( ( m_tdCurrTool.m_nType & TF_DRILLBIT) != 0 || if ( ( m_tdCurrTool.m_nType & TF_DRILLBIT) != 0 ||
( m_tdCurrTool.m_nType & TF_SAWBLADE) != 0 || ( m_tdCurrTool.m_nType & TF_SAWBLADE) != 0 ||
( m_tdCurrTool.m_nType & TF_MILL) != 0 || ( m_tdCurrTool.m_nType & TF_MILL) != 0 ||
( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
( m_tdCurrTool.m_nType & TF_CHISEL) != 0) { ( m_tdCurrTool.m_nType & TF_CHISEL) != 0) {
// recupero le dimensioni del porta utensili // recupero le dimensioni del porta utensili
double dTHoldBase = 0 ; double dTHoldBase = 0 ;
@@ -767,8 +757,9 @@ ToolsMgr::GetCurrToolThDiam( double& dThDiam) const
dThDiam = dTHoldDiam ; dThDiam = dTHoldDiam ;
return true ; return true ;
} }
// se waterjet // se mortasatrice/sega a catena o waterjet
else if ( ( m_tdCurrTool.m_nType & TF_WATERJET) != 0) { else if ( ( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
dThDiam = 0 ; dThDiam = 0 ;
return true ; return true ;
} }
@@ -784,11 +775,10 @@ ToolsMgr::GetCurrToolThLength( double& dThLen) const
if ( ! m_bCurrTool) if ( ! m_bCurrTool)
return false ; return false ;
// se punta a forare, lama, fresa, mortasatrice/sega a catena o scalpello // se punta a forare, lama, fresa o scalpello
if ( ( m_tdCurrTool.m_nType & TF_DRILLBIT) != 0 || if ( ( m_tdCurrTool.m_nType & TF_DRILLBIT) != 0 ||
( m_tdCurrTool.m_nType & TF_SAWBLADE) != 0 || ( m_tdCurrTool.m_nType & TF_SAWBLADE) != 0 ||
( m_tdCurrTool.m_nType & TF_MILL) != 0 || ( m_tdCurrTool.m_nType & TF_MILL) != 0 ||
( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
( m_tdCurrTool.m_nType & TF_CHISEL) != 0) { ( m_tdCurrTool.m_nType & TF_CHISEL) != 0) {
// recupero le dimensioni del porta utensili // recupero le dimensioni del porta utensili
double dTHoldBase = 0 ; double dTHoldBase = 0 ;
@@ -808,8 +798,9 @@ ToolsMgr::GetCurrToolThLength( double& dThLen) const
dThLen = dTHoldLen ; dThLen = dTHoldLen ;
return true ; return true ;
} }
// se waterjet // se mortasatrice/sega a catena o waterjet
else if ( ( m_tdCurrTool.m_nType & TF_WATERJET) != 0) { else if ( ( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
dThLen = 0 ; dThLen = 0 ;
return true ; return true ;
} }

Some files were not shown because too many files have changed in this diff Show More