Compare commits
233 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a1113ad94c | |||
| c321205086 | |||
| 33f969a254 | |||
| aad600faca | |||
| caee6ccb83 | |||
| 839639fcc8 | |||
| c3729befbb | |||
| a79d9c9fe8 | |||
| 0980e10c33 | |||
| 85258fe4c4 | |||
| d3b281a858 | |||
| 37d0b8f552 | |||
| ecc2c66fac | |||
| 97a0aed32c | |||
| 737124b0bd | |||
| 09bdd4852d | |||
| 1d3c722fd3 | |||
| 3ca2db72e9 | |||
| c23c975275 | |||
| b9e0c6e7e3 | |||
| 028a5b7bba | |||
| dd28529753 | |||
| 9d471f4647 | |||
| 1179ad7e84 | |||
| 6c8d1931f3 | |||
| 7f8798a159 | |||
| 443fac5f0f | |||
| 84fc7b0dc3 | |||
| 4f64b1efc2 | |||
| 9c09f30f08 | |||
| e10f917bab | |||
| d8c5fe0ea7 | |||
| a21be79df8 | |||
| 073c5f737e | |||
| d57198ac19 | |||
| ea20040495 | |||
| 6adad38ffa | |||
| bac737ee53 | |||
| 4ae515befd | |||
| d66cc47936 | |||
| cd2315af46 | |||
| 58b119c68f | |||
| 204d63b7c9 | |||
| 5a5b48326f | |||
| bd448babd9 | |||
| 28e76415ed | |||
| c163fe503e | |||
| c928a50243 | |||
| ac8feb7a17 | |||
| 8ae1d4cdc2 | |||
| d684f6fb82 | |||
| 0cbf148bb6 | |||
| 73ba4eb93a | |||
| 268fa05cc0 | |||
| ee9a446cc0 | |||
| 2e1d893d5d | |||
| cdfa857c02 | |||
| b7eee50e55 | |||
| 3cda97534e | |||
| 5975b00def | |||
| d845442ebd | |||
| b5ef9ae6dc | |||
| fcaf15cbe1 | |||
| 511d1c0aef | |||
| 4c25e19753 | |||
| ab84757a80 | |||
| 0fab073568 | |||
| 4d29452c2d | |||
| f8de95a6b6 | |||
| 2c1cd101b2 | |||
| f5a94ee0dd | |||
| 1bcff0eb79 | |||
| 790660e549 | |||
| 52bcc69023 | |||
| d60cec01ef | |||
| 18ccead437 | |||
| d49f198720 | |||
| 368721dcaa | |||
| 9267f902ae | |||
| 4558f5d842 | |||
| a404881759 | |||
| c8c8d9e2a5 | |||
| d5c39485ea | |||
| e14c8eb8b3 | |||
| 77cd16a5b6 | |||
| c89683cc0e | |||
| cc50f573bc | |||
| c13dba8c9f | |||
| c8cd417dac | |||
| ce704bdcbc | |||
| 7ca922c9b6 | |||
| 4d02f573d2 | |||
| d5638e192c | |||
| 85cdb84a5a | |||
| 63a71db7ff | |||
| 0dfc9a38da | |||
| aa369739c9 | |||
| 4ed4445d09 | |||
| d19dfc5f8f | |||
| 072b47590e | |||
| 31980fb85f | |||
| d874e30288 | |||
| 4047b8385e | |||
| 63e95ab2fe | |||
| 93a5bd72c7 | |||
| f51b05da5b | |||
| 46868459ae | |||
| ac85a09ff2 | |||
| b3a1ee8e6c | |||
| 562e8342c3 | |||
| 8c821750ba | |||
| 4ed01598a5 | |||
| 6669fdc7a9 | |||
| ec91d76869 | |||
| e2043a7e3a | |||
| cee893f4ca | |||
| 4e23dbe156 | |||
| 944473df2e | |||
| f92cec9d3d | |||
| efde63ba64 | |||
| 09cddcf9ac | |||
| 7dcf367d48 | |||
| 5562a0f20c | |||
| 05fb2ad32b | |||
| f30f028b17 | |||
| e146e1b6da | |||
| 1adcb2991c | |||
| 701fcbdd34 | |||
| 44aef02ca1 | |||
| 01d3e7baa9 | |||
| 285e0ce910 | |||
| 98aac3154c | |||
| a839a29dce | |||
| c58926bb5c | |||
| ea36a0b8a1 | |||
| 652aa35aaa | |||
| c7070e5f2f | |||
| a5007038b8 | |||
| ff8e875290 | |||
| d7a5f4aa72 | |||
| 2b5aacc160 | |||
| 7cd3925e4c | |||
| 25f141fbf0 | |||
| ed677dfec6 | |||
| 61d5029db9 | |||
| 1097f2a19f | |||
| 8c1b61b6b8 | |||
| 4cd354c85a | |||
| 80363af1f6 | |||
| 0fd0b12445 | |||
| 2a3a9fefe3 | |||
| 1fef9786ac | |||
| 6d8848ec46 | |||
| 9b5adeaeb3 | |||
| 01854f30ed | |||
| 2616d97d0a | |||
| 3fa4e64cc2 | |||
| 648ca06815 | |||
| 638d252b38 | |||
| cd2a7cc921 | |||
| 919ca81c43 | |||
| 6935bec958 | |||
| cdb35b4c38 | |||
| 8e52fd584a | |||
| f69de493d6 | |||
| e04805a99a | |||
| ccac200e41 | |||
| 2c501206b2 | |||
| 297bc0c86d | |||
| fac69a1d65 | |||
| 4711734998 | |||
| e04a05831e | |||
| e96f467b56 | |||
| ec1ee961be | |||
| ca74fa6794 | |||
| 8242146446 | |||
| 994658da16 | |||
| 4e2df90961 | |||
| 135c0bda51 | |||
| 3393ea8325 | |||
| 1060a10491 | |||
| d927848815 | |||
| d46f94f8da | |||
| 7b91c17cb3 | |||
| 3851bdcecb | |||
| 3dcba13efc | |||
| e4983d5276 | |||
| d2965af836 | |||
| fee74d47f8 | |||
| df86ffdee3 | |||
| 05a6f56cfe | |||
| 8f7fdc3a80 | |||
| 90dbb068a9 | |||
| 577143d176 | |||
| 37f4e0982f | |||
| fb5e01881d | |||
| a5096facc7 | |||
| c6aa83ccd5 | |||
| 9e12f9d3b6 | |||
| fc6af5de55 | |||
| 8afece4a6c | |||
| dc3ed5ea0a | |||
| dbe11e6343 | |||
| 27a23bcdaa | |||
| 7d554efe60 | |||
| 075c0f4e95 | |||
| 6378dddcdf | |||
| ed4a9ec745 | |||
| 25b940927e | |||
| 0911f167b1 | |||
| 766e6a208d | |||
| 9b0b1fe9d4 | |||
| 4d676c1f3b | |||
| 3d5398f877 | |||
| 025eea9c0f | |||
| 4b93557efe | |||
| 04cf5a69a8 | |||
| 7d819a9500 | |||
| a0da9d4e7d | |||
| dd960cb8a4 | |||
| 44af4a5bf4 | |||
| 8ac85f6754 | |||
| e3cfe48da3 | |||
| 068e99df97 | |||
| e3121ff553 | |||
| 0e8c41192d | |||
| 38d63633c2 | |||
| 14b433d206 | |||
| 15931dc304 | |||
| c97cc00cdc | |||
| 8b0bbe4ab0 | |||
| 4f264ee64e | |||
| 4e8953e864 |
@@ -17,9 +17,11 @@
|
||||
#include "Axis.h"
|
||||
#include "MachConst.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkUiUnits.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -137,9 +139,8 @@ Axis::Set( const string& sName, const string& sToken, bool bInvert, double dOffs
|
||||
bool
|
||||
Axis::Modify( const Point3d& ptPos, double dAxisMaxAdjust)
|
||||
{
|
||||
// Verifico che lo spostamento non superi il massimo ammesso
|
||||
Vector3d vtDelta = ptPos - m_ptPos ;
|
||||
Vector3d vtDeltaPerp = vtDelta - ( vtDelta * m_vtDir) * m_vtDir ;
|
||||
// Verifico che lo spostamento perpendicolare alla sua direzione non superi il massimo ammesso
|
||||
Vector3d vtDeltaPerp = OrthoCompo( ptPos - m_ptPos, m_vtDir) ;
|
||||
if ( vtDeltaPerp.Len() > dAxisMaxAdjust) {
|
||||
string sOut = " Modify Axis " + m_sName + " Position (" + ToString( ptPos) + ") failed" ;
|
||||
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
|
||||
@@ -147,6 +148,11 @@ Axis::Modify( const Point3d& ptPos, double dAxisMaxAdjust)
|
||||
}
|
||||
// Assegno la nuova posizione
|
||||
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 ;
|
||||
}
|
||||
|
||||
@@ -164,6 +170,11 @@ Axis::Modify( const Vector3d& vtDir, double dAxisMaxRotAdj)
|
||||
}
|
||||
// Assegno la nuova direzione
|
||||
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 ;
|
||||
}
|
||||
|
||||
@@ -172,10 +183,7 @@ bool
|
||||
Axis::Modify( const STROKE& Stroke)
|
||||
{
|
||||
m_Stroke = Stroke ;
|
||||
if ( m_dHomeVal < m_Stroke.Min)
|
||||
m_dHomeVal = m_Stroke.Min ;
|
||||
else if ( m_dHomeVal > m_Stroke.Max)
|
||||
m_dHomeVal = m_Stroke.Max ;
|
||||
m_dHomeVal = Clamp( m_dHomeVal, m_Stroke.Min, m_Stroke.Max) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -183,12 +191,7 @@ Axis::Modify( const STROKE& Stroke)
|
||||
bool
|
||||
Axis::Modify( double dHome)
|
||||
{
|
||||
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 ;
|
||||
m_dHomeVal = Clamp( dHome, m_Stroke.Min, m_Stroke.Max) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
+29
-8
@@ -1,13 +1,14 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2016
|
||||
// EgalTech 2015-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CamData.cpp Data : 24.02.16 Versione : 1.6n8
|
||||
// File : CamData.cpp Data : 22.11.23 Versione : 2.5k3
|
||||
// Contenuto : Implementazione informazioni Cam di ogni movimento.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 10.06.15 DS Creazione modulo.
|
||||
// 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).
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -53,7 +54,9 @@ static int CAM_PARAM_V7 = 22 ;
|
||||
static string CAM_ORIGFEED = "OrFeed" ;
|
||||
static int CAM_PARAM_V8 = 23 ;
|
||||
static string CAM_FLAG2 = "Flg2" ;
|
||||
static int CAM_TOTPARAM =CAM_PARAM_V8 ;
|
||||
static int CAM_PARAM_V9 = 24 ;
|
||||
static string CAM_TOOLSHOW = "TSh" ;
|
||||
static int CAM_TOTPARAM = CAM_PARAM_V9 ;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -79,6 +82,7 @@ CamData::Clone( void) const
|
||||
pCam->m_pGeomDB = nullptr ;
|
||||
pCam->m_nMove = m_nMove ;
|
||||
pCam->m_nCorre = m_nCorre ;
|
||||
pCam->m_bToolShow = m_bToolShow ;
|
||||
pCam->m_vtTool = m_vtTool ;
|
||||
pCam->m_vtCorr = m_vtCorr ;
|
||||
pCam->m_vtAux = m_vtAux ;
|
||||
@@ -139,6 +143,7 @@ CamData::Dump( string& sOut, bool bMM, const char* szNewLine) const
|
||||
sOut += CAM_AXND + "=" + ToString( m_vtMachN) + szNewLine ;
|
||||
sOut += CAM_NDLT + "=" + ToString( m_dDeltaN) + szNewLine ;
|
||||
sOut += CAM_BDIR + "=" + ToString( m_vtBackAux) + szNewLine ;
|
||||
sOut += CAM_TOOLSHOW + "=" + ToString( m_bToolShow) + szNewLine ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -149,6 +154,8 @@ CamData::SetOwner( int nId, IGeomDB* pGDB)
|
||||
{
|
||||
m_nOwnerId = nId ;
|
||||
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) ;
|
||||
}
|
||||
|
||||
@@ -203,6 +210,8 @@ CamData::Save( int nBaseId, STRVECTOR& vString) const
|
||||
vString[++k] = CAM_ORIGFEED + "=" + ToString( m_dOrigFeed) ;
|
||||
// parametri aggiunti V8
|
||||
vString[++k] = CAM_FLAG2 + "=" + ToString( m_nFlag2) ;
|
||||
// parametri aggiunti V9
|
||||
vString[++k] = CAM_TOOLSHOW + "=" + ToString( m_bToolShow) ;
|
||||
}
|
||||
catch( ...) {
|
||||
return false ;
|
||||
@@ -295,6 +304,14 @@ CamData::Load( const STRVECTOR& vString, int nBaseGdbId)
|
||||
else {
|
||||
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 ;
|
||||
}
|
||||
|
||||
@@ -311,7 +328,7 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
|
||||
PolyLine& PL = lstPL.back() ;
|
||||
// dimensioni
|
||||
const double TLEN = 40 ;
|
||||
const double ALEN = 4 ;
|
||||
const double ALEN = 1 ;
|
||||
// inserisco disegno nella polilinea
|
||||
PL.AddUPoint( 0, m_ptEnd) ;
|
||||
Point3d ptTip = m_ptEnd + m_vtTool * TLEN ;
|
||||
@@ -333,6 +350,9 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
|
||||
ptP6.ToGlob( frF) ;
|
||||
PL.AddUPoint( 6, ptP6) ;
|
||||
PL.AddUPoint( 6, ptTip) ;
|
||||
// da visualizzare sempre se richiesto
|
||||
if ( m_bToolShow)
|
||||
PL.SetTempProp( 1) ;
|
||||
}
|
||||
// se vettore correzione non nullo
|
||||
if ( ! m_vtCorr.IsSmall()) {
|
||||
@@ -342,14 +362,14 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
|
||||
PolyLine& PL = lstPL.back() ;
|
||||
// dimensioni
|
||||
const double CLEN = 20 ;
|
||||
const double ALEN = 2 ;
|
||||
const double ALEN = 1 ;
|
||||
// inserisco disegno nella polilinea
|
||||
PL.AddUPoint( 0, m_ptEnd) ;
|
||||
Point3d ptTip = m_ptEnd + m_vtCorr * CLEN ;
|
||||
PL.AddUPoint( 1, ptTip) ;
|
||||
// aggiungo simil-freccia
|
||||
Frame3d frF ;
|
||||
if ( m_vtTool. IsSmall())
|
||||
if ( m_vtTool. IsSmall() || AreSameOrOppositeVectorApprox( m_vtTool, m_vtCorr))
|
||||
frF.Set( ptTip, m_vtCorr) ;
|
||||
else
|
||||
frF.Set( ptTip, m_vtCorr, m_vtTool) ;
|
||||
@@ -371,14 +391,14 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
|
||||
PolyLine& PL = lstPL.back() ;
|
||||
// dimensioni
|
||||
const double CLEN = 20 ;
|
||||
const double ALEN = 2 ;
|
||||
const double ALEN = 1 ;
|
||||
// inserisco disegno nella polilinea
|
||||
PL.AddUPoint( 0, m_ptEnd) ;
|
||||
Point3d ptTip = m_ptEnd + m_vtAux * CLEN ;
|
||||
PL.AddUPoint( 1, ptTip) ;
|
||||
// aggiungo simil-freccia
|
||||
Frame3d frF ;
|
||||
if ( m_vtTool. IsSmall())
|
||||
if ( m_vtTool. IsSmall() || AreSameOrOppositeVectorApprox( m_vtTool, m_vtAux))
|
||||
frF.Set( ptTip, m_vtAux) ;
|
||||
else
|
||||
frF.Set( ptTip, m_vtAux, m_vtTool) ;
|
||||
@@ -546,6 +566,7 @@ CamData::CamData( void)
|
||||
m_pGeomDB = nullptr ;
|
||||
m_nMove = 0 ;
|
||||
m_nCorre = 0 ;
|
||||
m_bToolShow = false ;
|
||||
m_dAngCen = 0 ;
|
||||
m_dDeltaN = 0 ;
|
||||
m_dFeed = 0 ;
|
||||
|
||||
@@ -68,11 +68,13 @@ class CamData : public IUserObj
|
||||
bool SetAxesAngCen( double dAngCen) ;
|
||||
bool SetAxesNormDir( const Vector3d& vtDir) ;
|
||||
bool SetBackAuxDir( const Vector3d& vtDir) ;
|
||||
const int GetMoveType( void) const
|
||||
bool SetToolShow( bool bShow)
|
||||
{ m_bToolShow = bShow ; return true ; }
|
||||
int GetMoveType( void) const
|
||||
{ return m_nMove ; }
|
||||
const bool IsLine( void) const
|
||||
bool IsLine( void) const
|
||||
{ return ( m_nMove == 0 || m_nMove == 1) ; }
|
||||
const bool IsArc( void) const
|
||||
bool IsArc( void) const
|
||||
{ return ( m_nMove == 2 || m_nMove == 3) ; }
|
||||
const Vector3d& GetToolDir( void) const
|
||||
{ return m_vtTool ; }
|
||||
@@ -108,14 +110,16 @@ class CamData : public IUserObj
|
||||
{ return m_vMachAxes ; }
|
||||
const Point3d& GetAxesCen( void) const
|
||||
{ return m_ptMachCen ; }
|
||||
const double GetAxesRad( void) const
|
||||
double GetAxesRad( void) const
|
||||
{ return m_dMachRad ; }
|
||||
const double GetAxesAngCen( void) const
|
||||
double GetAxesAngCen( void) const
|
||||
{ return m_dMachAngCen ; }
|
||||
const Vector3d& GetAxesNormDir( void) const
|
||||
{ return m_vtMachN ; }
|
||||
const Vector3d& GetBackAuxDir( void) const
|
||||
{ return m_vtBackAux ; }
|
||||
bool GetToolShow( void) const
|
||||
{ return m_bToolShow ; }
|
||||
|
||||
public :
|
||||
enum { AS_NONE = 0,
|
||||
@@ -139,6 +143,7 @@ class CamData : public IUserObj
|
||||
IGeomDB* m_pGeomDB ;
|
||||
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)
|
||||
bool m_bToolShow ; // flag per forzare la visualizzazione della direzione utensile in ogni caso
|
||||
Vector3d m_vtTool ; // versore fresa
|
||||
Vector3d m_vtCorr ; // versore correzione
|
||||
Vector3d m_vtAux ; // versore ausiliario
|
||||
|
||||
+28
-5
@@ -595,6 +595,9 @@ Chiseling::Update( bool bPostApply)
|
||||
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
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
|
||||
|
||||
@@ -768,11 +771,31 @@ Chiseling::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in Chiseling : tool name changed (" +
|
||||
@@ -1013,8 +1036,8 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
for ( int nC = nCstart ; nC < nCend ; ++ nC) {
|
||||
// recupero i contorni del chunk
|
||||
for ( int nL = 0 ; nL < pReg->GetLoopCount( nC) ; ++ nL) {
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nC, nL)))
|
||||
PtrOwner<ICurveComposite> pCrvCompo ;
|
||||
if ( ! pCrvCompo.Set( ConvertCurveToComposite( pReg->GetLoop( nC, nL))))
|
||||
return false ;
|
||||
// assegno l'estrusione dalla normale alla regione
|
||||
pCrvCompo->SetExtrusion( vtN) ;
|
||||
|
||||
+6
-2
@@ -71,6 +71,10 @@ struct ChiselingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const ChiselingData* GetChiselingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const ChiselingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_CHISELING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const ChiselingData*>( pMdata)) ; }
|
||||
inline ChiselingData* GetChiselingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<ChiselingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_CHISELING)
|
||||
return nullptr ;
|
||||
return ( static_cast<ChiselingData*>( pMdata)) ; }
|
||||
|
||||
+23
-3
@@ -86,6 +86,8 @@ Disposition::Clone( void) const
|
||||
// eseguo copia dei dati
|
||||
if ( pDisp != nullptr) {
|
||||
try { pDisp->m_sTabName = m_sTabName ;
|
||||
pDisp->m_pMchMgr = m_pMchMgr ;
|
||||
pDisp->m_nPhase = m_nPhase ;
|
||||
pDisp->m_ptRef1 = m_ptRef1 ;
|
||||
pDisp->m_b3Area1 = m_b3Area1 ;
|
||||
pDisp->m_dAreaOffset = m_dAreaOffset ;
|
||||
@@ -1205,6 +1207,23 @@ Disposition::InsertMoveInfoInList( int nRawId, int nType, const Point3d& ptP, in
|
||||
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
|
||||
Disposition::RemoveRawPart( int nRawId)
|
||||
@@ -1353,7 +1372,8 @@ Disposition::SpecialApply( bool bRecalc)
|
||||
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
|
||||
// segnalo errori ed esco
|
||||
if ( ! bOk || nErr > 0) {
|
||||
m_nShifts = - 1 ;
|
||||
if ( m_nShifts != -1)
|
||||
m_nShifts = -2 ;
|
||||
string sOut = sMsg ;
|
||||
if ( IsEmptyOrSpaces( sOut))
|
||||
sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ;
|
||||
@@ -1393,12 +1413,12 @@ Disposition::SpecialUpdate( void)
|
||||
|
||||
// se disposizione vuota, esco
|
||||
if ( m_nShifts <= 0) {
|
||||
if ( m_nShifts < 0)
|
||||
if ( m_nShifts == -2)
|
||||
m_pMchMgr->SetWarning( 2052, "Warning in Disposition : No shifts") ;
|
||||
return true ;
|
||||
}
|
||||
// calcolo assi macchina
|
||||
if ( ! CalculateAxesValues( "")) {
|
||||
if ( ! CalculateAxesValues( "", false)) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 2007, "Error in Disposition : axes values not calculable") ;
|
||||
|
||||
+10
-7
@@ -56,14 +56,14 @@ class Disposition : public Operation
|
||||
{ return true ; }
|
||||
bool Save( int nBaseId, STRVECTOR& vString) const override ;
|
||||
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
|
||||
|
||||
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_DISP ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nShifts == 0) ; }
|
||||
int GetType( void) const override
|
||||
{ return OPER_DISP ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nShifts == 0) ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
protected : // Operation
|
||||
const std::string& GetToolName( void) const override ;
|
||||
@@ -71,7 +71,7 @@ class Disposition : public Operation
|
||||
int GetExitNbr( void) const override ;
|
||||
const std::string& GetToolTcPos( void) const override ;
|
||||
int GetSolCh( void) const override
|
||||
{ return 0 ; }
|
||||
{ return 0 ; }
|
||||
bool NeedPrevHome( void) const override ;
|
||||
|
||||
public :
|
||||
@@ -102,6 +102,7 @@ class Disposition : public Operation
|
||||
bool MoveRawPart( int nRawId, const Vector3d& vtMove) ;
|
||||
bool RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg) ;
|
||||
bool ApplyRotationToRawPart( int nRawId, double dAngCDeg, double dAngADeg, double dAngC1Deg, bool bAddToList = true) ;
|
||||
bool UpdateRawPartId( int nRawId, int nNewRawId) ;
|
||||
bool RemoveRawPart( int nRawId) ;
|
||||
bool GetFixtureData( int nInd, std::string& sName, int& nId, Point3d& ptPos,
|
||||
double& dAngDeg, double& dMov) const ;
|
||||
@@ -111,6 +112,8 @@ class Disposition : public Operation
|
||||
bool GetToolData( std::string& sName, std::string& sHead, int& nExit, std::string& sTcPos) const ;
|
||||
bool GetSomeByHand( void) const
|
||||
{ return m_bSomeByHand ; }
|
||||
bool IsWithTool( void)
|
||||
{ return ( m_nShifts != -1) ;}
|
||||
|
||||
private :
|
||||
bool InsertMoveInfoInList( int nRawId, int nType, const Point3d& ptP, int nFlag) ;
|
||||
|
||||
+662
-29
@@ -1,13 +1,14 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : Drilling.cpp Data : 21.05.15 Versione : 1.6e7
|
||||
// File : Drilling.cpp Data : 20.12.23 Versione : 2.5l47
|
||||
// Contenuto : Implementazione gestione forature.
|
||||
//
|
||||
// Note : Questa lavorazione è sempre espressa nel riferimento globale.
|
||||
//
|
||||
// Modifiche : 21.05.15 DS Creazione modulo.
|
||||
//
|
||||
// 20.12.23 RE Forature multiple con aggregati.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -19,6 +20,7 @@
|
||||
#include "OperationConst.h"
|
||||
#include "/EgtDev/Include/EXeCmdLogOff.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
@@ -27,6 +29,7 @@
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
#include "/EgtDev/Include/EGnStringKeyVal.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EGkGeoFrame3d.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -45,6 +48,9 @@ using namespace std ;
|
||||
// 2112 = "Error in Drilling : link outstroke xx"
|
||||
// 2113 = "Error in Drilling : post apply not calculable"
|
||||
// 2114 = "Error in Drilling : blind hole not reversible"
|
||||
// 2115 = "Error in Drilling : Mirror for Double calculation failed"
|
||||
// 2116 = "Error in Drilling : multi drilling head without valid tools"
|
||||
// 2117 = "Error in Drilling : incorrect multi drilling head"
|
||||
// 2151 = "Warning in Drilling : Skipped entity (xx)"
|
||||
// 2152 = "Warning in Drilling : No machinable path"
|
||||
// 2153 = "Warning in Drilling : Tool name changed (xx)"
|
||||
@@ -68,6 +74,39 @@ struct Hole
|
||||
: nOriId( GDB_ID_NULL), ptIni(), vtDir(), dDiam( 0), dThick( 0), dLen( 0), bBlind( true) {}
|
||||
} ;
|
||||
|
||||
struct MHDrill {
|
||||
int nInd_id_hole ; // indice foro
|
||||
Vector3d vtAux ; // vettore ausiliario per tale foratura
|
||||
} ;
|
||||
|
||||
struct HoleInfo {
|
||||
Hole hole ; // foro
|
||||
bool bDrill = false ; // se alla fine verrà lavorato
|
||||
bool bTempDrill = false ; // per test maschera (se durante un test viene lavorato o no)
|
||||
int nTempTool = -1 ; // per test maschera ( indice utensile che lo lavora durante un test)
|
||||
bool bSkipToAngle = false ; // nel caso di più assi rotanti, se foro già lavorato con testa orientata
|
||||
bool bForToolM = false ; // se tool main lavorerà questo foro
|
||||
int nIndHoleToolM = -1 ; // indice del foro che lo svuoterà inserendo il primo tool in esso
|
||||
INTVECTOR vToolHole ; // vettore di indici dei fori ai quali inserire l'ultim punta per lavorare il foro corrente
|
||||
INTVECTOR vIndTools ; // vettore dei tool associati ad ogni lavorazione in vToolHole (ordinati)
|
||||
VCT3DVECTOR vVtAux ; // vettore dei vtAux ausiliari del tool principale per lavorare questo foro (ordinati)
|
||||
int nIndTool = -1 ; // indice del tool che alla fine lavorerà il foro
|
||||
Vector3d vtAux ; // vettore ausiliario del tool principale che permette al tool principale di lavorare questo foro
|
||||
Point3d ptBtn ; // punto interno alla base del foro
|
||||
int nIndInSelVector = 0 ; // indice nel vettore m_vId (id fori selezionati)
|
||||
} ;
|
||||
|
||||
|
||||
struct ToolInfo
|
||||
{
|
||||
const ToolData* pTool ; // puntatore per utensile (nullo se utensile non presente)
|
||||
Point3d ptToolTip ; // punto finale del tool (per ptBtn del foro)
|
||||
ToolInfo( void)
|
||||
: pTool( nullptr) {}
|
||||
ToolInfo( const ToolData* pT)
|
||||
: pTool( pT) {}
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
USEROBJ_REGISTER( GetOperationClass( OPER_DRILLING), Drilling) ;
|
||||
|
||||
@@ -95,6 +134,7 @@ Drilling::Clone( void) const
|
||||
pDri->m_nStatus = m_nStatus ;
|
||||
pDri->m_nDrillings = m_nDrillings ;
|
||||
pDri->m_bTiltingTab = m_bTiltingTab ;
|
||||
pDri->m_vtTiltingAx = m_vtTiltingAx ;
|
||||
pDri->m_bAboveHead = m_bAboveHead ;
|
||||
pDri->m_bAggrBottom = m_bAggrBottom ;
|
||||
}
|
||||
@@ -450,16 +490,16 @@ Drilling::SetGeometry( const SELVECTOR& vIds)
|
||||
// se lavorazione standard
|
||||
if ( m_Params.m_nSubType == DRI_SUB_STD) {
|
||||
// recupero il valore di tolleranza sul diametro
|
||||
double dDiamTol = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
|
||||
//double dDiamTol = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
|
||||
// verifico che gli identificativi rappresentino dei fori con il corretto diametro
|
||||
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
|
||||
// recupero i dati del foro
|
||||
Hole hole ;
|
||||
if ( ! GetHoleData( vIds[i], hole) || ! VerifyDiameter( hole.dDiam, m_TParams.m_dDiam, dDiamTol)) {
|
||||
string sInfo = "Warning in Drilling : Skipped entity " + ToString( vIds[i].nId) ;
|
||||
m_pMchMgr->SetWarning( 2151, sInfo) ;
|
||||
continue ;
|
||||
}
|
||||
//Hole hole ;
|
||||
//if ( ! GetHoleData( vIds[i], hole) || !VerifyDiameter(hole.dDiam, m_TParams.m_dDiam, dDiamTol)) {
|
||||
// string sInfo = "Warning in Drilling : Skipped entity " + ToString( vIds[i].nId) ;
|
||||
// m_pMchMgr->SetWarning( 2151, sInfo) ;
|
||||
// continue ;
|
||||
//}
|
||||
// posso aggiungere alla lista
|
||||
m_vId.push_back( vIds[i]) ;
|
||||
}
|
||||
@@ -513,7 +553,7 @@ Drilling::Preview( bool bRecalc)
|
||||
|
||||
// se lavorazione standard
|
||||
if ( m_Params.m_nSubType == DRI_SUB_STD)
|
||||
return StdandardProcess( bRecalc, nPvId, GDB_ID_NULL) ;
|
||||
return StandardProcess( bRecalc, nPvId, GDB_ID_NULL) ;
|
||||
// se altrimenti lavorazione lungo curve
|
||||
else if ( m_Params.m_nSubType == DRI_SUB_ALONG_CURVE)
|
||||
return AlongCurveProcess( bRecalc, nPvId, GDB_ID_NULL) ;
|
||||
@@ -569,9 +609,22 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
|
||||
else
|
||||
m_pGeomDB->EmptyGroup( nClId) ;
|
||||
|
||||
// elimino eventuale gruppo geometria simmetrica per lavorazione in doppio
|
||||
int nDblId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_DBL) ;
|
||||
if ( nDblId != GDB_ID_NULL) {
|
||||
m_pGeomDB->Erase( nDblId) ;
|
||||
nDblId = GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
// rendo corrente l'utensile usato nella lavorazione
|
||||
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
|
||||
m_pMchMgr->SetLastError( 2322, "Error in Milling : Tool loading failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se lavorazione standard
|
||||
if ( m_Params.m_nSubType == DRI_SUB_STD) {
|
||||
if ( ! StdandardProcess( bRecalc, GDB_ID_NULL, nClId))
|
||||
if ( ! StandardProcess( bRecalc, GDB_ID_NULL, nClId))
|
||||
return false ;
|
||||
}
|
||||
// se altrimenti lavorazione lungo curve
|
||||
@@ -589,7 +642,13 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
|
||||
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
|
||||
if ( ! Update( bPostApply))
|
||||
return false ;
|
||||
|
||||
|
||||
// se lavorazione in doppio, aggiungo geometria della parte simmetrica
|
||||
if ( ! CalcMirrorByDouble( nClId, m_Params.m_sUserNotes)) {
|
||||
m_pMchMgr->SetLastError( 2115, "Error in Drilling : Mirror for Double calculation failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// aggiorno stato della lavorazione
|
||||
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
|
||||
// dichiaro successiva da aggiornare
|
||||
@@ -614,6 +673,9 @@ Drilling::Update( bool bPostApply)
|
||||
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
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
|
||||
|
||||
@@ -658,12 +720,71 @@ Drilling::Update( bool bPostApply)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::StdandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
Drilling::VerifyMultiParallelFixedDrills( void)
|
||||
{
|
||||
// se aggregato da sotto, sicuramente con una sola punta
|
||||
bool bAggrBottom = IsAggrBottom( m_TParams.m_sHead) ;
|
||||
if ( bAggrBottom)
|
||||
return false ;
|
||||
// se una sola uscita, inutile continuare
|
||||
int nExitCnt = m_pMchMgr->GetCurrMachine()->GetHeadExitCount( m_TParams.m_sHead) ;
|
||||
if ( nExitCnt == 1)
|
||||
return false ;
|
||||
// verifico che le uscite siano fisse
|
||||
int nSelectType = m_pMchMgr->GetCurrMachine()->GetHeadSelectType( m_TParams.m_sHead) ;
|
||||
if ( nSelectType != MCH_SLT_FIXEDEXITS)
|
||||
return false ;
|
||||
// recupero la direzione dell'utensile principale
|
||||
Point3d ptMainExit ; Vector3d vtMainTool, vtMainAux ;
|
||||
m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux( m_TParams.m_sHead, m_TParams.m_nExit, ptMainExit, vtMainTool, vtMainAux) ;
|
||||
// verifico ci sia almeno un'altra uscita attrezzata parallela a quella principale
|
||||
for ( int nT = 0 ; nT < nExitCnt ; ++ nT) {
|
||||
if ( nT + 1 == m_TParams.m_nExit)
|
||||
continue ;
|
||||
string sToolName ;
|
||||
if ( m_pMchMgr->GetLoadedTool( m_TParams.m_sHead, nT + 1, sToolName) && ! sToolName.empty()) {
|
||||
Point3d ptExit ; Vector3d vtTool, vtAux ;
|
||||
if ( m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux(m_TParams.m_sHead, nT + 1, ptExit, vtTool, vtAux) &&
|
||||
AreSameVectorApprox( vtTool, vtMainTool))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// non è stato trovato niente
|
||||
return false ;
|
||||
}
|
||||
|
||||
// elaboro i singoli fori
|
||||
int i = 0 ;
|
||||
for ( const auto& vId : m_vId) {
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
{
|
||||
// se ho almeno un'altra punta fissa parallela alla principale ...
|
||||
if ( VerifyMultiParallelFixedDrills()) {
|
||||
TABMHDRILL tabDrills ;
|
||||
double dMHOff = 0 ;
|
||||
if ( ! MultiHeadDrilling( m_vId, nClId, tabDrills, dMHOff))
|
||||
return false ;
|
||||
if ( tabDrills.empty())
|
||||
return true ;
|
||||
for ( int i = 0 ; i < ( int)tabDrills.size() ; ++i) {
|
||||
// se richiesto preview
|
||||
if ( nPvId != GDB_ID_NULL) {
|
||||
if ( ! GenerateHolePv( i, m_vId[tabDrills[i][0].nInd_id_hole], MCH_PATH, nClId))
|
||||
return false ;
|
||||
// creo la regione di ingombro del foro
|
||||
int nDriId = m_pGeomDB->GetFirstInGroup( m_pGeomDB->GetLastGroupInGroup( nPvId)) ;
|
||||
GenerateHoleRegionPv( nDriId, 1, nPvId) ;
|
||||
}
|
||||
// se richiesta lavorazione
|
||||
if ( nClId != GDB_ID_NULL) {
|
||||
if ( ! GenerateHoleCl( i, m_vId[tabDrills[i][0].nInd_id_hole], MCH_PATH, nClId, dMHOff, tabDrills[i][0].vtAux))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
// ... altrimenti elaboro i singoli fori
|
||||
for ( int i = 0 ; i < int( m_vId.size()) ; ++ i) {
|
||||
const auto& vId = m_vId[i] ;
|
||||
// se richiesto preview
|
||||
if ( nPvId != GDB_ID_NULL) {
|
||||
if ( ! GenerateHolePv( i, vId, MCH_PATH, nPvId))
|
||||
@@ -677,13 +798,503 @@ Drilling::StdandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
if ( ! GenerateHoleCl( i, vId, MCH_PATH, nClId))
|
||||
return false ;
|
||||
}
|
||||
// incremento indice
|
||||
++ i ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::MultiHeadDrilling( const SELVECTOR& vId, int nClId, TABMHDRILL& tabDrills, double& dMHOff, bool bOrd)
|
||||
{
|
||||
// controllo parametri
|
||||
tabDrills.clear() ;
|
||||
if ( vId.empty())
|
||||
return true ;
|
||||
|
||||
// gestore degli utensili
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
if ( pTMgr == nullptr)
|
||||
return false ;
|
||||
|
||||
// recupero il nome della testa e il numero di uscite
|
||||
string sHead ;
|
||||
m_pMchMgr->GetCurrMachine()->GetCurrHead( sHead) ;
|
||||
int nExitCnt = m_pMchMgr->GetCurrMachine()->GetHeadExitCount( sHead) ;
|
||||
|
||||
// Recupero i dati degli utensili montati sulla testa
|
||||
int nMainToolInd = -1 ;
|
||||
VECTORTOOL vTools ; vTools.reserve( nExitCnt) ;
|
||||
// ricavo gli utensili presenti sulle uscite
|
||||
for ( int nT = 0 ; nT < nExitCnt ; ++ nT) {
|
||||
string sToolName ;
|
||||
if ( ! m_pMchMgr->GetLoadedTool( sHead, nT + 1, sToolName) || sToolName.empty()) {
|
||||
// non c'è utensile
|
||||
vTools.emplace_back( nullptr) ;
|
||||
continue ;
|
||||
}
|
||||
// se presente e valido
|
||||
const ToolData* pTdata = pTMgr->GetTool( sToolName) ;
|
||||
vTools.emplace_back( pTdata) ;
|
||||
|
||||
// imposto il tool di riferimento come il tool m_TParams
|
||||
if ( pTdata->m_Uuid == m_TParams.m_Uuid)
|
||||
nMainToolInd = nT ;
|
||||
}
|
||||
// se non ho utensili attivi o validi, errore
|
||||
if ( nMainToolInd == -1 || vTools.empty()) {
|
||||
m_pMchMgr->SetLastError( 2116, "Error in Drilling : multi drilling head without valid tools") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// recupero i dati dell'uscita dell'utensile principale
|
||||
Vector3d vtTool, vtAux ;
|
||||
Point3d ptExit ;
|
||||
m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux( sHead, nMainToolInd + 1, ptExit, vtTool, vtAux) ;
|
||||
vTools[nMainToolInd].ptToolTip = ptExit - vtTool * vTools[nMainToolInd].pTool->m_dLen ;
|
||||
if ( vtAux.IsSmall() && m_pMchMgr->GetCurrMachine()->GetCurrRotAxes() == 0)
|
||||
vtAux = FromUprightOrtho( vtTool) ;
|
||||
if ( vtTool.IsSmall() || vtAux.IsSmall()) {
|
||||
m_pMchMgr->SetLastError( 2117, "Error in Drilling : incorrect multi drilling head") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// carico gli altri dati della testa con le sue uscite
|
||||
for ( int nT = 0 ; nT < nExitCnt ; ++ nT) {
|
||||
// se utensile principale, salto al successivo
|
||||
if ( nT == nMainToolInd)
|
||||
continue ;
|
||||
// se non attrezzato, salto al successivo
|
||||
if ( vTools[nT].pTool == nullptr)
|
||||
continue ;
|
||||
// recupero i dati dell'uscita
|
||||
Point3d ptExit ;
|
||||
Vector3d vtCurrDir, vtCurrAux ;
|
||||
m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux( sHead, nT + 1, ptExit, vtCurrDir, vtCurrAux) ;
|
||||
// controllo abbia la stessa direzione del principale, altrimenti disattrezzo
|
||||
if ( ! AreSameVectorApprox( vtCurrDir, vtTool)) {
|
||||
vTools[nT].pTool = nullptr ;
|
||||
continue ;
|
||||
}
|
||||
// assegno tip utensile
|
||||
vTools[nT].ptToolTip = ptExit - vtCurrDir * vTools[nT].pTool->m_dLen ;
|
||||
}
|
||||
|
||||
// Recupero le geometrie dei fori
|
||||
bool bSomeHoleOk = false ;
|
||||
VECTORHOLE vHoles( vId.size()) ;
|
||||
for ( int h = 0 ; h < ( int)vId.size() ; ++ h) {
|
||||
Hole hole ;
|
||||
if ( ! GetHoleData( m_vId[h], hole)) {
|
||||
string sInfo = "Warning in Drilling : Skipped entity " + ToString( m_vId[h]) ;
|
||||
m_pMchMgr->SetWarning( 2151, sInfo) ;
|
||||
continue ;
|
||||
}
|
||||
// se richiesta inversione e foro passante, provvedo
|
||||
if ( m_Params.m_bInvert) {
|
||||
if ( hole.bBlind) {
|
||||
m_pMchMgr->SetLastError( 2114, "Error in Drilling : blind hole not reversible") ;
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
hole.ptIni -= hole.vtDir * hole.dThick ;
|
||||
hole.vtDir.Invert() ;
|
||||
}
|
||||
}
|
||||
// se lavorazione del foro non arriva al suo fondo, lo considero cieco
|
||||
if ( hole.dLen < hole.dThick - 10 * EPS_SMALL)
|
||||
hole.bBlind = true ;
|
||||
|
||||
vHoles[h].hole = hole ;
|
||||
vHoles[h].nIndInSelVector = h ;
|
||||
bSomeHoleOk = true ;
|
||||
}
|
||||
if ( ! bSomeHoleOk)
|
||||
return true ;
|
||||
|
||||
// calcolo la corrispondenza tra utensili e fori
|
||||
if ( ! CalcMask( vHoles, vTools, nMainToolInd, vtTool, vtAux))
|
||||
return false ;
|
||||
|
||||
// i fori con dimensione 0 del vettore vToolHole non possono essere lavorati
|
||||
int nNoDrillHoles = 0 ;
|
||||
for ( int i = 0 ; i < ( int)vHoles.size() ; ++ i) {
|
||||
if ( vHoles[i].vToolHole.empty())
|
||||
++ nNoDrillHoles ;
|
||||
}
|
||||
|
||||
// resetto le variabili di controllo di lavorazione temporanea per tutti i fori
|
||||
for ( int k = 0 ; k < ( int)vHoles.size() ; ++k)
|
||||
vHoles[k].bTempDrill = false ;
|
||||
|
||||
// numero di fori lavorati
|
||||
int nOkHole = 0 ;
|
||||
|
||||
// se c'è un solo foro va sicuramente bene
|
||||
if ( vHoles.size() == 1 && ! vHoles[0].vVtAux.empty()) {
|
||||
vHoles[0].bForToolM = true ;
|
||||
vHoles[0].nIndTool = nMainToolInd ;
|
||||
vHoles[0].nIndHoleToolM = 0 ;
|
||||
vHoles[0].vtAux = vHoles[0].vVtAux[0] ;
|
||||
}
|
||||
|
||||
// decido in quali fori inserire il tool principale
|
||||
for ( int nCheck = 1 ; nCheck < ( int)vHoles.size() && nOkHole < ( int)vHoles.size() - nNoDrillHoles ; ++ nCheck) {
|
||||
for ( int i = 0 ; i < ( int)vHoles.size() ; ++i) {
|
||||
// prendo tutti i fori con vToolHope di lunghezza nCheck non già lavorati
|
||||
if ( vHoles[i].vToolHole.size() == nCheck && ! vHoles[i].bDrill) {
|
||||
vHoles[vHoles[i].vToolHole[0]].bForToolM = true ;
|
||||
vHoles[vHoles[i].vToolHole[0]].nIndTool = nMainToolInd ;
|
||||
vHoles[vHoles[i].vToolHole[0]].nIndHoleToolM = vHoles[i].vToolHole[0] ;
|
||||
vHoles[vHoles[i].vToolHole[0]].vtAux = vHoles[i].vVtAux[0] ;
|
||||
for ( int k = 0 ; k < ( int)vHoles.size() ; ++k) {
|
||||
for ( int l = 0 ; l < ( int)vHoles[k].vToolHole.size() ; ++l) {
|
||||
if ( vHoles[k].vToolHole[l] == vHoles[i].vToolHole[0] && ! vHoles[k].bDrill) {
|
||||
vHoles[k].bDrill = true ;
|
||||
vHoles[k].nIndTool = vHoles[k].vIndTools[0] ;
|
||||
vHoles[k].nIndHoleToolM = vHoles[vHoles[i].vToolHole[0]].nIndHoleToolM ;
|
||||
vHoles[k].vtAux = vHoles[k].vVtAux[l] ;
|
||||
++ nOkHole ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// calcolo la massima differenza di lunghezza tra il primo tool e gli altri ( così l'elevazione finale rimane compatibile)
|
||||
double dRefLen = vTools[nMainToolInd].pTool->m_dTLen ;
|
||||
double dOffMax = 0 ;
|
||||
for ( int nT = 0 ; nT < ( int)vTools.size() && nNoDrillHoles != (int)vHoles.size() ; ++ nT) {
|
||||
if ( vTools[nT].pTool == nullptr || nT == nMainToolInd)
|
||||
continue ;
|
||||
if ( vTools[nT].pTool->m_dTLen > dRefLen + dOffMax) {
|
||||
dOffMax = vTools[nT].pTool->m_dTLen - dRefLen ;
|
||||
}
|
||||
}
|
||||
dMHOff = dOffMax ;
|
||||
|
||||
// riempio la maschera
|
||||
VCT3DVECTOR vVtA ;
|
||||
for ( int i = 0 ; i < ( int)vHoles.size() && nNoDrillHoles != ( int)vHoles.size() ; ++ i) {
|
||||
if ( ! vHoles[i].bForToolM)
|
||||
continue ;
|
||||
// per tutti i fori che vengono svuotati da un tool t-esimo conto quanti versori A diversi tra loro trovo
|
||||
for ( int j = 0 ; j < ( int)vHoles.size() ; ++j) {
|
||||
if ( vHoles[j].nIndHoleToolM != i)
|
||||
continue ;
|
||||
if ( vVtA.empty())
|
||||
vVtA.push_back( vHoles[j].vtAux) ;
|
||||
else {
|
||||
bool bPush = true ;
|
||||
for ( int v = 0 ; v < ( int)vVtA.size() ; ++ v) {
|
||||
if ( AreSameVectorApprox( vHoles[j].vtAux, vVtA[v])) {
|
||||
bPush = false ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if ( bPush)
|
||||
vVtA.push_back( vHoles[j].vtAux) ;
|
||||
}
|
||||
}
|
||||
|
||||
for ( int v = 0 ; v < ( int)vVtA.size() ; ++ v) {
|
||||
vector<MHDrill> vRowDrill ;
|
||||
MHDrill FirstMHDrill ;
|
||||
FirstMHDrill.nInd_id_hole = i ;
|
||||
FirstMHDrill.vtAux = vVtA[v] ;
|
||||
vRowDrill.push_back( FirstMHDrill) ;
|
||||
tabDrills.push_back( vRowDrill) ;
|
||||
}
|
||||
vVtA.clear() ;
|
||||
}
|
||||
// se non trovo corrispondenze ...
|
||||
if ( tabDrills.empty())
|
||||
return true ;
|
||||
|
||||
// se devo riordinare
|
||||
if ( bOrd) {
|
||||
struct Order {
|
||||
int nInd_id_hole ;
|
||||
Point3d ptIni ;
|
||||
} ;
|
||||
vector<Order> vOrder ;
|
||||
for ( int i = 0 ; i < ( int)tabDrills.size() ; ++ i) {
|
||||
Order newOrder ;
|
||||
newOrder.nInd_id_hole = tabDrills[i][0].nInd_id_hole ;
|
||||
newOrder.ptIni = vHoles[tabDrills[i][0].nInd_id_hole].hole.ptIni ;
|
||||
vOrder.push_back( newOrder) ;
|
||||
}
|
||||
|
||||
// prendo come riferimento il punto del primo foro selezionato dall'utente
|
||||
Point3d ptRef = vOrder[0].ptIni ;
|
||||
double dMinDist = INFINITO ;
|
||||
int nIndexSwitch = -1 ;
|
||||
for ( int i = 0 ; i < ( int)vOrder.size() - 1 ; ++ i) {
|
||||
for ( int j = i + 1 ; j < ( int)vOrder.size() ; ++ j) {
|
||||
Point3d ptS = vOrder[j].ptIni ;
|
||||
if ( Dist( ptS, ptRef) < dMinDist) {
|
||||
dMinDist = Dist( ptS, ptRef) ;
|
||||
nIndexSwitch = j ;
|
||||
}
|
||||
}
|
||||
if ( nIndexSwitch != i + 1) {
|
||||
vector<MHDrill> VHelp = tabDrills[nIndexSwitch] ;
|
||||
tabDrills[nIndexSwitch] = tabDrills[i + 1] ;
|
||||
tabDrills[i + 1] = VHelp ;
|
||||
}
|
||||
ptRef = vOrder[i + 1].ptIni ;
|
||||
dMinDist = INFINITO ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux)
|
||||
{
|
||||
// controllo dei parametri
|
||||
if ( vHoles.empty() || vTools.empty())
|
||||
return false ;
|
||||
|
||||
// recupero il valore di tolleranza sul diametro
|
||||
double dDiamToler = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
|
||||
|
||||
int nExitCnt = ( int)vTools.size() ;
|
||||
int nNullTools = 0 ;
|
||||
for ( int i = 0 ; i < ( int)vTools.size() ; ++ i) {
|
||||
if ( vTools[i].pTool == nullptr)
|
||||
++ nNullTools ;
|
||||
}
|
||||
|
||||
// in ogni foro i-esimo inserisco il Tool principale
|
||||
for ( int i = 0 ; i < ( int)vHoles.size() ; ++ i) {
|
||||
|
||||
// resetto le veriabili di controllo di svuotatura temporanea per tutti i fori
|
||||
for ( int k = 0 ; k < ( int)vHoles.size() ; ++ k) {
|
||||
vHoles[k].bTempDrill = false ;
|
||||
vHoles[k].nTempTool = -1 ;
|
||||
}
|
||||
|
||||
// verifica validità del foro i-esimo per il Tool principale
|
||||
Hole Hole_i = vHoles[i].hole ;
|
||||
if ( ! MultiHeadVerifyHole( Hole_i, vTools[nIndMT].pTool, dDiamToler, m_vId[vHoles[i].nIndInSelVector]))
|
||||
continue ;
|
||||
|
||||
int nStat ;
|
||||
DBLVECTOR vAng1, vAng2 ;
|
||||
// angoli per allineare T del tool principale con vtDir del foro i-esimo
|
||||
if ( ! m_pMchMgr->GetCalcAngles( Hole_i.vtDir, V_NULL, nStat, vAng1, vAng2))
|
||||
continue ;
|
||||
Vector3d vtTnew ;
|
||||
// check che T sia allineato con vtDir
|
||||
if ( ! m_pMchMgr->GetCalcToolDirFromAngles( vAng1, vtTnew) || ! AreSameVectorApprox( vtTnew, Hole_i.vtDir))
|
||||
continue ;
|
||||
Vector3d vtAnew ;
|
||||
// nuova configurazione del versore A ottenuta
|
||||
if ( ! m_pMchMgr->GetCalcAuxDirFromAngles( vAng1, vtAnew))
|
||||
continue ;
|
||||
if ( vtAnew.IsSmall() && m_pMchMgr->GetCurrMachine()->GetCurrRotAxes() == 0)
|
||||
vtAnew = vtAux ;
|
||||
|
||||
// creo un nuovo sistema di riferimento centrato nel Tool principale
|
||||
Frame3d frMT ;
|
||||
frMT.Set( vTools[nIndMT].ptToolTip, vtTool, vtAux) ;
|
||||
if ( ! frMT.IsValid())
|
||||
return false ;
|
||||
|
||||
// creo un frame nel foro i-esimo orientato come il frame sul tool principale ( origine nella base interna del foro)
|
||||
Frame3d frHMT ;
|
||||
frHMT.Set( Hole_i.ptIni - Hole_i.vtDir * Hole_i.dLen, vtTnew, vtAnew) ;
|
||||
if ( ! frHMT.IsValid())
|
||||
return false ;
|
||||
|
||||
// numero di svuotature inserendo il Tool principale nel foro i-esimo
|
||||
int nDrills = 1 ;
|
||||
// setto le variabili temporanee per il foro i-esimo
|
||||
vHoles[i].bTempDrill = true ;
|
||||
vHoles[i].nTempTool = nIndMT ;
|
||||
|
||||
// controllo la compatibilità tra le geometrie dei Tool e dei fori
|
||||
CheckOtherHolesWithTools( vHoles, vTools, nIndMT, i, Hole_i, frMT, frHMT, dDiamToler, nDrills) ;
|
||||
|
||||
// controllo quanti fori sono riuscito a svuotare e setto i loro parametri di foratura
|
||||
if ( nDrills == nExitCnt - nNullTools) { // se ho svuotato il numero corretto di fori ...
|
||||
for ( int d = 0 ; d < ( int)vHoles.size() ; ++ d) {
|
||||
if ( vHoles[d].bTempDrill) {
|
||||
vHoles[d].vToolHole.push_back( i) ; // indice del foro per il tool principale
|
||||
vHoles[d].vIndTools.push_back( vHoles[d].nTempTool) ; // indice del tool che svuota questo foro
|
||||
vHoles[d].vVtAux.push_back( frHMT.VersX()) ; // versore ausiliario A del tool principale
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for ( int d = 0 ; d < ( int)vHoles.size() ; ++ d)
|
||||
if ( vHoles[d].bTempDrill)
|
||||
vHoles[d].bTempDrill = false ;
|
||||
}
|
||||
|
||||
// se la testa può ruotare
|
||||
if ( nStat < 0) {
|
||||
|
||||
// inizio a scorrere tutti i tools
|
||||
for ( int t = 0 ; t < ( int)vTools.size() ; ++ t) {
|
||||
if ( vTools[t].pTool == nullptr || t == nIndMT)
|
||||
continue ;
|
||||
|
||||
// cerco se ho un foro j-esimo adatto per quella punta
|
||||
for ( int j = 0 ; j < ( int)vHoles.size() ; ++ j) {
|
||||
|
||||
Hole Hole_j = vHoles[j].hole ;
|
||||
if ( i == j ||
|
||||
vHoles[j].bSkipToAngle ||
|
||||
! AreSameVectorApprox( Hole_j.vtDir, Hole_i.vtDir) ||
|
||||
! MultiHeadVerifyHole( Hole_j, vTools[t].pTool, dDiamToler, m_vId[vHoles[j].nIndInSelVector]))
|
||||
continue ;
|
||||
|
||||
// resetto le veriabili di controllo di svuotatura temporanea per tutti i fori
|
||||
for ( int k = 0 ; k < ( int)vHoles.size() ; ++ k) {
|
||||
vHoles[k].bTempDrill = false ;
|
||||
vHoles[k].nTempTool = -1 ;
|
||||
}
|
||||
|
||||
Vector3d vtRefT = vTools[t].ptToolTip - vTools[nIndMT].ptToolTip ;
|
||||
Vector3d vtRefH = Hole_j.ptIni - Hole_j.vtDir * Hole_j.dLen -
|
||||
( Hole_i.ptIni - Hole_i.vtDir * Hole_i.dLen) ;
|
||||
|
||||
// se le distanze sono compatibili
|
||||
if ( abs( vtRefH.Len() - vtRefT.Len()) < EPS_SMALL) {
|
||||
// rioriento il frame sul foro i-esimo
|
||||
Point3d ptHj = Hole_j.ptIni - Hole_j.vtDir * Hole_j.dLen ;
|
||||
ptHj.ToLoc( frHMT) ;
|
||||
Vector3d vtProjB( ptHj.x, ptHj.y, 0) ;
|
||||
|
||||
Point3d ptTt = vTools[t].ptToolTip ;
|
||||
ptTt.ToLoc( frMT) ;
|
||||
Vector3d vtProjA( ptTt.x, ptTt.y, 0) ;
|
||||
|
||||
double dAngle ; vtProjA.GetAngle( vtProjB, dAngle) ;
|
||||
frHMT.Rotate( frHMT.Orig(), frHMT.VersZ(), dAngle) ;
|
||||
|
||||
nDrills = 1 ; // foratura nel foro i-esimo e j-esimo
|
||||
CheckOtherHolesWithTools( vHoles, vTools, nIndMT, i, Hole_i, frMT, frHMT, dDiamToler, nDrills) ;
|
||||
|
||||
// setto le variabili temporanee per il foro i-esimo
|
||||
vHoles[i].bTempDrill = true ;
|
||||
vHoles[i].nTempTool = nIndMT ;
|
||||
|
||||
// controllo quanti fori sono riuscito a svuotare in questo nuovo sistema di riferimento
|
||||
if ( nDrills == nExitCnt - nNullTools) {
|
||||
for ( int d = 0 ; d < ( int)vHoles.size() ; ++ d) {
|
||||
if ( vHoles[d].bTempDrill) {
|
||||
vHoles[d].vToolHole.push_back( i) ; // indice del foro per il tool principale
|
||||
vHoles[d].vIndTools.push_back( vHoles[d].nTempTool) ; // indice del tool che svuota questo foro
|
||||
vHoles[d].vVtAux.push_back( frHMT.VersX()) ; // versore ausiliario del tool principale
|
||||
vHoles[d].bSkipToAngle = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for ( int d = 0 ; d < ( int)vHoles.size() ; ++ d)
|
||||
if ( vHoles[d].bTempDrill)
|
||||
vHoles[d].bTempDrill = false ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::CheckOtherHolesWithTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP,
|
||||
const Frame3d& frMT, const Frame3d& frHMT, double dDiamToler, int& nDrills)
|
||||
{
|
||||
// controllo parametri
|
||||
if ( vHoles.empty() || vTools.empty())
|
||||
return true ;
|
||||
if ( nIndTM < 0 || nIndTM >= ( int)vTools.size() ||
|
||||
nIndHTM < 0 || nIndHTM >= ( int)vHoles.size() ||
|
||||
! frMT.IsValid() || ! frHMT.IsValid() ||
|
||||
nDrills < 0 || nDrills > max( ( int)vHoles.size(), ( int)vTools.size()))
|
||||
return false ;
|
||||
|
||||
// definisco il punto dove cade il tool principale
|
||||
Hole holeTM = holeICP ; // copia del foro i-esimo
|
||||
|
||||
// ciclo su tutti i tools
|
||||
for ( int t = 0 ; t < ( int)vTools.size() ; ++ t) {
|
||||
if ( vTools[t].pTool == nullptr || t == nIndTM)
|
||||
continue ;
|
||||
// esprimo il punto finale del tool t-esimo nel sistema di riferimento del Tool principale
|
||||
Point3d ptETt = vTools[t].ptToolTip ;
|
||||
ptETt.ToLoc( frMT) ;
|
||||
|
||||
// cerco se ho un foro j-esimo adatto per quella punta
|
||||
for ( int j = 0 ; j < ( int)vHoles.size() ; ++ j) {
|
||||
Hole Hole_j = vHoles[j].hole ; // copia del foro j-esimo
|
||||
// controllo che il foro j-esimo non sia l'i-esimo, che non sia stato già precedentemente svuotato da un altro tool t'-esimo ...
|
||||
// ... che vtDir del foro i-esimo coincida con vtDir del foro j-esimo e che il tool t-esimo sia compatibile con il foro j-esimo
|
||||
if ( nIndHTM == j ||
|
||||
vHoles[j].bTempDrill ||
|
||||
! AreSameVectorApprox( Hole_j.vtDir, holeTM.vtDir) ||
|
||||
! MultiHeadVerifyHole( Hole_j, vTools[t].pTool, dDiamToler, m_vId[vHoles[j].nIndInSelVector]))
|
||||
continue ;
|
||||
|
||||
// esprimo il foro j-esimo nel sistema di riferimento del Tool principale centrato nel foro i-esimo
|
||||
Point3d ptHj = Hole_j.ptIni - Hole_j.vtDir * Hole_j.dLen ;
|
||||
ptHj.ToLoc( frHMT) ;
|
||||
|
||||
// controllo la compatibilità
|
||||
if ( AreSamePointApprox( ptHj, ptETt)) {
|
||||
// un foro in più lavorato
|
||||
++ nDrills ;
|
||||
// aggiorno le variabili temporanee
|
||||
vHoles[j].bTempDrill = true ;
|
||||
vHoles[j].nTempTool = t ;
|
||||
// non controllo gli altri vertici per la punta t-esima
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id)
|
||||
{
|
||||
// verifico che il diamtro del tool sia compatibile con quello del foro
|
||||
if ( ! VerifyDiameter( hole.dDiam, Tool->m_dDiam, dDiamToler))
|
||||
return false ;
|
||||
// imposto elevazione da lunghezza foro con possibilità di sovrascrittura da info
|
||||
double dElev = hole.dLen ;
|
||||
double dMaxElev ;
|
||||
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxElev="), dMaxElev) && dElev > dMaxElev) {
|
||||
dElev = dMaxElev ;
|
||||
hole.ptIni += hole.vtDir * ( dElev - hole.dLen) ;
|
||||
hole.dLen = dElev ;
|
||||
}
|
||||
// limito lunghezza foro a massima lavorazione della punta
|
||||
double dAddLen = ( hole.bBlind ? 0 : m_Params.m_dThroughAddLen) ;
|
||||
if ( ( dElev + dAddLen) > Tool->m_dMaxMat + EPS_SMALL) {
|
||||
hole.dLen = Tool->m_dMaxMat + max( hole.dLen - dElev, 0.) ;
|
||||
hole.bBlind = true ;
|
||||
}
|
||||
if ( ! VerifyHoleFromBottom( hole, Id))
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::AlongCurveProcess( bool bRecalc, int nPvId, int nClId)
|
||||
@@ -976,12 +1587,12 @@ Drilling::GenerateHolePv( int nInd, const SelData& nCircId, const string& sPName
|
||||
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pCrvArc) || ! pCrvArc->Set( hole.ptIni, hole.vtDir, 0.5 * m_TParams.m_dDiam))
|
||||
return false ;
|
||||
// assegno il versore estrusione e lo spessore
|
||||
// assegno il versore estrusione e lo spessore
|
||||
pCrvArc->SetExtrusion( hole.vtDir) ;
|
||||
pCrvArc->SetThickness( - hole.dLen) ;
|
||||
// inserisco nel DB
|
||||
int nDriId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrvArc)) ;
|
||||
// assegno nome e colore
|
||||
// assegno nome e colore
|
||||
m_pGeomDB->SetName( nDriId, MCH_PV_CUT) ;
|
||||
m_pGeomDB->SetMaterial( nDriId, LIME) ;
|
||||
// aggiorno numero forature
|
||||
@@ -991,7 +1602,7 @@ Drilling::GenerateHolePv( int nInd, const SelData& nCircId, const string& sPName
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName, int nClId)
|
||||
Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName, int nClId, double dMHOff, Vector3d vtA)
|
||||
{
|
||||
// creo gruppo per geometria di lavorazione del foro
|
||||
int nPathId = m_pGeomDB->AddGroup( GDB_ID_NULL, nClId, Frame3d()) ;
|
||||
@@ -1042,7 +1653,7 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
|
||||
}
|
||||
// verifico se tavola basculante
|
||||
bool bTiltTab = false ;
|
||||
m_bTiltingTab = ( m_pMchMgr->GetCurrMachine()->GetCurrTableIsTilting( bTiltTab) && bTiltTab) ;
|
||||
m_bTiltingTab = ( m_pMchMgr->GetCurrMachine()->GetCurrTableIsTilting( bTiltTab, m_vtTiltingAx) && bTiltTab) ;
|
||||
// verifico se testa da sopra (Z+)
|
||||
m_bAboveHead = m_pMchMgr->GetHeadAbove( m_TParams.m_sHead) ;
|
||||
// verifiche per foro verso il basso
|
||||
@@ -1059,7 +1670,7 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
|
||||
// foro normale
|
||||
if ( m_Params.m_dStep < EPS_SMALL ||
|
||||
m_Params.m_dStep > hole.dLen - EPS_SMALL) {
|
||||
if ( DoStandardDrilling( hole, nCircId, nPathId)) {
|
||||
if ( DoStandardDrilling( hole, nCircId, nPathId, dMHOff, vtA)) {
|
||||
// aggiorno numero forature
|
||||
++ m_nDrillings ;
|
||||
}
|
||||
@@ -1304,11 +1915,31 @@ Drilling::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in Drilling : tool name changed (" +
|
||||
@@ -1457,7 +2088,7 @@ Drilling::VerifyHoleFromBottom( const Hole& hole, SelData Id)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double dMHOff, Vector3d vtA)
|
||||
{
|
||||
// aggiusto alcuni parametri del ciclo di foratura
|
||||
double dStartSlowLen = abs( m_Params.m_dStartSlowLen) ;
|
||||
@@ -1487,7 +2118,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
|
||||
double dAppr = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
|
||||
Point3d ptP1 = hole.ptIni + hole.vtDir * ( dAppr + dElev + dTExtrLen) ;
|
||||
Point3d ptP1 = hole.ptIni + hole.vtDir * ( dAppr + dElev + dTExtrLen + dMHOff) ;
|
||||
if ( m_bAggrBottom) {
|
||||
Point3d ptP0 = ptP1 + m_vtAggrBottom * ( m_dDistBottom + m_AggrBottom.dEncH + dSafeZ) ;
|
||||
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAppr + dTExtrLen) ;
|
||||
@@ -1514,6 +2145,8 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if( ! vtA.IsSmall())
|
||||
SetAuxDir( vtA) ;
|
||||
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
|
||||
+16
-3
@@ -19,7 +19,13 @@
|
||||
#include "MachiningConst.h"
|
||||
|
||||
struct Hole ;
|
||||
struct MHDrill ;
|
||||
struct HoleInfo ;
|
||||
struct ToolInfo ;
|
||||
class ICurve ;
|
||||
typedef std::vector<std::vector<MHDrill>> TABMHDRILL ;
|
||||
typedef std::vector<HoleInfo> VECTORHOLE ;
|
||||
typedef std::vector<ToolInfo> VECTORTOOL ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Drilling : public Machining
|
||||
@@ -68,18 +74,24 @@ class Drilling : public Machining
|
||||
|
||||
private :
|
||||
bool GetHoleData( SelData Id, Hole& hole) ;
|
||||
bool StdandardProcess( bool bRecalc, int nPvId, int nClId) ;
|
||||
bool StandardProcess( bool bRecalc, int nPvId, int nClId) ;
|
||||
bool AlongCurveProcess( bool bRecalc, int nPvId, int nClId) ;
|
||||
bool Chain( int nGrpDestId) ;
|
||||
ICurve* GetCurve( SelData Id) ;
|
||||
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
|
||||
bool GenerateHolePv( int nInd, const SelData& nCircId, const std::string& sPName, int nPvId) ;
|
||||
bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId) ;
|
||||
bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId, double dMHOff = .0, Vector3d vtAux = V_NULL) ;
|
||||
bool GenerateHoleRegionPv( int nFirstId, int nCount, int nPvId) ;
|
||||
bool VerifyDiameter( double dHdiam, double dTdiam, double ddiamTol) ;
|
||||
bool VerifyHoleFromBottom( const Hole& hole, SelData Id) ;
|
||||
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId) ;
|
||||
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double nMHOff, Vector3d vtA) ;
|
||||
bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) ;
|
||||
bool MultiHeadDrilling( const SELVECTOR& vId, int nClId, TABMHDRILL& vDrills, double& dMHOff, bool bOrd = true) ;
|
||||
bool CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux) ;
|
||||
bool CheckOtherHolesWithTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP,
|
||||
const Frame3d& frHTM, const Frame3d& frHMTOP, double dDiamToler, int& nDrills) ;
|
||||
bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id) ;
|
||||
bool VerifyMultiParallelFixedDrills( void) ;
|
||||
|
||||
private :
|
||||
double GetSpeed() const
|
||||
@@ -100,6 +112,7 @@ class Drilling : public Machining
|
||||
int m_nStatus ; // stato di aggiornamento della lavorazione
|
||||
int m_nDrillings ; // numero di fori generati
|
||||
bool m_bTiltingTab ; // flag utilizzo tavola basculante
|
||||
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
|
||||
bool m_bAboveHead ; // flag utilizzo testa da sopra
|
||||
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
|
||||
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
|
||||
|
||||
+6
-2
@@ -75,6 +75,10 @@ struct DrillingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const DrillingData* GetDrillingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const DrillingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_DRILLING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const DrillingData*>( pMdata)) ; }
|
||||
inline DrillingData* GetDrillingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<DrillingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_DRILLING)
|
||||
return nullptr ;
|
||||
return ( static_cast<DrillingData*>( pMdata)) ; }
|
||||
|
||||
Binary file not shown.
@@ -21,7 +21,7 @@
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{0BD58222-92F3-48B2-B656-4497D1956874}</ProjectGuid>
|
||||
<RootNamespace>EgtMachKernel</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
@@ -100,11 +100,12 @@
|
||||
<Optimization>Disabled</Optimization>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EMK;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EMK;_VRONI;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -166,6 +167,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
@@ -193,7 +195,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EMK;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
|
||||
@@ -124,6 +124,9 @@ Exit::Modify( const Point3d& ptPos, double dExitMaxAdjust)
|
||||
}
|
||||
// Assegno la nuova posizione
|
||||
m_ptPos = ptPos ;
|
||||
// Sistemo la geometria dell'uscita
|
||||
if ( ! vtDelta.IsZero())
|
||||
m_pGeomDB->Translate( m_nOwnerId, vtDelta) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
+59
-3
@@ -55,6 +55,17 @@ static const string EVAR_STARTPOS = ".STARTPOS" ; // IN (num) quota di inizio l
|
||||
static const string EVAR_OFFSR = ".OFFSR" ; // IN (num) offset radiale
|
||||
static const string EVAR_OFFSL = ".OFFSL" ; // IN (num) offset longitudinale
|
||||
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_STARTFEED = ".STARTFEED" ;// IN (num) feed di inizio dell'utensile
|
||||
static const string EVAR_ENDFEED = ".ENDFEED" ; // IN (num) feed di fine dell'utensile
|
||||
@@ -481,6 +492,17 @@ GenMachining::Preview( bool bRecalc)
|
||||
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_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_STARTFEED, GetStartFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
|
||||
@@ -584,6 +606,17 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
|
||||
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_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_STARTFEED, GetStartFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
|
||||
@@ -636,6 +669,9 @@ GenMachining::Update( bool bPostApply)
|
||||
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
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
|
||||
|
||||
@@ -806,11 +842,31 @@ GenMachining::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in GenMachining : tool name changed (" +
|
||||
|
||||
+6
-2
@@ -67,6 +67,10 @@ struct GenMachiningData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const GenMachiningData* GetGenMachiningData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const GenMachiningData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_GENMACHINING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const GenMachiningData*>( pMdata)) ; }
|
||||
inline GenMachiningData* GetGenMachiningData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<GenMachiningData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_GENMACHINING)
|
||||
return nullptr ;
|
||||
return ( static_cast<GenMachiningData*>( pMdata)) ; }
|
||||
|
||||
+29
-11
@@ -19,6 +19,7 @@
|
||||
#include "OutputConst.h"
|
||||
#include "/EgtDev/Include/EMkDllMain.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/EGnGetKeyData.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -46,19 +47,31 @@ Generator::Init( MachMgr* pMchMgr)
|
||||
bool
|
||||
Generator::Run( const string& sCncFile, const string& sInfo)
|
||||
{
|
||||
// verifico sia abilitato dalla licenza
|
||||
bool bEnabled = false ;
|
||||
if ( GetEMkNetHwKey()) {
|
||||
bEnabled = true ;
|
||||
}
|
||||
else {
|
||||
unsigned int nOpt1, nOpt2 ;
|
||||
int nOptExpDays ;
|
||||
// Controllo della licenza
|
||||
unsigned int nOpt1, nOpt2 ;
|
||||
int nOptExpDays ;
|
||||
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
||||
nOpt1, nOpt2, nOptExpDays) ;
|
||||
if ( ! GetEMkNetHwKey())
|
||||
int nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
||||
nOpt1, nOpt2, nOptExpDays) ;
|
||||
bEnabled = ( nRet == KEY_OK && ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0) ;
|
||||
}
|
||||
if ( bEnabled) {
|
||||
|
||||
// Verifica della abilitazione
|
||||
bool bMinTime = false ;
|
||||
if ( nOptExpDays >= GetMinDay())
|
||||
bMinTime = true ;
|
||||
bool bCurrTime = false ;
|
||||
if ( nOptExpDays >= GetCurrDay())
|
||||
bCurrTime = true ;
|
||||
bool bKey = false ;
|
||||
if ( nRet == KEY_OK)
|
||||
bKey = true ;
|
||||
bool bOption = false ;
|
||||
if ( ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0)
|
||||
bOption = true ;
|
||||
|
||||
// Esecuzione
|
||||
if ( bMinTime && bCurrTime && bKey && bOption) {
|
||||
|
||||
// emetto info di log
|
||||
{ string sOut = "Generator Run : " + sCncFile ;
|
||||
@@ -79,6 +92,11 @@ Generator::Run( const string& sCncFile, const string& sInfo)
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
// cancello l'eventuale file di uscita (e anche il file errore)
|
||||
EraseFile( sCncFile) ;
|
||||
string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ;
|
||||
EraseFile( sErrFile) ;
|
||||
|
||||
// Generazione non abilitata
|
||||
m_pMchMgr->SetLastError( 1000, "NC_OFF") ;
|
||||
std::string sErr = "Warning on Key (MKC/NCO)" ;
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ GetRotationComponent( const Vector3d& vtDir1, double dComp, const Vector3d& vtDi
|
||||
double dDenom = dT0uv * dSinG ;
|
||||
double dNumer = dComp - dT0w * dCosG ;
|
||||
// due angoli possibili
|
||||
if ( abs( dDenom) > abs( dNumer)) {
|
||||
if ( abs( dDenom) > abs( dNumer) + SIN_EPS_ANG_ZERO) {
|
||||
double dDeltaAngRad = acos( dNumer / dDenom) ;
|
||||
dAng1Deg = ( dOffsAngRad + dDeltaAngRad) * RADTODEG ;
|
||||
dAng2Deg = ( dOffsAngRad - dDeltaAngRad) * RADTODEG ;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
//----------- Costanti per approssimazioni con polilinee o poliarchi --------
|
||||
const double LIN_TOL_STD = 0.1 ;
|
||||
const double LIN_TOL_MID = 0.05 ;
|
||||
const double LIN_TOL_RAW = 0.5 ;
|
||||
const double ANG_TOL_MAX_DEG = 90 ;
|
||||
const double ANG_TOL_STD_DEG = 15 ;
|
||||
const double LIN_FEA_STD = 20 ;
|
||||
|
||||
@@ -103,7 +103,7 @@ Head::GetGeomDB( void) const
|
||||
//----------------------------------------------------------------------------
|
||||
Head::Head( void)
|
||||
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_nType( MCH_HT_NONE), m_nExitCount( 0),
|
||||
m_dRot1W( 1), m_bMaxDeltaR2On1( true), m_nSolCh( MCH_SCC_NONE)
|
||||
m_nSelectType( MCH_SLT_FIXEDEXITS), m_dRot1W( 1), m_bMaxDeltaR2On1( true), m_nSolCh( MCH_SCC_NONE)
|
||||
{
|
||||
m_Rot2Stroke.Min = - INFINITO ;
|
||||
m_Rot2Stroke.Max = INFINITO ;
|
||||
@@ -111,7 +111,7 @@ Head::Head( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet, const Vector3d& vtADir,
|
||||
Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet, int nSelectType, const Vector3d& vtADir,
|
||||
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl)
|
||||
{
|
||||
m_sName = sName ;
|
||||
@@ -122,6 +122,10 @@ Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet,
|
||||
m_nExitCount = 1 ;
|
||||
m_vsHSet.clear() ;
|
||||
m_vsHSet.push_back( sHSet) ;
|
||||
if ( nSelectType == MCH_SLT_FIXEDEXITS || nSelectType == MCH_SLT_ONEEXIT || nSelectType == MCH_SLT_MULTIEXITS)
|
||||
m_nSelectType = nSelectType ;
|
||||
else
|
||||
m_nSelectType = MCH_SLT_FIXEDEXITS ;
|
||||
m_vtADir = vtADir ;
|
||||
m_vtADir.Normalize() ;
|
||||
m_dRot1W = dRot1W ;
|
||||
|
||||
@@ -30,7 +30,7 @@ class Head : public IUserObj
|
||||
|
||||
public :
|
||||
Head( void) ;
|
||||
bool Set( const std::string& sName, int nType, int nExitCount, const std::string& sHSet,
|
||||
bool Set( const std::string& sName, int nType, int nExitCount, const std::string& sHSet, int nSelectType,
|
||||
const Vector3d& vtADir, double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh,
|
||||
const STRVECTOR& vsOthColl) ;
|
||||
bool AddHeadToHSet( const std::string& sHead) ;
|
||||
@@ -43,6 +43,8 @@ class Head : public IUserObj
|
||||
{ return m_nExitCount ; }
|
||||
const STRVECTOR& GetHSet(void) const
|
||||
{ return m_vsHSet ; }
|
||||
int GetSelectType( void) const
|
||||
{ return m_nSelectType ; }
|
||||
const Vector3d& GetADir( void) const
|
||||
{ return m_vtADir ; }
|
||||
double GetRot1W( void) const
|
||||
@@ -63,6 +65,7 @@ class Head : public IUserObj
|
||||
int m_nType ;
|
||||
int m_nExitCount ;
|
||||
STRVECTOR m_vsHSet ;
|
||||
int m_nSelectType ;
|
||||
Vector3d m_vtADir ;
|
||||
double m_dRot1W ;
|
||||
bool m_bMaxDeltaR2On1 ;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2022
|
||||
// EgalTech 2015-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachMgr.h Data : 21.09.22 Versione : 2.4i4
|
||||
// File : MachMgr.h Data : 28.10.23 Versione : 2.5j4
|
||||
// Contenuto : Dichiarazione della classe MachMgr.
|
||||
//
|
||||
//
|
||||
@@ -11,6 +11,8 @@
|
||||
// 17.08.20 DS Aggiunte GetAxisMin e GetAxisMax.
|
||||
// 17.03.21 DS Aggiunte funzioni per import/export utensili.
|
||||
// 21.09.22 DS Aggiunta GetAxisOffset.
|
||||
// 25.08.23 DS Aggiunta CopyMachGroup.
|
||||
// 28.10.23 DS Aggiunte GetClEntAxesVal e GetToolSetupPosInCurrSetup.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -95,7 +97,9 @@ class MachMgr : public IMachMgr
|
||||
int GetPrevMachGroup( int nId) const override ;
|
||||
bool GetMachGroupNewName( std::string& sName) const 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 ChangeMachGroupName( int nId, const std::string& sNewName) override ;
|
||||
std::string GetMachGroupName( int nId) const override ;
|
||||
std::string GetMachGroupMachineName( int nId) const override ;
|
||||
int GetMachGroupId( const std::string& sName) const override ;
|
||||
@@ -203,6 +207,7 @@ class MachMgr : public IMachMgr
|
||||
bool ImportSetup( const std::string& sName) override ;
|
||||
bool VerifyCurrSetup( STRVECTOR& vsErrors) 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 UpdateCurrSetup( void) override ;
|
||||
bool EraseCurrSetup( void) override ;
|
||||
@@ -301,8 +306,9 @@ class MachMgr : public IMachMgr
|
||||
bool GetMachiningEndPoint( Point3d& ptEnd) const override ;
|
||||
// CL Entities Interrogations
|
||||
bool GetClEntMove( int nEntId, int& nMove) const override ;
|
||||
bool GetClEntFlag( int nEntId, int& nFlag) const override ;
|
||||
bool GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const override ;
|
||||
bool GetClEntIndex( int nEntId, int& nIndex) const override ;
|
||||
bool GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const override ;
|
||||
// Simulation
|
||||
bool SimInit( void) override ;
|
||||
bool SimStart( bool bFirst) override ;
|
||||
@@ -321,6 +327,7 @@ class MachMgr : public IMachMgr
|
||||
// Machine Calc
|
||||
bool SetCalcTable( const std::string& sTable) override ;
|
||||
bool SetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) override ;
|
||||
bool GetAllCurrAxesName( STRVECTOR& vAxName) const override ;
|
||||
bool SetRotAxisBlock( const std::string& sAxis, double dVal) override ;
|
||||
bool GetRotAxisBlocked( int nInd, std::string& sAxis, double& dVal) const override ;
|
||||
bool GetCalcTool( std::string& sTool) const override ;
|
||||
@@ -430,10 +437,11 @@ class MachMgr : public IMachMgr
|
||||
// MachineCalc
|
||||
int GetCurrLinAxes( void) const ;
|
||||
int GetCurrRotAxes( void) const ;
|
||||
bool GetAllCurrAxesName( STRVECTOR& vAxName) const ;
|
||||
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
|
||||
bool GetCurrAxisHomePos( int nInd, double& dHome) const ;
|
||||
const Frame3d& GetCurrLinAxesFrame( void) const ;
|
||||
bool GetCurrIsCenter( void) const ;
|
||||
bool GetCurrIsRobot( void) const ;
|
||||
bool ApplyRotAxisBlock( void) ;
|
||||
void ClearRotAxisBlock( void)
|
||||
{ m_vAxisBlock.clear() ; }
|
||||
|
||||
+24
-4
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2019-2019
|
||||
// EgalTech 2019-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachMgrClEntities.cpp Data : 15.10.19 Versione : 2.1j4
|
||||
// File : MachMgrClEntities.cpp Data : 27.10.23 Versione : 2.5j4
|
||||
// Contenuto : Implementazione interrogazione entità CL della classe MachMgr.
|
||||
//
|
||||
//
|
||||
@@ -39,10 +39,11 @@ MachMgr::GetClEntMove( int nEntId, int& nMove) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntFlag( int nEntId, int& nFlag) const
|
||||
MachMgr::GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const
|
||||
{
|
||||
// default
|
||||
nFlag = 0 ;
|
||||
nFlag2 = 0 ;
|
||||
// verifico validita GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
@@ -50,8 +51,9 @@ MachMgr::GetClEntFlag( int nEntId, int& nFlag) const
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero il flag
|
||||
// recupero i flag
|
||||
nFlag = pCamData->GetFlag() ;
|
||||
nFlag2 = pCamData->GetFlag2() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -72,3 +74,21 @@ MachMgr::GetClEntIndex( int nEntId, int& nIndex) const
|
||||
nIndex = pCamData->GetIndex() ;
|
||||
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 ;
|
||||
}
|
||||
|
||||
+17
-1
@@ -631,6 +631,8 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
|
||||
pTdata->GetParam( TPA_TOTDIAM, dTotDiam) ;
|
||||
double dDist = 0 ;
|
||||
pTdata->GetParam( TPA_DIST, dDist) ;
|
||||
double dStemDiam = 0 ;
|
||||
pTdata->GetParam( TPA_STEMDIAM, dStemDiam) ;
|
||||
double dMaxMat = 0 ;
|
||||
pTdata->GetParam( TPA_MAXMAT, dMaxMat) ;
|
||||
double dCornRad = 0 ;
|
||||
@@ -694,6 +696,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TOTDIAM", dTotDiam) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.STEMDIAM", dStemDiam) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.MAXMAT", dMaxMat) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.HEIGHT", dThick) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SIDEANG", dSideAng) ;
|
||||
@@ -718,7 +721,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
|
||||
if ( ! ExeLuaGetGlobIntVar( "TOOL.ERR", &nErr) || nErr != 0)
|
||||
return nErr ;
|
||||
// Se per salvataggio
|
||||
if ( bOk && bToSave) {
|
||||
if ( bOk && bToSave) {
|
||||
// Nascondo layer ausiliario
|
||||
int nAuxId = ExeGetFirstNameInGroup( ExeGetFirstGroupInGroup( GDB_ID_ROOT), "AUX") ;
|
||||
ExeSetStatus( { nAuxId}, GDB_ST_OFF) ;
|
||||
@@ -728,6 +731,16 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
|
||||
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) ;
|
||||
}
|
||||
|
||||
@@ -747,6 +760,8 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
|
||||
pTdata->GetParam( TPA_DIAM, dDiam) ;
|
||||
double dDist = 0 ;
|
||||
pTdata->GetParam( TPA_DIST, dDist) ;
|
||||
double dSpeed = 0 ;
|
||||
pTdata->GetParam( TPA_SPEED, dSpeed) ;
|
||||
// Imposto contesto per il disegno utensile
|
||||
if ( ! ExeSetCurrentContext( nToolCtx))
|
||||
return TD_INT_ERR ;
|
||||
@@ -756,6 +771,7 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIST", dDist) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ;
|
||||
// Eseguo aggiornamento utensile
|
||||
bOk = bOk && ExeLuaCallFunction( "AdjustCustomTool") ;
|
||||
// Recupero errore
|
||||
|
||||
+80
-21
@@ -182,6 +182,52 @@ MachMgr::AddMachGroup( const string& sName, const string& sMachineName)
|
||||
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
|
||||
MachMgr::RemoveMachGroup( int nId)
|
||||
@@ -222,44 +268,60 @@ MachMgr::VerifyMachGroup( int nId, MachGrp& mgData) const
|
||||
// verifica della macchina
|
||||
bool bMName = m_pGeomDB->GetInfo( nId, MACH_MACHINE_KEY, mgData.MGeoName) ;
|
||||
// scansiono i sottogruppi
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
bool bSetup = false ;
|
||||
bool bFixt = false ;
|
||||
bool bRaw = false ;
|
||||
bool bOper = false ;
|
||||
bool bIter = pIter->GoToFirstGroupInGroup( nId) ;
|
||||
while ( bIter) {
|
||||
int nGrpId = m_pGeomDB->GetFirstGroupInGroup( nId) ;
|
||||
while ( nGrpId != GDB_ID_NULL) {
|
||||
string sName ;
|
||||
if ( pIter->GetName( sName)) {
|
||||
if ( m_pGeomDB->GetName( nGrpId, sName)) {
|
||||
if ( sName == MACH_SETUP_GROUP) {
|
||||
if ( ! bSetup)
|
||||
mgData.SetupGroupId = pIter->GetId() ;
|
||||
mgData.SetupGroupId = nGrpId ;
|
||||
bSetup = true ;
|
||||
}
|
||||
else if ( sName == MACH_FIXT_GROUP) {
|
||||
if ( ! bFixt)
|
||||
mgData.FixtGroupId = pIter->GetId() ;
|
||||
mgData.FixtGroupId = nGrpId ;
|
||||
bFixt = true ;
|
||||
}
|
||||
else if ( sName == MACH_RAW_GROUP) {
|
||||
if ( ! bRaw)
|
||||
mgData.RawGroupId = pIter->GetId() ;
|
||||
mgData.RawGroupId = nGrpId ;
|
||||
bRaw = true ;
|
||||
}
|
||||
else if ( sName == MACH_OPER_GROUP) {
|
||||
if ( ! bOper)
|
||||
mgData.OperGroupId = pIter->GetId() ;
|
||||
mgData.OperGroupId = nGrpId ;
|
||||
bOper = true ;
|
||||
}
|
||||
}
|
||||
// passo al successivo
|
||||
bIter = pIter->GoToNextGroup() ;
|
||||
nGrpId = m_pGeomDB->GetNextGroup( nGrpId) ;
|
||||
}
|
||||
return ( bMName && bSetup && bRaw && bOper) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ChangeMachGroupName( int nId, const string& sNewName)
|
||||
{
|
||||
// verifica del gruppo base per le lavorazioni
|
||||
if ( ! VerifyMachBase())
|
||||
return false ;
|
||||
// verifico che il gruppo ricevuto sia corretto
|
||||
if ( m_pGeomDB->GetParentId( nId) != m_nMachBaseId)
|
||||
return false ;
|
||||
// verifico nome non vuoto e non esista già un gruppo con lo stesso nome
|
||||
if ( &sNewName == nullptr || sNewName.empty() || GetMachGroupId( sNewName) != GDB_ID_NULL)
|
||||
return false ;
|
||||
// cambio il nome del gruppo di lavoro
|
||||
if ( ! m_pGeomDB->SetName( nId, sNewName))
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
string
|
||||
MachMgr::GetMachGroupName( int nId) const
|
||||
@@ -298,22 +360,19 @@ MachMgr::GetMachGroupId( const string& sName) const
|
||||
{
|
||||
// verifica dei parametri
|
||||
if ( &sName == nullptr || sName.empty())
|
||||
return false ;
|
||||
return GDB_ID_NULL ;
|
||||
// verifica del gruppo base per le lavorazioni
|
||||
if ( ! VerifyMachBase())
|
||||
return false ;
|
||||
return GDB_ID_NULL ;
|
||||
// recupero l'identificativo del gruppo con il nome indicato
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
bool bIter = pIter->GoToFirstGroupInGroup( m_nMachBaseId) ;
|
||||
while( bIter) {
|
||||
int nGrpId = m_pGeomDB->GetFirstGroupInGroup( m_nMachBaseId) ;
|
||||
while ( nGrpId != GDB_ID_NULL) {
|
||||
// verifico il nome
|
||||
string sMGroupName ;
|
||||
if ( pIter->GetName( sMGroupName) && EqualNoCase( sMGroupName, sName))
|
||||
return pIter->GetId() ;
|
||||
if ( m_pGeomDB->GetName( nGrpId, sMGroupName) && EqualNoCase( sMGroupName, sName))
|
||||
return nGrpId ;
|
||||
// passo al successivo
|
||||
bIter = pIter->GoToNextGroup() ;
|
||||
nGrpId = m_pGeomDB->GetNextGroup( nGrpId) ;
|
||||
}
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
+21
-1
@@ -356,7 +356,7 @@ bool
|
||||
MachMgr::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->SetAxisPos( sAxis, dVal, pdNewVal) : false) ;
|
||||
return ( ( pMch != nullptr) ? pMch->SetAxisPos( sAxis, dVal, true, pdNewVal) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -683,6 +683,26 @@ MachMgr::GetCurrLinAxesFrame( void) const
|
||||
return pMch->GetCurrLinAxesFrame() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCurrIsCenter( void) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_CENTER) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCurrIsRobot( void) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_ROBOT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
|
||||
@@ -625,6 +625,7 @@ MachMgr::VerifyRawPartPhase( int nRawId, int nPhase) const
|
||||
INTVECTOR vPhase ;
|
||||
if ( ! GetRawPartPhases( nRawId, vPhase))
|
||||
return false ;
|
||||
// verifico presenza nella fase indicata
|
||||
return ( find( vPhase.begin(), vPhase.end(), nPhase) != vPhase.end()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -130,6 +130,13 @@ MachMgr::FindToolInCurrSetup( const string& sTool)
|
||||
return m_stuMgr.FindTool( sTool) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos)
|
||||
{
|
||||
return m_stuMgr.GetToolSetupPos( sTool, sTcPos) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools)
|
||||
|
||||
@@ -198,7 +198,7 @@ MachMgr::SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||
{
|
||||
// verifico simulatore
|
||||
if ( m_pSimul == nullptr)
|
||||
return false ;
|
||||
return SIM_AXMV_RES_ERR ;
|
||||
// lancio movimento assi
|
||||
return m_pSimul->MoveAxes( nMoveType, vAxNaEpSt) ;
|
||||
}
|
||||
|
||||
+77
-11
@@ -58,6 +58,7 @@ Machine::Machine( void)
|
||||
m_nHeadRotAxes = 0 ;
|
||||
m_nHeadSpecRotAxis = -1 ;
|
||||
m_frLinAx.Reset( false) ;
|
||||
m_nCalcChainType = KIN_CHAIN_NONE ;
|
||||
m_nMachineLook = MCH_LOOK_NONE ;
|
||||
}
|
||||
|
||||
@@ -141,6 +142,8 @@ Machine::Init( const string& sMachineName, const string& sMachineDir, MachMgr* p
|
||||
m_nMachineLook = ( bOk ? MCH_LOOK_ALL : MCH_LOOK_NONE) ;
|
||||
// metto tutti gli assi in posizione home
|
||||
bOk = bOk && ResetAllAxesPos() ;
|
||||
// reset catena cinematica corrente
|
||||
m_nCalcChainType = KIN_CHAIN_NONE ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -441,8 +444,16 @@ Machine::ModifyMachineAxisPosition( const string& sName, const Point3d& ptPos)
|
||||
Axis* pAx = GetAxis( nAxGrp) ;
|
||||
if ( pAx == nullptr)
|
||||
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
|
||||
return pAx->Modify( ptPos, m_dAxisMaxAdjust) ;
|
||||
bool bOk = pAx->Modify( ptPos, m_dAxisMaxAdjust) ;
|
||||
// ripristino l'asse al valore corrente
|
||||
if ( abs( dCurrVal) > EPS_ZERO)
|
||||
SetAxisPos( sName, dCurrVal, false) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -458,8 +469,16 @@ Machine::ModifyMachineAxisDirection( const string& sName, const Vector3d& vtDir)
|
||||
Axis* pAx = GetAxis( nAxGrp) ;
|
||||
if ( pAx == nullptr)
|
||||
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
|
||||
return pAx->Modify( vtDir, m_dAxisMaxRotAdj) ;
|
||||
bool bOk = pAx->Modify( vtDir, m_dAxisMaxRotAdj) ;
|
||||
// ripristino l'asse al valore corrente
|
||||
if ( abs( dCurrVal) > EPS_ZERO)
|
||||
SetAxisPos( sName, dCurrVal, false) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -528,7 +547,7 @@ Machine::LoadMachineStdHead( const string& sName, const string& sParent, const s
|
||||
Head* pHead = new(nothrow) Head ;
|
||||
if ( pHead == nullptr)
|
||||
return false ;
|
||||
pHead->Set( sName, MCH_HT_STD, 1, sHSet, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
pHead->Set( sName, MCH_HT_STD, 1, sHSet, 0, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
m_pGeomDB->SetUserObj( nLay, pHead) ;
|
||||
// aggiorno la testa capostipite
|
||||
if ( ! AddHeadToSet( sHSet, sName))
|
||||
@@ -548,7 +567,7 @@ Machine::LoadMachineStdHead( const string& sName, const string& sParent, const s
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const string& sHSet,
|
||||
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
|
||||
int nSelectType, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
|
||||
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
|
||||
const string& sGeo, const STRVECTOR& vsAux)
|
||||
{
|
||||
@@ -577,7 +596,8 @@ Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const
|
||||
Head* pHead = new(nothrow) Head ;
|
||||
if ( pHead == nullptr)
|
||||
return false ;
|
||||
pHead->Set( sName, MCH_HT_MULTI, int( vMuExit.size()), sHSet, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
pHead->Set( sName, MCH_HT_MULTI, int( vMuExit.size()), sHSet, nSelectType,
|
||||
vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
m_pGeomDB->SetUserObj( nLay, pHead) ;
|
||||
// aggiorno la testa capostipite
|
||||
if ( ! AddHeadToSet( sHSet, sName))
|
||||
@@ -624,7 +644,7 @@ Machine::LoadMachineSpecialHead( const string& sName, const string& sParent, con
|
||||
Head* pHead = new(nothrow) Head ;
|
||||
if ( pHead == nullptr)
|
||||
return false ;
|
||||
pHead->Set( sName, MCH_HT_SPECIAL, 1, sHSet, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
pHead->Set( sName, MCH_HT_SPECIAL, 1, sHSet, 0, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
m_pGeomDB->SetUserObj( nLay, pHead) ;
|
||||
// aggiorno la testa capostipite
|
||||
if ( ! AddHeadToSet( sHSet, sName))
|
||||
@@ -643,9 +663,9 @@ Machine::LoadMachineSpecialHead( const string& sName, const string& sParent, con
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LoadMachineTcPos( const string& sName, const string& sParent,
|
||||
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
|
||||
const string& sGeo, const STRVECTOR& vsAux)
|
||||
Machine::LoadMachineStdTcPos( const string& sName, const string& sParent,
|
||||
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
|
||||
const string& sGeo, const STRVECTOR& vsAux)
|
||||
{
|
||||
// recupero pezzo e layer della geometria originale della posizione nel cambio utensile
|
||||
string sPart, sLay ;
|
||||
@@ -685,6 +705,48 @@ Machine::LoadMachineTcPos( const string& sName, const string& sParent,
|
||||
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
|
||||
Machine::GetGroup( const string& sGroup) const
|
||||
@@ -918,7 +980,7 @@ Machine::CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
Vector3d vtRotAx = vtTDir ^ vtDirN ; vtRotAx.Normalize() ;
|
||||
Vector3d vtRotAx = vtTDir ^ vtDirN ; vtRotAx.Normalize( EPS_ZERO) ;
|
||||
string sOut = " Exit " + sName + " rotation = (" + ToString( dAngRot) + "/" + ToString( vtRotAx) + ")" ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
|
||||
vtRotAx.ToLoc( frHead) ;
|
||||
@@ -976,7 +1038,11 @@ Machine::ModifyMachineExitPosition( const string& sHead, int nExit, const Point3
|
||||
if ( pExit == nullptr)
|
||||
return false ;
|
||||
// eseguo la modifica
|
||||
return pExit->Modify( ptPos, m_dExitMaxAdjust) ;
|
||||
if ( ! pExit->Modify( ptPos, m_dExitMaxAdjust))
|
||||
return false ;
|
||||
// eventuale aggiornamento variabile lua EMC.EXITPOS con la nuova posizione
|
||||
LuaSetGlobVar( "EMC.EXITPOS", ptPos) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -53,7 +53,7 @@ class Machine
|
||||
int GetHeadId( const std::string& sHead) const
|
||||
{ int nId = GetGroup( sHead) ;
|
||||
return ( IsHeadGroup( nId) ? nId : GDB_ID_NULL) ; }
|
||||
int GetExitId( const std::string& sHead, int nExit) const
|
||||
int GetExitId( const std::string& sHead, int nExit) const
|
||||
{ int nHeadId = GetHeadId( sHead) ;
|
||||
int nId = ( m_pGeomDB != nullptr ? m_pGeomDB->GetFirstNameInGroup( nHeadId, MCH_EXIT + ToString( nExit)) : GDB_ID_NULL) ;
|
||||
return ( IsExitGroup( nId) ? nId : GDB_ID_NULL) ; }
|
||||
@@ -67,6 +67,7 @@ class Machine
|
||||
int GetHeadExitCount( const std::string& sHead) const ;
|
||||
int GetHeadExitPosDirAux( const std::string& sHead, int nExit, Point3d& ptPos, Vector3d& vtDir, Vector3d& vtAux) const ;
|
||||
int GetHeadSolCh( const std::string& sHead) const ;
|
||||
int GetHeadSelectType(const std::string& sHead) const ;
|
||||
double GetAngDeltaMinForHome( void) const
|
||||
{ return m_dAngDeltaMinForHome ; }
|
||||
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) ;
|
||||
@@ -81,7 +82,7 @@ class Machine
|
||||
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const ;
|
||||
bool GetAxisOffset( const std::string& sAxis, double& dOffset) const ;
|
||||
bool GetAxisType( const std::string& sAxis, bool& bLinear) 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 GetAxisMin( const std::string& sAxis, double& dMin) const ;
|
||||
bool GetAxisMax( const std::string& sAxis, double& dMax) const ;
|
||||
@@ -95,7 +96,7 @@ class Machine
|
||||
bool GetCurrTableRef1( Point3d& ptRef1) const ;
|
||||
bool GetCurrTableArea1( BBox3d& b3Area1) const ;
|
||||
bool GetCurrTableDeltaRef1( Vector3d& vtDelta1) const ;
|
||||
bool GetCurrTableIsTilting( bool& bTilting) const ;
|
||||
bool GetCurrTableIsTilting( bool& bTilting, Vector3d& vtTiltingAx) const ;
|
||||
bool SetCurrTool( const std::string& sTool, const std::string& sHead, int nExit) ;
|
||||
bool ResetCurrTool( void) ;
|
||||
int GetCurrTool( void) const ;
|
||||
@@ -125,16 +126,22 @@ class Machine
|
||||
bool GetAllCurrAxesToken( STRVECTOR& vAxToken) const ;
|
||||
bool GetCurrAxisMin( int nInd, double& dMin) const ;
|
||||
bool GetCurrAxisMax( int nInd, double& dMax) const ;
|
||||
bool GetCurrAxisOffset( int nInd, double& dOffset) const ;
|
||||
bool GetCurrAxisInvert( int nInd, bool& bInvert) const ;
|
||||
bool GetCurrAxisHomePos( int nInd, double& dHome) const ;
|
||||
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
|
||||
const Frame3d& GetCurrLinAxesFrame( void) const
|
||||
{ return m_frLinAx ; }
|
||||
int GetCurrKinematicChainType( void) const
|
||||
{ return m_nCalcChainType ; }
|
||||
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ;
|
||||
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
|
||||
bool GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
int& nStat, double& dX, double& dY, double& dZ) const ;
|
||||
bool GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
|
||||
bool GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
|
||||
Point3d& ptNose) const ;
|
||||
bool GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
|
||||
@@ -206,16 +213,19 @@ class Machine
|
||||
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
|
||||
const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
bool LoadMachineMultiHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
|
||||
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
|
||||
int nSelectType, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
|
||||
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
|
||||
const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
bool LoadMachineSpecialHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
|
||||
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
|
||||
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
|
||||
const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
bool LoadMachineTcPos( const std::string& sName, const std::string& sParent,
|
||||
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
|
||||
const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
bool LoadMachineStdTcPos( const std::string& sName, const std::string& sParent,
|
||||
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
|
||||
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 ;
|
||||
bool IsBaseGroup( int nGroup) const ;
|
||||
Axis* GetAxis( int nGroup) const ;
|
||||
@@ -305,6 +315,9 @@ class Machine
|
||||
KINAXISVECTOR m_vCalcLinAx ; // vettore assi lineari attivi per calcoli
|
||||
KINAXISVECTOR m_vCalcRotAx ; // vettore assi rotanti attivi per calcoli
|
||||
Frame3d m_frLinAx ; // sistema di riferimento definito dagli assi lineari
|
||||
int m_nCalcChainType ; // tipologia testa attiva (nulla, centro di lavoro o robot)
|
||||
Point3d m_ptWristCen ; // centro del polso sferico nel riferimento testa/uscita di calcolo
|
||||
Vector3d m_vtWristRef ; // direzione del polso sferico nel riferimento testa/uscita di calcolo
|
||||
mutable OutStroke m_OutstrokeInfo ; // informazioni su ultima extra corsa
|
||||
// stato di visualizzazione
|
||||
int m_nMachineLook ; // stato di visualizzazione della macchina
|
||||
@@ -323,6 +336,8 @@ class Machine
|
||||
static int LuaEmtMultiHead( lua_State* L) ;
|
||||
static int LuaEmtSpecialHead( 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 LuaEmtModifyAxisDirection( lua_State* L) ;
|
||||
static int LuaEmtModifyAxisStroke( lua_State* L) ;
|
||||
|
||||
+3
-5
@@ -19,6 +19,7 @@
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -88,7 +89,7 @@ Machine::GetAxisType( const string& sAxis, bool& bLinear) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
|
||||
Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* pdNewVal)
|
||||
{
|
||||
// controllo GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
@@ -114,10 +115,7 @@ Machine::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
|
||||
Vector3d vtDir = pGV->GetVector() ;
|
||||
vtDir.Normalize() ;
|
||||
// limito il movimento alla corsa dell'asse
|
||||
if ( dVal > Stroke.Max)
|
||||
dVal = Stroke.Max ;
|
||||
else if ( dVal < Stroke.Min)
|
||||
dVal = Stroke.Min ;
|
||||
dVal = Clamp( dVal, Stroke.Min, Stroke.Max) ;
|
||||
// eseguo il movimento
|
||||
if ( bLinear)
|
||||
m_pGeomDB->TranslateGroup( nAxGrp, vtDir * ( dVal - dCurrVal)) ;
|
||||
|
||||
+314
-63
@@ -24,11 +24,13 @@
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
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_HEAD = ".HEAD" ; // (string) nome della testa
|
||||
static const string EVAR_EXIT = ".EXIT" ; // (int) numero dell'uscita
|
||||
@@ -37,6 +39,7 @@ 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_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_USERNOTES = ".USERNOTES" ; // (string) note utente dell'utensile
|
||||
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_L2 = ".L2" ; // (num) valore del secondo asse lineare
|
||||
@@ -74,6 +77,7 @@ Machine::SetCurrTable( const string& sTable)
|
||||
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
|
||||
// definisco variabili
|
||||
bool bOk = LuaCreateGlobTable( EMC_VAR) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TABNAME, sTable) ;
|
||||
// chiamo funzione
|
||||
bOk = bOk && LuaCallFunction( ON_SET_TABLE) ;
|
||||
@@ -167,17 +171,23 @@ Machine::GetCurrTableDeltaRef1( Vector3d& vtDelta1) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetCurrTableIsTilting( bool& bTilting) const
|
||||
Machine::GetCurrTableIsTilting( bool& bTilting, Vector3d& vtTiltingAx) const
|
||||
{
|
||||
// default
|
||||
bTilting = false ;
|
||||
vtTiltingAx = V_NULL ;
|
||||
// verifico esistenza tavola
|
||||
if ( m_nCalcTabId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// verifico se presente flag che lo forza come tale
|
||||
bool bTiltingLike ;
|
||||
if ( m_pGeomDB->GetInfo( m_nCalcTabId, MCH_TILTINGLIKE, bTiltingLike) && bTiltingLike) {
|
||||
int nTiltingLike ;
|
||||
if ( m_pGeomDB->GetInfo( m_nCalcTabId, MCH_TILTINGLIKE, nTiltingLike) && nTiltingLike != 0) {
|
||||
bTilting = true ;
|
||||
switch ( abs( nTiltingLike)) {
|
||||
default : vtTiltingAx = X_AX ; break ;
|
||||
case 2 : vtTiltingAx = Y_AX ; break ;
|
||||
case 3 : vtTiltingAx = Z_AX ; break ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
// recupero gli eventuali assi rotanti della tavola
|
||||
@@ -192,6 +202,7 @@ Machine::GetCurrTableIsTilting( bool& bTilting) const
|
||||
// verifico se asse rotante orizzontale
|
||||
if ( pAx->GetType() == MCH_AT_ROTARY && abs( pAx->GetDir().z) < EPS_SMALL) {
|
||||
bTilting = true ;
|
||||
vtTiltingAx = pAx->GetDir() ;
|
||||
return true ;
|
||||
}
|
||||
// risalgo lungo la catena
|
||||
@@ -238,6 +249,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
|
||||
double dTOvLen = 0 ;
|
||||
double dTOvDiam = 0 ;
|
||||
double dTDist = 0 ;
|
||||
string sTUserNotes = "" ;
|
||||
string sTcPos = "" ;
|
||||
// se definito
|
||||
if ( ! sTool.empty()) {
|
||||
@@ -256,7 +268,8 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
|
||||
! m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, dTLen) ||
|
||||
! m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, dTDiam) ||
|
||||
! 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 ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_DIST, dTDist) ; // opzionale
|
||||
if ( ! m_pMchMgr->GetCurrSetupMgr().GetToolSetupPos( sTool, sTcPos))
|
||||
@@ -296,6 +309,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
|
||||
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
|
||||
// definisco variabili
|
||||
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_EXIT, nExit) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOOL, sTool) ;
|
||||
@@ -303,6 +317,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOTDIAM, dTOvDiam) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOTLEN, dTOvLen) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_DIST, dTDist) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, sTUserNotes) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TCPOS, sTcPos) ;
|
||||
// chiamo funzione
|
||||
bOk = bOk && LuaCallFunction( ON_SET_HEAD) ;
|
||||
@@ -451,14 +466,13 @@ Machine::CalculateKinematicChain( void)
|
||||
m_nHeadSpecRotAxis = -1 ;
|
||||
m_vCalcLinAx.clear() ;
|
||||
m_vCalcRotAx.clear() ;
|
||||
m_nCalcChainType = KIN_CHAIN_NONE ;
|
||||
// recupero gli assi di tavola
|
||||
if ( m_nCalcTabId == GDB_ID_NULL)
|
||||
return false ;
|
||||
int nTParId = m_pGeomDB->GetParentId( m_nCalcTabId) ;
|
||||
if ( nTParId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_nTabLinAxes = 0 ;
|
||||
m_nTabRotAxes = 0 ;
|
||||
while ( IsAxisGroup( nTParId)) {
|
||||
if ( ! AddKinematicAxis( false, nTParId))
|
||||
return false ;
|
||||
@@ -470,14 +484,62 @@ Machine::CalculateKinematicChain( void)
|
||||
int nHParId = m_pGeomDB->GetParentId( m_nCalcHeadId) ;
|
||||
if ( nHParId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_nHeadLinAxes = 0 ;
|
||||
m_nHeadRotAxes = 0 ;
|
||||
while ( IsAxisGroup( nHParId)) {
|
||||
if ( ! AddKinematicAxis( true, nHParId))
|
||||
return false ;
|
||||
nHParId = m_pGeomDB->GetParentId( nHParId) ;
|
||||
}
|
||||
|
||||
// se non ci sono assi, né lineari né rotanti, sicuramente errore
|
||||
if ( m_nTabLinAxes == 0 && m_nHeadLinAxes == 0 &&
|
||||
m_nTabRotAxes == 0 && m_nHeadRotAxes == 0) {
|
||||
LOG_ERROR( GetEMkLogger(), "Errors in Axes : none have been found")
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se nessun asse lineare deve essere un robot (in futuro va permesso un lineare di tavola)
|
||||
if ( m_nTabLinAxes == 0 && m_nHeadLinAxes == 0) {
|
||||
// verifico ci siano 6 assi rotanti tutti di testa (in futuro va permesso un rotante di tavola)
|
||||
if ( m_nTabRotAxes != 0 || m_nHeadRotAxes != 6) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : number or type")
|
||||
return false ;
|
||||
}
|
||||
// riordino gli assi rotanti
|
||||
swap( m_vCalcRotAx[0], m_vCalcRotAx[5]) ;
|
||||
swap( m_vCalcRotAx[1], m_vCalcRotAx[4]) ;
|
||||
swap( m_vCalcRotAx[2], m_vCalcRotAx[3]) ;
|
||||
// direzione assi rotanti deve essere Z Y Y X Y X
|
||||
if ( ! m_vCalcRotAx[0].vtDir.IsZ() ||
|
||||
! m_vCalcRotAx[1].vtDir.IsY() ||
|
||||
! m_vCalcRotAx[2].vtDir.IsY() ||
|
||||
! m_vCalcRotAx[3].vtDir.IsX() ||
|
||||
! m_vCalcRotAx[4].vtDir.IsY() ||
|
||||
! m_vCalcRotAx[5].vtDir.IsX()) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not ZYY-XYX")
|
||||
return false ;
|
||||
}
|
||||
// verifico che gli ultimi 3 assi formino un polso sferico (ovvero passino per uno stesso punto)
|
||||
if ( abs( m_vCalcRotAx[3].ptPos.y - m_vCalcRotAx[5].ptPos.y) > EPS_SMALL ||
|
||||
abs( m_vCalcRotAx[3].ptPos.z - m_vCalcRotAx[5].ptPos.z) > EPS_SMALL ||
|
||||
abs( m_vCalcRotAx[4].ptPos.z - m_vCalcRotAx[3].ptPos.z) > EPS_SMALL) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not spherical Wrist")
|
||||
return false ;
|
||||
}
|
||||
// calcolo il centro del polso in coordinate globali (R5.x, R6.y, R5.z)
|
||||
Point3d ptCenG( m_vCalcRotAx[4].ptPos.x, m_vCalcRotAx[5].ptPos.y, m_vCalcRotAx[4].ptPos.z) ;
|
||||
// recupero il riferimento dell'uscita (da posizione, direzione utensile e direzione ausiliaria)
|
||||
Frame3d frExit ;
|
||||
if ( ! frExit.Set( m_ptCalcPos, m_vtCalcDir, m_vtCalcADir))
|
||||
return false ;
|
||||
// calcolo il centro del polso in locale a questo riferimento
|
||||
m_ptWristCen = GetToLoc( ptCenG, frExit) ;
|
||||
// calcolo la direzione di riferimento del polso in locale a questo riferimento
|
||||
m_vtWristRef = GetToLoc( m_vCalcRotAx[5].vtDir, frExit) ;
|
||||
// dichiaro tipo robot
|
||||
m_nCalcChainType = KIN_CHAIN_ROBOT ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
// verifiche sugli assi lineari :
|
||||
// aggiusto gli indici di ordine sulla sua catena cinematica (1-based)
|
||||
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
|
||||
@@ -487,8 +549,10 @@ Machine::CalculateKinematicChain( void)
|
||||
m_vCalcLinAx[i].nInd *= -1 ;
|
||||
}
|
||||
// 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 ;
|
||||
}
|
||||
// devono essere ordinabili come XYZ
|
||||
if ( ! m_vCalcLinAx[0].vtDir.IsX()) {
|
||||
if ( m_vCalcLinAx[1].vtDir.IsX())
|
||||
@@ -514,7 +578,6 @@ Machine::CalculateKinematicChain( void)
|
||||
}
|
||||
|
||||
// verifiche sugli assi rotanti :
|
||||
bool bOk = false ;
|
||||
// aggiusto gli indici di ordine sulla sua catena cinematica (1-based)
|
||||
for ( int i = 0 ; i < int( m_vCalcRotAx.size()) ; ++ i) {
|
||||
if ( m_vCalcRotAx[i].bHead)
|
||||
@@ -524,7 +587,7 @@ Machine::CalculateKinematicChain( void)
|
||||
}
|
||||
// se 0 o 1 va bene
|
||||
if ( m_vCalcRotAx.size() <= 1)
|
||||
bOk = true ;
|
||||
;
|
||||
// se 2 va bene
|
||||
else if ( m_vCalcRotAx.size() == 2) {
|
||||
// se entrambi di testa devo invertirne l'ordine
|
||||
@@ -538,7 +601,6 @@ Machine::CalculateKinematicChain( void)
|
||||
m_vCalcRotAx[1].stroke.Max = min( m_vCalcRotAx[1].stroke.Max, pHead->GetRot2Stroke().Max) ;
|
||||
}
|
||||
}
|
||||
bOk = true ;
|
||||
}
|
||||
// se 3 va bene ( uno dovrà poi avere valore assegnato)
|
||||
else if ( m_vCalcRotAx.size() == 3) {
|
||||
@@ -561,10 +623,13 @@ Machine::CalculateKinematicChain( void)
|
||||
m_vCalcRotAx[n2ndHeadRotAx].stroke.Max = min( m_vCalcRotAx[n2ndHeadRotAx].stroke.Max, pHead->GetRot2Stroke().Max) ;
|
||||
}
|
||||
}
|
||||
bOk = true ;
|
||||
}
|
||||
if ( ! bOk)
|
||||
// se più di 3
|
||||
else {
|
||||
// altrimenti non ancora gestito, quindi errore
|
||||
LOG_ERROR( GetEMkLogger(), "Rotary Axes not manageable")
|
||||
return false ;
|
||||
}
|
||||
// verifico esistenza eventuale asse rotante speciale di testa
|
||||
if ( m_nHeadRotAxes > 0 && m_nHeadLinAxes > 0) {
|
||||
// indice di posizione primo asse di testa
|
||||
@@ -600,11 +665,9 @@ Machine::CalculateKinematicChain( void)
|
||||
}
|
||||
}
|
||||
}
|
||||
// dichiaro tipo centro di lavoro
|
||||
m_nCalcChainType = KIN_CHAIN_CENTER ;
|
||||
return true ;
|
||||
|
||||
// altrimenti non ancora gestito, quindi errore
|
||||
LOG_ERROR( GetEMkLogger(), "Rotary Axes not manageable")
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -951,8 +1014,8 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
vtAx2.Invert() ;
|
||||
// calcolo secondo angolo di rotazione
|
||||
nStat = GetRotationComponent( vtDirHn, dCompTSuAxR1, vtAx1, vtAx2, dAngB1, dAngB2, bDet) ;
|
||||
// se indeterminato con richiesta direzione ausiliaria esatta, ricalcolo con direzione aux
|
||||
if ( nStat >= 1 && ! bDet && m_bSolChExact) {
|
||||
// se indeterminato, provo ricalcolo con direzione aux
|
||||
if ( nStat >= 1 && ! bDet) {
|
||||
// componente versore ausiliario desiderato su direzione primo asse rotante
|
||||
Vector3d vtSccDir ;
|
||||
if ( GetSccDir( m_nCalcSolCh, vtDirAn, vtSccDir)) {
|
||||
@@ -1002,7 +1065,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
// calcolo primo angolo di rotazione per seconda soluzione
|
||||
bool bDet2 = true ;
|
||||
if ( nStat == 2) {
|
||||
if ( ! vtDirH2.GetRotation( vtDirTn, vtAx1, dAngA2, bDet2) )
|
||||
if ( ! vtDirH2.GetRotation( vtDirTn, vtAx1, SIN_EPS_ANG_SMALL, dAngA2, bDet2))
|
||||
nStat = 1 ;
|
||||
else {
|
||||
// se indeterminato, provo a determinarlo con la direzione ausiliaria
|
||||
@@ -1025,7 +1088,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
// calcolo primo angolo di rotazione per prima soluzione
|
||||
bool bDet1 = true ;
|
||||
if ( nStat >= 1) {
|
||||
if ( ! vtDirH1.GetRotation( vtDirTn, vtAx1, dAngA1, bDet1) )
|
||||
if ( ! vtDirH1.GetRotation( vtDirTn, vtAx1, SIN_EPS_ANG_SMALL, dAngA1, bDet1))
|
||||
nStat = 0 ;
|
||||
else {
|
||||
// se indeterminato, provo a determinarlo con la direzione ausiliaria
|
||||
@@ -1070,7 +1133,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
}
|
||||
if ( nStat >= 1) {
|
||||
// se non riesco ad aggiustare, elimino
|
||||
if ( ! AdjustAngleInStroke( RotAx1.stroke, dAngA1) ||
|
||||
if ( ( bDet1 && ! AdjustAngleInStroke( RotAx1.stroke, dAngA1)) ||
|
||||
( nNumRotAx == 2 && ! AdjustAngleInStroke( RotAx2.stroke, dAngB1))) {
|
||||
-- nStat ;
|
||||
// riloco eventuale soluzione rimasta
|
||||
@@ -1213,26 +1276,46 @@ Machine::GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
|
||||
// la posizione deve essere espressa rispetto allo ZERO MACCHINA
|
||||
// è espressa nel riferimento di macchina (tiene conto delle sole traslazioni e rotazioni di testa)
|
||||
|
||||
// aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa
|
||||
ptNose = m_ptCalcPos ;
|
||||
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
|
||||
// se asse di testa non speciale
|
||||
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
|
||||
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
|
||||
if ( vAng.size() < m_vCalcRotAx.size())
|
||||
return false ;
|
||||
|
||||
// se centro di lavoro
|
||||
if ( m_nCalcChainType == KIN_CHAIN_CENTER) {
|
||||
// aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa
|
||||
ptNose = m_ptCalcPos ;
|
||||
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
|
||||
// se asse di testa non speciale
|
||||
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
|
||||
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
}
|
||||
// aggiorno posizione testa con assi lineari di testa
|
||||
DBLVECTOR vMov( {dX, dY, dZ}) ;
|
||||
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
|
||||
if ( m_vCalcLinAx[i].bHead)
|
||||
ptNose += m_vCalcLinAx[i].vtDir * vMov[i] ;
|
||||
}
|
||||
// eseguo rotazione eventuale asse rotante speciale di testa
|
||||
if ( m_nHeadSpecRotAxis != -1) {
|
||||
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
|
||||
return false ;
|
||||
int i = m_nHeadSpecRotAxis ;
|
||||
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
}
|
||||
}
|
||||
// aggiorno posizione testa con assi lineari di testa
|
||||
DBLVECTOR vMov( {dX, dY, dZ}) ;
|
||||
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
|
||||
if ( m_vCalcLinAx[i].bHead)
|
||||
ptNose += m_vCalcLinAx[i].vtDir * vMov[i] ;
|
||||
}
|
||||
// eseguo rotazione eventuale asse rotante speciale di testa
|
||||
if ( m_nHeadSpecRotAxis != -1) {
|
||||
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
|
||||
return false ;
|
||||
int i = m_nHeadSpecRotAxis ;
|
||||
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
// se robot
|
||||
else if ( m_nCalcChainType == KIN_CHAIN_ROBOT) {
|
||||
// aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa
|
||||
ptNose = m_ptCalcPos ;
|
||||
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
|
||||
// se asse di testa
|
||||
if ( m_vCalcRotAx[i].bHead)
|
||||
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
}
|
||||
}
|
||||
// altrimenti errore
|
||||
else
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -1245,26 +1328,46 @@ Machine::GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
|
||||
// la posizione deve essere espressa rispetto allo ZERO MACCHINA
|
||||
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di testa)
|
||||
|
||||
// aggiorno posizione tip utensile a riposo mediante ciclo inverso sugli assi rotanti di testa
|
||||
ptTip = m_ptCalcPos - m_vtCalcDir * m_dCalcTLen ;
|
||||
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
|
||||
// se asse di testa non speciale
|
||||
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
|
||||
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
|
||||
if ( vAng.size() < m_vCalcRotAx.size())
|
||||
return false ;
|
||||
|
||||
// se centro di lavoro
|
||||
if ( m_nCalcChainType == KIN_CHAIN_CENTER) {
|
||||
// aggiorno posizione tip utensile a riposo mediante ciclo inverso sugli assi rotanti di testa
|
||||
ptTip = m_ptCalcPos - m_vtCalcDir * m_dCalcTLen ;
|
||||
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
|
||||
// se asse di testa non speciale
|
||||
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
|
||||
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
}
|
||||
// aggiorno posizione tip utensile con assi lineari di testa
|
||||
DBLVECTOR vMov( {dX, dY, dZ}) ;
|
||||
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
|
||||
if ( m_vCalcLinAx[i].bHead)
|
||||
ptTip += m_vCalcLinAx[i].vtDir * vMov[i] ;
|
||||
}
|
||||
// eseguo rotazione eventuale asse rotante speciale di testa
|
||||
if ( m_nHeadSpecRotAxis != -1) {
|
||||
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
|
||||
return false ;
|
||||
int i = m_nHeadSpecRotAxis ;
|
||||
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
}
|
||||
}
|
||||
// aggiorno posizione tip utensile con assi lineari di testa
|
||||
DBLVECTOR vMov( {dX, dY, dZ}) ;
|
||||
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
|
||||
if ( m_vCalcLinAx[i].bHead)
|
||||
ptTip += m_vCalcLinAx[i].vtDir * vMov[i] ;
|
||||
}
|
||||
// eseguo rotazione eventuale asse rotante speciale di testa
|
||||
if ( m_nHeadSpecRotAxis != -1) {
|
||||
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
|
||||
return false ;
|
||||
int i = m_nHeadSpecRotAxis ;
|
||||
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
// se robot
|
||||
else if ( m_nCalcChainType == KIN_CHAIN_ROBOT) {
|
||||
// aggiorno posizione tip utensile a riposo mediante ciclo inverso sugli assi rotanti di testa
|
||||
ptTip = m_ptCalcPos - m_vtCalcDir * m_dCalcTLen ;
|
||||
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
|
||||
// se asse di testa
|
||||
if ( m_vCalcRotAx[i].bHead)
|
||||
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
}
|
||||
}
|
||||
// altrimenti errore
|
||||
else
|
||||
return false ;
|
||||
|
||||
// Se richiesto ingombro totale o punto sotto del tip utensile
|
||||
if ( bOverall || bBottom) {
|
||||
@@ -1474,10 +1577,7 @@ Machine::LimitAngleToStroke( int nInd, double& dAng) const
|
||||
if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size()))
|
||||
return true ;
|
||||
// se angolo fuori corsa, lo porto all'estremo più vicino
|
||||
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 ;
|
||||
dAng = Clamp( dAng, m_vCalcRotAx[nInd].stroke.Min, m_vCalcRotAx[nInd].stroke.Max) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1572,6 +1672,7 @@ Machine::VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR&
|
||||
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
|
||||
// definisco variabili
|
||||
bOk = bOk && LuaCreateGlobTable( EMC_VAR) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L1, dX) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L2, dY) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L3, dZ) ;
|
||||
@@ -1820,6 +1921,52 @@ Machine::GetCurrAxisMax( int nInd, double& dMax) const
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetCurrAxisOffset( int nInd, double& dOffset) const
|
||||
{
|
||||
int nLinAxes = int( m_vCalcLinAx.size()) ;
|
||||
int nRotAxes = int( m_vCalcRotAx.size()) ;
|
||||
if ( nInd >= 0 && nInd < nLinAxes) {
|
||||
Axis* pAx = GetAxis( m_vCalcLinAx[nInd].nGrpId) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
dOffset = pAx->GetOffset() ;
|
||||
return true ;
|
||||
}
|
||||
else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) {
|
||||
Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
dOffset = pAx->GetOffset() ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetCurrAxisInvert( int nInd, bool& bInvert) const
|
||||
{
|
||||
int nLinAxes = int( m_vCalcLinAx.size()) ;
|
||||
int nRotAxes = int( m_vCalcRotAx.size()) ;
|
||||
if ( nInd >= 0 && nInd < nLinAxes) {
|
||||
Axis* pAx = GetAxis( m_vCalcLinAx[nInd].nGrpId) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
bInvert = pAx->GetInvert() ;
|
||||
return true ;
|
||||
}
|
||||
else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) {
|
||||
Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
bInvert = pAx->GetInvert() ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetCurrAxisHomePos( int nInd, double& dHome) const
|
||||
@@ -1867,3 +2014,107 @@ Machine::GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const
|
||||
{
|
||||
// pulisco il risultato
|
||||
vAng1.clear() ;
|
||||
vAng2.clear() ;
|
||||
// riferimento utensile
|
||||
Frame3d frTool ;
|
||||
frTool.Set( ORIG, vtDirT, vtDirA) ;
|
||||
// deduco la posizione richiesta del centro del polso
|
||||
Point3d ptCen = ptP + m_ptWristCen.x * frTool.VersX() +
|
||||
m_ptWristCen.y * frTool.VersY() +
|
||||
( m_dCalcTLen + m_ptWristCen.z) * frTool.VersZ() ;
|
||||
// deduco la direzione richiesta del centro del polso
|
||||
Vector3d vtCen = m_vtWristRef.x * frTool.VersX() +
|
||||
m_vtWristRef.y * frTool.VersY() +
|
||||
m_vtWristRef.z * frTool.VersZ() ;
|
||||
// calcolo il primo asse rotante
|
||||
Vector3d vtArm = ptCen - m_vCalcRotAx[0].ptPos ;
|
||||
double dAng1 ; bool bDet1 ;
|
||||
if ( ! X_AX.GetRotation( vtArm, m_vCalcRotAx[0].vtDir, EPS_SMALL, dAng1, bDet1) || ! bDet1) {
|
||||
LOG_ERROR( GetEMkLogger(), "Error : direction unreachable (robot)")
|
||||
return false ;
|
||||
}
|
||||
vAng1.push_back( dAng1) ;
|
||||
vAng2.push_back( dAng1) ;
|
||||
// calcolo secondo e terzo asse rotante
|
||||
Point3d ptR2 = m_vCalcRotAx[1].ptPos ;
|
||||
ptR2.Rotate( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, dAng1) ;
|
||||
Vector3d vtR2 = m_vCalcRotAx[1].vtDir ;
|
||||
vtR2.Rotate( m_vCalcRotAx[0].vtDir, dAng1) ;
|
||||
Vector3d vtR2Cen = ptCen - ( ptR2 + ( ptCen - ptR2) * vtR2 * vtR2) ;
|
||||
double dDistR2Cen = vtR2Cen.Len() ;
|
||||
double dDistR2R3 = m_vCalcRotAx[2].ptPos.z - m_vCalcRotAx[1].ptPos.z ;
|
||||
Vector3d vtR3R5 = m_vCalcRotAx[4].ptPos - m_vCalcRotAx[2].ptPos ; vtR3R5.y = 0 ;
|
||||
double dDistR3R5 = vtR3R5.Len() ;
|
||||
double dAngR3R5 = atan2( vtR3R5.z, vtR3R5.x) * RADTODEG ;
|
||||
double dCosB = ( dDistR2R3 * dDistR2R3 + dDistR2Cen * dDistR2Cen - dDistR3R5 * dDistR3R5) / ( 2 * dDistR2R3 * dDistR2Cen) ;
|
||||
double dCosC = ( dDistR3R5 * dDistR3R5 + dDistR2Cen * dDistR2Cen - dDistR2R3 * dDistR2R3) / ( 2 * dDistR3R5 * dDistR2Cen) ;
|
||||
if ( abs( dCosB) > 1 || abs( dCosC) > 1) {
|
||||
LOG_ERROR( GetEMkLogger(), "Error : position unreachable (robot)")
|
||||
return false ;
|
||||
}
|
||||
double dAngB = acos( dCosB) * RADTODEG ;
|
||||
double dAng2 ; bool bDet2 ;
|
||||
if ( ! Z_AX.GetRotation( vtR2Cen, vtR2, EPS_SMALL, dAng2, bDet2) || ! bDet2) {
|
||||
LOG_ERROR( GetEMkLogger(), "Error : R2 not calculable (robot)")
|
||||
return false ;
|
||||
}
|
||||
dAng2 -= dAngB ;
|
||||
vAng1.push_back( dAng2) ;
|
||||
vAng2.push_back( dAng2) ;
|
||||
double dAngC = acos( dCosC) * RADTODEG ;
|
||||
double dAng3 = dAngB + dAngC + dAngR3R5 - ANG_RIGHT ;
|
||||
vAng1.push_back( dAng3) ;
|
||||
vAng2.push_back( dAng3) ;
|
||||
// calcolo i primi due assi rotanti del polso
|
||||
Frame3d frWrist ;
|
||||
frWrist.Set( m_vCalcRotAx[3].ptPos, m_vCalcRotAx[3].vtDir, m_vCalcRotAx[4].vtDir ^ m_vCalcRotAx[3].vtDir) ;
|
||||
frWrist.Rotate( m_vCalcRotAx[2].ptPos, m_vCalcRotAx[2].vtDir, dAng3) ;
|
||||
frWrist.Rotate( m_vCalcRotAx[1].ptPos, m_vCalcRotAx[1].vtDir, dAng2) ;
|
||||
frWrist.Rotate( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, dAng1) ;
|
||||
Vector3d vtCenL = GetToLoc( vtCen, frWrist) ;
|
||||
double dAng4, dAng5 ;
|
||||
vtCenL.ToSpherical( nullptr, &dAng5, &dAng4) ;
|
||||
if ( dAng4 > ANG_STRAIGHT)
|
||||
dAng4 -= ANG_FULL ;
|
||||
if ( dAng4 > ANG_RIGHT) {
|
||||
dAng4 -= ANG_STRAIGHT ;
|
||||
dAng5 = -dAng5 ;
|
||||
}
|
||||
else if ( dAng4 < -ANG_RIGHT) {
|
||||
dAng4 += ANG_STRAIGHT ;
|
||||
dAng5 = -dAng5 ;
|
||||
}
|
||||
vAng1.push_back( dAng4) ;
|
||||
vAng1.push_back( dAng5) ;
|
||||
vAng2.push_back( dAng4 + ( dAng4 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT)) ;
|
||||
vAng2.push_back( -dAng5) ;
|
||||
// calcolo il terzo asse rotante del polso
|
||||
Vector3d vtR6 = m_vCalcRotAx[5].vtDir ;
|
||||
for ( int i = 4; i >= 0 ; --i)
|
||||
vtR6.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
|
||||
Vector3d vtTool = m_vtCalcDir ;
|
||||
for ( int i = 4; i >= 0 ; --i)
|
||||
vtTool.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
|
||||
double dAng6 ; bool bDet6 ;
|
||||
if ( ! vtTool.GetRotation( vtDirT, vtR6, EPS_SMALL, dAng6, bDet6) || ! bDet6) {
|
||||
Vector3d vtAux = m_vtCalcADir ;
|
||||
for ( int i = 4; i >= 0 ; --i)
|
||||
vtAux.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
|
||||
if ( ! vtAux.GetRotation( vtDirA, vtR6, EPS_SMALL, dAng6, bDet6) || ! bDet6) {
|
||||
LOG_ERROR( GetEMkLogger(), "Error : R6 not calculable (robot)")
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
vAng1.push_back( dAng6) ;
|
||||
vAng2.push_back( dAng6 + ( dAng6 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT)) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -98,6 +98,18 @@ Machine::GetHeadSolCh( const string& sHead) const
|
||||
return pHead->GetSolCh() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::GetHeadSelectType( const string& sHead) const
|
||||
{
|
||||
// recupero testa
|
||||
Head* pHead = GetHead( GetGroup( sHead)) ;
|
||||
if ( pHead == nullptr)
|
||||
return MCH_SCC_NONE ;
|
||||
// recupero tipo di selezione delle uscite della testa
|
||||
return pHead->GetSelectType() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LoadTool( const string& sHead, int nExit, const string& sTool)
|
||||
|
||||
+98
-18
@@ -44,12 +44,14 @@ static const string FLD_INVERT = "Invert" ;
|
||||
static const string FLD_AXIS_OFFSET = "Offset" ;
|
||||
static const string FLD_REF1 = "Ref1" ;
|
||||
static const string FLD_SCALE = "Scale" ;
|
||||
static const string FLD_EXIT_NBR = "ExitNbr" ;
|
||||
static const string FLD_POS = "Pos" ;
|
||||
static const string FLD_DIR = "Dir" ;
|
||||
static const string FLD_STROKE = "Stroke" ;
|
||||
static const string FLD_HOME = "Home" ;
|
||||
static const string FLD_ADJUSTAUX = "AdjustAux" ;
|
||||
static const string FLD_HSET = "HSet" ;
|
||||
static const string FLD_SEL_TYPE = "SelType" ;
|
||||
static const string FLD_TDIR = "TDir" ;
|
||||
static const string FLD_ADIR = "ADir" ;
|
||||
static const string FLD_ROT1W = "Rot1W" ;
|
||||
@@ -659,9 +661,12 @@ Machine::LuaEmtMultiHead( lua_State* L)
|
||||
// lettura campo 'HSet' dalla tabella
|
||||
string sHSet ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_HSET, sHSet)
|
||||
// lettura eventuale campo tipo di selezione ammessa per le uscite
|
||||
int nSelectType = MCH_SLT_FIXEDEXITS ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_SEL_TYPE, nSelectType) ;
|
||||
// lettura campo 'ExitNbr' dalla tabella
|
||||
int nExitNbr ;
|
||||
LuaCheckTabFieldParam( L, 1, "ExitNbr", nExitNbr)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_EXIT_NBR, nExitNbr)
|
||||
// lettura campi 'PosN' e 'TDirN' per ogni uscita dalla tabella
|
||||
MUEXITVECTOR vMuExit ;
|
||||
vMuExit.reserve( nExitNbr) ;
|
||||
@@ -676,7 +681,7 @@ Machine::LuaEmtMultiHead( lua_State* L)
|
||||
// inserimento nell'array
|
||||
vMuExit.emplace_back( ptPos, vtTDir) ;
|
||||
}
|
||||
// lettura campo 'ADir' dalla tabella
|
||||
// lettura eventuale campo 'ADir' dalla tabella
|
||||
Vector3d vtADir ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_ADIR, vtADir) ;
|
||||
// lettura eventuale campo 'Rot1W' dalla tabella (default 1)
|
||||
@@ -711,9 +716,9 @@ Machine::LuaEmtMultiHead( lua_State* L)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
|
||||
// carico i dati della testa multipla
|
||||
if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, vMuExit, vtADir,
|
||||
if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, nSelectType, vMuExit, vtADir,
|
||||
dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Standard Head failed") ;
|
||||
return luaL_error( L, " Load Machine Multi Head failed") ;
|
||||
|
||||
// restituisco l'indice della testa
|
||||
int nHeadId = m_pMchLua->GetHeadId( sName) ;
|
||||
@@ -797,6 +802,26 @@ Machine::LuaEmtSpecialHead( lua_State* L)
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
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
|
||||
if ( ! lua_istable( L, 1))
|
||||
@@ -833,8 +858,70 @@ Machine::LuaEmtTcPos( lua_State* L)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
|
||||
// carico i dati della posizione cambio utensile
|
||||
if ( ! m_pMchLua->LoadMachineTcPos( sName, sParent, ptPos, vtTDir, vtADir, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Tc Position failed") ;
|
||||
if ( ! m_pMchLua->LoadMachineStdTcPos( sName, sParent, ptPos, vtTDir, vtADir, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Standard 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
|
||||
int nTcPosId = m_pMchLua->GetTcPosId( sName) ;
|
||||
@@ -1395,19 +1482,12 @@ Machine::LuaEmtAddToolForVmill( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtMoveAxes( lua_State* L)
|
||||
{
|
||||
// 4, ..., 16 parametri : nMoveType, sAx1, dPos1, dStep1 [, sAx2, dPos2, dStep2] [, sAx3, dPos3, dStep3] [, sAx4, dPos4, dStep4] [, sAx5, dPos5, dStep5]
|
||||
int nMoveType ;
|
||||
LuaCheckParam( L, 1, nMoveType)
|
||||
string sAx1 ;
|
||||
LuaCheckParam( L, 2, sAx1) ;
|
||||
double dEnd1 ;
|
||||
LuaCheckParam( L, 3, dEnd1) ;
|
||||
double dStep1 ;
|
||||
LuaCheckParam( L, 4, dStep1) ;
|
||||
// 4, ..., 31 parametri : nMoveType, sAx1, dPos1, dStep1 [, sAx2, dPos2, dStep2] ... [, sAx10, dPos10, dStep10]
|
||||
int nMoveType = 0 ;
|
||||
LuaGetParam( L, 1, nMoveType) ;
|
||||
SAMVECTOR vAxNaEpSt ;
|
||||
vAxNaEpSt.emplace_back( sAx1, dEnd1, dStep1) ;
|
||||
for ( int i = 0 ; i < 4 ; ++ i) {
|
||||
int nInd = 5 + 3 * i ;
|
||||
for ( int i = 0 ; i < 10 ; ++ i) {
|
||||
int nInd = 2 + 3 * i ;
|
||||
string sAxN ;
|
||||
double dEndN ;
|
||||
double dStepN ;
|
||||
|
||||
+16
-4
@@ -31,7 +31,7 @@ using namespace std ;
|
||||
int
|
||||
Machine::LuaEmtAddRapidStart( lua_State* L)
|
||||
{
|
||||
// 6 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag
|
||||
// 6 o 7 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag [, bToolShow]
|
||||
int nPathId ;
|
||||
LuaCheckParam( L, 1, nPathId)
|
||||
Point3d ptP ;
|
||||
@@ -44,6 +44,8 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
|
||||
LuaCheckParam( L, 5, vtAux)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 6, nFlag)
|
||||
bool bToolShow = false ;
|
||||
LuaGetParam( L, 7, bToolShow) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -69,6 +71,7 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
|
||||
pCam->SetEndPoint( ptP) ;
|
||||
pCam->SetFeed( 0) ;
|
||||
pCam->SetFlag( nFlag) ;
|
||||
pCam->SetToolShow( bToolShow) ;
|
||||
// associo questo oggetto a quello geometrico
|
||||
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
|
||||
}
|
||||
@@ -84,7 +87,7 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtAddRapidMove( lua_State* L)
|
||||
{
|
||||
// 7 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag
|
||||
// 7 o 8 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag [, bToolShow]
|
||||
int nPathId ;
|
||||
LuaCheckParam( L, 1, nPathId)
|
||||
Point3d ptIni ;
|
||||
@@ -99,6 +102,8 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
|
||||
LuaCheckParam( L, 6, vtAux)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 7, nFlag)
|
||||
bool bToolShow = false ;
|
||||
LuaGetParam( L, 8, bToolShow) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -124,6 +129,7 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
|
||||
pCam->SetEndPoint( ptFin) ;
|
||||
pCam->SetFeed( 0) ;
|
||||
pCam->SetFlag( nFlag) ;
|
||||
pCam->SetToolShow( bToolShow) ;
|
||||
// associo questo oggetto a quello geometrico
|
||||
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
|
||||
}
|
||||
@@ -139,7 +145,7 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtAddLinearMove( lua_State* L)
|
||||
{
|
||||
// 8 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag
|
||||
// 8 o 9 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag [, bToolShow]
|
||||
int nPathId ;
|
||||
LuaCheckParam( L, 1, nPathId)
|
||||
Point3d ptIni ;
|
||||
@@ -156,6 +162,8 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
|
||||
LuaCheckParam( L, 7, dFeed)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 8, nFlag)
|
||||
bool bToolShow = false ;
|
||||
LuaGetParam( L, 9, bToolShow) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -181,6 +189,7 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
|
||||
pCam->SetEndPoint( ptFin) ;
|
||||
pCam->SetFeed( dFeed) ;
|
||||
pCam->SetFlag( nFlag) ;
|
||||
pCam->SetToolShow( bToolShow) ;
|
||||
// associo questo oggetto a quello geometrico
|
||||
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
|
||||
}
|
||||
@@ -196,7 +205,7 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtAddArcMove( lua_State* L)
|
||||
{
|
||||
// 11 parametri : nPathId, ptIni, ptFin, ptCen, dAngCen, vtN, vtTool, vtCorr, vtAux, dFeed, nFlag
|
||||
// 11 o 12 parametri : nPathId, ptIni, ptFin, ptCen, dAngCen, vtN, vtTool, vtCorr, vtAux, dFeed, nFlag [, bToolShow]
|
||||
int nPathId ;
|
||||
LuaCheckParam( L, 1, nPathId)
|
||||
Point3d ptIni ;
|
||||
@@ -219,6 +228,8 @@ Machine::LuaEmtAddArcMove( lua_State* L)
|
||||
LuaCheckParam( L, 10, dFeed)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 11, nFlag)
|
||||
bool bToolShow = false ;
|
||||
LuaGetParam( L, 12, bToolShow) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -252,6 +263,7 @@ Machine::LuaEmtAddArcMove( lua_State* L)
|
||||
pCam->SetNormDir( vtN) ;
|
||||
pCam->SetFeed( dFeed) ;
|
||||
pCam->SetFlag( nFlag) ;
|
||||
pCam->SetToolShow( bToolShow) ;
|
||||
// associo questo oggetto a quello geometrico
|
||||
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
|
||||
}
|
||||
|
||||
+14
-2
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachineStruConst.h Data : 25.05.15 Versione : 1.6e7
|
||||
// File : MachineStruConst.h Data : 15.01.24 Versione : 2.5l6
|
||||
// Contenuto : Strutture e costanti di macchina.
|
||||
//
|
||||
//
|
||||
@@ -88,6 +88,18 @@ enum MchHeadType { MCH_HT_NONE = 0,
|
||||
MCH_HT_MULTI = 2,
|
||||
MCH_HT_SPECIAL = 3} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Tipo di selezione ammessa per le uscite
|
||||
enum MchSelType { MCH_SLT_FIXEDEXITS = 0,
|
||||
MCH_SLT_ONEEXIT = 1,
|
||||
MCH_SLT_MULTIEXITS = 2} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Tipo della catena cinematica
|
||||
enum KinChainType { KIN_CHAIN_NONE = 0,
|
||||
KIN_CHAIN_CENTER = 1,
|
||||
KIN_CHAIN_ROBOT = 2} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Identificativo iniziale riferimenti di tavola
|
||||
const std::string MCH_TREF = "R" ;
|
||||
|
||||
+2
-2
@@ -287,12 +287,12 @@ Machining::ToolPreview( int nEntId, int nFlag) const
|
||||
Frame3d frHead ;
|
||||
m_pGeomDB->GetGroupGlobFrame( nId, frHead) ;
|
||||
Frame3d frRef ;
|
||||
if ( vtAux.IsSmall())
|
||||
if ( vtAux.IsSmall() || AreSameOrOppositeVectorApprox( vtAux, vtDir))
|
||||
frRef.Set( ptOrig, vtDir) ;
|
||||
else
|
||||
frRef.Set( ptOrig, vtDir, vtAux) ;
|
||||
Frame3d frShow ;
|
||||
if ( vtBAux.IsSmall())
|
||||
if ( vtBAux.IsSmall() || AreSameOrOppositeVectorApprox( vtBAux, vtTool))
|
||||
frShow.Set( ptEnd + vtTool * GetToolData().m_dLen, vtTool) ;
|
||||
else
|
||||
frShow.Set( ptEnd + vtTool * GetToolData().m_dLen, vtTool, vtBAux) ;
|
||||
|
||||
+10
-1
@@ -103,7 +103,11 @@ GetMachiningTitle( int nMchType)
|
||||
"SawRoughing",
|
||||
"SawFinishing",
|
||||
"GenMachining",
|
||||
"Chiseling"} ;
|
||||
"Chiseling",
|
||||
"SurfRoughing",
|
||||
"SurfFinishing",
|
||||
"Waterjetting",
|
||||
"5axMachining"} ;
|
||||
switch ( nMchType) {
|
||||
case MT_DRILLING : return MchTitle[1] ;
|
||||
case MT_SAWING : return MchTitle[2] ;
|
||||
@@ -114,6 +118,11 @@ GetMachiningTitle( int nMchType)
|
||||
case MT_SAWFINISHING : return MchTitle[7] ;
|
||||
case MT_GENMACHINING : return MchTitle[8] ;
|
||||
case MT_CHISELING : return MchTitle[9] ;
|
||||
case MT_SURFROUGHING : return MchTitle[10] ;
|
||||
case MT_SURFFINISHING : return MchTitle[11] ;
|
||||
case MT_WATERJETTING : return MchTitle[12] ;
|
||||
case MT_5AXMACHINING : return MchTitle[13] ;
|
||||
|
||||
}
|
||||
return MchTitle[0] ;
|
||||
}
|
||||
|
||||
+1208
-422
File diff suppressed because it is too large
Load Diff
@@ -96,21 +96,25 @@ class Milling : public Machining
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
|
||||
bool AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bOutStart, bool bAboveStart) ;
|
||||
bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, double dSafeZ, double dStElev, double dAppr) ;
|
||||
bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, const Vector3d& vtTool,
|
||||
double dSafeZ, double dSawStElev, double dStElev, double dAppr) ;
|
||||
bool AddDirectApproach( const Point3d& ptP) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bAboveEnd) ;
|
||||
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, double dSafeZ, double dEndElev, double dAppr) ;
|
||||
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool,
|
||||
double dSafeZ, double dSawEndElev, double dEndElev, double dAppr) ;
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
|
||||
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const ;
|
||||
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) const ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
|
||||
const Vector3d& vtTool, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs) ;
|
||||
const Vector3d& vtTool, double dStElev, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs) ;
|
||||
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool,
|
||||
double dEndElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const ;
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, double dEndElev,
|
||||
bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs, Point3d& ptP1) ;
|
||||
bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs, Point3d& ptP1, Vector3d& vtDir1) ;
|
||||
bool AdjustOscillParams( const ICurve* pCrv, bool& bPathOscEnable, 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) ;
|
||||
@@ -121,9 +125,10 @@ class Milling : public Machining
|
||||
double GetRadiusForStartEndElevation( bool bExtra = true) const ;
|
||||
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, double dSafeZ) const ;
|
||||
bool GetPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
|
||||
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU) ;
|
||||
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU) ;
|
||||
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false) ;
|
||||
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false) ;
|
||||
bool CalcOffset( ICurveComposite* pCompo, double dSignOffs) ;
|
||||
bool TrimExtendCurveToClosedStm( ICurveComposite* pCompo, int nCstmId, bool bInvert) ;
|
||||
|
||||
private :
|
||||
double GetSpeed() const
|
||||
@@ -145,7 +150,17 @@ class Milling : public Machining
|
||||
bool IsLeadInHelixOrZigzag() const
|
||||
{ int nType = GetLeadInType() ;
|
||||
return ( nType == MILL_LI_ZIGZAG || nType == MILL_LI_HELIX) ; }
|
||||
friend class LeadIOStatus ;
|
||||
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) ; }
|
||||
friend class LeadIOStatus ;
|
||||
|
||||
private :
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
@@ -160,10 +175,13 @@ class Milling : public Machining
|
||||
double m_dAddedOverlap ; // overlap effettivamente aggiunto a percorso chiuso
|
||||
int m_nHeadSolCh ; // criterio scelta soluzione impostato nella testa
|
||||
bool m_bTiltingTab ; // flag utilizzo tavola basculante
|
||||
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
|
||||
bool m_bAboveHead ; // flag utilizzo testa da sopra
|
||||
bool m_bAggrBottom ; // flag utilizzo di aggregato da sotto
|
||||
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
|
||||
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
|
||||
double m_dCurrOscillLen ; // lunghezza corrente lungo il percorso per l'oscillazione
|
||||
double m_dCurrTabsLen ; // lunghezza corrente lungo il percorso per tabs
|
||||
bool m_bStartOutRaw ; // flag forzatura inizio fuori dal grezzo
|
||||
bool m_bEndOutRaw ; // flag forzatura fine fuori dal grezzo
|
||||
} ;
|
||||
+6
-2
@@ -110,6 +110,10 @@ struct MillingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const MillingData* GetMillingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const MillingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MILLING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const MillingData*>( pMdata)) ; }
|
||||
inline MillingData* GetMillingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<MillingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MILLING)
|
||||
return nullptr ;
|
||||
return ( static_cast<MillingData*>( pMdata)) ; }
|
||||
|
||||
+31
-8
@@ -634,6 +634,9 @@ Mortising::Update( bool bPostApply)
|
||||
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
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
|
||||
|
||||
@@ -641,7 +644,7 @@ Mortising::Update( bool bPostApply)
|
||||
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
|
||||
if ( ! m_Params.m_sInitAngs.empty())
|
||||
sHint = m_Params.m_sInitAngs ;
|
||||
if ( ! CalculateAxesValues( sHint, true)) {
|
||||
if ( ! CalculateAxesValues( sHint, true, true)) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 2507, "Error in Mortising : axes values not calculable") ;
|
||||
@@ -816,11 +819,31 @@ Mortising::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in Mortising : tool name changed (" +
|
||||
@@ -1537,8 +1560,8 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() + m_pMchMgr->GetDeltaSafeZ( m_TParams.m_sHead) ;
|
||||
double dStartElev = 0 ;
|
||||
Point3d ptLi = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * dDelta ;
|
||||
bool bUnderStart = GetPointUnderRaw( ptLi, vtTool, 0,
|
||||
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dStartElev) ;
|
||||
bool bUnderStart = GetAhPointUnderRaw( ptLi, vtTool, 0,
|
||||
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dStartElev) ;
|
||||
// altrimenti ridetermino elevazione su inizio percorso di lavoro
|
||||
if ( ! bUnderStart)
|
||||
GetElevation( m_nPhase, ptLi, vtTool, GetRadiusForStartEndElevation(), vtTool, dStartElev) ;
|
||||
@@ -1643,8 +1666,8 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
// determino se la fine dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
|
||||
double dEndElev = 0 ;
|
||||
Point3d ptLo = ptLast + vtTool * dDelta ;
|
||||
bool bUnderEnd = GetPointUnderRaw( ptLo, vtTool, 0,
|
||||
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dEndElev) ;
|
||||
bool bUnderEnd = GetAhPointUnderRaw( ptLo, vtTool, 0,
|
||||
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dEndElev) ;
|
||||
// altrimenti ridetermino elevazione su fine percorso di lavoro
|
||||
if ( ! bUnderEnd)
|
||||
GetElevation( m_nPhase, ptLo, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev) ;
|
||||
|
||||
+6
-2
@@ -77,6 +77,10 @@ struct MortisingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const MortisingData* GetMortisingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const MortisingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MORTISING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const MortisingData*>( pMdata)) ; }
|
||||
inline MortisingData* GetMortisingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<MortisingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MORTISING)
|
||||
return nullptr ;
|
||||
return ( static_cast<MortisingData*>( pMdata)) ; }
|
||||
|
||||
+1571
-494
File diff suppressed because it is too large
Load Diff
+42
-10
@@ -20,6 +20,7 @@
|
||||
#include "/EgtDev/Include/EGkUserObj.h"
|
||||
#include "/EgtDev/Include/EGkSelection.h"
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
||||
|
||||
class MachMgr ;
|
||||
class CamData ;
|
||||
@@ -71,14 +72,26 @@ class Operation : public IUserObj
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP,
|
||||
const Vector3d& vtDir, double& dElev, Vector3d& vtNorm) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP,
|
||||
const Vector3d& vtDir, double& dElev, INTVECTOR& vRawStmId) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP,
|
||||
const Vector3d& vtDir, double& dElev, Vector3d& vtNorm, INTVECTOR& vRawStmId) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
|
||||
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtTool, double dRad, double dLen,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetAhPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
|
||||
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetUhPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
|
||||
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetSignedDistFromStmRaw( int nPhase, const Point3d ptP, const Vector3d vtDir,
|
||||
double& dDist, Vector3d& vtNorm) const ;
|
||||
bool GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist) const ;
|
||||
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
|
||||
double& dDist, Vector3d& vtDir) const ;
|
||||
@@ -89,18 +102,21 @@ class Operation : public IUserObj
|
||||
{ double dDummy ;
|
||||
return GetDistanceFromRawBottom( nPhase, nPathId, dToler, dRbDist, dDummy) ; }
|
||||
bool GetDistanceFromRawBottom( int nPhase, int nPathId, double dToler, double& dRbDist, double& dAllRbDist) const ;
|
||||
bool GetDistanceFromRawBottom( int nPhase, BBox3d& b3Test, double dToler, double& dRbDist, double& dAllRbDist) const;
|
||||
bool GetDistanceFromRawBottom( int nPhase, BBox3d& b3Test, double dToler, double& dRbDist, double& dAllRbDist) const ;
|
||||
bool GetRawGlobBox( int nPhase, int nPathId, double dToler, BBox3d& b3Raw) const ;
|
||||
bool GetRawGlobBox( int nPhase, const BBox3d& b3Test, double dToler, BBox3d& b3Raw) const ;
|
||||
bool GetCurrRawsGlobBox( BBox3d& b3Raw) const ;
|
||||
|
||||
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, double dToolThick, int nGrade = 3) ;
|
||||
bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ;
|
||||
bool ApproxWithLines( ICurveComposite* pCompo) const ;
|
||||
bool ApproxWithLines( ICurveComposite* pCompo, double dMaxLen = 0) const ;
|
||||
bool VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) const ;
|
||||
|
||||
bool CalcAndSetBBox( int nClId) ;
|
||||
bool CalcAndSetAxesBBox( void) ;
|
||||
|
||||
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ;
|
||||
|
||||
bool GetInitialAxesValues( bool bSkipClimb, DBLVECTOR& vAxVal) const ;
|
||||
bool GetClPathInitialAxesValues( int nClPathId, bool bSkipClimb, DBLVECTOR& vAxVal) const ;
|
||||
bool GetFinalAxesValues( bool bSkipRise, DBLVECTOR& vAxVal) const ;
|
||||
@@ -116,9 +132,16 @@ class Operation : public IUserObj
|
||||
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
|
||||
std::string ExtractHint( const std::string& sNotes) const ;
|
||||
bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ;
|
||||
bool CalculateAxesValues( const std::string& sHint, bool bSolChExact = false) ;
|
||||
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W, bool bMaxDeltaR2OnFirst,
|
||||
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
|
||||
bool CalculateAxesValues( const std::string& sHint, bool bRotContOnNext = true, bool bSolChExact = false) ;
|
||||
bool CalculateClPathCenterAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
|
||||
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
|
||||
bool CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
|
||||
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
|
||||
bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
|
||||
bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const ;
|
||||
@@ -127,22 +150,28 @@ class Operation : public IUserObj
|
||||
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, int nFlag = 0) ;
|
||||
bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
|
||||
bool AddHome( void) ;
|
||||
bool RemoveClimbRiseHome( void) ;
|
||||
bool AddRobotClimb( int nEntId, double dDeltaZ) ;
|
||||
bool CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const Vector3d& vtA, double dDeltaZ,
|
||||
DBLVECTOR& vAx, double* pdNewDeltaZ = nullptr) const ;
|
||||
bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const ;
|
||||
bool GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
|
||||
const DBLVECTOR& vAx2, const Vector3d& vtTool2,
|
||||
double dSafeZ, double& dExtraZ) const ;
|
||||
double dHomeZ, double& dExtraZ) const ;
|
||||
bool SpecialGetMaxZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
|
||||
const DBLVECTOR& vAx2, const Vector3d& vtTool2,
|
||||
double& dMaxZ) const ;
|
||||
bool GetRotationAtZmax( void) const ;
|
||||
bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
|
||||
bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, const BBox3d& b3Raws) const ;
|
||||
int GetUserNotesZmax( void) const ;
|
||||
bool GetZHomeDown( void) const ;
|
||||
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
|
||||
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
|
||||
int SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
|
||||
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
|
||||
bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, DBLVECTOR& vAxNew, bool& bModif) ;
|
||||
|
||||
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
|
||||
bool IsAggrBottom( const std::string& sHead) const ;
|
||||
|
||||
protected :
|
||||
int m_nOwnerId ; // identificativo dell'oggetto geometrico possessore
|
||||
@@ -158,6 +187,7 @@ class Operation : public IUserObj
|
||||
bool SetCorrAuxDir( const Vector3d& vtDir) ;
|
||||
bool SetFeed( double dFeed) ;
|
||||
bool SetFlag( int nFlag) ;
|
||||
bool SetFlagOnLastMove( int nFlag) ;
|
||||
bool SetFlag2( int nFlag2) ;
|
||||
bool SetIndex( int nIndex) ;
|
||||
bool GetCurrPos( Point3d& ptCurr) const
|
||||
@@ -204,3 +234,5 @@ inline Operation* GetOperation( IUserObj* pUserObj)
|
||||
enum { TOOL_PARAL = 1, TOOL_ORTHO = 2, TOOL_ORTUP = 3, TOOL_PAR_SLANT= 4} ;
|
||||
// tipo di utilizzo contorno faccia
|
||||
enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6, FACE_CONT = 7} ;
|
||||
// risultato di SpecialTestCollisionAvoid
|
||||
enum { SCAV_ERROR = -1, SCAV_COLLIDE = 0, SCAV_AVOID = 1, SCAV_TOTEST = 2};
|
||||
|
||||
@@ -82,6 +82,18 @@ Operation::SetFlag( int nFlag)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::SetFlagOnLastMove( int nFlag)
|
||||
{
|
||||
int nLastEntId = m_pGeomDB->GetLastInGroup( m_nPathId) ;
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nLastEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
pCamData->SetFlag( nFlag) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::SetFlag2( int nFlag2)
|
||||
|
||||
@@ -60,6 +60,7 @@ 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_EXIT = ".EXIT" ; // (int) indice uscita
|
||||
static const std::string GVAR_TCPOS = ".TCPOS" ; // (string) eventuale posizione utensile nel TC
|
||||
static const std::string GVAR_TTYPE = ".TTYPE" ; // (int) tipo utensile
|
||||
static const std::string GVAR_TCOMP = ".TCOMP" ; // (int) numero correttore utensile
|
||||
static const std::string GVAR_TDIAM = ".TDIAM" ; // (num) diametro utensile
|
||||
static const std::string GVAR_TTOTDIAM = ".TTOTDIAM" ; // (num) diametro totale utensile
|
||||
@@ -205,6 +206,8 @@ static const std::string ON_ESTIM_RAPID = "OnEstimRapid" ;
|
||||
static const std::string ON_ESTIM_LINEAR = "OnEstimLinear" ;
|
||||
static const std::string ON_ESTIM_ARC = "OnEstimArc" ;
|
||||
// Funzioni simulazione
|
||||
static const std::string ON_SIMUL_INIT = "OnSimulInit" ;
|
||||
static const std::string ON_SIMUL_EXIT = "OnSimulExit" ;
|
||||
static const std::string ON_SIMUL_START = "OnSimulStart" ;
|
||||
static const std::string ON_SIMUL_END = "OnSimulEnd" ;
|
||||
static const std::string ON_SIMUL_DISPOSITION_STARTING = "OnSimulDispositionStarting" ;
|
||||
|
||||
+10855
-3929
File diff suppressed because it is too large
Load Diff
+238
-83
@@ -20,6 +20,8 @@
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Pocketing : public Machining
|
||||
@@ -67,82 +69,219 @@ class Pocketing : public Machining
|
||||
Pocketing( void) ;
|
||||
|
||||
private :
|
||||
// Debug functions ----
|
||||
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf = true, Color Col = Color( 0., 0., 1., 0.45),
|
||||
bool bAlphaCoverage = false) ;
|
||||
void DrawSimpleSurf( const ISurfFlatRegion* pSrf, Color Col = Color( 0., 0., 1., 0.45)) ;
|
||||
void DrawVectorCurves( const ICRVCOMPOPOVECTOR& vCrv) ;
|
||||
void DrawSimpleCurve( const ICurveComposite* pCrv, bool bUniform = false, Color Col = WHITE) ;
|
||||
void DrawSimpleTriMesh( const ISurfTriMesh* pStm, Color Col = Color( 0., 0., 0., 1.)) ;
|
||||
void DrawSimplePoint( const Point3d& pT, Color Col = WHITE) ;
|
||||
void DrawSimpleVector( const Vector3d& vt, Point3d ptPos = ORIG, Color Col = WHITE) ;
|
||||
// --------------------
|
||||
|
||||
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
|
||||
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
|
||||
bool SetCurveAllTempProp( int nCrvId, ICurve* pCurve) ;
|
||||
bool GetCurvesAndPartialVolume( SelData Id, ICURVEPLIST& lstPC, ISurfTriMesh* pStmTmp, Vector3d& vtN) ;
|
||||
bool GetForcedClosed( void) ;
|
||||
bool SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen = nullptr) ;
|
||||
bool ResetCurveAllTempProp( ICurve* pCurve) ;
|
||||
bool Chain( int nGrpDestId) ;
|
||||
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
|
||||
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) const ;
|
||||
bool VerifyPathFromBottom( const ISurfFlatRegion* pSrf, const Vector3d& vtTool) ;
|
||||
bool GeneratePocketingPv( int nPathId, const ISurfFlatRegion* pSrfPock) ;
|
||||
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dLen, double& dElev) const ;
|
||||
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
|
||||
bool GeneratePocketingPv( int nPathId, const ISurfTriMesh* pStm_PartVolume) ;
|
||||
bool CheckSimpleOverlap( const ICurve* pCrv, const ICurveComposite* pCrvOri, int& nStat, double dToll) ;
|
||||
bool CalcDepth( const int nId, const Vector3d& vtExtr, double dThick, double& dDepth) ;
|
||||
bool ChainCurveArray( ICURVEPOVECTOR& vpCrvs, ICRVCOMPOPOVECTOR& vCrvCompo) ;
|
||||
bool CreateStmForIntersection( ISurfTriMesh* pStm, ICRVCOMPOPOVECTOR& vCrvCompo, const Vector3d& vtN) ;
|
||||
bool CalcOffsExtensionsForCurves( const ICurveComposite* pCrvCompo, const Vector3d& vtN, double& dExt) ;
|
||||
bool GetExtendedLoopToFitStmVolume( ICurveComposite* pCrvLoop, const double& dExt, const Vector3d& vtN) ;
|
||||
bool GetCurrentPart( const PNTVECTOR& vPtInside, ISurfTriMesh* pStmPart) ;
|
||||
bool SetPocketingVolume( const PNTVECTOR& vPtInside, ISurfTriMesh* pStm) ;
|
||||
bool AdjustPocketingSideForVolumePart( ISurfTriMesh* pStmVolPart, const Vector3d& vtTool) ;
|
||||
bool SewingMissingFacesOnPlanes( ISurfTriMesh* pStm, const Plane3d& plPlane) ;
|
||||
bool ChainBisectors( ICURVEPOVECTOR& vpCrvs, ICRVCOMPOPOVECTOR& vCrvCompo) ;
|
||||
bool ChooseBestBisectorPath( ICRVCOMPOPOVECTOR& vCrvCompo, const Point3d& ptS,
|
||||
const Point3d& ptE, ICurveComposite* pCrvPath) ;
|
||||
bool GetSpecialElevation( const ISurfFlatRegion* pSfr, const ICurveLine* pLine, const bool bInVsOut,
|
||||
double& dElev) ;
|
||||
|
||||
bool ModifyCurveToSmooted( ICurveComposite* pCrvOffset, double dRightPer, double dleftPer) ;
|
||||
|
||||
// ===== ZigZag =====
|
||||
bool AddZigZag( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev, double dOkStep,
|
||||
bool bSplitArcs, int nPathId) ;
|
||||
bool GetDangerSfrForSideStep( const ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm_Part, const double dExtraLenInOut,
|
||||
ISurfFlatRegion* pSfrDanger) ;
|
||||
bool AdjustTrapezoidSpiralLeadInLeadOutForSideAngle( ICurveComposite* pMCrv, const double dExtraLenInOut,
|
||||
const int nOutsideRaw, const Vector3d& vtN) ;
|
||||
bool GetRaw( ISurfTriMesh* pStmRaw) ;
|
||||
bool SliceVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const ISurfTriMesh* pSt_Raw,
|
||||
ISURFFRPOVECTOR& vSrfSliced, ISURFFRPOVECTOR& vSfrLimit, std::vector<ICRVCOMPOPOVECTOR>& vCrvOEWithFlags,
|
||||
BOOLVECTOR& vbChangedPrec, VCT3DVECTOR& vVtTrasl, int& nStep, const Vector3d vtTool,
|
||||
const double dElev, const double dDepth, const double dStep, double& dExtraLenInOut) ;
|
||||
bool TranslateVolumeFaces( const double dTrasl, Frame3d& frElevation, ISurfTriMesh* pStmVol, ISurfTriMesh* pStm_Part,
|
||||
ISurfTriMesh* pStmRaw) ;
|
||||
bool CalcExtraSteps( const ISurfTriMesh* pStmVol, VCT3DVECTOR& vVtTrasl, int& nStep, const double dElev,
|
||||
const double dDepth, const double dStep, INTVECTOR& vIndExtraSteps,
|
||||
ISURFTMPOVECTOR& vStmES_Edges_OC) ;
|
||||
bool CutVolumeByPlane( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const Vector3d& vtTrasl,
|
||||
const bool bIsExtraStep, ISurfFlatRegion* pSfrResult) ;
|
||||
bool CheckSideAngleForVolume( const ISurfTriMesh* pStmVol_Sliced, const ISurfTriMesh* pStm_Part,
|
||||
ISurfFlatRegion* pSfr_Projection, double& dExtraLenInOut, ISurfFlatRegion* pSfr) ;
|
||||
bool ProjectVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const Vector3d& vtTrasl,
|
||||
const Vector3d& vtTraslPrec, const bool bIsExtraStep, ISurfFlatRegion* pSfrOpenProjPrec,
|
||||
ISurfFlatRegion* pSfr, const bool bOneStep, double& dExtraLenInOut) ;
|
||||
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm, const bool bOnIsClosed = false) ;
|
||||
bool SimplifySfrLoops( ISurfFlatRegion* pSfr) ;
|
||||
bool GetCurvesForOptimizedPocketing( ISurfFlatRegion* pSfr, ICRVCOMPOPOVECTOR& vCrvOEWithFlags) ;
|
||||
bool ModifySurfByOpenEdges( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrLimit) ;
|
||||
bool AdjustContourWithOpenEdges( ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vCrvIsl, const double dDiam,
|
||||
const double dOffR, const double dStep, const ISurfFlatRegion* pSfrLimit) ;
|
||||
bool AdjustOpenEdge( const ICurveComposite* pCrvCompo, const ICRVCOMPOPOVECTOR& vCrvIsland,
|
||||
const double dParS, const double dParE, const Vector3d& vtTanS,
|
||||
const Vector3d& vtTanE, const double dRad, const double dDiamJ,
|
||||
const ISurfFlatRegion* pSfrLimit, ICurveComposite* pCrvBorder) ;
|
||||
bool GetProjectionOfStmToNotPocket( const ISurfTriMesh* pStm, const ISurfTriMesh* pStmVol,
|
||||
const Vector3d& vtTrasl, ISurfFlatRegion* pSfrProj) ;
|
||||
bool CreateSurfFrIncidence( const ICurveComposite* pCrv, const Vector3d& vtTanS, const Vector3d& vtTaneE,
|
||||
const double dRad, ISurfFlatRegion* pSfrInc) ;
|
||||
bool GetNewSfrByAnotherPocketing( ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrNoExtendedByOpenEdges,
|
||||
const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part,
|
||||
const ISurfFlatRegion* pSfrLimit) ;
|
||||
bool GetHomogeneousParts( ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||
bool OptimizedSpiralCirle( const ICurveComposite* pCrvCompo, const double dToll, double& dRad,
|
||||
Point3d& ptC, bool& bIsCirlce) ;
|
||||
bool ModifyCurveToSmoothed( ICurveComposite* pCrv, double dRightLen, double dLeftLen, bool bAsParam) ;
|
||||
bool OrderCurvesByLastPntOfPath( ICRVCOMPOPOVECTOR& vCrv, Point3d ptEnd, PNTVECTOR& vPtStart,
|
||||
VCT3DVECTOR& vVtOut, BOOLVECTOR& vbMidOut) ;
|
||||
bool SetPtStartForPath( ICurveComposite* pCrv0, const ISurfFlatRegion* pSrfToWork, const Point3d& ptEndPrec,
|
||||
const Frame3d& frPocket, Point3d& ptStart, Vector3d& vtMidOut, bool& bMidOut,
|
||||
int nOffs = 0, ICurveComposite* pCrvOrig = nullptr) ;
|
||||
bool SetSpecialPtStartForOpenEdges( const ICurveComposite* pCrvOrig, const Frame3d& frPocket,
|
||||
ICurveComposite* pCrvCompo, Point3d& ptStart, Vector3d& vtMidOut,
|
||||
bool& bMidOut) ;
|
||||
bool GetOptCrvIndex( const std::vector<ICRVCOMPOPOVECTOR>& vCrvOEWithFlags, int nStep, ISurfFlatRegion* pSrfChunkFinal,
|
||||
int& nIndex) ;
|
||||
bool GetTrapezoidFromShape( const ICurveComposite* pCrvCompo, ICurveComposite* pCrvTrap, Frame3d& frTrap,
|
||||
double& dPocketSize, int& nBase, int& nSecondBase) ;
|
||||
bool GetBoxCrvOptTrap( const int nCrv, const ICurveComposite* pCrvCompo, const double dDiam, int& nType, ICurveComposite* pCrvBox) ;
|
||||
bool CheckTrapezoidClosedEdgePosition( const ICurveComposite* pCrvCompo, const int nCrvInd, const double dDimBoxY,
|
||||
INTVECTOR& vIndClosedSides, bool& bOk,
|
||||
ICurveComposite* pCrvTrap) ;
|
||||
bool CheckSecondBaseTrapezoid( const ICurveComposite* pCrvCompo, const int nCrvInd, int& nSecondBase) ;
|
||||
bool PreparareTrapezoidTwoBases( const ICurveComposite* pCrvCompo, const double dDiam, const int nType, int& nBase,
|
||||
int& nSecondBase, bool& bOk, ICurveComposite* pCrvTrap) ;
|
||||
bool GetSfrByStm( const ISurfTriMesh* pStm, ISurfFlatRegion* pSfr, const Plane3d plPock, const Vector3d& vtExtr,
|
||||
const double dThick, double dToll = 5 * EPS_SMALL) ;
|
||||
bool ProjectStmOnPlane( const ISurfTriMesh* pStmAbove, const Plane3d plPock, ISurfFlatRegion* pSfrProj) ;
|
||||
bool GetCoeffLinArc( const ICurveArc* pArc, double dDiam, double& dSubArc) ;
|
||||
bool GetParamOnOpenSide( const ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvIsl,
|
||||
const Frame3d& frPocket, Point3d& ptMid, Vector3d& vtMidOut) ;
|
||||
bool AdjustContourStart( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvIsl, bool bOrder = false,
|
||||
Point3d ptRef = P_INVALID) ;
|
||||
bool GetParamForPtStartOnEdge( const ICurve* pCrv, const ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvIsl,
|
||||
double& dPar) ;
|
||||
bool CheckForRemovingIsland( const ICurveComposite* pCrvIslandBorder, double dOffs, bool bRemove) ;
|
||||
bool AddZigZag( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
|
||||
VCT3DVECTOR& vVtTrasl, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool CalcZigZag( const ISurfFlatRegion* pSrfZigZag, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||
bool 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& bOpposite, Vector3d& vtDir) ;
|
||||
bool CalcZigZagLink( ICurveComposite* pCrv1, ICurveComposite* pCrv2, ICurveComposite* pCrvLink) ;
|
||||
bool OptimizedZigZag( ISurfFlatRegion* pSrf, const Vector3d & vtTool, double dDepth, double dSafeZ,
|
||||
Frame3d& frPocket, ICurveComposite* pCrvOrig, bool& bOptimizedZigZag,
|
||||
ICRVCOMPOPOVECTOR& vpCrvs, ICRVCOMPOPOVECTOR& vCrvIslMergeBorders, double& dOffs,
|
||||
int& nClosedSides, bool& bTwoOpposite) ;
|
||||
bool ZigZagOptimizedNoClosedEdges( ICurveComposite* pCrvPocket, bool& bOptimizedZigZag, Vector3d& vtDir, double& dOffs) ;
|
||||
bool ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClosedId, bool& bOptimizedZigZag,
|
||||
Vector3d& vtDir, double& dOffs) ;
|
||||
bool ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds,
|
||||
bool& bOptimizedZigZag, bool& bOpposite, Vector3d& vtDir, double& dOffs) ;
|
||||
bool ZigZagOptimizedThreeClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag,
|
||||
bool& bOpposite, Vector3d& vtDir) ;
|
||||
bool ZigZagOptimizedComputeOffset( ICurveComposite* pCrvPocket, const Vector3d& vtMainDir, int nOffsettedEdgesOnY,
|
||||
const INTVECTOR& vnClosedIds) ;
|
||||
bool& bOpposite, Vector3d& vtDir, double& dOffs) ;
|
||||
bool ZigZagOptimizedComputeOffset( ICurveComposite* pCrvPocket, const Vector3d& vtMainDir, int nOffsettedEdgesOnY,
|
||||
const INTVECTOR& vnClosedIds, double& dOffs) ;
|
||||
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
|
||||
bool GetUnclearedRegion( ICRVCOMPOPOVECTOR& vFirstOffs, ICRVCOMPOPOVECTOR& vCrvs, ICURVEPOVECTOR& vLinks, ISurfFlatRegion* pSrfToCut) ;
|
||||
// ==================
|
||||
|
||||
// ==== OneWay ======
|
||||
bool AddOneWay( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
|
||||
// ==================
|
||||
|
||||
// ==== SpiralIn/Out ====
|
||||
bool AddSpiralIn( const ISurfFlatRegion* pSrfPock, const PNTVECTOR vPtStart, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth,
|
||||
double dElev, double dOkStep, bool bSplitArcs, BOOLVECTOR vbMidOpen, PNTVECTOR vPtMidOpen, VCT3DVECTOR vVtMidOut, int nPathId) ;
|
||||
bool AddSpiralOut( const ISurfFlatRegion* pSrfpock, const PNTVECTOR vPtStart, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev,
|
||||
double dOkStep, bool bSplitArcs, int nPathId) ;
|
||||
bool CalcSpiral( const ISurfFlatRegion* pSrfChunk, int nReg, Point3d ptStart, bool bSplitArcs, ICurveComposite* pMCrv, ICurveComposite* pRCrv, int nPathId,
|
||||
bool& bOptimizedTrap) ;
|
||||
bool RemoveExtraParts( ISurfFlatRegion* pSrfToCut, ICRVCOMPOPOVECTOR& vOffs, ICRVCOMPOPOVECTOR& vOffsClosedCurves, ICRVCOMPOPOVECTOR& vOffsFirstCurve,
|
||||
ICURVEPOVECTOR& vLinks) ;
|
||||
bool RemoveExtraPartByMedialAxis( ISurfFlatRegion* pChunkToCut, ICRVCOMPOPOVECTOR& vOffsFirstCurve, int& nOptFlag, Point3d& ptCentroid,
|
||||
ICurveComposite* pCrvPath) ;
|
||||
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink) ;
|
||||
bool CalcBoundedSmootedLink( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd, double dParMeet,
|
||||
ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink) ;
|
||||
bool AddOneWay( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
|
||||
VCT3DVECTOR& vVtTrasl, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool AddSpiralIn( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
|
||||
VCT3DVECTOR& vVtTrasl, ISURFFRPOVECTOR& vSrfLimit, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
const double dDepth, const double dElev, const double dMaxElev, const double dOkStep,
|
||||
const bool bSplitArcs, const double dExtraLenInOut) ;
|
||||
bool AddSpiralOut( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
|
||||
VCT3DVECTOR& vVtTrasl, ISURFFRPOVECTOR& vSrfLimit, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs,
|
||||
const double dExtraLenInOut) ;
|
||||
bool CalcSpiral( const ISurfFlatRegion* pSrfPock, int& nReg, Point3d& ptStart, const Point3d& ptEndPrec, Vector3d& vtMidOut , bool& bMidOut,
|
||||
bool bSplitArcs,ICurveComposite* pMCrv, ICurveComposite* pRCrv, ICurveComposite* pCrvOEWithFlags,
|
||||
bool vbChangedPrec, bool& bOptimizedTrap) ;
|
||||
bool CheckIfOffsetIsNecessary( const ICurveComposite* pCrvOffs, const double dOffs, const int nIter,
|
||||
const int nOffsCount, const Vector3d& vtN, bool& bInsert) ;
|
||||
bool CreateSpiralPocketingPath( ICRVCOMPOPOVECTOR& vOffs, ICURVEPOVECTOR& vLinks,
|
||||
const ICRVCOMPOPOVECTOR& vOffsClosedCurves, const ICRVCOMPOPOVECTOR& vOffsFirstCurve) ;
|
||||
bool GetUnclearedRegion( ICRVCOMPOPOVECTOR& vFirstOffs, ICRVCOMPOPOVECTOR& vCrvs, ICURVEPOVECTOR& vLinks,
|
||||
const ICurveComposite* pCrv_orig, ISurfFlatRegion* pSrfToCut) ;
|
||||
bool GetDynamicClearedRegion( ISurfFlatRegion* pSrfPrec, const ICurveComposite* pCrv) ;
|
||||
bool RemoveFirstLoopFromSfr( ISurfFlatRegion* pSrfOrig) ;
|
||||
bool RemoveExtraParts( ISurfFlatRegion* pSrfToCut, ICRVCOMPOPOVECTOR& vOffs, ICRVCOMPOPOVECTOR& vOffsClosedCurves,
|
||||
ICRVCOMPOPOVECTOR& vOffsFirstCurve, ICURVEPOVECTOR& vLinks) ;
|
||||
bool RemoveExtraPartByMedialAxis( const ISurfFlatRegion* pChunkToCut, ICRVCOMPOPOVECTOR& vOffsFirstCurve,
|
||||
int& nOptFlag, Point3d& ptCentroid, ICurveComposite* pCrvPath) ;
|
||||
bool CutOffsetToClosestPoint( ICRVCOMPOPOVECTOR& vCurves, const Point3d& ptFocus, ICurveComposite* pCrv1,
|
||||
ICurveComposite* pCrv2, int& nIndex) ;
|
||||
bool CutLinkToClosestPoint( ICURVEPOVECTOR& vCurves, ICRVCOMPOPOVECTOR& vOffs, const Point3d& ptFocus,
|
||||
ICurveComposite* pCrv1, ICurveComposite* pCrv2, bool& bFound, int& nIndex) ;
|
||||
bool GetNewCurvetWithCentroid( const ICurveComposite* pCrvH1, const ICurveComposite* pCrvH2, Point3d& ptC, bool bCir,
|
||||
ICRVCOMPOPOVECTOR& VFirstOff, ICurveComposite* pCrvNewCurve) ;
|
||||
bool GetNewCurvetWithPath( const ICurveComposite* pCrvH1, const ICurveComposite* pCrvH2, ICurveComposite* pCrvPath,
|
||||
ICRVCOMPOPOVECTOR& VFirstOff, ICRVCOMPOPOVECTOR& VoffsCl, ICurveComposite* pCrvNewCurve) ;
|
||||
bool ManageSmoothAndAutoInters( ICurveComposite* pCrv, ICurveComposite* pCrvPath, ICurveComposite* pPath1,
|
||||
ICurveComposite* pPath2, ICRVCOMPOPOVECTOR& vOffsCL) ;
|
||||
bool GetCurveWeightInfo( const ICurveComposite* pCrvCompo, double dMaxLen, double& dToTRot, int& nSmallArcs, int& nSmallLines) ;
|
||||
bool ChoosePath( const ICurveComposite* pCrv1, const ICurveComposite* pCrv2, int nP, double dPerP, double dMaxLen, int& nC) ;
|
||||
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const ICRVCOMPOPOVECTOR& vOffIslands,
|
||||
ICurveComposite* pCrvLink) ;
|
||||
bool CalcBoundedSmootedLink( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtEnd, const double dParMeet,
|
||||
const ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink) ;
|
||||
bool ModifyBiArc( ICurve* pCrvBiArc, double dCutToll, ICurveComposite* pNewCrv) ;
|
||||
bool CutCurveByOffsets( ICurveComposite* pCurve, ICRVCOMPOPOVECTOR& vOffs) ;
|
||||
bool 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 CutCurveToConnect( ICurveComposite* pCrvS, ICurveComposite* pCrvE, const ICRVCOMPOPOVECTOR& vOffs,
|
||||
const ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink,
|
||||
double dLenPercS = 0.01, double dLenPercE = 0.01, int nMaxIter = 2) ;
|
||||
bool CalcBoundedLinkWithBiArcs( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd,
|
||||
const ICurve* pCrvBound, ICurveComposite* pCrvLink) ;
|
||||
bool CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double dOutRad, double dIntRad,
|
||||
bool bSplitArcs, ICurveComposite* pMCrv, ICurveComposite* pRCrv) ;
|
||||
bool CalcTrapezoidSpiral( ICurveComposite* pCrvPocket, const Vector3d& vtDir, double dPocketSize,
|
||||
ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool& bOptimizedTrap) ;
|
||||
bool CalcTrapezoidSpiral( ICurveComposite* pCrvPocket, const Frame3d& frTrap, double dPocketSize, int nBase,
|
||||
int nSecondBase, ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool& bOptimizedTrap) ;
|
||||
bool CalcSingleOffsetSpiral( const ISurfFlatRegion* pSfr, ICurveComposite* pOffs,
|
||||
Point3d& ptStart, Vector3d& vtMidOut, bool& bMidOut) ;
|
||||
bool CalcTrapezoidSpiralLocalFrame( ICurveComposite * pCrvPocket, const Vector3d& vtDir, Frame3d& frLoc) ;
|
||||
bool CalcTrapezoidSpiralXCoord( const ICurveComposite * pCrvPocket, bool bStart, double dYCoord, double& dXCoord, double dPocketSize) ;
|
||||
bool AdjustTrapezoidSpiralForAngles( ICurveComposite * pMCrv, const ICurveComposite * pCrvPocket, bool bStart) ;
|
||||
bool SpecialAdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, const ICurveComposite* pCrvPocket) ;
|
||||
bool CalcTrapezoidSpiralXCoord( const ICurveComposite * pCrvPocket, int nBase,int nSecondBase,
|
||||
bool bStart, double dYCoord, double& dXCoord, double dPocketSize) ;
|
||||
bool AdjustTrapezoidSpiralForAngles( ICurveComposite * pMCrv, const ICurveComposite * pCrvPocket,
|
||||
bool bStart) ;
|
||||
bool SpecialAdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, const bool bEven, const ICurveComposite* pCrvPocket) ;
|
||||
bool AdjustTrapezoidSpiralForLeadInLeadOut( ICurveComposite * pCompo, ICurveComposite * pRCrv, const Vector3d& vtTool,
|
||||
double dDepth, int& nOutsideRaw) ;
|
||||
bool ComputeTrapezoidSpiralLeadInLeadOut( ICurveComposite * pCompo, const Vector3d& vtMainDir, bool bLeadIn, const Vector3d& vtTool, double dDepth,
|
||||
bool& bIsOutsideRaw) ;
|
||||
// ==================
|
||||
|
||||
bool GetSignedDistFromRealDirection( const Point3d ptP, const Vector3d vtDir, double& dDist, Vector3d& vtNorm) ;
|
||||
double GetMinFeed( void ) const { return GetFeed() * GetSideStep() / m_TParams.m_dDiam ; }
|
||||
double GetMaxFeed( void ) const { return GetFeed() ; }
|
||||
bool GetFeedForParam( double& dPar, double& dFeed) ;
|
||||
bool AssignDefaultFeed( ICurveComposite* pCrv) ;
|
||||
bool DrawColoredCrvForFeedTest( ICurve* pCurve, double dFeed) ;
|
||||
bool AssignFeedForOpenEdge( ICurveComposite* pCrv, const ICurveComposite* pCrvOF_ori) ;
|
||||
bool AssignFeedForLineInOut( ICurveComposite* pCrv, const bool bIsIn) ;
|
||||
bool AssignFeedOnCorners( ICurveComposite* pCrv, const ICurveComposite* pCrv_orig, const double dLenToll) ;
|
||||
bool AssignFeedForEdgeCleaning( ICurveComposite *pCrv, const ICRVCOMPOPOVECTOR& vCrvOF_orig, int nInd = -1) ;
|
||||
bool AssignFeedZigZagOneWay( ICurveComposite* pCompoLine, const bool bIsLink, const ICURVEPOVECTOR& vLAbove,
|
||||
const ICURVEPOVECTOR& vLUnder, const ICRVCOMPOPOVECTOR& vAddedLinks) ;
|
||||
bool AssignFeedSpiral( ICurveComposite* pCrv, const ISurfFlatRegion* pSrfRemoved_offs, const bool bIsLink,
|
||||
const ICRVCOMPOPOVECTOR& vLinks_done, const ICurveComposite* pCrv_orig, double dToll) ;
|
||||
bool AssignFeedSpiralOpt( const int nOptType, ICurveComposite* pCrv) ;
|
||||
bool AssignFeedCrvOnUnclearedRegions( ICurveComposite* pCrv) ;
|
||||
bool AssignFeedForReturnPath( ICurveComposite* pCrv) ;
|
||||
bool VerifyLeadInHelix( ISurfFlatRegion* pSrfChunk, const Point3d& ptCen, double dRad) const ;
|
||||
bool VerifyLeadInZigZag( ISurfFlatRegion* pSrfChunk, const Point3d& ptPa, const Point3d& ptPb) const ;
|
||||
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;
|
||||
bool AddEpicycles( ICurveComposite * pCompo, ICurveComposite * pCrv, ICurveComposite * pCrvBound = nullptr) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
@@ -155,18 +294,23 @@ class Pocketing : public Machining
|
||||
double dElev, double dAppr) ;
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
const ICurveComposite* pRCrv, Point3d& ptP1) const ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
ISurfFlatRegion* pSrfChunk, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
|
||||
bool AddLeadIn( const ICurveComposite* pCrvCompo, const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
|
||||
const Vector3d& vtEnd, const Vector3d& vtN, ISurfFlatRegion* pSrfChunk,
|
||||
const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
|
||||
bool bNoneForced = false, bool bSkipControl = false) ;
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, Point3d& ptP1, double& dElev, bool bNoneForced = false) ;
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1,
|
||||
double& dElev, bool bRecalcElev = true) ;
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced,
|
||||
Point3d& ptP1, double& dElev, bool& bOppositeHome, bool bRecalcElev = true) ;
|
||||
bool SetLeadInPointStart( const Point3d& ptCurr, const Vector3d vtN,
|
||||
const bool& bAtLeft, Vector3d& vtStart, Point3d& ptDest) ;
|
||||
bool CalcLinkOnStep( const Point3d& ptS, const Point3d& ptE, const ISurfFlatRegion* pSfr,
|
||||
const ISurfFlatRegion* pSfrLimit, ICurveComposite* pCrvStepLink) ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ;
|
||||
bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ;
|
||||
bool AdjustContourStart( ICurveComposite* pCompo) ;
|
||||
bool VerifyLeadInHelix( ISurfFlatRegion* pSrfChunk, const Point3d& ptCen, double dRad) const ;
|
||||
bool VerifyLeadInZigZag( ISurfFlatRegion* pSrfChunk, const Point3d& ptPa, const Point3d& ptPb) const ;
|
||||
bool CalcDistanceFromRawSurface( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist, Vector3d& vtNorm) ;
|
||||
|
||||
// ===================================================================
|
||||
|
||||
private :
|
||||
double GetSpeed( void) const
|
||||
@@ -191,7 +335,7 @@ class Pocketing : public Machining
|
||||
if ( m_Params.m_nLeadInType != POCKET_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL)
|
||||
return POCKET_LI_NONE ;
|
||||
return m_Params.m_nLeadInType ; }
|
||||
int LeadInIsOk( void) const
|
||||
bool LeadInRawIsOk( void) const
|
||||
{ if ( m_TParams.m_nType != TT_MILL_NOTIP)
|
||||
return true ;
|
||||
return (( GetLeadInType() == POCKET_LI_ZIGZAG || GetLeadInType() == POCKET_LI_HELIX) &&
|
||||
@@ -202,20 +346,31 @@ class Pocketing : public Machining
|
||||
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
|
||||
bool m_bAboveHead ; // flag utilizzo testa da sopra
|
||||
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
|
||||
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
|
||||
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
|
||||
bool m_bOpenOutRaw ; // flag forzatura lati aperti sempre fuori dal grezzo
|
||||
POLYLINEVECTOR m_VplIsland ; // vettore che contiene le curve che descrivono le isole
|
||||
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_bOptOffset ; // flag per ottimizzazione numero di Offset necessari
|
||||
bool m_bOptOffsetCM ; // flag per ottimizzazione numero di Offset necessari con centroidi e medial Axis
|
||||
bool m_bAssignFeed ; // flag per controllo della Feed
|
||||
double m_dDiam_Prec ; // diametro utensile per precedente svuotatura
|
||||
double m_dOffsetR_Prec ; // offset radiale della svuotatura precedente
|
||||
double m_dSideStep_Prec ; // side Step della svuotatura precedente
|
||||
double m_dLen_Prec ; // Lunghezza del tool precedente
|
||||
bool m_bOrderStepZ ; // parametro per ordinare gli step Extra per Z decrescente o meno
|
||||
bool m_bPocketPlane ; // flag per svuotare solo la rimanenza sullo Step Extra
|
||||
double m_dOpenEdgeRad ; // raggio di rientro per i lati aperti
|
||||
} ;
|
||||
+6
-2
@@ -83,6 +83,10 @@ struct PocketingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const PocketingData* GetPocketingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const PocketingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_POCKETING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const PocketingData*>( pMdata)) ; }
|
||||
inline PocketingData* GetPocketingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<PocketingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_POCKETING)
|
||||
return nullptr ;
|
||||
return ( static_cast<PocketingData*>( pMdata)) ; }
|
||||
|
||||
+15
-4
@@ -84,6 +84,9 @@ Processor::Run( const string& sOutFile, const string& sInfo)
|
||||
if ( ! VerifySetup())
|
||||
return false ;
|
||||
|
||||
// imposto la fase iniziale come corrente
|
||||
m_pMchMgr->SetCurrPhase( 1) ;
|
||||
|
||||
// evento inizio esecuzione
|
||||
bool bOk = true ;
|
||||
if ( ! OnStart()) {
|
||||
@@ -145,6 +148,9 @@ Processor::Run( const string& sOutFile, const string& sInfo)
|
||||
LOG_ERROR( GetEMkLogger(), "OnEnd error") ;
|
||||
}
|
||||
|
||||
// imposto la fase iniziale come corrente
|
||||
m_pMchMgr->SetCurrPhase( 1) ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -184,8 +190,8 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
|
||||
bool bEmpty = pDisp->IsEmpty() ;
|
||||
bool bSomeByHand = pDisp->GetSomeByHand() ;
|
||||
|
||||
// Se disposizione con movimenti macchina
|
||||
if ( ! pDisp->IsEmpty()) {
|
||||
// Se disposizione con movimenti autonomi e utensile associato
|
||||
if ( ! pDisp->IsEmpty() && pDisp->IsWithTool()) {
|
||||
// Recupero l'utensile della disposizione corrente
|
||||
string sTool ; string sHead ; int nExit ; string sTcPos ;
|
||||
if ( ! pDisp->GetToolData( sTool, sHead, nExit, sTcPos))
|
||||
@@ -603,6 +609,7 @@ Processor::ProcessToolData( void)
|
||||
string sHead ;
|
||||
int nExit ;
|
||||
string sTcPos ;
|
||||
int nType ;
|
||||
int nComp ;
|
||||
double dDiam ;
|
||||
double dTDiam ;
|
||||
@@ -611,7 +618,7 @@ Processor::ProcessToolData( void)
|
||||
double dDist ;
|
||||
double dMaxSpeed ;
|
||||
MyToolData( void)
|
||||
: sName(), sHead(), nExit( 0), sTcPos(), nComp(0), dDiam( 0), dLen( 0), dDist( 0), dMaxSpeed( 0) {}
|
||||
: sName(), sHead(), nExit( 0), sTcPos(), nType(0), nComp(0), dDiam( 0), dLen( 0), dDist( 0), dMaxSpeed( 0) {}
|
||||
} ;
|
||||
typedef vector<MyToolData> TDATAVECTOR ;
|
||||
TDATAVECTOR vTdata ;
|
||||
@@ -636,6 +643,7 @@ Processor::ProcessToolData( void)
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_HEAD, Tdata.sHead) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, Tdata.nExit) ;
|
||||
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_DIAM, Tdata.dDiam) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, Tdata.dTDiam) ;
|
||||
@@ -674,7 +682,8 @@ Processor::ProcessToolData( void)
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, nExit) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos) ;
|
||||
if ( m_pMchMgr->TdbSetCurrTool( sTool)) {
|
||||
int nComp ; double dDiam ; double dTDiam ; double dLen ; double dTLen ; double dDist ; double dMaxSpeed ;
|
||||
int nType ; 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_DIAM, dDiam) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, dTDiam) ;
|
||||
@@ -682,6 +691,7 @@ Processor::ProcessToolData( void)
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTLEN, dTLen) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_DIST, dDist) ;
|
||||
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_TDIAM, dDiam) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTDIAM, dTDiam) ;
|
||||
@@ -721,6 +731,7 @@ Processor::ProcessToolData( void)
|
||||
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_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_TDIAM, vTdata[i].dDiam) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTDIAM, vTdata[i].dTDiam) ;
|
||||
|
||||
+47
-10
@@ -607,6 +607,9 @@ SawFinishing::Update( bool bPostApply)
|
||||
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
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
|
||||
|
||||
@@ -795,11 +798,31 @@ SawFinishing::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in SawFinishing : tool name changed (" +
|
||||
@@ -959,15 +982,15 @@ SawFinishing::AdjustGeometry( int nAuxId)
|
||||
if ( ! pGuide->IsFlat( plPlane, false, 10 * EPS_SMALL) || ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX))
|
||||
return false ;
|
||||
// verifiche sulla curva (che trasformo in composita)
|
||||
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pGuide)))
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pGuide))))
|
||||
return false ;
|
||||
// converto in archi e rette
|
||||
pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ;
|
||||
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
|
||||
VerifyArcs( pCompo) ;
|
||||
// reinserisco nella curva originale
|
||||
pGuide.Set( Release( pCompo)) ;
|
||||
pGuide.Set( pCompo) ;
|
||||
}
|
||||
// deve iniziare in comune con la prima sezione ed essere ivi perpendicolare
|
||||
Vector3d vtGdDir ;
|
||||
@@ -1564,6 +1587,18 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
|
||||
// La porto in globale
|
||||
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+
|
||||
Vector3d vtTool = Z_AX ;
|
||||
|
||||
@@ -1845,6 +1880,7 @@ SawFinishing::ClassifySection( ICurve* pCrv, INTVECTOR& vnClass)
|
||||
{
|
||||
const ICurveComposite* pCompo = GetCurveComposite( pCrv) ;
|
||||
if ( pCompo != nullptr) {
|
||||
int Ind = 0 ;
|
||||
const ICurve* pSimpCrv = pCompo->GetFirstCurve() ;
|
||||
while ( pSimpCrv != nullptr) {
|
||||
// analizzo la curva
|
||||
@@ -1862,6 +1898,7 @@ SawFinishing::ClassifySection( ICurve* pCrv, INTVECTOR& vnClass)
|
||||
else
|
||||
vnClass.push_back( CCL_FALL) ;
|
||||
// passo alla curva successiva
|
||||
++ Ind ;
|
||||
pSimpCrv = pCompo->GetNextCurve() ;
|
||||
}
|
||||
}
|
||||
@@ -2366,8 +2403,8 @@ SawFinishing::CalcCurvedAlongVerticalCuts( ICurve* pSect, int nUmin, int nUmax,
|
||||
Vector3d vtMove = ( dY - m_TParams.m_dThick / 2) * Z_AX ;
|
||||
OffsetCurve OffsCrv ;
|
||||
OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ;
|
||||
PtrOwner<ICurveComposite> pCut( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve()))
|
||||
PtrOwner<ICurveComposite> pCut ;
|
||||
if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve())))
|
||||
return false ;
|
||||
VerifyArcs( pCut) ;
|
||||
pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ;
|
||||
@@ -2441,8 +2478,8 @@ SawFinishing::CalcCurvedAlongStdCuts( ICurve* pSect, double dUmin, double dUmax,
|
||||
Vector3d vtMove = ( ptP.y - m_TParams.m_dThick / 2) * Z_AX ;
|
||||
OffsetCurve OffsCrv ;
|
||||
OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ;
|
||||
PtrOwner<ICurveComposite> pCut( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve()))
|
||||
PtrOwner<ICurveComposite> pCut ;
|
||||
if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve())))
|
||||
return false ;
|
||||
VerifyArcs( pCut) ;
|
||||
pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ;
|
||||
|
||||
+6
-2
@@ -81,6 +81,10 @@ struct SawFinishingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const SawFinishingData* GetSawFinishingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const SawFinishingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWFINISHING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const SawFinishingData*>( pMdata)) ; }
|
||||
inline SawFinishingData* GetSawFinishingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<SawFinishingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWFINISHING)
|
||||
return nullptr ;
|
||||
return ( static_cast<SawFinishingData*>( pMdata)) ; }
|
||||
|
||||
+31
-8
@@ -571,6 +571,9 @@ SawRoughing::Update( bool bPostApply)
|
||||
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
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
|
||||
|
||||
@@ -753,11 +756,31 @@ SawRoughing::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in SawRoughing : tool name changed (" +
|
||||
@@ -917,15 +940,15 @@ SawRoughing::AdjustGeometry( int nAuxId)
|
||||
if ( ! pGuide->IsFlat( plPlane, false, 10 * EPS_SMALL) || ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX))
|
||||
return false ;
|
||||
// verifiche sulla curva (che trasformo in composita)
|
||||
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pGuide)))
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pGuide))))
|
||||
return false ;
|
||||
// converto in archi e rette
|
||||
pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ;
|
||||
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
|
||||
VerifyArcs( pCompo) ;
|
||||
// reinserisco nella curva originale
|
||||
pGuide.Set( Release( pCompo)) ;
|
||||
pGuide.Set( pCompo) ;
|
||||
}
|
||||
// deve iniziare in comune con la prima sezione ed essere ivi perpendicolare
|
||||
Vector3d vtGdDir ;
|
||||
@@ -1307,8 +1330,8 @@ SawRoughing::CalculateCurvedToolPath( int nAuxId, int nClId)
|
||||
// creo la curva di taglio
|
||||
OffsetCurve OffsCrv ;
|
||||
OffsCrv.Make( pGuide, dX, ICurve::OFF_FILLET) ;
|
||||
PtrOwner<ICurveComposite> pCut( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve()))
|
||||
PtrOwner<ICurveComposite> pCut ;
|
||||
if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve())))
|
||||
return false ;
|
||||
VerifyArcs( pCut) ;
|
||||
Vector3d vtMove = ( dY - m_TParams.m_dThick / 2) * Z_AX ;
|
||||
|
||||
+6
-2
@@ -78,6 +78,10 @@ struct SawRoughingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const SawRoughingData* GetSawRoughingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const SawRoughingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWROUGHING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const SawRoughingData*>( pMdata)) ; }
|
||||
inline SawRoughingData* GetSawRoughingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<SawRoughingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWROUGHING)
|
||||
return nullptr ;
|
||||
return ( static_cast<SawRoughingData*>( pMdata)) ; }
|
||||
|
||||
+56
-22
@@ -742,6 +742,9 @@ Sawing::Update( bool bPostApply)
|
||||
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
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
|
||||
|
||||
@@ -1025,11 +1028,31 @@ Sawing::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in Sawing : tool name changed (" +
|
||||
@@ -1256,8 +1279,8 @@ Sawing::GetCurve( SelData Id)
|
||||
// recupero l'indice del chunk
|
||||
int nChunk = ( ( Id.nSub == SEL_SUB_ALL) ? 0 : Id.nSub) ;
|
||||
// recupero il contorno esterno del chunk
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nChunk, 0)))
|
||||
PtrOwner<ICurveComposite> pCrvCompo ;
|
||||
if ( ! pCrvCompo.Set( ConvertCurveToComposite( pReg->GetLoop( nChunk, 0))))
|
||||
return nullptr ;
|
||||
// recupero la normale della regione
|
||||
Vector3d vtN = pReg->GetNormVersor() ;
|
||||
@@ -1478,7 +1501,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
ICurveComposite* pCompo = GetCurveComposite( m_pGeomDB->GetGeoObj( nCopyId)) ;
|
||||
|
||||
// unisco le parti allineate
|
||||
if ( ! pCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL))
|
||||
if ( ! pCompo->MergeCurves( 100 * EPS_SMALL, 100 * EPS_ANG_SMALL))
|
||||
return false ;
|
||||
|
||||
// eventuale inversione percorso
|
||||
@@ -1831,10 +1854,10 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
|
||||
// Eventuale variazioni di velocità all'inizio e alla fine del percorso
|
||||
FseVar FvVar ;
|
||||
if ( pCrvP == nullptr) {
|
||||
string sFsta = ExtractInfo( m_Params.m_sUserNotes, "Fsta:") ;
|
||||
string sFsta = ExtractInfo( m_Params.m_sUserNotes, "Fsta=") ;
|
||||
if ( ! sFsta.empty()) {
|
||||
string sLen, sPu ;
|
||||
SplitFirst( sFsta, "=", sLen, sPu) ;
|
||||
SplitFirst( sFsta, ",", sLen, sPu) ;
|
||||
FromString( sLen, FvVar.dLenStart) ;
|
||||
FvVar.dLenStart = max( FvVar.dLenStart, 0.) ;
|
||||
FromString( sPu, FvVar.dPuStart) ;
|
||||
@@ -1842,10 +1865,10 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
|
||||
}
|
||||
}
|
||||
if ( pCrvN == nullptr) {
|
||||
string sFend = ExtractInfo( m_Params.m_sUserNotes, "Fend:") ;
|
||||
string sFend = ExtractInfo( m_Params.m_sUserNotes, "Fend=") ;
|
||||
if ( ! sFend.empty()) {
|
||||
string sLen, sPu ;
|
||||
SplitFirst( sFend, "=", sLen, sPu) ;
|
||||
SplitFirst( sFend, ",", sLen, sPu) ;
|
||||
FromString( sLen, FvVar.dLenEnd) ;
|
||||
FvVar.dLenEnd = max( FvVar.dLenEnd, 0.) ;
|
||||
FromString( sPu, FvVar.dPuEnd) ;
|
||||
@@ -3812,29 +3835,40 @@ bool
|
||||
Sawing::CalculateToolAndCorrVersors( const Vector3d& vtTang, int nHeadSide, int nWorkSide, double dSideAng,
|
||||
Vector3d& vtTool, Vector3d& vtCorr)
|
||||
{
|
||||
// Versore fresa : annullo la componente in Z e normalizzo
|
||||
vtTool = vtTang ;
|
||||
vtTool.z = 0 ;
|
||||
if ( ! vtTool.Normalize())
|
||||
// Direzione tangente nel piano XY
|
||||
Vector3d vtXYTg = vtTang ;
|
||||
vtXYTg.z = 0 ;
|
||||
double dLenXYTg = vtXYTg.Len() ;
|
||||
if ( dLenXYTg < EPS_SMALL)
|
||||
return false ;
|
||||
// ruoto attorno a Zglob+ a seconda del lato mandrino
|
||||
vtXYTg /= dLenXYTg ;
|
||||
// se direzione tangente inclinata in Z e SideAng non nullo devo calcolare la vera tangente nel piano XY
|
||||
if ( abs( vtTang.z) > EPS_SMALL && abs( dSideAng) > EPS_ANG_SMALL) {
|
||||
double dSinDelta = vtTang.z * tan( dSideAng * DEGTORAD) / dLenXYTg ;
|
||||
double dCosDelta = sqrt( 1 - dSinDelta * dSinDelta) ;
|
||||
if ( nHeadSide == SAW_HS_LEFT)
|
||||
vtXYTg.Rotate( Z_AX, dCosDelta, dSinDelta) ;
|
||||
else
|
||||
vtXYTg.Rotate( Z_AX, dCosDelta, -dSinDelta) ;
|
||||
}
|
||||
|
||||
// Versore fresa : ruoto direzione nel piano XY attorno a Zglob+ a seconda del lato mandrino
|
||||
vtTool = vtXYTg ;
|
||||
if ( nHeadSide == SAW_HS_LEFT)
|
||||
vtTool.Rotate( Z_AX, 0, 1) ;
|
||||
else
|
||||
vtTool.Rotate( Z_AX, 0, -1) ;
|
||||
|
||||
// Versore correzione
|
||||
// Versore correzione : se lama sbandata devo aggiustare
|
||||
vtCorr = Z_AX ;
|
||||
|
||||
// Se lama sbandata
|
||||
if ( abs( dSideAng) > EPS_ANG_SMALL) {
|
||||
if ( nWorkSide == SAW_WS_RIGHT) {
|
||||
vtTool.Rotate( vtTang, - dSideAng) ;
|
||||
vtCorr.Rotate( vtTang, - dSideAng) ;
|
||||
vtTool.Rotate( vtXYTg, - dSideAng) ;
|
||||
vtCorr.Rotate( vtXYTg, - dSideAng) ;
|
||||
}
|
||||
else {
|
||||
vtTool.Rotate( vtTang, dSideAng) ;
|
||||
vtCorr.Rotate( vtTang, dSideAng) ;
|
||||
vtTool.Rotate( vtXYTg, dSideAng) ;
|
||||
vtCorr.Rotate( vtXYTg, dSideAng) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -99,6 +99,10 @@ struct SawingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const SawingData* GetSawingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const SawingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const SawingData*>( pMdata)) ; }
|
||||
inline SawingData* GetSawingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<SawingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWING)
|
||||
return nullptr ;
|
||||
return ( static_cast<SawingData*>( pMdata)) ; }
|
||||
|
||||
+21
-5
@@ -271,14 +271,20 @@ SetupMgr::GetPosData( int nPos, string& sTcPos, string& sHead, int& nExit, strin
|
||||
bool
|
||||
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
|
||||
if ( IsEmptyOrSpaces( sName))
|
||||
return false ;
|
||||
// cerco l'utensile
|
||||
int nI = - 1 ;
|
||||
for ( size_t i = 0 ; i < m_vStuData.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < int( m_vStuData.size()) ; ++ i) {
|
||||
if ( m_vStuData[i].m_nExit > 0 && EqualNoCase( sName, m_vStuData[i].m_sName)) {
|
||||
nI = int( i) ;
|
||||
nI = i ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@@ -312,11 +318,21 @@ SetupMgr::GetToolName( const string& sHead, int nExit, string& sName) const
|
||||
bool
|
||||
SetupMgr::GetToolsInSetupPos( const string& sTcPos, STRVECTOR& vsTools) const
|
||||
{
|
||||
// default vettore vuoto
|
||||
vsTools.clear() ;
|
||||
// eseguo ricerca
|
||||
// verifico macchina
|
||||
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) {
|
||||
if ( EqualNoCase( sTcPos, m_vStuData[i].m_sTcPos)) {
|
||||
vsTools.emplace_back( m_vStuData[i].m_sName) ;
|
||||
if ( ! IsEmptyOrSpaces( m_vStuData[i].m_sHead) && EqualNoCase( sTcPos, m_vStuData[i].m_sTcPos)) {
|
||||
if ( vsTools.empty()) {
|
||||
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 ;
|
||||
|
||||
+226
-81
@@ -25,9 +25,11 @@
|
||||
#include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkCDeSpheClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkCDeConeFrustumClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkCDeClosedSurfTmClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkVolZmap.h"
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkSurfLocal.h"
|
||||
#include "/EgtDev/Include/EXeCmdLogOff.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EMkToolConst.h"
|
||||
@@ -45,10 +47,12 @@ static const double MIN_STEP = 1.0 ;
|
||||
static const double MAX_STEP = 100.0 ;
|
||||
static const double MID_STEP = 50.0 ;
|
||||
static const double COLL_STEP = 10. ;
|
||||
static const double SQ_COEFF_ROT_MOVE = 100. ;
|
||||
static const double COEFF_LIM = 0.999 ;
|
||||
static const double SAFEDIST_STD = 5.0 ;
|
||||
static const int ERR_OUTSTROKE = 1 ;
|
||||
static const int ERR_COLLISION = 11 ;
|
||||
static const int ERR_TOOL_SEL = 21 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Simulator::Simulator( void)
|
||||
@@ -57,6 +61,7 @@ Simulator::Simulator( void)
|
||||
m_pGeomDB = nullptr ;
|
||||
m_pMachine = nullptr ;
|
||||
m_pPerfCnt = nullptr ;
|
||||
m_nStatus = SIS_CREATED ;
|
||||
m_dStep = MID_STEP ;
|
||||
m_nUiStatus = MCH_UISIM_NULL ;
|
||||
m_nOpId = GDB_ID_NULL ;
|
||||
@@ -72,6 +77,7 @@ Simulator::Simulator( void)
|
||||
m_nAuxEInd = 0 ;
|
||||
m_nExit = 0 ;
|
||||
m_dTDiam = 0 ;
|
||||
m_bCutOnTip = false ;
|
||||
m_dSafeDist = SAFEDIST_STD ;
|
||||
m_nAxesMask = 0 ;
|
||||
m_bEnabAxes = true ;
|
||||
@@ -87,6 +93,8 @@ Simulator::~Simulator( void)
|
||||
{
|
||||
// porto la macchina in posizione home
|
||||
GoHome() ;
|
||||
// gestione evento uscita dal simulatore
|
||||
OnExit() ;
|
||||
// rimuovo tavola variabili globali
|
||||
m_pMachine->LuaResetGlobVar( GLOB_VAR) ;
|
||||
// rimuovo performance counter
|
||||
@@ -108,6 +116,7 @@ Simulator::Init( MachMgr* pMchMgr)
|
||||
m_pGeomDB = m_pMchMgr->GetGeomDB() ;
|
||||
m_pMachine = m_pMchMgr->GetCurrMachine() ;
|
||||
m_pPerfCnt = new PerformanceCounter ;
|
||||
m_nStatus = SIS_INITIALIZED ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -122,21 +131,28 @@ Simulator::Start( bool bFirst)
|
||||
m_pMchMgr->ResetLastError() ;
|
||||
m_pMchMgr->ResetWarnings() ;
|
||||
|
||||
// Forzo aggiornamento attrezzaggio della macchinata
|
||||
bool bOk = m_pMchMgr->UpdateCurrSetup() ;
|
||||
bool bOk = true ;
|
||||
|
||||
// Se avvio vero, verifico attrezzaggio
|
||||
if ( bFirst && ! VerifySetup())
|
||||
bOk = false ;
|
||||
// Se appena entrati in simulazione
|
||||
if ( m_nStatus == SIS_INITIALIZED) {
|
||||
// Forzo aggiornamento attrezzaggio della macchinata
|
||||
if ( ! m_pMchMgr->UpdateCurrSetup())
|
||||
bOk = false ;
|
||||
// Verifico attrezzaggio
|
||||
if ( ! VerifySetup())
|
||||
bOk = false ;
|
||||
}
|
||||
|
||||
// Reset utensile, interpolazione e assi correnti
|
||||
m_sTool.clear() ;
|
||||
m_sHead.clear() ;
|
||||
m_nExit = 0 ;
|
||||
m_dTDiam = 0 ;
|
||||
m_bCutOnTip = false ;
|
||||
ResetInterpolation() ;
|
||||
ResetAxes() ;
|
||||
ResetAuxAxes() ;
|
||||
|
||||
// porto la macchina in home
|
||||
if ( ! GoHome())
|
||||
bOk = false ;
|
||||
@@ -155,19 +171,42 @@ Simulator::Start( bool bFirst)
|
||||
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_VER, GetEMkVer()) ;
|
||||
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MACHNAME, m_pMachine->GetMachineName()) ;
|
||||
|
||||
// Richiamo funzione su avvio simulazione
|
||||
if ( ! OnStart( bFirst))
|
||||
// Se appena entrati in simulazione
|
||||
if ( m_nStatus == SIS_INITIALIZED) {
|
||||
if ( ! OnInit())
|
||||
bOk = false ;
|
||||
m_nStatus = SIS_READYTOSTART ;
|
||||
}
|
||||
|
||||
// Richiamo funzione per evento avvio simulazione
|
||||
if ( ! OnProgramStart( bFirst))
|
||||
bOk = false ;
|
||||
|
||||
// Arrivo alla preparazione per la prima lavorazione
|
||||
int nStatus ;
|
||||
if ( ! FindAndManageOperationStart( true, bFirst, nStatus) && nStatus != MCH_SIM_STOP)
|
||||
bOk = false ;
|
||||
// se sono ancora su disposizione
|
||||
if ( m_pMchMgr->GetOperationType( m_nOpId) == OPER_DISP) {
|
||||
// ricerca e gestione inizio percorso di lavoro
|
||||
if ( ! FindAndManagePathStart( nStatus))
|
||||
return false ;
|
||||
// eventuali comandi ausiliari di inizio percorso
|
||||
while ( m_nAuxSInd < m_nAuxSTot) {
|
||||
if ( ! ManagePathStartAux( nStatus))
|
||||
return false ;
|
||||
}
|
||||
// aggiornamento assi per eventuali teste caricate
|
||||
UpdateAxes() ;
|
||||
}
|
||||
|
||||
// Reset timer
|
||||
if ( m_pPerfCnt != nullptr)
|
||||
m_pPerfCnt->Start() ;
|
||||
|
||||
// Imposto lo stato interno
|
||||
m_nStatus = ( bOk ? SIS_READYTORUN : SIS_READYTOSTART) ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -223,7 +262,7 @@ bool
|
||||
Simulator::Move( int& nStatus)
|
||||
{
|
||||
// Verifiche
|
||||
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr || m_pMachine == nullptr) {
|
||||
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr || m_pMachine == nullptr || m_nStatus != SIS_READYTORUN) {
|
||||
nStatus = MCH_SIM_ERR ;
|
||||
return false ;
|
||||
}
|
||||
@@ -267,7 +306,7 @@ Simulator::Move( int& nStatus)
|
||||
return false ;
|
||||
// se non ce ne sono altre, sono alla fine
|
||||
if ( m_nOpId == GDB_ID_NULL) {
|
||||
OnEnd() ;
|
||||
OnProgramEnd() ;
|
||||
nStatus = MCH_SIM_END ;
|
||||
return false ;
|
||||
}
|
||||
@@ -470,6 +509,9 @@ Simulator::UpdateTool( bool bFirst, int& nErr)
|
||||
m_sHead = sHead ;
|
||||
m_nExit = nExit ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, m_dTDiam) ;
|
||||
double dTipFeed = 0 ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TIPFEED, dTipFeed) ;
|
||||
m_bCutOnTip = ( dTipFeed > EPS_MACH_LEN_PAR) ;
|
||||
// ripristino la lavorazione corrente
|
||||
m_pMchMgr->SetCurrMachining( nCurrMchId) ;
|
||||
// aggiorno gli assi macchina
|
||||
@@ -509,6 +551,9 @@ Simulator::UpdateTool( bool bFirst, int& nErr)
|
||||
m_sHead = sHead ;
|
||||
m_nExit = nExit ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, m_dTDiam) ;
|
||||
double dTipFeed = 0 ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TIPFEED, dTipFeed) ;
|
||||
m_bCutOnTip = ( dTipFeed > EPS_MACH_LEN_PAR) ;
|
||||
// aggiorno gli assi macchina
|
||||
if ( ! UpdateAxes())
|
||||
return false ;
|
||||
@@ -537,7 +582,7 @@ Simulator::UpdateAxes( void)
|
||||
if ( ! pMachine->GetAllCurrAxesName( m_AxesName) ||
|
||||
! pMachine->GetAllCurrAxesToken( m_AxesToken))
|
||||
return false ;
|
||||
// Aggiorno flag invertito, il tipo e la posizione corrente degli assi macchina attivi
|
||||
// Aggiorno flag di invertito, offset, tipo e posizione corrente degli assi macchina attivi
|
||||
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
|
||||
bool bInvert ;
|
||||
m_pMachine->GetAxisInvert( m_AxesName[i], bInvert) ;
|
||||
@@ -679,11 +724,13 @@ Simulator::FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus)
|
||||
}
|
||||
// cambio fase
|
||||
m_pMchMgr->SetCurrPhase( nPhase, ( nPhase == 1)) ;
|
||||
// aggiorno utensile e assi conseguenti
|
||||
int nErr ;
|
||||
if ( ! UpdateTool( bFirst, nErr)) {
|
||||
nStatus = CalcStatusOnError( nErr) ;
|
||||
return false ;
|
||||
// se previsto, aggiorno utensile e assi conseguenti
|
||||
if ( pDisp->IsWithTool()) {
|
||||
int nErr ;
|
||||
if ( ! UpdateTool( bFirst, nErr)) {
|
||||
nStatus = CalcStatusOnError( nErr) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
++ m_nOpInd ;
|
||||
// richiamo gestione evento inizio disposizione
|
||||
@@ -813,8 +860,9 @@ Simulator::FindAndManagePathStart( int& nStatus)
|
||||
}
|
||||
// se altrimenti trovato nuovo CL path vuoto
|
||||
else if ( m_nCLPathId != GDB_ID_NULL) {
|
||||
// non ci possono essere eventi ausiliari di inizio
|
||||
m_nAuxSTot = 0 ;
|
||||
// recupero il numero di eventi ausiliari di inizio
|
||||
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, KEY_AS_TOT, m_nAuxSTot))
|
||||
m_nAuxSTot = 0 ;
|
||||
m_nAuxSInd = 0 ;
|
||||
// recupero il numero di eventi ausiliari di fine
|
||||
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, KEY_AE_TOT, m_nAuxETot))
|
||||
@@ -978,12 +1026,22 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
|
||||
// Calcolo distanza di movimento
|
||||
double dSqDist = 0 ;
|
||||
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
|
||||
// coefficiente moltiplicativo per differenziare assi lineari (primi 3) e rotanti (altri)
|
||||
double dSqCoeff = (( i < 3) ? 1 : 100) ;
|
||||
// coefficiente moltiplicativo per differenziare assi lineari e rotanti
|
||||
double dSqCoeff = ( m_AxesLinear[i] ? 1 : SQ_COEFF_ROT_MOVE) ;
|
||||
dSqDist += dSqCoeff * ( AxesEnd[i] - m_AxesVal[i]) * ( AxesEnd[i] - m_AxesVal[i]) ;
|
||||
}
|
||||
// Calcolo distanza di movimento eventuali assi ausiliari
|
||||
double dSqDistAux = 0 ;
|
||||
for ( int i = 0 ; i < int( m_AuxAxesName.size()) ; ++ i) {
|
||||
if ( m_AuxAxesLink[i] != 0)
|
||||
continue ;
|
||||
// coefficiente moltiplicativo per differenziare assi lineari e rotanti
|
||||
double dSqCoeff = ( m_AuxAxesLinear[i] ? 1 : SQ_COEFF_ROT_MOVE) ;
|
||||
dSqDistAux += dSqCoeff * ( m_AuxAxesEnd[i] - m_AuxAxesVal[i]) * ( m_AuxAxesEnd[i] - m_AuxAxesVal[i]) ;
|
||||
}
|
||||
// Considero il massimo delle due distanze
|
||||
double dPrevCoeff = m_dCoeff ;
|
||||
double dDist = sqrt( dSqDist) ;
|
||||
double dDist = sqrt( max( dSqDist, dSqDistAux)) ;
|
||||
if ( dDist > EPS_SMALL) {
|
||||
double dStep = min( ( nMoveType == 0 ? 2 : 1) * m_dStep, MAX_STEP) ;
|
||||
int nStep = max( int( dDist / dStep), 1) ;
|
||||
@@ -1006,6 +1064,12 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
|
||||
for ( int i = 0 ; i < int( m_VmId.size()) ; ++ i)
|
||||
bOkI = m_pGeomDB->GetGlobFrame( m_VmId[i], vFrVzmI[i]) && bOkI ;
|
||||
|
||||
// Log per debug
|
||||
if ( ExeGetDebugLevel() >= 10) {
|
||||
string sOut = "MoveType=" + ToString( nMoveType) + " Coeff=" + ToString( m_dCoeff) ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
}
|
||||
|
||||
// Eseguo movimento rapido o lineare
|
||||
if ( nMoveType != 2 && nMoveType != 3) {
|
||||
// se attivo CollisionCheck approssimo movimento con più step
|
||||
@@ -1038,21 +1102,28 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
|
||||
}
|
||||
m_pMachine->SetAxisPos( m_AuxAxesName[j], dVal) ;
|
||||
}
|
||||
// eseguo eventuale collision check
|
||||
bCollCheck = bCollCheck && ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
|
||||
}
|
||||
// se non è rapido o non c'è verifica collisioni, eseguo eventuale Vmill
|
||||
if ( nMoveType != 0 || ! NeedCollisionCheck()) {
|
||||
for ( int i = 0 ; i < int( m_VmTool.size()) ; ++ i) {
|
||||
Point3d ptNoseF ; Vector3d vtDirF ; Vector3d vtAuxF ;
|
||||
bool bOkF = GetHeadCurrPosDirAux( m_VmTool[i].sHead, m_VmTool[i].nExit, ptNoseF, vtDirF, vtAuxF) ;
|
||||
for ( int j = 0 ; j < int( m_VmId.size()) ; ++ j) {
|
||||
Frame3d frVzmF ;
|
||||
bOkF = m_pGeomDB->GetGlobFrame( m_VmId[j], frVzmF) && bOkF ;
|
||||
ExecLineVmill( m_VmId[j], i, m_VmTool[i].dTdOffs, m_VmTool[i].dAdOffs,
|
||||
vPtNoseI[i], vVtDirI[i], vVtAuxI[i], vFrVzmI[j], ptNoseF, vtDirF, vtAuxF, frVzmF) ;
|
||||
// se non è rapido o non c'è verifica collisioni, eseguo eventuale Vmill
|
||||
if ( nMoveType != 0 || ! NeedCollisionCheck()) {
|
||||
for ( int j = 0 ; j < int( m_VmTool.size()) ; ++ j) {
|
||||
Point3d ptNoseF ; Vector3d vtDirF ; Vector3d vtAuxF ;
|
||||
bool bOkF = GetHeadCurrPosDirAux( m_VmTool[j].sHead, m_VmTool[j].nExit, ptNoseF, vtDirF, vtAuxF) ;
|
||||
for ( int k = 0 ; k < int( m_VmId.size()) ; ++ k) {
|
||||
Frame3d frVzmF ;
|
||||
bOkF = m_pGeomDB->GetGlobFrame( m_VmId[k], frVzmF) && bOkF ;
|
||||
ExecLineVmill( m_VmId[k], j, m_VmTool[j].dTdOffs, m_VmTool[j].dAdOffs,
|
||||
vPtNoseI[j], vVtDirI[j], vVtAuxI[j], vFrVzmI[k], ptNoseF, vtDirF, vtAuxF, frVzmF) ;
|
||||
// se ultimo utensile, salvo riferimento per prossimo inizio
|
||||
if ( j == int( m_VmTool.size()) - 1)
|
||||
vFrVzmI[k] = frVzmF ;
|
||||
}
|
||||
// aggiorno prossimo inizio
|
||||
vPtNoseI[j] = ptNoseF ;
|
||||
vVtDirI[j] = vtDirF ;
|
||||
vVtAuxI[j] = vtAuxF ;
|
||||
}
|
||||
}
|
||||
// eseguo eventuale collision check
|
||||
bCollCheck = bCollCheck && ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
|
||||
}
|
||||
}
|
||||
// Eseguo movimento su arco
|
||||
@@ -1147,7 +1218,7 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
|
||||
double dSqDist = 0 ;
|
||||
for ( int i = 0 ; i < int( m_AuxAxesName.size()) ; ++ i) {
|
||||
// coefficiente moltiplicativo per differenziare assi lineari e rotanti
|
||||
double dSqCoeff = ( m_AuxAxesLinear[i] ? 1 : 100) ;
|
||||
double dSqCoeff = ( m_AuxAxesLinear[i] ? 1 : SQ_COEFF_ROT_MOVE) ;
|
||||
dSqDist += dSqCoeff * ( m_AuxAxesEnd[i] - m_AuxAxesVal[i]) * ( m_AuxAxesEnd[i] - m_AuxAxesVal[i]) ;
|
||||
}
|
||||
double dPrevCoeff = m_dCoeff ;
|
||||
@@ -1265,8 +1336,11 @@ Simulator::ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVm
|
||||
{
|
||||
// Recupero Zmap
|
||||
IVolZmap* pVZM = GetVolZmap( m_pGeomDB->GetGeoObj( nVmId)) ;
|
||||
if ( pVZM == nullptr)
|
||||
if ( pVZM == nullptr) {
|
||||
string sOut = " --> GetVolZmap (" + ToString( nVmId) +") Error <--" ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
// Porto gli estremi nel riferimento opportuno dello Zmap
|
||||
Point3d ptHiL = ptHi ; ptHiL.ToLoc( frVzmI) ;
|
||||
Vector3d vtHiL = vtHi ; vtHiL.ToLoc( frVzmI) ;
|
||||
@@ -1279,13 +1353,35 @@ Simulator::ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVm
|
||||
ptHfL += dVmTdOffs * vtHfL + dVmAdOffs * vtAfL ;
|
||||
// Log per debug
|
||||
if ( ExeGetDebugLevel() >= 10) {
|
||||
string sOut = "Zmap=" + ToString( nVmId) + " CurrTool=" + ToString( nCurrTool) +
|
||||
"Pi=(" + ToString( ptHiL) + ") Vi=(" + ToString( vtHiL) + ") Ai=(" + ToString( vtAiL) +
|
||||
string sOut = "Zmap=" + ToString( nVmId) + " Tool=" + ToString( nCurrTool) +
|
||||
" Pi=(" + ToString( ptHiL) + ") Vi=(" + ToString( vtHiL) + ") Ai=(" + ToString( vtAiL) +
|
||||
") Pf=(" + ToString( ptHfL) + ") Vf=(" + ToString( vtHfL) + ") Af=(" + ToString( vtAfL) + ")" ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
}
|
||||
// Se utensile che non lavora di testa
|
||||
if ( ! m_bCutOnTip) {
|
||||
// se movimento di testa (angolo movimento verso la testa oltre 5.8deg), non eseguo asportazione
|
||||
Vector3d vtDirM = Media( vtHiL, vtHfL) ;
|
||||
vtDirM.Normalize() ;
|
||||
double dAxMove = ( ptHfL - ptHiL) * vtDirM ;
|
||||
if ( dAxMove < -EPS_SMALL) {
|
||||
double dMove = ( ptHfL - ptHiL).Len() ;
|
||||
if ( dAxMove < -0.1 * abs( dMove))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Eseguo
|
||||
return pVZM->MillingStep( nCurrTool, ptHiL, vtHiL, vtAiL, ptHfL, vtHfL, vtAfL) ;
|
||||
bool bOk = pVZM->MillingStep( nCurrTool, ptHiL, vtHiL, vtAiL, ptHfL, vtHfL, vtAfL) ;
|
||||
if ( ! bOk) {
|
||||
if ( ExeGetDebugLevel() < 10) {
|
||||
string sOut = "Zmap=" + ToString( nVmId) + " Tool=" + ToString( nCurrTool) +
|
||||
" Pi=(" + ToString( ptHiL) + ") Vi=(" + ToString( vtHiL) + ") Ai=(" + ToString( vtAiL) +
|
||||
") Pf=(" + ToString( ptHfL) + ") Vf=(" + ToString( vtHfL) + ") Af=(" + ToString( vtAfL) + ")" ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
}
|
||||
LOG_DBG_INFO( GetEMkLogger(), " --> MillingStep Error <--")
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1324,44 +1420,62 @@ Simulator::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
|
||||
// se utensile attivo su grezzo in lavoro e non è rapido, salto
|
||||
if ( bIsTool && bIsRaw && nMoveType != 0)
|
||||
continue ;
|
||||
// se riferimento non trovato, si salta
|
||||
const IGeoFrame3d* pGeoFrame = GetGeoFrame3d( m_pGeomDB->GetGeoObj( m_CollObj[j].nFrameId)) ;
|
||||
if ( pGeoFrame == nullptr)
|
||||
continue ;
|
||||
// esecuzione controlli di collisione
|
||||
bool bOk = true ;
|
||||
Frame3d frObj = pGeoFrame->GetFrame() ;
|
||||
if ( ! m_CollObj[j].vtMove.IsSmall())
|
||||
frObj.Translate( m_CollObj[j].vtMove.x * frObj.VersX() +
|
||||
m_CollObj[j].vtMove.y * frObj.VersY() +
|
||||
m_CollObj[j].vtMove.z * frObj.VersZ()) ;
|
||||
Frame3d frParent ; m_pGeomDB->GetGlobFrame( m_CollObj[j].nFrameId, frParent) ;
|
||||
frObj.LocToLoc( frParent, frCd) ;
|
||||
if ( m_CollObj[j].nType == MCH_SIM_COB_BOX) {
|
||||
Vector3d vtDiag( m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3) ;
|
||||
if ( pVZM != nullptr)
|
||||
bOk = pVZM->AvoidBox( frObj, vtDiag, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeBoxClosedSurfTm( frObj, vtDiag, m_dSafeDist, *pSTM) ;
|
||||
// oggetti che richiedono frame associato (Box, Cylinder, Sphere, Cone)
|
||||
if ( m_CollObj[j].nType != MCH_SIM_COB_POLY) {
|
||||
// se riferimento non trovato, si salta
|
||||
const IGeoFrame3d* pGeoFrame = GetGeoFrame3d( m_pGeomDB->GetGeoObj( m_CollObj[j].nFrameId)) ;
|
||||
if ( pGeoFrame == nullptr)
|
||||
continue ;
|
||||
Frame3d frObj = pGeoFrame->GetFrame() ;
|
||||
if ( ! m_CollObj[j].vtMove.IsSmall())
|
||||
frObj.Translate( m_CollObj[j].vtMove.x * frObj.VersX() +
|
||||
m_CollObj[j].vtMove.y * frObj.VersY() +
|
||||
m_CollObj[j].vtMove.z * frObj.VersZ()) ;
|
||||
Frame3d frParent ; m_pGeomDB->GetGlobFrame( m_CollObj[j].nFrameId, frParent) ;
|
||||
frObj.LocToLoc( frParent, frCd) ;
|
||||
// controlli di collisione
|
||||
if ( m_CollObj[j].nType == MCH_SIM_COB_BOX) {
|
||||
Vector3d vtDiag( m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3) ;
|
||||
if ( pVZM != nullptr)
|
||||
bOk = ! pVZM->CDeBox( frObj, vtDiag, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeBoxClosedSurfTm( frObj, vtDiag, *pSTM, m_dSafeDist) ;
|
||||
}
|
||||
else if ( m_CollObj[j].nType == MCH_SIM_COB_CYL) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = ! pVZM->CDeCylinder( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeCylClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, *pSTM, m_dSafeDist) ;
|
||||
}
|
||||
else if ( m_CollObj[j].nType == MCH_SIM_COB_SPHE) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = ! pVZM->CDeSphere( frObj.Orig(), m_CollObj[j].dPar1, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeSpheClosedSurfTm( frObj.Orig(), m_CollObj[j].dPar1, *pSTM, m_dSafeDist) ;
|
||||
}
|
||||
else if ( m_CollObj[j].nType == MCH_SIM_COB_CONE) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = ! pVZM->CDeConeFrustum( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeConeFrustumClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, *pSTM, m_dSafeDist) ;
|
||||
}
|
||||
}
|
||||
else if ( m_CollObj[j].nType == MCH_SIM_COB_CYL) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = pVZM->AvoidCylinder( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_dSafeDist) ;
|
||||
// altrimenti poliedro
|
||||
else {
|
||||
SurfLocal SurfLoc( m_pGeomDB, m_CollObj[j].nFrameId, frCd) ;
|
||||
const ISurfTriMesh* pStmLoc = GetSurfTriMesh( SurfLoc) ;
|
||||
if ( pStmLoc != nullptr) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = ! pVZM->CDeSurfTm( *pStmLoc, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeClosedSurfTmClosedSurfTm( *pStmLoc, *pSTM, m_dSafeDist) ;
|
||||
}
|
||||
else
|
||||
bOk = ! CDeCylClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_dSafeDist, *pSTM) ;
|
||||
}
|
||||
else if ( m_CollObj[j].nType == MCH_SIM_COB_SPHE) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = pVZM->AvoidSphere( frObj.Orig(), m_CollObj[j].dPar1, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeSpheClosedSurfTm( frObj.Orig(), m_CollObj[j].dPar1, m_dSafeDist, *pSTM) ;
|
||||
}
|
||||
else if ( m_CollObj[j].nType == MCH_SIM_COB_CONE) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = pVZM->AvoidConeFrustum( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeConeFrustumClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist, *pSTM) ;
|
||||
bOk = false ;
|
||||
}
|
||||
// se trovata collisione
|
||||
if ( ! bOk) {
|
||||
nCdInd = i ;
|
||||
nObjInd = j ;
|
||||
@@ -1374,7 +1488,29 @@ Simulator::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::OnStart( bool bFirst)
|
||||
Simulator::OnInit( void)
|
||||
{
|
||||
// verifico esistenza funzione
|
||||
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_INIT))
|
||||
return true ;
|
||||
// chiamo la funzione di ingresso nella simulazione
|
||||
return m_pMachine->LuaCallFunction( ON_SIMUL_INIT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::OnExit( void)
|
||||
{
|
||||
// verifico esistenza funzione
|
||||
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_EXIT))
|
||||
return true ;
|
||||
// chiamo la funzione di uscita dalla simulazione
|
||||
return m_pMachine->LuaCallFunction( ON_SIMUL_EXIT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::OnProgramStart( bool bFirst)
|
||||
{
|
||||
// assegno flag inizio simulazione
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SIM1ST, bFirst) ;
|
||||
@@ -1388,7 +1524,7 @@ Simulator::OnStart( bool bFirst)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::OnEnd( void)
|
||||
Simulator::OnProgramEnd( void)
|
||||
{
|
||||
// verifico esistenza funzione
|
||||
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_END))
|
||||
@@ -1550,8 +1686,10 @@ Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit, co
|
||||
m_AuxAxesLink.emplace_back( 0) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
bOk = false ;
|
||||
nErr = ERR_TOOL_SEL ;
|
||||
}
|
||||
}
|
||||
|
||||
return ( bOk && nErr == 0) ;
|
||||
@@ -1944,6 +2082,10 @@ Simulator::AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, con
|
||||
if ( ( dPar1 < EPS_SMALL && dPar2 < EPS_SMALL) || dPar3 < EPS_SMALL)
|
||||
return false ;
|
||||
break ;
|
||||
case MCH_SIM_COB_POLY :
|
||||
if ( ! ExeSurfIsClosed( nFrameId))
|
||||
return false ;
|
||||
break ;
|
||||
default :
|
||||
return false ;
|
||||
}
|
||||
@@ -1996,10 +2138,7 @@ Simulator::SetToolForVmill( const string& sTool, const string& sHead, int nExit,
|
||||
else if ( nType == TT_WATERJET)
|
||||
ExeVolZmapSetStdTool( vVmill, sTool, dLen + 50, dDiam, dCornR, dMaxMat, nFlag, bFirst) ;
|
||||
else if ( abs( dSideAng) < EPS_ANG_SMALL || abs( dThick) < EPS_SMALL) {
|
||||
if ( dDiam <= dMaxStemDiam)
|
||||
ExeVolZmapSetStdTool( vVmill, sTool, dLen, dDiam, dCornR, dMaxMat, nFlag, bFirst) ;
|
||||
else
|
||||
ExeVolZmapSetSawTool( vVmill, sTool, dLen, dDiam, dMaxMat, 0, dCornR, nFlag, bFirst) ;
|
||||
ExeVolZmapSetStdTool( vVmill, sTool, dLen, dDiam, dCornR, dMaxMat, nFlag, bFirst) ;
|
||||
}
|
||||
else {
|
||||
bool bExtra = ( dThick > 0) ;
|
||||
@@ -2082,6 +2221,7 @@ Simulator::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||
static const int STEP_RAPID = -2 ;
|
||||
static const int STEP_RAPROT = -3 ;
|
||||
static const int STEP_COLLROT = -4 ;
|
||||
bool bViewAllFrames = true ;
|
||||
int nStep = 1 ;
|
||||
for ( int i = 0 ; i < nAxCount ; ++ i) {
|
||||
double dMove = abs( vAxNaEpSt[i].dEndPos - vPrev[i]) ;
|
||||
@@ -2091,10 +2231,14 @@ Simulator::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||
dStep = m_dStep ;
|
||||
else if ( abs( dStep - STEP_RAPID) < EPS_SMALL)
|
||||
dStep = 4 * m_dStep ;
|
||||
else if ( abs( dStep - STEP_RAPROT) < EPS_SMALL)
|
||||
else if ( abs( dStep - STEP_RAPROT) < EPS_SMALL) {
|
||||
dStep = 0.4 * m_dStep ;
|
||||
else // STEP_COLLROT
|
||||
bViewAllFrames = false ;
|
||||
}
|
||||
else { // STEP_COLLROT
|
||||
dStep = min( 0.4 * m_dStep, 10.) ;
|
||||
bViewAllFrames = false ;
|
||||
}
|
||||
}
|
||||
dStep = max( dStep, 1.) ;
|
||||
int nAxStep = int( dMove / dStep) + 1 ;
|
||||
@@ -2129,7 +2273,8 @@ Simulator::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||
}
|
||||
}
|
||||
// Aggiorno visualizzazione
|
||||
ExeDraw() ;
|
||||
if ( bViewAllFrames || ( i % 4) == 0 || i == nStep)
|
||||
ExeDraw() ;
|
||||
// Verifico collisioni
|
||||
int nCdInd, nObjInd ;
|
||||
bool bCollCheck = ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
|
||||
|
||||
+10
-2
@@ -86,8 +86,10 @@ class Simulator
|
||||
{ return ( ! m_CollObj.empty() && ! m_CdId.empty()) ; }
|
||||
bool Stopped( void)
|
||||
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
|
||||
bool OnStart( bool bFirst) ;
|
||||
bool OnEnd( void) ;
|
||||
bool OnInit( void) ;
|
||||
bool OnExit( void) ;
|
||||
bool OnProgramStart( bool bFirst) ;
|
||||
bool OnProgramEnd( void) ;
|
||||
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
|
||||
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
|
||||
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
|
||||
@@ -135,12 +137,17 @@ class Simulator
|
||||
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
|
||||
} ;
|
||||
typedef std::vector<VmTool> VMTVECTOR ;
|
||||
enum { SIS_CREATED = 0,
|
||||
SIS_INITIALIZED = 1,
|
||||
SIS_READYTOSTART = 2,
|
||||
SIS_READYTORUN = 3} ;
|
||||
|
||||
private :
|
||||
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
|
||||
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
|
||||
Machine* m_pMachine ; // puntatore alla macchina
|
||||
PerformanceCounter* m_pPerfCnt ; // timer per calcolo FPS
|
||||
int m_nStatus ; // stato interno del simulatore (creato, inizializzato, pronto al movimento)
|
||||
double m_dStep ; // lunghezza di riferimento per la velocità di simulazione
|
||||
int m_nUiStatus ; // stato simulazione a livello utente
|
||||
int m_nOpId ; // identificativo della operazione (lavoraz.) corrente
|
||||
@@ -158,6 +165,7 @@ class Simulator
|
||||
std::string m_sHead ; // nome della testa corrente
|
||||
int m_nExit ; // indice dell'uscita corrente
|
||||
double m_dTDiam ; // diametro dell'utensile corrente
|
||||
bool m_bCutOnTip ; // flag capacità di lavorare di testa dell'utensile corrente
|
||||
INTVECTOR m_VmId ; // vettore identificativi Zmap per Virtual Milling
|
||||
INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection
|
||||
VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling
|
||||
|
||||
+41
-10
@@ -606,6 +606,9 @@ SurfFinishing::Update( bool bPostApply)
|
||||
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
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
|
||||
|
||||
@@ -800,11 +803,31 @@ SurfFinishing::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in SurfFinishing : tool name changed (" +
|
||||
@@ -1308,8 +1331,8 @@ SurfFinishing::AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
bool bStart = true ;
|
||||
while ( OffsCrv.GetCurveCount() > 0) {
|
||||
// recupero la prima curva di offset
|
||||
PtrOwner<ICurveComposite> pOffs( CreateCurveComposite()) ;
|
||||
if ( IsNull( pOffs) || ! pOffs->AddCurve( OffsCrv.GetLongerCurve())) {
|
||||
PtrOwner<ICurveComposite> pOffs ;
|
||||
if ( ! pOffs.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve()))) {
|
||||
m_pMchMgr->SetLastError( 3110, "Error in SurfFinishing : Toolpath not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1359,7 +1382,7 @@ SurfFinishing::AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL))
|
||||
return false ;
|
||||
// sostituisco la vecchia curva con la nuova
|
||||
vpCrvs[k].Set( Release( pCompo )) ;
|
||||
vpCrvs[k].Set( pCompo) ;
|
||||
}
|
||||
// ciclo sulle curve elementari
|
||||
int nMaxInd = vpCrvs[k]->GetCurveCount() - 1 ;
|
||||
@@ -1649,6 +1672,13 @@ SurfFinishing::CalcZigZag( const ICurveComposite* pOffs,
|
||||
nJ = -1 ;
|
||||
}
|
||||
}
|
||||
|
||||
// se richiesta percorrenza invertita
|
||||
if ( m_Params.m_bInvert) {
|
||||
for ( auto& pCompo : vpCrvs)
|
||||
pCompo->Invert() ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1720,7 +1750,7 @@ SurfFinishing::AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL))
|
||||
return false ;
|
||||
// sostituisco la vecchia curva con la nuova
|
||||
pMCrv.Set( Release( pCompo )) ;
|
||||
pMCrv.Set( pCompo) ;
|
||||
}
|
||||
// ciclo sulle curve elementari
|
||||
int nMaxInd = pMCrv->GetCurveCount() - 1 ;
|
||||
@@ -1883,7 +1913,7 @@ SurfFinishing::CalcSpiral( const ICurveComposite* pCompo, bool bSplitArcs,
|
||||
if ( bNextOk) {
|
||||
// sistemo per prossimo step
|
||||
dCurrRad = dRad ;
|
||||
pOffs.Set( Release( pNextOffs)) ;
|
||||
pOffs.Set( pNextOffs) ;
|
||||
pCurr = Get( pOffs) ;
|
||||
// nuovo valore pari allo step
|
||||
dOffs = GetSideStep() ;
|
||||
@@ -2083,6 +2113,7 @@ SurfFinishing::GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) con
|
||||
double
|
||||
SurfFinishing::GetRadiusForStartEndElevation( void) const
|
||||
{
|
||||
const double DELTA_ELEV_RAD = 20.0 ;
|
||||
return ( 0.5 * m_TParams.m_dTDiam + DELTA_ELEV_RAD) ;
|
||||
const double DELTA_ELEV_RAD = 4.0 ;
|
||||
double dDeltaRad = min( DELTA_ELEV_RAD, 0.5 * m_TParams.m_dTDiam) ;
|
||||
return ( 0.5 * m_TParams.m_dTDiam + dDeltaRad) ;
|
||||
}
|
||||
|
||||
+6
-2
@@ -83,6 +83,10 @@ struct SurfFinishingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const SurfFinishingData* GetSurfFinishingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const SurfFinishingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SURFFINISHING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const SurfFinishingData*>( pMdata)) ; }
|
||||
inline SurfFinishingData* GetSurfFinishingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<SurfFinishingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SURFFINISHING)
|
||||
return nullptr ;
|
||||
return ( static_cast<SurfFinishingData*>( pMdata)) ; }
|
||||
|
||||
+5
-5
@@ -72,7 +72,7 @@ struct ToolData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline bool
|
||||
SameTool( const ToolData& Td1, const ToolData& Td2)
|
||||
SameTool( const ToolData& Td1, const ToolData& Td2, bool bAlsoNameTcPosHeadExit = true)
|
||||
{
|
||||
const double EPS_TOOL_LEN = 10 * EPS_SMALL ;
|
||||
const double EPS_TOOL_ANG = 10 * EPS_ANG_SMALL ;
|
||||
@@ -80,11 +80,11 @@ SameTool( const ToolData& Td1, const ToolData& Td2)
|
||||
const double EPS_FEED = 0.5 ;
|
||||
const double EPS_ABSORP = 0.5 ;
|
||||
return ( Td1.m_Uuid == Td2.m_Uuid &&
|
||||
Td1.m_sName == Td2.m_sName &&
|
||||
( Td1.m_sName == Td2.m_sName || ! bAlsoNameTcPosHeadExit) &&
|
||||
Td1.m_sDraw == Td2.m_sDraw &&
|
||||
Td1.m_sTcPos == Td2.m_sTcPos &&
|
||||
Td1.m_sHead == Td2.m_sHead &&
|
||||
Td1.m_nExit == Td2.m_nExit &&
|
||||
( Td1.m_sTcPos == Td2.m_sTcPos || ! bAlsoNameTcPosHeadExit) &&
|
||||
( Td1.m_sHead == Td2.m_sHead || ! bAlsoNameTcPosHeadExit) &&
|
||||
( Td1.m_nExit == Td2.m_nExit || ! bAlsoNameTcPosHeadExit) &&
|
||||
Td1.m_nCorr == Td2.m_nCorr &&
|
||||
Td1.m_nType == Td2.m_nType &&
|
||||
abs( Td1.m_dMaxSpeed - Td2.m_dMaxSpeed) < EPS_SPEED &&
|
||||
|
||||
+16
-12
@@ -694,12 +694,16 @@ ToolsMgr::GetCurrToolMaxDepth( double dSafe, double& dMaxDepth) const
|
||||
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ;
|
||||
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ;
|
||||
}
|
||||
// calcolo il massimo affondamento
|
||||
// calcolo il massimo affondamento per le limitazioni dal portautensili
|
||||
dMaxDepth = m_tdCurrTool.m_dLen - dSafe ;
|
||||
if ( m_tdCurrTool.m_dDiam > dTHoldDiam)
|
||||
dMaxDepth -= dTHoldBase ;
|
||||
else
|
||||
if ( dTHoldDiam > m_tdCurrTool.m_dDiam + EPS_SMALL)
|
||||
dMaxDepth -= dTHoldLen ;
|
||||
else
|
||||
dMaxDepth -= dTHoldBase ;
|
||||
// recupero l'eventuale diametro gambo utensile (definito se non nullo)
|
||||
double dStemDiam ; m_tdCurrTool.GetParam( TPA_STEMDIAM, dStemDiam) ;
|
||||
if ( dStemDiam > m_tdCurrTool.m_dDiam + EPS_SMALL)
|
||||
dMaxDepth = min( dMaxDepth, m_tdCurrTool.m_dMaxMat) ;
|
||||
return true ;
|
||||
}
|
||||
// se mortasatrice o sega a catena
|
||||
@@ -734,10 +738,11 @@ ToolsMgr::GetCurrToolThDiam( double& dThDiam) const
|
||||
if ( ! m_bCurrTool)
|
||||
return false ;
|
||||
|
||||
// se punta a forare, lama, fresa o scalpello
|
||||
// se punta a forare, lama, fresa, mortasatrice/sega a catena o scalpello
|
||||
if ( ( m_tdCurrTool.m_nType & TF_DRILLBIT) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_SAWBLADE) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_MILL) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_CHISEL) != 0) {
|
||||
// recupero le dimensioni del porta utensili
|
||||
double dTHoldBase = 0 ;
|
||||
@@ -757,9 +762,8 @@ ToolsMgr::GetCurrToolThDiam( double& dThDiam) const
|
||||
dThDiam = dTHoldDiam ;
|
||||
return true ;
|
||||
}
|
||||
// se mortasatrice/sega a catena o waterjet
|
||||
else if ( ( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
|
||||
// se waterjet
|
||||
else if ( ( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
|
||||
dThDiam = 0 ;
|
||||
return true ;
|
||||
}
|
||||
@@ -775,10 +779,11 @@ ToolsMgr::GetCurrToolThLength( double& dThLen) const
|
||||
if ( ! m_bCurrTool)
|
||||
return false ;
|
||||
|
||||
// se punta a forare, lama, fresa o scalpello
|
||||
// se punta a forare, lama, fresa, mortasatrice/sega a catena o scalpello
|
||||
if ( ( m_tdCurrTool.m_nType & TF_DRILLBIT) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_SAWBLADE) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_MILL) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_CHISEL) != 0) {
|
||||
// recupero le dimensioni del porta utensili
|
||||
double dTHoldBase = 0 ;
|
||||
@@ -798,9 +803,8 @@ ToolsMgr::GetCurrToolThLength( double& dThLen) const
|
||||
dThLen = dTHoldLen ;
|
||||
return true ;
|
||||
}
|
||||
// se mortasatrice/sega a catena o waterjet
|
||||
else if ( ( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
|
||||
// se waterjet
|
||||
else if ( ( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
|
||||
dThLen = 0 ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
+32
-9
@@ -740,6 +740,9 @@ WaterJetting::Update( bool bPostApply)
|
||||
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
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
|
||||
|
||||
@@ -964,11 +967,31 @@ WaterJetting::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in WaterJetting : tool name changed (" +
|
||||
@@ -1941,7 +1964,7 @@ WaterJetting::AddLeadInPreview( const ICurveComposite* pCompo, ISurfFlatRegion*
|
||||
{ PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||
if ( IsNull( pLine) || ! pLine->Set( ptP1, ptStart))
|
||||
return false ;
|
||||
pCrv.Set( Release( pLine)) ;
|
||||
pCrv.Set( pLine) ;
|
||||
} break ;
|
||||
case WJET_LI_TANGENT :
|
||||
pCrv.Set( GetArc2PVN( ptStart, ptP1, - vtStart, vtN)) ;
|
||||
@@ -2010,7 +2033,7 @@ WaterJetting::AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion*
|
||||
Point3d ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp ;
|
||||
if ( IsNull( pLine) || ! pLine->Set( ptEnd, ptP1))
|
||||
return false ;
|
||||
pCrv.Set( Release( pLine)) ;
|
||||
pCrv.Set( pLine) ;
|
||||
} break ;
|
||||
case WJET_LO_TANGENT :
|
||||
{ // calcolo punto finale dell'uscita
|
||||
@@ -2587,8 +2610,8 @@ WaterJetting::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
|
||||
pCrv->Invert() ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs) {
|
||||
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pCrv)) || ! ApproxWithLines( pCompo))
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pCrv))) || ! ApproxWithLines( pCompo))
|
||||
return false ;
|
||||
return ( AddCurveMove( pCompo, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
@@ -2658,8 +2681,8 @@ WaterJetting::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vec
|
||||
return false ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs) {
|
||||
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pCrv)) || ! ApproxWithLines( pCompo))
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pCrv))) || ! ApproxWithLines( pCompo))
|
||||
return false ;
|
||||
return ( AddCurveMove( pCompo, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
}
|
||||
|
||||
+6
-2
@@ -102,6 +102,10 @@ struct WaterJettingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const WaterJettingData* GetWaterJettingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const WaterJettingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_WATERJETTING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const WaterJettingData*>( pMdata)) ; }
|
||||
inline WaterJettingData* GetWaterJettingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<WaterJettingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_WATERJETTING)
|
||||
return nullptr ;
|
||||
return ( static_cast<WaterJettingData*>( pMdata)) ; }
|
||||
|
||||
Reference in New Issue
Block a user