Compare commits
143 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b7eee50e55 | |||
| 3cda97534e | |||
| 5975b00def | |||
| d845442ebd | |||
| b5ef9ae6dc | |||
| fcaf15cbe1 | |||
| 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 | |||
| fee74d47f8 | |||
| 37f4e0982f | |||
| fb5e01881d | |||
| a5096facc7 | |||
| dbe11e6343 | |||
| ed4a9ec745 | |||
| 25b940927e | |||
| 0911f167b1 | |||
| 766e6a208d | |||
| 9b0b1fe9d4 | |||
| 4d676c1f3b | |||
| 3d5398f877 | |||
| 38d63633c2 | |||
| 14b433d206 |
@@ -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 ;
|
||||
}
|
||||
|
||||
|
||||
+27
-6
@@ -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,7 +362,7 @@ 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 ;
|
||||
@@ -371,7 +391,7 @@ 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 ;
|
||||
@@ -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
|
||||
|
||||
+5
-2
@@ -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) ;
|
||||
|
||||
@@ -1033,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)) ; }
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
+202
-174
@@ -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.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -47,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)"
|
||||
@@ -71,23 +75,23 @@ struct Hole
|
||||
} ;
|
||||
|
||||
struct MHDrill {
|
||||
int nInd_id_hole ; // indice id foro
|
||||
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à svuotato
|
||||
bool bTempDrill = false ; // per test maschera (se durante un test viene svuotato o no)
|
||||
int nTempTool = -1 ; // per test maschera ( indice utensile che lo svuota durante un test)
|
||||
bool bSkipToAngle = false ; // nel caso di più assi rotanti, se foro già svuotato con testa orientata
|
||||
bool bForToolM = false ; // se tool main svuoterà questo foro
|
||||
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 svuotatura in vToolHole (ordinati)
|
||||
VCT3DVECTOR vVtAux ; // vettore dei vtAux ausiliari del tool principale per svuotare questo foro (ordinati)
|
||||
int nIndTool = -1 ; // indice del tool che alla fine svuoterà il foro
|
||||
Vector3d vtAux ; // vettore ausiliario del tool principale che permette al tool principale di svuotare questo foro
|
||||
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)
|
||||
} ;
|
||||
@@ -95,8 +99,12 @@ struct HoleInfo {
|
||||
|
||||
struct ToolInfo
|
||||
{
|
||||
ToolData* pTool ; // 1) puntatore per utensile (nullo se utensile non presente)
|
||||
Point3d ptETool ; // 2) punto finale del tool (per ptBtn del foro)
|
||||
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) {}
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -601,6 +609,13 @@ 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 ;
|
||||
}
|
||||
|
||||
// se lavorazione standard
|
||||
if ( m_Params.m_nSubType == DRI_SUB_STD) {
|
||||
if ( ! StandardProcess( bRecalc, GDB_ID_NULL, nClId))
|
||||
@@ -621,7 +636,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
|
||||
@@ -646,6 +667,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) ;
|
||||
|
||||
@@ -696,12 +720,12 @@ Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
string sCurrHead ;
|
||||
if ( ! m_pMchMgr->GetCurrMachine()->GetCurrHead( sCurrHead))
|
||||
return false ;
|
||||
int nExit = m_pMchMgr->GetCurrMachine()->GetHeadExitCount( sCurrHead) ;
|
||||
int nExitCnt = m_pMchMgr->GetCurrMachine()->GetHeadExitCount( sCurrHead) ;
|
||||
TABMHDRILL tabDrills ;
|
||||
double dMHOff = 0 ;
|
||||
// se ho più uscite...
|
||||
if ( nExit > 1) {
|
||||
if ( ! MultiHeadDrilling( nExit, m_vId, nClId, tabDrills, dMHOff))
|
||||
if ( nExitCnt > 1) {
|
||||
if ( ! MultiHeadDrilling( nExitCnt, m_vId, nClId, tabDrills, dMHOff))
|
||||
return false ;
|
||||
if( tabDrills.size() == 0)
|
||||
return true ;
|
||||
@@ -750,83 +774,83 @@ Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::MultiHeadDrilling( int nExit, const SELVECTOR& vId, int nClId, TABMHDRILL& tabDrills, double& dMHOff, bool bOrd) {
|
||||
|
||||
Drilling::MultiHeadDrilling( int nExitCnt, const SELVECTOR& vId, int nClId, TABMHDRILL& tabDrills, double& dMHOff, bool bOrd)
|
||||
{
|
||||
// controllo parametri
|
||||
tabDrills.clear() ;
|
||||
if (( int)vId.size() == 0)
|
||||
if ( vId.empty())
|
||||
return true ;
|
||||
|
||||
// recupero il nome della testa
|
||||
string sHead ;
|
||||
m_pMchMgr->GetCurrMachine()->GetCurrHead( sHead) ;
|
||||
|
||||
// gestore dei tool corrente
|
||||
// gestore degli utensili
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
|
||||
// ------------------------------ Tools ------------------------------------------
|
||||
|
||||
// ciclo tutti i tools salvando le loro geometrie
|
||||
typedef vector<ToolInfo> VECTORTOOL ;
|
||||
VECTORTOOL vTools ; vTools.reserve( nExit) ;
|
||||
|
||||
int nNullTools = 0 ; // numero di utensili non attivi
|
||||
int nIndMainTool = 0 ; // Main Tool ( non nullo )
|
||||
bool bToolValid = false ; // se il Tool attuale è valido ( non nullo )
|
||||
|
||||
for ( int t = 0 ; t < nExit ; ++t) { // recupero l'utensile sulle uscite
|
||||
string sToolName ;
|
||||
ToolInfo TInf ;
|
||||
if( ! m_pMchMgr->GetLoadedTool( sHead, t + 1, sToolName) || sToolName.empty()) {
|
||||
TInf.pTool = nullptr ; // se non attivo ( nullo )
|
||||
vTools.push_back( TInf) ;
|
||||
++nNullTools ;
|
||||
continue ;
|
||||
}
|
||||
// se attivo ( non nullo )
|
||||
TInf.pTool = (( ToolData*)pTMgr->GetTool( sToolName)) ;
|
||||
vTools.push_back( TInf) ;
|
||||
|
||||
// imposto il tool di riferimento come il tool m_TParams
|
||||
if( TInf.pTool->m_Uuid == m_TParams.m_Uuid)
|
||||
nIndMainTool = t ;
|
||||
}
|
||||
if ( nNullTools == nExit || vTools.size() == 0) // se non ho utensili attivi o validi...
|
||||
if ( pTMgr == nullptr)
|
||||
return false ;
|
||||
|
||||
Point3d PtEndTool ; // punto finale del tool
|
||||
Vector3d vtDirPrec, vtDirAct, vtAux ; // per controllare direzioni dei tool ( T )
|
||||
Vector3d vtT, vtA ; // versore T e A per sistema di riferimento del tool
|
||||
|
||||
bToolValid = false ;
|
||||
for ( int t = 0 ; t < nExit ; ++t) { // controllo direzioni ( T ) e punto finale all'estremità
|
||||
if ( vTools[t].pTool == nullptr)
|
||||
// Recupero i dati degli utensili montati sulla testa
|
||||
int nMainToolInd = -1 ;
|
||||
VECTORTOOL vTools ; vTools.reserve( nExitCnt) ;
|
||||
// ricavo gli utensili presenti sulle uscite
|
||||
for ( int nT = 0 ; nT < nExitCnt ; ++ nT) {
|
||||
string sToolName ;
|
||||
ToolInfo TInf ;
|
||||
if ( ! m_pMchMgr->GetLoadedTool( sHead, nT + 1, sToolName) || sToolName.empty()) {
|
||||
// non c'è utensile
|
||||
vTools.emplace_back( nullptr) ;
|
||||
continue ;
|
||||
m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux( sHead, t + 1, PtEndTool, vtDirAct, vtAux) ;
|
||||
if ( ! bToolValid) {
|
||||
bToolValid = true ;
|
||||
vtDirPrec = vtDirAct ;
|
||||
}
|
||||
else {
|
||||
// controllo che le direzioni dei tool siano tutte parallele tra loro
|
||||
if ( ! AreSameVectorApprox( vtDirAct, vtDirPrec))
|
||||
return false ;
|
||||
}
|
||||
if ( t == nIndMainTool) { // per il sistema di riferiemento centrato sul tool principale
|
||||
vtT = vtDirAct ;
|
||||
vtA = vtAux ;
|
||||
}
|
||||
PtEndTool.Translate( - vtDirAct * ( vTools[t].pTool->m_dLen)) ;
|
||||
vTools[t].ptETool = PtEndTool ;
|
||||
// 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 ;
|
||||
}
|
||||
|
||||
// ------------------------------ Holes ------------------------------------------
|
||||
// ciclo tutti i fori salvando le loro geometrie
|
||||
typedef vector<HoleInfo> VECTORHOLE ;
|
||||
VECTORHOLE vHoles(( int)vId.size()) ; // vettore dei fori
|
||||
bool bOKHole = false ; // validità di almeno un foro
|
||||
// carico i dati della testa con le sue uscite
|
||||
Vector3d vtTool, vtAux ;
|
||||
for ( int nT = 0 ; nT < nExitCnt ; ++ nT) {
|
||||
// se non attrezzato, salto al successivo
|
||||
if ( vTools[nT].pTool == nullptr)
|
||||
continue ;
|
||||
// recupero i dati dell'uscita
|
||||
Point3d ptExit ;
|
||||
Vector3d vtCurrDir, vtCurrAux ;
|
||||
m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux( sHead, nT + 1, ptExit, vtCurrDir, vtCurrAux) ;
|
||||
// se utensile successivo
|
||||
if ( ! vtTool.IsSmall()) {
|
||||
// controllo abbia la stessa direzione dei precedenti, altrimenti errore
|
||||
if ( ! AreSameVectorApprox( vtCurrDir, vtTool)) {
|
||||
vtTool = V_NULL ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// altrimenti primo utensile
|
||||
else {
|
||||
vtTool = vtCurrDir ;
|
||||
vtAux = vtCurrAux ;
|
||||
}
|
||||
// assegno tip utensile
|
||||
vTools[nT].ptToolTip = ptExit - vtCurrDir * vTools[nT].pTool->m_dLen ;
|
||||
}
|
||||
if ( vtTool.IsSmall() || vtAux.IsSmall()) {
|
||||
m_pMchMgr->SetLastError( 2117, "Error in Drilling : incorrect multi drilling head") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
for ( int h = 0 ; h < ( int)vId.size() ; ++h) {
|
||||
// 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]) ;
|
||||
@@ -850,45 +874,45 @@ Drilling::MultiHeadDrilling( int nExit, const SELVECTOR& vId, int nClId, TABMHDR
|
||||
|
||||
vHoles[h].hole = hole ;
|
||||
vHoles[h].nIndInSelVector = h ;
|
||||
bOKHole = true ;
|
||||
bSomeHoleOk = true ;
|
||||
}
|
||||
if ( vHoles.size() == 0 || ! bOKHole) // se non ho fori...
|
||||
if ( ! bSomeHoleOk)
|
||||
return true ;
|
||||
|
||||
// calcolo la maschera tra tools e holes
|
||||
if( ! CalcMask( vHoles, vTools, nIndMainTool, vtT, vtA))
|
||||
// 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 svuotati
|
||||
// i fori con dimensione 0 del vettore vToolHole non possono essere lavorati
|
||||
int nNoDrillHoles = 0 ;
|
||||
for ( int i = 0 ; i < ( int)vHoles.size() ; ++i) {
|
||||
for ( int i = 0 ; i < ( int)vHoles.size() ; ++ i) {
|
||||
if ( vHoles[i].vToolHole.size() == 0)
|
||||
++nNoDrillHoles ;
|
||||
++ nNoDrillHoles ;
|
||||
}
|
||||
|
||||
// resetto le variabili di controllo di svuotatura temporanea per tutti i fori
|
||||
// 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 svuotati
|
||||
// numero di fori lavorati
|
||||
int nOkHole = 0 ;
|
||||
|
||||
// decido in quali fori inserire il tool principale
|
||||
for ( int nCheck = 1 ; nCheck < ( int)vHoles.size() && nOkHole < ( int)vHoles.size() - nNoDrillHoles ; ++nCheck) {
|
||||
for ( int nCheck = 1 ; nCheck < ( int)vHoles.size() && nOkHole < ( int)vHoles.size() - nNoDrillHoles ; ++ nCheck) {
|
||||
for ( int i = 0 ; i < ( int)vHoles.size() ; ++i) {
|
||||
if ( vHoles[i].vToolHole.size() == nCheck && ! vHoles[i].bDrill) { // prendo tutti i fori con vToolHope di lunghezza nCheck non già svuotati
|
||||
vHoles[vHoles[i].vToolHole[0]].bForToolM = true ;
|
||||
vHoles[vHoles[i].vToolHole[0]].nIndTool = nIndMainTool ;
|
||||
vHoles[vHoles[i].vToolHole[0]].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) {
|
||||
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 ;
|
||||
++ nOkHole ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@@ -898,42 +922,42 @@ Drilling::MultiHeadDrilling( int nExit, const SELVECTOR& vId, int nClId, TABMHDR
|
||||
}
|
||||
|
||||
// calcolo la massima differenza di lunghezza tra il primo tool e gli altri ( così l'elevazione finale rimane compatibile)
|
||||
double dRefLen = vTools[nIndMainTool].pTool->m_dTLen ;
|
||||
double dRefLen = vTools[nMainToolInd].pTool->m_dTLen ;
|
||||
double dOffMax = 0 ;
|
||||
for ( int t = 0 ; t < ( int)vTools.size() && nNoDrillHoles != (int)vHoles.size() ; ++t) {
|
||||
if ( vTools[t].pTool == nullptr || t == nIndMainTool)
|
||||
for ( int nT = 0 ; nT < ( int)vTools.size() && nNoDrillHoles != (int)vHoles.size() ; ++ nT) {
|
||||
if ( vTools[nT].pTool == nullptr || nT == nMainToolInd)
|
||||
continue ;
|
||||
if ( vTools[t].pTool->m_dTLen > dRefLen + dOffMax) {
|
||||
dOffMax = vTools[t].pTool->m_dTLen - dRefLen ;
|
||||
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) {
|
||||
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) {
|
||||
for ( int j = 0 ; j < ( int)vHoles.size() ; ++j) {
|
||||
if ( vHoles[j].nIndHoleToolM != i)
|
||||
continue ;
|
||||
if (( int)vVtA.size() == 0)
|
||||
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])) {
|
||||
for ( int v = 0 ; v < ( int)vVtA.size() ; ++ v) {
|
||||
if ( AreSameVectorApprox( vHoles[j].vtAux, vVtA[v])) {
|
||||
bPush = false ;
|
||||
break ;
|
||||
}
|
||||
if( bPush)
|
||||
}
|
||||
if ( bPush)
|
||||
vVtA.push_back( vHoles[j].vtAux) ;
|
||||
}
|
||||
}
|
||||
|
||||
for( int v = 0 ; v < ( int)vVtA.size() ; ++v) {
|
||||
for ( int v = 0 ; v < ( int)vVtA.size() ; ++ v) {
|
||||
vector<MHDrill> vRowDrill ;
|
||||
MHDrill FirstMHDrill ;
|
||||
FirstMHDrill.nInd_id_hole = i ;
|
||||
@@ -943,19 +967,18 @@ Drilling::MultiHeadDrilling( int nExit, const SELVECTOR& vId, int nClId, TABMHDR
|
||||
}
|
||||
vVtA.clear() ;
|
||||
}
|
||||
if ( tabDrills.size() == 0) // se non trovo corrispondenze ...
|
||||
// se non trovo corrispondenze ...
|
||||
if ( tabDrills.empty())
|
||||
return true ;
|
||||
|
||||
// se devo riordinare
|
||||
// se devo riordinare
|
||||
if ( bOrd) {
|
||||
struct Order
|
||||
{
|
||||
struct Order {
|
||||
int nInd_id_hole ;
|
||||
Point3d ptIni ;
|
||||
} ;
|
||||
typedef vector<Order> VECTORORDER ;
|
||||
VECTORORDER vOrder ;
|
||||
for ( int i = 0 ; i < ( int)tabDrills.size() ; ++i) {
|
||||
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 ;
|
||||
@@ -966,8 +989,8 @@ Drilling::MultiHeadDrilling( int nExit, const SELVECTOR& vId, int nClId, TABMHDR
|
||||
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) {
|
||||
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) ;
|
||||
@@ -989,34 +1012,34 @@ Drilling::MultiHeadDrilling( int nExit, const SELVECTOR& vId, int nClId, TABMHDR
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::CalcMask( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndMT, Vector3d vtT, Vector3d vtA) {
|
||||
|
||||
// recupero il valore di tolleranza sul diametro
|
||||
double dDiamTol = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
|
||||
|
||||
Drilling::CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux)
|
||||
{
|
||||
// controllo dei parametri
|
||||
if (( int)vHoles.size() <= 0 || ( int)vTools.size() <= 0)
|
||||
if ( vHoles.empty() || vTools.empty())
|
||||
return false ;
|
||||
|
||||
int nExit = ( int)vTools.size() ;
|
||||
// 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 ;
|
||||
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){
|
||||
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) {
|
||||
for ( int k = 0 ; k < ( int)vHoles.size() ; ++ k) {
|
||||
vHoles[k].bTempDrill = false ;
|
||||
vHoles[k].nTempTool = -1 ;
|
||||
}
|
||||
|
||||
// verifica validità del foro i-esimo per il Tool principale
|
||||
Hole Hole_i = vHoles[i].hole ;
|
||||
if ( ! MultiHeadVerifyHole( Hole_i, vTools[nIndMT].pTool, dDiamTol, m_vId[vHoles[i].nIndInSelVector]))
|
||||
if ( ! MultiHeadVerifyHole( Hole_i, vTools[nIndMT].pTool, dDiamToler, m_vId[vHoles[i].nIndInSelVector]))
|
||||
continue ;
|
||||
|
||||
int nStat ;
|
||||
@@ -1035,14 +1058,14 @@ Drilling::CalcMask( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndMT, Vector3d
|
||||
|
||||
// creo un nuovo sistema di riferimento centrato nel Tool principale
|
||||
Frame3d frMT ;
|
||||
frMT.Set( vTools[nIndMT].ptETool, vtT, vtA) ;
|
||||
if( ! frMT.IsValid())
|
||||
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())
|
||||
if ( ! frHMT.IsValid())
|
||||
return false ;
|
||||
|
||||
// numero di svuotature inserendo il Tool principale nel foro i-esimo
|
||||
@@ -1052,11 +1075,11 @@ Drilling::CalcMask( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndMT, Vector3d
|
||||
vHoles[i].nTempTool = nIndMT ;
|
||||
|
||||
// controllo la compatibilità tra le geometrie dei Tool e dei fori
|
||||
CheckOtherHolesWithTools( vHoles, vTools, nIndMT, i, Hole_i, frMT, frHMT, dDiamTol, nDrills) ;
|
||||
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 == nExit - nNullTools) { // se ho svuotato il numero corretto di fori ...
|
||||
for ( int d = 0 ; d < ( int)vHoles.size() ; ++d) {
|
||||
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
|
||||
@@ -1065,44 +1088,47 @@ Drilling::CalcMask( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndMT, Vector3d
|
||||
}
|
||||
}
|
||||
else {
|
||||
for( int d = 0 ; d < ( int)vHoles.size() ; ++d)
|
||||
if( vHoles[d].bTempDrill)
|
||||
for ( int d = 0 ; d < ( int)vHoles.size() ; ++ d)
|
||||
if ( vHoles[d].bTempDrill)
|
||||
vHoles[d].bTempDrill = false ;
|
||||
}
|
||||
if ( nStat < 0) { // se la testa può ruotare
|
||||
|
||||
// se la testa può ruotare
|
||||
if ( nStat < 0) {
|
||||
|
||||
// inizio a scorrere tutti i tools
|
||||
for ( int t = 0 ; t < ( int)vTools.size() ; ++t) {
|
||||
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) {
|
||||
for ( int j = 0 ; j < ( int)vHoles.size() ; ++ j) {
|
||||
|
||||
Hole Hole_j = vHoles[j].hole ;
|
||||
if ( i == j
|
||||
|| vHoles[j].bSkipToAngle
|
||||
|| ! AreSameVectorApprox( Hole_j.vtDir, Hole_i.vtDir)
|
||||
|| ! MultiHeadVerifyHole( Hole_j, vTools[t].pTool, dDiamTol, m_vId[vHoles[j].nIndInSelVector]))
|
||||
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) {
|
||||
for ( int k = 0 ; k < ( int)vHoles.size() ; ++ k) {
|
||||
vHoles[k].bTempDrill = false ;
|
||||
vHoles[k].nTempTool = -1 ;
|
||||
}
|
||||
|
||||
Vector3d vtRefT = vTools[t].ptETool - vTools[nIndMT].ptETool ;
|
||||
Vector3d 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) ;
|
||||
|
||||
if(( vtRefH.Len() - vtRefT.Len()) < EPS_SMALL) { // se le distanze sono compatibili
|
||||
|
||||
// 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].ptETool ;
|
||||
Point3d ptTt = vTools[t].ptToolTip ;
|
||||
ptTt.ToLoc( frMT) ;
|
||||
Vector3d vtProjA( ptTt.x, ptTt.y, 0) ;
|
||||
|
||||
@@ -1110,15 +1136,15 @@ Drilling::CalcMask( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndMT, Vector3d
|
||||
frHMT.Rotate( frHMT.Orig(), frHMT.VersZ(), dAngle) ;
|
||||
|
||||
nDrills = 1 ; // foratura nel foro i-esimo e j-esimo
|
||||
CheckOtherHolesWithTools( vHoles, vTools, nIndMT, i, Hole_i, frMT, frHMT, dDiamTol, nDrills) ;
|
||||
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 == nExit - nNullTools) {
|
||||
for ( int d = 0 ; d < ( int)vHoles.size() ; ++d) {
|
||||
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
|
||||
@@ -1128,8 +1154,8 @@ Drilling::CalcMask( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndMT, Vector3d
|
||||
}
|
||||
}
|
||||
else {
|
||||
for( int d = 0 ; d < ( int)vHoles.size() ; ++d)
|
||||
if( vHoles[d].bTempDrill)
|
||||
for ( int d = 0 ; d < ( int)vHoles.size() ; ++ d)
|
||||
if ( vHoles[d].bTempDrill)
|
||||
vHoles[d].bTempDrill = false ;
|
||||
}
|
||||
|
||||
@@ -1145,38 +1171,38 @@ Drilling::CalcMask( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndMT, Vector3d
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::CheckOtherHolesWithTools( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP, Frame3d frMT,
|
||||
Frame3d frHMT, double dDiamTol, int& nDrills) {
|
||||
|
||||
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(( int)vHoles.size() < 1 || vTools.size() < 1)
|
||||
if ( vHoles.empty() || vTools.empty())
|
||||
return true ;
|
||||
if( nIndTM >= ( int)vTools.size() || nIndTM < 0
|
||||
|| nIndHTM >= ( int)vHoles.size() || nIndHTM < 0
|
||||
|| ! frMT.IsValid() || ! frHMT.IsValid()
|
||||
|| nDrills < 0 || nDrills > max(( int)vHoles.size(), ( int)vTools.size()))
|
||||
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) {
|
||||
for ( int t = 0 ; t < ( int)vTools.size() ; ++ t) {
|
||||
if ( vTools[t].pTool == nullptr || t == nIndTM)
|
||||
continue ;
|
||||
// esprimo il punto finale del tool t-esimo nel sistema di riferimento del Tool principale
|
||||
Point3d ptETt = vTools[t].ptETool ;
|
||||
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) {
|
||||
for ( int j = 0 ; j < ( int)vHoles.size() ; ++ j) {
|
||||
Hole Hole_j = vHoles[j].hole ; // copia del foro j-esimo
|
||||
// controllo che il foro j-esimo non sia l'i-esimo, che non sia stato già precedentemente svuotato da un altro tool t'-esimo ...
|
||||
// ... che vtDir del foro i-esimo coincida con vtDir del foro j-esimo e che il tool t-esimo sia compatibile con il foro j-esimo
|
||||
if ( nIndHTM == j
|
||||
|| vHoles[j].bTempDrill
|
||||
|| ! AreSameVectorApprox( Hole_j.vtDir, holeTM.vtDir)
|
||||
|| ! MultiHeadVerifyHole( Hole_j, vTools[t].pTool, dDiamTol, m_vId[vHoles[j].nIndInSelVector]))
|
||||
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
|
||||
@@ -1185,11 +1211,13 @@ Drilling::CheckOtherHolesWithTools( VECTORHOLE& vHoles, VECTORTOOL& vTools, int
|
||||
|
||||
// controllo la compatibilità
|
||||
if ( AreSamePointApprox( ptHj, ptETt)) {
|
||||
++nDrills ; // un foro in più svuotato
|
||||
// un foro in più lavorato
|
||||
++ nDrills ;
|
||||
// aggiorno le variabili temporanee
|
||||
vHoles[j].bTempDrill = true ;
|
||||
vHoles[j].nTempTool = t ;
|
||||
break ; // non controllo gli altri vertici per la punta t-esima
|
||||
// non controllo gli altri vertici per la punta t-esima
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1199,10 +1227,10 @@ Drilling::CheckOtherHolesWithTools( VECTORHOLE& vHoles, VECTORTOOL& vTools, int
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamTol, SelData Id) {
|
||||
|
||||
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, dDiamTol))
|
||||
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 ;
|
||||
@@ -1214,7 +1242,7 @@ Drilling::MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamTol
|
||||
}
|
||||
// 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) {
|
||||
if ( ( dElev + dAddLen) > Tool->m_dMaxMat + EPS_SMALL) {
|
||||
hole.dLen = Tool->m_dMaxMat + max( hole.dLen - dElev, 0.) ;
|
||||
hole.bBlind = true ;
|
||||
}
|
||||
|
||||
+5
-5
@@ -86,11 +86,11 @@ class Drilling : public Machining
|
||||
bool VerifyHoleFromBottom( const Hole& hole, SelData Id) ;
|
||||
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double nMHOff, Vector3d vtA) ;
|
||||
bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) ;
|
||||
bool MultiHeadDrilling( int nExit, const SELVECTOR& vId, int nClId, TABMHDRILL& vDrills, double& dMHOff, bool bOrd = true) ;
|
||||
bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamTol, SelData Id) ;
|
||||
bool CalcMask( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndMT, Vector3d vtT, Vector3d vtA) ;
|
||||
bool CheckOtherHolesWithTools( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP, Frame3d frHTM,
|
||||
Frame3d frHMTOP, double dDiamTol, int& nDrills) ;
|
||||
bool MultiHeadDrilling( int nExitCnt, const SELVECTOR& vId, int nClId, TABMHDRILL& vDrills, double& dMHOff, bool bOrd = true) ;
|
||||
bool CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux) ;
|
||||
bool CheckOtherHolesWithTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP,
|
||||
const Frame3d& frHTM, const Frame3d& frHMTOP, double dDiamToler, int& nDrills) ;
|
||||
bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id) ;
|
||||
|
||||
private :
|
||||
double GetSpeed() const
|
||||
|
||||
+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.
@@ -100,7 +100,7 @@
|
||||
<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>false</OpenMPSupport>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
@@ -195,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 ;
|
||||
}
|
||||
|
||||
|
||||
@@ -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) ;
|
||||
|
||||
|
||||
+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)) ; }
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
@@ -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,6 +97,7 @@ 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 ;
|
||||
std::string GetMachGroupName( int nId) const override ;
|
||||
std::string GetMachGroupMachineName( int nId) const override ;
|
||||
@@ -203,6 +206,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 +305,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 +326,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,7 +436,6 @@ 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 ;
|
||||
|
||||
+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 ;
|
||||
}
|
||||
|
||||
+11
-1
@@ -721,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) ;
|
||||
@@ -731,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) ;
|
||||
}
|
||||
|
||||
|
||||
+49
-3
@@ -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)
|
||||
@@ -298,14 +344,14 @@ 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 ;
|
||||
return GDB_ID_NULL ;
|
||||
bool bIter = pIter->GoToFirstGroupInGroup( m_nMachBaseId) ;
|
||||
while( bIter) {
|
||||
// verifico il nome
|
||||
|
||||
+1
-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) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -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)
|
||||
|
||||
+69
-7
@@ -441,8 +441,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 +466,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 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -643,9 +659,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 +701,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 +976,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 +1034,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 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -81,7 +81,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 ;
|
||||
@@ -215,9 +215,12 @@ class Machine
|
||||
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 ;
|
||||
@@ -325,6 +328,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)) ;
|
||||
|
||||
+16
-8
@@ -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) ;
|
||||
@@ -245,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()) {
|
||||
@@ -263,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))
|
||||
@@ -303,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) ;
|
||||
@@ -310,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) ;
|
||||
@@ -494,8 +502,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())
|
||||
@@ -958,8 +968,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)) {
|
||||
@@ -1481,10 +1491,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 ;
|
||||
}
|
||||
|
||||
@@ -1579,6 +1586,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) ;
|
||||
|
||||
+90
-7
@@ -44,6 +44,7 @@ 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" ;
|
||||
@@ -661,7 +662,7 @@ Machine::LuaEmtMultiHead( lua_State* L)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_HSET, sHSet)
|
||||
// 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 +677,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)
|
||||
@@ -713,7 +714,7 @@ Machine::LuaEmtMultiHead( lua_State* L)
|
||||
// carico i dati della testa multipla
|
||||
if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, 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 +798,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 +854,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,7 +1478,7 @@ 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]
|
||||
// 4, ..., 31 parametri : nMoveType, sAx1, dPos1, dStep1 [, sAx2, dPos2, dStep2] ... [, sAx10, dPos10, dStep10]
|
||||
int nMoveType ;
|
||||
LuaCheckParam( L, 1, nMoveType)
|
||||
string sAx1 ;
|
||||
@@ -1406,7 +1489,7 @@ Machine::LuaEmtMoveAxes( lua_State* L)
|
||||
LuaCheckParam( L, 4, dStep1) ;
|
||||
SAMVECTOR vAxNaEpSt ;
|
||||
vAxNaEpSt.emplace_back( sAx1, dEnd1, dStep1) ;
|
||||
for ( int i = 0 ; i < 4 ; ++ i) {
|
||||
for ( int i = 0 ; i < 9 ; ++ i) {
|
||||
int nInd = 5 + 3 * i ;
|
||||
string sAxN ;
|
||||
double dEndN ;
|
||||
|
||||
+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)) ;
|
||||
}
|
||||
|
||||
+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] ;
|
||||
}
|
||||
|
||||
+438
-303
File diff suppressed because it is too large
Load Diff
@@ -98,20 +98,21 @@ class Milling : public Machining
|
||||
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, const Vector3d& vtTool,
|
||||
double dSafeZ, double dEndElev, double dAppr) ;
|
||||
double dSafeZ, double dSawEndElev, double dEndElev, double dAppr) ;
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
|
||||
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) ;
|
||||
@@ -146,6 +147,9 @@ class Milling : public Machining
|
||||
bool IsLeadInHelixOrZigzag() const
|
||||
{ int nType = GetLeadInType() ;
|
||||
return ( nType == MILL_LI_ZIGZAG || nType == MILL_LI_HELIX) ; }
|
||||
bool IsLeadInHelixOrZigzagOrGlide() const
|
||||
{ int nType = GetLeadInType() ;
|
||||
return ( nType == MILL_LI_ZIGZAG || nType == MILL_LI_HELIX || nType == MILL_LI_GLIDE) ; }
|
||||
bool LeadInRawIsOk( void) const
|
||||
{ if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0)
|
||||
return false ;
|
||||
|
||||
+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)) ; }
|
||||
|
||||
@@ -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) ;
|
||||
|
||||
|
||||
+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)) ; }
|
||||
|
||||
+518
-88
@@ -22,6 +22,7 @@
|
||||
#include "/EgtDev/Include/EGkAngle.h"
|
||||
#include "/EgtDev/Include/EGkBBox1d.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkArcSpecial.h"
|
||||
@@ -32,10 +33,12 @@
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
#include "/EgtDev/Include/EGkCDeBoxClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkCAvToolSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -314,7 +317,7 @@ Operation::GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2,
|
||||
double dElevS = 0 ;
|
||||
// faccio test con un insieme di punti ( !!! sostituire con intersezione tra rettangolo e trimesh !!!)
|
||||
const double STEP = 50 ;
|
||||
int nStep = max( (int) ceil( ApproxDist( ptP1L, ptP2L) / STEP), 3) ;
|
||||
int nStep = max( (int) ceil( ApproxDist( ptP1L, ptP2L) / STEP), 2) ;
|
||||
for ( int i = 0 ; i <= nStep ; ++ i) {
|
||||
// calcolo punto di test
|
||||
double dFraz = i / (double) nStep ;
|
||||
@@ -382,59 +385,96 @@ bool
|
||||
Operation::GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad,
|
||||
const Vector3d& vtDir, double& dElev) const
|
||||
{
|
||||
const double STD_TOOL_LEN = 100 ;
|
||||
return GetElevation( nPhase, ptP, vtTool, dRad, STD_TOOL_LEN, vtDir, dElev) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen,
|
||||
const Vector3d& vtDir, double& dElev) const
|
||||
{
|
||||
// risultato di default
|
||||
dElev = 0 ;
|
||||
// verifico oggetti base
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// vettore grezzi interessati
|
||||
INTVECTOR vRawStmId ;
|
||||
// considero il punto centrale
|
||||
if ( ! GetElevation( nPhase, ptP, vtDir, dElev, vRawStmId))
|
||||
return false ;
|
||||
// considero più posizioni sulla circonferenza
|
||||
const int MIN_STEP = 9 ;
|
||||
const int MAX_STEP = 127 ;
|
||||
const double LEN_STEP = 12.5 ;
|
||||
int nStep = Clamp( 2 * int( ( PIGRECO * dRad) / LEN_STEP) + 1, MIN_STEP, MAX_STEP) ;
|
||||
Vector3d vtRad = FromUprightOrtho( vtTool) * dRad ;
|
||||
for ( int i = 0 ; i < nStep ; ++ i) {
|
||||
double dElevT = 0 ;
|
||||
if ( ! GetElevation( nPhase, ptP + vtRad, vtDir, dElevT, vRawStmId))
|
||||
return false ;
|
||||
dElev = max( dElev, dElevT) ;
|
||||
// passo alla direzione successiva
|
||||
vtRad.Rotate( vtTool, ANG_FULL / nStep) ;
|
||||
}
|
||||
// considero i vertici che cadono entro il cilindro positivo spazzato dal fondo utensile
|
||||
for ( auto nRawStmId : vRawStmId) {
|
||||
// recupero la superficie
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nRawStmId)) ;
|
||||
if ( pStm != nullptr) {
|
||||
// recupero il riferimento della trimesh
|
||||
Frame3d frStm ;
|
||||
m_pGeomDB->GetGlobFrame( nRawStmId, frStm) ;
|
||||
// ciclo sui vertici
|
||||
Point3d ptV ;
|
||||
int nV = pStm->GetFirstVertex( ptV) ;
|
||||
while ( nV != SVT_NULL) {
|
||||
ptV.ToGlob( frStm) ;
|
||||
double dDist = ( ptV - ptP) * vtDir ;
|
||||
if ( dDist > EPS_ZERO) {
|
||||
if ( AreSameOrOppositeVectorApprox( vtTool, vtDir)) {
|
||||
Vector3d vtOrtho = OrthoCompo( ptV - ptP, vtDir) ;
|
||||
if ( vtOrtho.SqLen() < dRad * dRad + EPS_ZERO)
|
||||
dElev = max( dElev, dDist) ;
|
||||
}
|
||||
else {
|
||||
Vector3d vtOrtho = OrthoCompo( ptV - ptP, vtDir) ;
|
||||
Vector3d vtMajAx = vtTool ^ vtDir ; vtMajAx.Normalize() ;
|
||||
Vector3d vtMajOrt = ParallCompo( vtOrtho, vtMajAx) ;
|
||||
Vector3d vtMinOrt = ( vtOrtho - vtMajOrt) / abs( vtTool * vtDir) ;
|
||||
if ( vtMajOrt.SqLen() + vtMinOrt.SqLen() < dRad * dRad + EPS_ZERO)
|
||||
dElev = max( dElev, dDist) ;
|
||||
}
|
||||
// inizializzo elevazioni per ogni grezzo
|
||||
INTDBLVECTOR vRawElev ;
|
||||
// ciclo sui grezzi della fase
|
||||
int nRawId = m_pMchMgr->GetFirstRawPart() ;
|
||||
while ( nRawId != GDB_ID_NULL) {
|
||||
// verifico che il grezzo compaia nella fase
|
||||
if ( m_pMchMgr->VerifyRawPartPhase( nRawId, nPhase)) {
|
||||
// recupero la trimesh del grezzo
|
||||
int nStmId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nStmId)) ;
|
||||
if ( pStm != nullptr) {
|
||||
// recupero il riferimento della trimesh
|
||||
Frame3d frStm ;
|
||||
m_pGeomDB->GetGlobFrame( nStmId, frStm) ;
|
||||
// porto posizione e direzioni in questo riferimento
|
||||
Point3d ptPL = GetToLoc( ptP, frStm) ;
|
||||
Vector3d vtToolL = GetToLoc( vtTool, frStm) ;
|
||||
Vector3d vtDirL = GetToLoc( vtDir, frStm) ;
|
||||
// determino quanto allontanarsi
|
||||
PtrOwner<ICAvToolSurfTm> pCAvTlStm( CreateCAvToolSurfTm()) ;
|
||||
if ( IsNull( pCAvTlStm))
|
||||
return false ;
|
||||
pCAvTlStm->SetStdTool( dLen, dRad, 0) ;
|
||||
pCAvTlStm->SetSurfTm( *pStm) ;
|
||||
double dDist = 0 ;
|
||||
// non è ammesso un angolo oltre 90deg tra direzione utensile e vettore movimento
|
||||
if ( vtToolL * vtDirL < 0) {
|
||||
// il tip utensile è qui il naso mandrino per Collision Avoid
|
||||
if ( ! pCAvTlStm->TestPosition( ptPL, -vtToolL, vtDirL, dDist))
|
||||
return false ;
|
||||
}
|
||||
nV = pStm->GetNextVertex( nV, ptV) ;
|
||||
else {
|
||||
// per Collision Avoid il punto di riferimento non è il tip dell'utensile ma il naso mandrino
|
||||
if ( ! pCAvTlStm->TestPosition( ptPL + dLen * vtToolL, vtToolL, vtDirL, dDist))
|
||||
return false ;
|
||||
}
|
||||
if ( dDist > EPS_SMALL)
|
||||
vRawElev.emplace_back( nStmId, dDist) ;
|
||||
}
|
||||
}
|
||||
// passo al grezzo successivo
|
||||
nRawId = m_pMchMgr->GetNextRawPart( nRawId) ;
|
||||
}
|
||||
// se trovate elevazioni
|
||||
if ( ! vRawElev.empty()) {
|
||||
// ordino il vettore secondo l'elevazione crescente
|
||||
sort( vRawElev.begin(), vRawElev.end(), []( const INTDBL& a, const INTDBL& b)
|
||||
{ return a.second < b.second ; }) ;
|
||||
// box dell'utensile nella posizione iniziale
|
||||
BBox3d b3Tool ;
|
||||
b3Tool.Add( ptP) ;
|
||||
b3Tool.Add( ptP + dLen * vtTool) ;
|
||||
if ( vtTool.IsX())
|
||||
b3Tool.Expand( 0, dRad, dRad) ;
|
||||
else if ( vtTool.IsY())
|
||||
b3Tool.Expand( dRad, 0, dRad) ;
|
||||
else if ( vtTool.IsZ())
|
||||
b3Tool.Expand( dRad, dRad, 0) ;
|
||||
else {
|
||||
double dExpandX = dRad * sqrt( 1 - vtTool.x * vtTool.x) ;
|
||||
double dExpandY = dRad * sqrt( 1 - vtTool.y * vtTool.y) ;
|
||||
double dExpandZ = dRad * sqrt( 1 - vtTool.z * vtTool.z) ;
|
||||
b3Tool.Expand( dExpandX, dExpandY, dExpandZ) ;
|
||||
}
|
||||
b3Tool.Expand( MAX_DIST_RAW) ;
|
||||
// verifico la reale interferenza dell'utensile con i diversi grezzi
|
||||
for ( int i = 0 ; i < int( vRawElev.size()) ; ++ i) {
|
||||
// box del grezzo
|
||||
BBox3d b3Raw ;
|
||||
m_pGeomDB->GetGlobalBBox( vRawElev[i].first, b3Raw) ;
|
||||
// confronto con il box dell'utensile nella posizione precedente
|
||||
BBox3d b3CurrTool = b3Tool ;
|
||||
b3CurrTool.Translate( dElev * vtDir) ;
|
||||
if ( b3Raw.Overlaps( b3CurrTool))
|
||||
dElev = vRawElev[i].second ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -442,19 +482,27 @@ Operation::GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen,
|
||||
Operation::GetElevation( int nPhase, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtTool, double dRad, double dLen,
|
||||
const Vector3d& vtDir, double& dElev) const
|
||||
{
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// sopra e sotto
|
||||
double dElev1, dElev2 ;
|
||||
if ( ! GetElevation( nPhase, ptP, vtTool, dRad, vtDir, dElev1))
|
||||
return false ;
|
||||
if ( ! GetElevation( nPhase, ptP + dLen * vtTool, vtTool, dRad, vtDir, dElev2))
|
||||
return false ;
|
||||
dElev = max( dElev1, dElev2) ;
|
||||
return true ;
|
||||
// risultato di default
|
||||
bool bOk = false ;
|
||||
dElev = 0 ;
|
||||
// faccio test sui punti dall'inizio alla fine
|
||||
const double STEP = 50 ;
|
||||
int nStep = max( (int) ceil( ApproxDist( ptS, ptE) / STEP), 2) ;
|
||||
for ( int i = 0 ; i <= nStep ; ++ i) {
|
||||
// calcolo punto di test
|
||||
double dFraz = i / (double) nStep ;
|
||||
Point3d ptP = Media( ptS, ptE, dFraz) ;
|
||||
// eseguo il calcolo
|
||||
double dCurrElev ;
|
||||
if ( GetElevation( nPhase, ptP, vtTool, dRad, dLen, vtDir, dCurrElev)) {
|
||||
bOk = true ;
|
||||
dElev = max( dElev, dCurrElev) ;
|
||||
}
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -496,17 +544,17 @@ Operation::GetAhPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, doubl
|
||||
// determino elevazione del punto rispetto al grezzo a metà altezza
|
||||
Point3d ptTest( ptP.x, ptP.y, dRawCentZ) ;
|
||||
double dNewElev ;
|
||||
if ( GetElevation( m_nPhase, ptTest - 10 * EPS_SMALL * vtTool, vtTool, dToolRadForElev, vtMyDir, dNewElev))
|
||||
if ( GetElevation( m_nPhase, ptTest, vtTool, dToolRadForElev, vtMyDir, dNewElev))
|
||||
dElev = max( dElev, dNewElev) ;
|
||||
// se direzione di fuga quasi orizzontale (max 30 deg) e ingombro utensile rilevante rispetto ad altezza grezzo
|
||||
if ( vtMyDir.z < 0.5 && dToolDimZ > dRawDimZ / 2) {
|
||||
// determino elevazione del punto rispetto al grezzo a metà altezza più metà ingombro utensile
|
||||
ptTest = Point3d( ptP.x, ptP.y, dRawCentZ + dToolDimZ / 2) ;
|
||||
if ( GetElevation( m_nPhase, ptTest - 10 * EPS_SMALL * vtTool, vtTool, dToolRadForElev, vtMyDir, dNewElev))
|
||||
if ( GetElevation( m_nPhase, ptTest, vtTool, dToolRadForElev, vtMyDir, dNewElev))
|
||||
dElev = max( dElev, dNewElev) ;
|
||||
// determino elevazione del punto rispetto al grezzo a metà altezza meno metà ingombro utensile
|
||||
ptTest = Point3d( ptP.x, ptP.y, dRawCentZ - dToolDimZ / 2) ;
|
||||
if ( GetElevation( m_nPhase, ptTest - 10 * EPS_SMALL * vtTool, vtTool, dToolRadForElev, vtMyDir, dNewElev))
|
||||
if ( GetElevation( m_nPhase, ptTest, vtTool, dToolRadForElev, vtMyDir, dNewElev))
|
||||
dElev = max( dElev, dNewElev) ;
|
||||
}
|
||||
return true ;
|
||||
@@ -517,6 +565,269 @@ Operation::GetAhPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, doubl
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool IsPointOnBox( BBox3d BBox, Point3d pt) {
|
||||
|
||||
if ( BBox.IsEmpty())
|
||||
return false ;
|
||||
|
||||
int nCheck = 0 ;
|
||||
if (( pt.x - BBox.GetMin().x) < EPS_SMALL)
|
||||
++ nCheck ;
|
||||
if (( pt.y - BBox.GetMin().y) < EPS_SMALL)
|
||||
++ nCheck ;
|
||||
if (( pt.z - BBox.GetMin().z) < EPS_SMALL)
|
||||
++ nCheck ;
|
||||
if (( pt.x - BBox.GetMax().x) < EPS_SMALL)
|
||||
++ nCheck ;
|
||||
if (( pt.y - BBox.GetMax().y) < EPS_SMALL)
|
||||
++ nCheck ;
|
||||
if (( pt.z - BBox.GetMax().z) < EPS_SMALL)
|
||||
++ nCheck ;
|
||||
|
||||
if ( nCheck >= 2)
|
||||
return true ;
|
||||
|
||||
return false ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetSignedDistFromStmRaw( int nPhase, const Point3d ptP, const Vector3d vtDir,
|
||||
double& dDist, Vector3d& vtNorm) const
|
||||
{
|
||||
|
||||
// controllo MachManager e database geometrico
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
|
||||
// la distanza negativa se il punto interno, positiva se esterno, 0 se sulla suprificie
|
||||
const double RAY_LEN = 100000 ;
|
||||
bool bIsInside = false ; // se punto interno ad un RawPart
|
||||
bool bIsPointOn = false ; // se il punto stato trovato su una faccia
|
||||
bool bIsOnLoop = false ; // se il punto su un loop
|
||||
bool bIsOnBox = false ; // se il punto su un Box3D
|
||||
bool bSkip = false ; // se salto controlli sui bordi
|
||||
|
||||
// vettore dei grezzi
|
||||
ISURFTMPOVECTOR vSrfRawPart ;
|
||||
|
||||
int nRawId = m_pMchMgr->GetFirstRawPart() ;
|
||||
while( nRawId != GDB_ID_NULL) {
|
||||
|
||||
// verifico che il grezzo compaia nella fase
|
||||
if ( m_pMchMgr->VerifyRawPartPhase( nRawId, nPhase)) {
|
||||
|
||||
// recupero l'oggetto dal database con tale Id
|
||||
int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
|
||||
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( nRawSolidId) ;
|
||||
|
||||
// recupero il frame in cui si trova
|
||||
Frame3d frRaw ;
|
||||
m_pGeomDB->GetGlobFrame( nRawSolidId, frRaw) ;
|
||||
if ( pGObj == nullptr)
|
||||
return false ;
|
||||
|
||||
// controllo che sia una Trimesh
|
||||
if ( pGObj->GetType() == SRF_TRIMESH) {
|
||||
|
||||
// Trimesh della parte p-esima
|
||||
PtrOwner<ISurfTriMesh> pStmRawPart( CloneSurfTriMesh( GetSurfTriMesh( pGObj))) ;
|
||||
if ( IsNull( pStmRawPart))
|
||||
return false ;
|
||||
|
||||
// porto la trimesh in globale
|
||||
pStmRawPart->ToGlob( frRaw) ;
|
||||
|
||||
// salvo la superificie
|
||||
vSrfRawPart.emplace_back( pStmRawPart->Clone()) ;
|
||||
|
||||
// distanza dalla parte p-esima
|
||||
double dCurrDist = 0 ;
|
||||
|
||||
// recupero la distanza tra il punto e la parte p-esima
|
||||
DistPointSurfTm distPtStm( ptP, *pStmRawPart) ;
|
||||
if ( ! distPtStm.GetDist( dCurrDist))
|
||||
return false ;
|
||||
|
||||
// controllo se il punto dentro al grezzo
|
||||
if ( distPtStm.IsPointInside()) {
|
||||
bIsInside = true ;
|
||||
bSkip = true ;
|
||||
}
|
||||
|
||||
if ( dCurrDist < EPS_SMALL && !bSkip) {
|
||||
// controllo se sono su un Loop
|
||||
POLYLINEVECTOR vP ;
|
||||
bool bIsCurrOnLoop = false ;
|
||||
for ( int i = 0 ; i < pStmRawPart->GetFacetCount() ; ++ i) {
|
||||
pStmRawPart->GetFacetLoops( i, vP) ;
|
||||
for ( int j = 0 ; j < ( int)vP.size() && !bIsCurrOnLoop ; ++ j) {
|
||||
PtrOwner<ICurveComposite> pCrvEdge( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvEdge))
|
||||
return false ;
|
||||
pCrvEdge->FromPolyLine( vP[j]) ;
|
||||
if ( !pCrvEdge->IsValid() || pCrvEdge->GetCurveCount() == 0)
|
||||
return false ;
|
||||
if ( pCrvEdge->IsPointOn( ptP))
|
||||
bIsCurrOnLoop = true ;
|
||||
}
|
||||
}
|
||||
|
||||
// se il punto sta sulla curva...
|
||||
if ( bIsCurrOnLoop) {
|
||||
if ( bIsOnLoop) { // se ho gi trovato una curva che contiene il punto ...
|
||||
BBox3d bCurrBox ;
|
||||
if ( ! pStmRawPart->GetBBox( GLOB_FRM, bCurrBox))
|
||||
return false ;
|
||||
|
||||
if ( IsPointOnBox( bCurrBox, ptP)) { // se il punto sta sul Box
|
||||
if ( bIsOnBox) { // se il punto stava gi su un altro Box
|
||||
bIsInside = false ;
|
||||
bSkip = true ;
|
||||
}
|
||||
else // se il punto non stava gi su un box
|
||||
bIsInside = true ;
|
||||
|
||||
bSkip = true ;
|
||||
}
|
||||
else // se il punto non sta sul box
|
||||
bIsInside = true ;
|
||||
|
||||
}
|
||||
else { // se la prima curva a contenere il punto
|
||||
bIsPointOn = true ;
|
||||
// controllo se il punto sta sulla faccia del box del grezzo corrente
|
||||
BBox3d bCurrBox ;
|
||||
if ( ! pStmRawPart->GetBBox( GLOB_FRM, bCurrBox))
|
||||
return false ;
|
||||
// controllo se il punto sta su una faccia del box
|
||||
if ( IsPointOnBox( bCurrBox, ptP))
|
||||
bIsOnBox = true ;
|
||||
}
|
||||
}
|
||||
// se il punto non sta sulla curva ...
|
||||
else {
|
||||
if ( bIsPointOn) {
|
||||
bIsInside = true ;
|
||||
bSkip = true ;
|
||||
}
|
||||
else
|
||||
bIsPointOn = true ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// passo al grezzo successivo
|
||||
nRawId = m_pMchMgr->GetNextRawPart( nRawId) ;
|
||||
}
|
||||
|
||||
if ( bSkip) {
|
||||
bIsPointOn = false ;
|
||||
bIsOnLoop = false ;
|
||||
bIsOnBox = false ;
|
||||
}
|
||||
|
||||
double dCurrDist = bIsInside ? -INFINITO : INFINITO ; // distanza attuale
|
||||
dDist = dCurrDist ;
|
||||
double dTmpCurrDist = 0 ;
|
||||
|
||||
for ( int i = 0 ; i < ( int)vSrfRawPart.size() ; ++ i) {
|
||||
|
||||
ILSIVECTOR vInfo ; // info
|
||||
Triangle3d Tria ; // triangolo della trimesh intersecato
|
||||
|
||||
// recupero la distanza tra il punto e la parte p-esima
|
||||
if ( IntersLineSurfTm( ptP, vtDir, RAY_LEN, *vSrfRawPart[i], vInfo)) {
|
||||
|
||||
if (( int)vInfo.size() == 0)
|
||||
continue ;
|
||||
|
||||
DistPointSurfTm distPtStm( ptP, *vSrfRawPart[i]) ;
|
||||
if( ! distPtStm.GetDist( dTmpCurrDist))
|
||||
return false ;
|
||||
|
||||
if (( bIsPointOn && !bIsInside)) { // punto sulla superificie totale dei grezzi
|
||||
// se il grezzo quello giusto ...
|
||||
if ( dTmpCurrDist < EPS_SMALL) {
|
||||
dDist = 0 ;
|
||||
vSrfRawPart[i]->GetTriangle( vInfo[0].nT, Tria) ;
|
||||
vtNorm = Tria.GetN() ;
|
||||
return true ;
|
||||
}
|
||||
else { // se sono su un altro ... ( prima o poi ritorno al controllo sopra ...)
|
||||
}
|
||||
}
|
||||
else if (( int)vInfo.size() == 1 && bIsInside) {
|
||||
if ( distPtStm.IsPointInside() || dTmpCurrDist < EPS_SMALL) {
|
||||
// se punto interno alla grezzo corrente
|
||||
double dUCurr = vInfo[0].dU ;
|
||||
// se direzione || ad una faccia faccia, ma punto non interno al grezzo corrente
|
||||
if ( vInfo[0].nILTT == ILTT_SEGM || vInfo[0].nILTT == ILTT_EDGE)
|
||||
double dUCurr = - vInfo[0].dU2 ;
|
||||
if ( dUCurr > dCurrDist) {
|
||||
dCurrDist = dUCurr ;
|
||||
vSrfRawPart[i]->GetTriangle( vInfo[0].nT, Tria) ;
|
||||
vtNorm = Tria.GetN() ;
|
||||
}
|
||||
}
|
||||
else { // se interno ma non al grezzo corrente ( prima o poi ritono al controllo sopra )
|
||||
}
|
||||
}
|
||||
else if (( int)vInfo.size() > 1) { // se la linea trapassa il grezzo corrente (entra ed esce)...
|
||||
if ( bIsInside) { // e il punto interno ( quindi non al grezzo corrente )
|
||||
double dUCurr = 0 ;
|
||||
int nT ;
|
||||
for ( int j = 0 ; j < ( int)vInfo.size() ; ++ j) {
|
||||
IntLinStmInfo Info = vInfo[j] ;
|
||||
if ( Info.nILTT == ILTT_SEGM || Info.nILTT == ILTT_SEGM_ON_EDGE) {
|
||||
// se prosegue un tratto precedente, non devo controllare sia minimo
|
||||
dUCurr = Info.dU2 ;
|
||||
nT = Info.nT ;
|
||||
//break ; ???????
|
||||
}
|
||||
// se altrimenti intersezione puntuale, verifico che esca (coseno >= 0)
|
||||
else if ( Info.dCosDN > - COS_ORTO_ANG_ZERO) {
|
||||
dUCurr = Info.dU ;
|
||||
nT = Info.nT ;
|
||||
break ;
|
||||
}
|
||||
// se altrimenti la prima ed entra ( non la considero ...)
|
||||
else {
|
||||
}
|
||||
|
||||
}
|
||||
if ( dUCurr > dCurrDist) { // tengo la distanza pi grande
|
||||
dCurrDist = dUCurr ;
|
||||
vSrfRawPart[i]->GetTriangle( nT, Tria) ;
|
||||
vtNorm = Tria.GetN() ;
|
||||
}
|
||||
}
|
||||
else { // se invece un punto esterno a tutto
|
||||
if ( vInfo[0].dU < dCurrDist) { // tengo la distanza ( positiva) pi grande
|
||||
dCurrDist = vInfo[0].dU ;
|
||||
vSrfRawPart[i]->GetTriangle( vInfo[0].nT, Tria) ;
|
||||
vtNorm = Tria.GetN() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( dCurrDist > INFINITO - 1 && ! bIsInside) // non ho intersecato mai nessun grezzo
|
||||
dDist = INFINITO ;
|
||||
if ( dCurrDist < -INFINITO + 1 && bIsInside) // sono interno ma non interseco un grezzo ... errore
|
||||
return false ;
|
||||
dDist = bIsInside ? - dCurrDist : dCurrDist ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetUhPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
|
||||
@@ -556,17 +867,17 @@ Operation::GetUhPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool, doubl
|
||||
// determino elevazione del punto rispetto al grezzo a metà altezza
|
||||
Point3d ptTest( ptP.x, ptP.y, dRawCentZ) ;
|
||||
double dNewElev ;
|
||||
if ( GetElevation( m_nPhase, ptTest - 10 * EPS_SMALL * vtTool, vtTool, dToolRadForElev, vtMyDir, dNewElev))
|
||||
if ( GetElevation( m_nPhase, ptTest, vtTool, dToolRadForElev, vtMyDir, dNewElev))
|
||||
dElev = max( dElev, dNewElev) ;
|
||||
// se direzione di fuga quasi orizzontale (max 30 deg) e ingombro utensile rilevante rispetto ad altezza grezzo
|
||||
if ( vtMyDir.z > -0.5 && dToolDimZ > dRawDimZ / 2) {
|
||||
// determino elevazione del punto rispetto al grezzo a metà altezza più metà ingombro utensile
|
||||
ptTest = Point3d( ptP.x, ptP.y, dRawCentZ + dToolDimZ / 2) ;
|
||||
if ( GetElevation( m_nPhase, ptTest - 10 * EPS_SMALL * vtTool, vtTool, dToolRadForElev, vtMyDir, dNewElev))
|
||||
if ( GetElevation( m_nPhase, ptTest, vtTool, dToolRadForElev, vtMyDir, dNewElev))
|
||||
dElev = max( dElev, dNewElev) ;
|
||||
// determino elevazione del punto rispetto al grezzo a metà altezza meno metà ingombro utensile
|
||||
ptTest = Point3d( ptP.x, ptP.y, dRawCentZ - dToolDimZ / 2) ;
|
||||
if ( GetElevation( m_nPhase, ptTest - 10 * EPS_SMALL * vtTool, vtTool, dToolRadForElev, vtMyDir, dNewElev))
|
||||
if ( GetElevation( m_nPhase, ptTest, vtTool, dToolRadForElev, vtMyDir, dNewElev))
|
||||
dElev = max( dElev, dNewElev) ;
|
||||
}
|
||||
return true ;
|
||||
@@ -652,8 +963,12 @@ Operation::GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3
|
||||
IntersCurveCurve intCC( *pRay, *pOut) ;
|
||||
int nInters = intCC.GetIntersCount() ;
|
||||
IntCrvCrvInfo aInfo ;
|
||||
if ( nInters > 0 && intCC.GetIntCrvCrvInfo( nInters - 1, aInfo))
|
||||
dDist = aInfo.IciA[0].dU * RAY_LEN - EXTRA_LEN ;
|
||||
if ( nInters > 0 && intCC.GetIntCrvCrvInfo( nInters - 1, aInfo)) {
|
||||
if ( ! aInfo.bOverlap)
|
||||
dDist = aInfo.IciA[0].dU * RAY_LEN - EXTRA_LEN ;
|
||||
else
|
||||
dDist = aInfo.IciA[1].dU * RAY_LEN - EXTRA_LEN ;
|
||||
}
|
||||
else
|
||||
dDist = 0 ;
|
||||
return true ;
|
||||
@@ -773,13 +1088,25 @@ Operation::GetDistanceFromRawBottom( int nPhase, int nPathId, double dToler, dou
|
||||
{
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero distanza da fondo dei grezzi interessati o no dal percorso
|
||||
dRbDist = 0 ;
|
||||
dAllRbDist = 0 ;
|
||||
|
||||
// ricerco grezzi interessati dal percorso
|
||||
BBox3d b3Compo ;
|
||||
if ( ! m_pGeomDB->GetGlobalBBox( nPathId, b3Compo))
|
||||
return false ;
|
||||
b3Compo.Expand( dToler, dToler, 0) ;
|
||||
return GetDistanceFromRawBottom( nPhase, b3Compo, dToler, dRbDist, dAllRbDist) ;
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetDistanceFromRawBottom( int nPhase, BBox3d& b3Test, double dToler, double& dRbDist, double& dAllRbDist) const
|
||||
{
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero distanza da fondo dei grezzi interessati o no dal percorso
|
||||
dRbDist = 0 ;
|
||||
dAllRbDist = 0 ;
|
||||
b3Test.Expand( dToler, dToler, 0) ;
|
||||
int nRawId = m_pMchMgr->GetFirstRawPart() ;
|
||||
while ( nRawId != GDB_ID_NULL) {
|
||||
// verifico che il grezzo compaia nella fase
|
||||
@@ -787,8 +1114,8 @@ Operation::GetDistanceFromRawBottom( int nPhase, int nPathId, double dToler, dou
|
||||
BBox3d b3Raw ;
|
||||
int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
|
||||
if ( m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw)) {
|
||||
double dDist = b3Compo.GetMax().z - b3Raw.GetMin().z ;
|
||||
if ( b3Compo.OverlapsXY( b3Raw) && dDist > dRbDist)
|
||||
double dDist = b3Test.GetMax().z - b3Raw.GetMin().z ;
|
||||
if ( b3Test.OverlapsXY( b3Raw) && dDist > dRbDist)
|
||||
dRbDist = dDist ;
|
||||
if ( dDist > dAllRbDist)
|
||||
dAllRbDist = dDist ;
|
||||
@@ -842,6 +1169,29 @@ Operation::GetRawGlobBox( int nPhase, const BBox3d& b3Test, double dToler, BBox3
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetCurrRawsGlobBox( BBox3d& b3Raw) const
|
||||
{
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// inizializzo box
|
||||
b3Raw.Reset() ;
|
||||
// Ciclo sui grezzi attivi
|
||||
int nRawId = m_pMchMgr->GetFirstRawPart() ;
|
||||
while ( nRawId != GDB_ID_NULL) {
|
||||
if ( m_pMchMgr->VerifyRawPartPhase( nRawId, m_nPhase)) {
|
||||
BBox3d b3OneRaw ;
|
||||
int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
|
||||
if ( m_pGeomDB->GetGlobalBBox( nRawSolidId, b3OneRaw)) {
|
||||
b3Raw.Add( b3OneRaw) ;
|
||||
}
|
||||
}
|
||||
nRawId = m_pMchMgr->GetNextRawPart( nRawId) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
inline Vector3d
|
||||
@@ -1068,6 +1418,9 @@ Operation::ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp)
|
||||
pCompo->GetExtrusion( vtExtr) ;
|
||||
double dThick = 0 ;
|
||||
pCompo->GetThickness( dThick) ;
|
||||
// recupero le proprietà temporanee
|
||||
int nProp0 = pCompo->GetTempProp( 0) ;
|
||||
int nProp1 = pCompo->GetTempProp( 1) ;
|
||||
// verifico se ci sono tante linee corte
|
||||
int nSmallLineCnt = 0 ;
|
||||
const ICurve* pCrv = pCompo->GetFirstCurve() ;
|
||||
@@ -1163,6 +1516,10 @@ Operation::ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp)
|
||||
pCompo->SetExtrusion( vtExtr) ;
|
||||
pCompo->SetThickness( dThick) ;
|
||||
|
||||
// riassegno le proprietà temporanee
|
||||
pCompo->SetTempProp( nProp0, 0) ;
|
||||
pCompo->SetTempProp( nProp1, 1) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1350,6 +1707,55 @@ Operation::CalcAndSetAxesBBox( void)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::CalcMirrorByDouble( int nClId, const std::string& sUserNotes)
|
||||
{
|
||||
// verifico se prevista lavorazione in doppio
|
||||
int nDouble ;
|
||||
if ( ! GetValInNotes( sUserNotes, "DOUBLE", nDouble) ||
|
||||
( nDouble != 1 && nDouble != 2 && nDouble != 3))
|
||||
return true ;
|
||||
|
||||
// copio gruppo di lavorazione e cambio nome
|
||||
int nDblId = m_pGeomDB->Copy( nClId, GDB_ID_NULL, nClId, GDB_AFTER) ;
|
||||
if ( nDblId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nDblId, MCH_DBL) ;
|
||||
// assegno colore di copia
|
||||
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nDblId) ;
|
||||
while ( nClPathId != GDB_ID_NULL) {
|
||||
m_pGeomDB->SetMaterial( nClPathId, GRAY) ;
|
||||
nClPathId = m_pGeomDB->GetNextGroup( nClPathId) ;
|
||||
}
|
||||
|
||||
// determino posizione del piano di mirroring
|
||||
BBox3d b3Raw ;
|
||||
Point3d ptOn ;
|
||||
if ( ! GetCurrRawsGlobBox( b3Raw) || ! b3Raw.GetCenter( ptOn))
|
||||
return false ;
|
||||
Vector3d vtNorm ;
|
||||
switch ( nDouble) {
|
||||
case 1 : vtNorm = X_AX ; break ;
|
||||
case 2 : vtNorm = Y_AX ; break ;
|
||||
case 3 : vtNorm = Z_AX ; break ;
|
||||
}
|
||||
double dPlanePos ;
|
||||
if ( GetValInNotes( sUserNotes, "MirrorAx", dPlanePos))
|
||||
ptOn = b3Raw.GetMin() + dPlanePos * vtNorm ;
|
||||
|
||||
// eseguo mirroring rispetto a piano opportuno
|
||||
m_pGeomDB->MirrorGroup( nDblId, ptOn, vtNorm) ;
|
||||
|
||||
// se presente una differenza in Z, eseguo spostamento
|
||||
double dDeltaZ ;
|
||||
if ( GetValInNotes( sUserNotes, "DeltaZ", dDeltaZ) && abs( dDeltaZ) > EPS_SMALL)
|
||||
m_pGeomDB->TranslateGlob( nDblId, Vector3d( 0, 0, dDeltaZ)) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
@@ -1548,19 +1954,15 @@ Operation::SetBlockedRotAxis( const string& sBlockedAxis) const
|
||||
int nLinAxes = m_pMchMgr->GetCurrLinAxes() ;
|
||||
int nRotAxes = m_pMchMgr->GetCurrRotAxes() ;
|
||||
// lo cerco tra i token degli assi rotanti correnti
|
||||
bool bFound = false ;
|
||||
for ( int i = 0 ; i < nRotAxes && ! bFound ; ++ i) {
|
||||
for ( int i = 0 ; i < nRotAxes ; ++ i) {
|
||||
string sAxToken ;
|
||||
if ( m_pMchMgr->GetCurrMachine()->GetCurrAxisToken( i + nLinAxes, sAxToken) &&
|
||||
sKey == Trim( sAxToken)) {
|
||||
sKey == Trim( sAxToken, " \t\r\n=")) {
|
||||
string sAxis ;
|
||||
m_pMchMgr->GetCurrMachine()->GetCurrAxisName( i + nLinAxes, sAxis) ;
|
||||
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
|
||||
bFound = true ;
|
||||
return m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
|
||||
}
|
||||
}
|
||||
if ( bFound)
|
||||
return true ;
|
||||
// lo cerco tra gli assi rotanti della macchina
|
||||
return m_pMchMgr->SetRotAxisBlock( sKey, dVal) ;
|
||||
}
|
||||
@@ -1630,7 +2032,7 @@ Operation::CalculateAxesValues( const string& sHint, bool bRotContOnNext, bool b
|
||||
for ( int i = 0 ; i < nRotAxes ; ++ i) {
|
||||
string sAxToken ;
|
||||
if ( m_pMchMgr->GetCurrMachine()->GetCurrAxisToken( nLinAxes + i, sAxToken) &&
|
||||
szKey == Trim( sAxToken)) {
|
||||
szKey == Trim( sAxToken, " \t\r\n=")) {
|
||||
double dVal ;
|
||||
if ( FromString( szVal, dVal)) {
|
||||
double dOffset = 0 ;
|
||||
@@ -1773,7 +2175,7 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
|
||||
else
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
|
||||
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
vAng1[i] = m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
}
|
||||
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente
|
||||
if ( nRStat < 0 && vAng1.size() >= 1) {
|
||||
@@ -1824,13 +2226,13 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
|
||||
else
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
|
||||
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
vAng1[i] = m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
if ( bRotContOnNext)
|
||||
vAng2[i] = AngleNearAngle( vAng2[i], vAxRotPrec[i]) ;
|
||||
else
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ;
|
||||
if ( abs( vAng2[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
vAng2[i] = m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
|
||||
}
|
||||
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente
|
||||
if ( nRStat < 0 && vAng1.size() >= 1) {
|
||||
@@ -2197,12 +2599,15 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
// Recupero box complessivo dei grezzi attivi
|
||||
BBox3d b3Raws ;
|
||||
GetCurrRawsGlobBox( b3Raws) ;
|
||||
// Se già a Zmax
|
||||
if ( bMaxZ) {
|
||||
// non devo fare alcunché
|
||||
}
|
||||
// se altrimenti richiesta risalita a Zmax
|
||||
else if ( bToZmax || ForcedZmax( vAxVal, vAxIni)) {
|
||||
else if ( bToZmax || ForcedZmax( vAxVal, vAxIni, b3Raws)) {
|
||||
// cancello eventuale risalita parziale della lavorazione precedente
|
||||
pPrevOp->RemoveRise() ;
|
||||
// aggiungo risalita a Zmax
|
||||
@@ -2433,6 +2838,9 @@ Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation*
|
||||
}
|
||||
// verifico se la testa interferisce con i pezzi o i bloccaggi sulla tavola
|
||||
else {
|
||||
// Recupero box complessivo dei grezzi attivi
|
||||
BBox3d b3Raws ;
|
||||
GetCurrRawsGlobBox( b3Raws) ;
|
||||
// recupero se ZHome è in basso
|
||||
bool bZHomeDown = GetZHomeDown() ;
|
||||
// determino la Z più alta tra le due posizioni
|
||||
@@ -2441,7 +2849,7 @@ Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation*
|
||||
DBLVECTOR vAxPrevTmp = vAxPrev ; vAxPrevTmp[2] = dTopZ ;
|
||||
DBLVECTOR vAxCurrTmp = vAxCurr ; vAxCurrTmp[2] = dTopZ ;
|
||||
// verifico se forzata risalita a Zmax
|
||||
bool bForcedZMax = ForcedZmax( vAxPrevTmp, vAxCurrTmp) ;
|
||||
bool bForcedZMax = ForcedZmax( vAxPrevTmp, vAxCurrTmp, b3Raws) ;
|
||||
// se interferisce
|
||||
if ( bForcedZMax || ! TestCollisionAvoid( vAxPrevTmp, vAxCurrTmp)) {
|
||||
// recupero HomeZ
|
||||
@@ -2898,6 +3306,21 @@ Operation::RemoveHome( void)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::RemoveClimbRiseHome( void)
|
||||
{
|
||||
// elimino le entità CLIMB, RISE e HOME delle diverse path dell'operazione
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
|
||||
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
|
||||
while ( nClPathId != GDB_ID_NULL) {
|
||||
RemoveClimb( nClPathId) ;
|
||||
RemoveRise( nClPathId) ;
|
||||
nClPathId = m_pGeomDB->GetNextGroup( nClPathId) ;
|
||||
}
|
||||
return ( nClId != GDB_ID_NULL) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const
|
||||
@@ -3101,7 +3524,7 @@ Operation::GetRotationAtZmax( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const
|
||||
Operation::ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, const BBox3d& b3Raws) const
|
||||
{
|
||||
// Recupero macchina corrente
|
||||
Machine* pMch = ( m_pMchMgr != nullptr ? m_pMchMgr->GetCurrMachine() : nullptr) ;
|
||||
@@ -3119,6 +3542,13 @@ Operation::ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const
|
||||
int nHeadId = pMch->GetCurrHead() ;
|
||||
DBLVECTOR vdVal ;
|
||||
if ( m_pGeomDB->GetInfo( nHeadId, MCH_ZMAXONROT, vdVal) && vdVal.size() >= 1 && lround(vdVal[0]) > 0) {
|
||||
// controllo altezza minima grezzi
|
||||
double dHmin = 100 * EPS_SMALL ;
|
||||
if ( vdVal.size() >= 3)
|
||||
dHmin = max( vdVal[2], dHmin) ;
|
||||
if ( b3Raws.GetDimZ() < dHmin)
|
||||
return false ;
|
||||
// controllo variazione angolare minima
|
||||
double dAngTol = 100 * EPS_ANG_SMALL ;
|
||||
if ( vdVal.size() >= 2)
|
||||
dAngTol = max( vdVal[1], dAngTol) ;
|
||||
|
||||
+11
-1
@@ -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 ;
|
||||
@@ -83,10 +84,14 @@ class Operation : public IUserObj
|
||||
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 ;
|
||||
@@ -97,8 +102,10 @@ class Operation : public IUserObj
|
||||
{ double dDummy ;
|
||||
return GetDistanceFromRawBottom( nPhase, nPathId, dToler, dRbDist, dDummy) ; }
|
||||
bool GetDistanceFromRawBottom( int nPhase, int nPathId, double dToler, double& dRbDist, double& dAllRbDist) const ;
|
||||
bool GetDistanceFromRawBottom( int nPhase, BBox3d& b3Test, double dToler, double& dRbDist, double& dAllRbDist) const ;
|
||||
bool GetRawGlobBox( int nPhase, int nPathId, double dToler, BBox3d& b3Raw) const ;
|
||||
bool GetRawGlobBox( int nPhase, const BBox3d& b3Test, double dToler, BBox3d& b3Raw) const ;
|
||||
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 ;
|
||||
@@ -108,6 +115,8 @@ class Operation : public IUserObj
|
||||
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 ;
|
||||
@@ -135,6 +144,7 @@ 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 CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const ;
|
||||
bool GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
|
||||
const DBLVECTOR& vAx2, const Vector3d& vtTool2,
|
||||
@@ -143,7 +153,7 @@ class Operation : public IUserObj
|
||||
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 ;
|
||||
|
||||
@@ -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
|
||||
|
||||
+9609
-2829
File diff suppressed because it is too large
Load Diff
+188
-60
@@ -19,6 +19,9 @@
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#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,52 +70,172 @@ class Pocketing : public Machining
|
||||
|
||||
private :
|
||||
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 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 ICurveComposite* pCompo) ;
|
||||
bool AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs, int nPathId) ;
|
||||
bool CalcZigZag( const ICurveComposite* pOffs, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||
bool OptimizedZigZag( int nPathId, const Vector3d& vtTool, double dDepth, double dSafeZ,
|
||||
Frame3d& frPocket, bool& bOptimizedZigZag, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||
bool ZigZagOptimizedNoClosedEdges( ICurveComposite* pCrvPocket, bool& bOptimizedZigZag, Vector3d& vtDir) ;
|
||||
bool ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClosedId, bool& bOptimizedZigZag, Vector3d& vtDir) ;
|
||||
bool ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag,
|
||||
bool& bOpposite, Vector3d& vtDir) ;
|
||||
bool GeneratePocketingPv( int nPathId, const ISurfTriMesh* pStm_PartVolume) ;
|
||||
bool CheckSimpleOverlap( const ICurve* pCrv, const ICurveComposite* pCrvOri, int& nStat, double dToll) ;
|
||||
bool CalcDepth( const int nId, const Vector3d& vtExtr, double dThick, double& dDepth) ;
|
||||
bool ChainCurveArray( const SELVECTOR vInds, ICURVEPOVECTOR& vpCrvs, ICRVCOMPOPOVECTOR& vCrvCompo) ;
|
||||
bool CreateStmForIntersection( ISurfTriMesh* pStm, ICRVCOMPOPOVECTOR& vCrvCompo, const Vector3d& vtN) ;
|
||||
bool CalcOffsExtensionsForCurves( const ICurveComposite* pCrvCompo, const Vector3d& vtN, double& dExt) ;
|
||||
bool GetExtendedLoopToFitStmVolume( ICurveComposite* pCrvLoop, const double& dExt, const Vector3d& vtN) ;
|
||||
bool GetCurrentPart( const Point3d& ptInside, ISurfTriMesh* pStmPart) ;
|
||||
bool SetPocketingVolume( const Point3d& ptInside, ISurfTriMesh* pStm) ;
|
||||
bool AdjustPocketingSideForVolumePart( ISurfTriMesh* pStmVolPart, const Vector3d& vtTool) ;
|
||||
bool SewingMissingFacesOnPlanes( ISurfTriMesh* pStm, const Plane3d& plPlane) ;
|
||||
bool SliceVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, ISURFFRPOVECTOR& vSrfSliced,
|
||||
std::vector<ICRVCOMPOPOVECTOR>& vCrvOEWithFlags, BOOLVECTOR& vbChangedPrec,
|
||||
VCT3DVECTOR& vVtTrasl, int& nStep, const Vector3d vtTool,
|
||||
const double dElev, const double dDepth, const double dStep) ;
|
||||
bool CalcExtraSteps( const ISurfTriMesh* pStmVol, VCT3DVECTOR& vVtTrasl, int& nStep, const double dElev,
|
||||
const double dDepth, const double dStep, INTVECTOR& vIndExtraSteps,
|
||||
ISURFTMPOVECTOR& vStmES_Edges_OC) ;
|
||||
bool CutVolumeByPlane( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const Vector3d& vtTrasl,
|
||||
const bool bIsExtraStep, ISurfFlatRegion* pSfrResult) ;
|
||||
bool ProjectVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const Vector3d& vtTrasl,
|
||||
const Vector3d& vtTraslPrec, ISurfFlatRegion* pSfrOpenProjPrec, ISurfFlatRegion* pSfr) ;
|
||||
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm, const bool bOnIsClosed = false) ;
|
||||
bool GetCurvesForOptimizedPocketing( ISurfFlatRegion* pSfr, ICRVCOMPOPOVECTOR& vCrvOEWithFlags) ;
|
||||
bool ModifySurfByOpenEdges( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrLimit) ;
|
||||
bool AdjustContourWithOpenEdges( ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vCrvIsl, const double dDiam,
|
||||
const double dOffR, const double dStep, const ISurfFlatRegion* pSfrLimit) ;
|
||||
bool AdjustOpenEdge( const ICurveComposite* pCrvCompo, const ICRVCOMPOPOVECTOR& vCrvIsland,
|
||||
const double dParS, const double dParE, const double dRad, const double dDiamJ,
|
||||
const ISurfFlatRegion* pSfrLimit, ICurveComposite* pCrvBorder) ;
|
||||
bool GetProjectionOfStmToNotPocket( const ISurfTriMesh* pStmPart, const ISurfTriMesh* pStmVol,
|
||||
const Vector3d& vtTrasl, ISurfFlatRegion* pSfrProj) ;
|
||||
bool CreateSurfFrIncidence( const ICurveComposite* pCrv, const double dRad, ISurfFlatRegion* pSfrInc) ;
|
||||
bool GetNewSfrByAnotherPocketing( ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrNoExtendedByOpenEdges,
|
||||
const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part,
|
||||
const ISurfFlatRegion* pSfrLimit) ;
|
||||
bool CalcAdaptedElevation( const Point3d& pt1, const Point3d& pt2) ;
|
||||
bool GetHomogeneousParts( ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||
bool ModifyCurveToSmoothed( ICurveComposite* pCrv, double dRightLen, double dLeftLen, bool bAsParam) ;
|
||||
bool OrderCurvesByLastPntOfPath( ICRVCOMPOPOVECTOR& vCrv, Point3d ptEnd, PNTVECTOR& vPtStart,
|
||||
VCT3DVECTOR& vVtOut, BOOLVECTOR& vbMidOut) ;
|
||||
bool SetBetterPtStartForSubChunks( ICurveComposite* pCrv0, const ISurfFlatRegion* pSrfToWork, Point3d& ptStart,
|
||||
Vector3d& vtMidOut, bool& bMidOut) ;
|
||||
bool GetOptCrvIndex( const std::vector<ICRVCOMPOPOVECTOR>& vCrvOEWithFlags, int nStep, ISurfFlatRegion* pSrfChunkFinal,
|
||||
int& nIndex) ;
|
||||
bool GetTrapezoidFromShape( const ICurveComposite* pCrvCompo, ICurveComposite* pCrvTrap, Frame3d& frTrap,
|
||||
double& dPocketSize, int& nBase, int& nSecondBase) ;
|
||||
bool CheckTrapezoidClosedEdgePosition( const ICurveComposite* pCrvCompo, const int nCrvInd, const double dDimBoxY,
|
||||
INTVECTOR& vIndClosedSides, bool& bOk,
|
||||
ICurveComposite* pCrvTrap) ;
|
||||
bool CheckSecondBaseTrapezoid( const ICurveComposite* pCrvCompo, const int nCrvInd, int& nSecondBase) ;
|
||||
bool PreparareTrapezoidTwoBases( const ICurveComposite* pCrvCompo, BBox3d BBox, const int nBase, int& nSecondBase,
|
||||
bool& bOk, ICurveComposite* pCrvTrap) ;
|
||||
bool GetSfrByStm( const ISurfTriMesh* pStm, ISurfFlatRegion* pSfr, const Plane3d plPock, const Vector3d& vtExtr,
|
||||
const double dThick, double dToll = 5 * EPS_SMALL) ;
|
||||
bool ProjectStmOnPlane( const ISurfTriMesh* pStmAbove, const Plane3d plPock, ISurfFlatRegion* pSfrProj) ;
|
||||
bool GetCoeffLinArc( const ICurveArc* pArc, double dDiam, double& dSubArc) ;
|
||||
bool GetParamOnOpenSide( const ICurveComposite* pCompo,const ICRVCOMPOPOVECTOR& vCrvIsl, Point3d& ptMid, Vector3d& vtMidOut) ;
|
||||
bool AdjustContourStart( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvIsl, bool bOrder = false) ;
|
||||
bool GetParamForPtStartOnEdge( const ICurve* pCrv, const ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvIsl,
|
||||
double& dPar) ;
|
||||
bool CheckForRemovingIsland( const ICurveComposite* pCrvIslandBorder, double dOffs, bool bRemove) ;
|
||||
bool AddZigZag( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
|
||||
VCT3DVECTOR& vVtTrasl, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool CalcZigZag( const ISurfFlatRegion* pSrfZigZag, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||
bool 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 AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bMidOpen,
|
||||
const Point3d& ptMidOpen, const Vector3d& vtMidOut, int nPathId) ;
|
||||
bool AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs, int nPathId) ;
|
||||
bool CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
|
||||
ICurveComposite* pMCrv, ICurveComposite* pRCrv, int nPathId, bool& bOptimizedTrap) ;
|
||||
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const ICurve* pCrvBound,
|
||||
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, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool AddSpiralOut( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
|
||||
VCT3DVECTOR& vVtTrasl, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool CalcSpiral( const ISurfFlatRegion* pSrfPock, int& nReg, Point3d& ptStart, 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 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, ICRVCOMPOPOVECTOR& vOffIslands,
|
||||
ICurveComposite* pCrvLink) ;
|
||||
bool CalcBoundedSmootedLink( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd, double dParMeet,
|
||||
ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink) ;
|
||||
bool ModifyBiArc( ICurve* pCrvBiArc, double dCutToll, ICurveComposite* pNewCrv) ;
|
||||
bool CutCurveByOffsets( ICurveComposite* pCurve, ICRVCOMPOPOVECTOR& vOffs) ;
|
||||
bool CutCurveToConnect( ICurveComposite* pCrvS, ICurveComposite* pCrvE, ICRVCOMPOPOVECTOR& vOffs, 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 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 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,
|
||||
@@ -125,22 +248,17 @@ 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,
|
||||
const ICurveComposite* pCompo, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
ISurfFlatRegion* pSrfChunk, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
|
||||
bool bNoneForced = false, bool bSkipControl = false) ;
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced,
|
||||
Point3d& ptP1, double& dElev) ;
|
||||
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) ;
|
||||
Point3d& ptP1, double& dElev, bool& bOppositeHome, bool bRecalcElev = true) ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ;
|
||||
bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ;
|
||||
bool AdjustContourStart( ICurveComposite* pCompo) ;
|
||||
bool VerifyLeadInHelix( const ICurveComposite* pCompo, const Point3d& ptCen, double dRad) const ;
|
||||
bool VerifyLeadInZigZag( const ICurveComposite* pCompo, const Point3d& ptPa, const Point3d& ptPb) const ;
|
||||
bool CalcDistanceFromRawSurface( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist, Vector3d& vtNorm) ;
|
||||
// ===================================================================
|
||||
|
||||
private :
|
||||
double GetSpeed( void) const
|
||||
@@ -176,21 +294,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
|
||||
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
|
||||
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 = true ; // flag per ottimizzazione numero di Offset necessari
|
||||
bool m_bOptOffsetCM = false ; // flag per ottimizzazione numero di Offset necessari con centroidi e medial Axis
|
||||
bool m_bAssignFeed = false ; // flag per controllo della Feed
|
||||
double m_dDiam_Prec = 0.0 ; // diametro utensile per precedente svuotatura
|
||||
double m_dOffsetR_Prec = 0.0 ; // offset radiale della svuotatura precedente
|
||||
double m_dSideStep_Prec = 0.0 ; // side Step della svuotatura precedente
|
||||
double m_dLen_Prec = 0.0 ; // Lunghezza del tool precedente
|
||||
bool m_bOrderStepZ = true ; // parametro per ordinare gli step Extra per Z decrescente o meno
|
||||
bool m_bPocketPlane = false ; // flag per svuotare solo la rimanenza sullo Step Extra
|
||||
|
||||
} ;
|
||||
+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)) ; }
|
||||
|
||||
+13
-2
@@ -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 ;
|
||||
}
|
||||
|
||||
@@ -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) ;
|
||||
|
||||
+9
-6
@@ -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) ;
|
||||
|
||||
@@ -979,8 +982,8 @@ 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) ;
|
||||
@@ -2400,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) ;
|
||||
@@ -2475,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)) ; }
|
||||
|
||||
+7
-4
@@ -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) ;
|
||||
|
||||
@@ -937,8 +940,8 @@ 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) ;
|
||||
@@ -1327,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)) ; }
|
||||
|
||||
+5
-2
@@ -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) ;
|
||||
|
||||
@@ -1276,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() ;
|
||||
|
||||
+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
-11
@@ -181,16 +181,12 @@ SetupMgr::Import( const string& sFileName)
|
||||
m_pMchMgr->GetCurrMachGroup() == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
// recupero il gruppo di setup
|
||||
int nSetupId = m_pMchMgr->GetCurrSetupGroupId() ;
|
||||
|
||||
// inizializzo lo scanner
|
||||
Scanner TheScanner ;
|
||||
if ( ! TheScanner.Init( sFileName, ";"))
|
||||
return false ;
|
||||
|
||||
// eseguo la lettura dei campi di attrezzaggio
|
||||
int nPos = 1 ;
|
||||
string sLine ;
|
||||
while ( TheScanner.GetLine( sLine)) {
|
||||
// salto dichiarazione sezione
|
||||
@@ -228,8 +224,6 @@ SetupMgr::Import( const string& sFileName)
|
||||
stuData.m_nExit = 0 ;
|
||||
m_vStuData.emplace_back( stuData) ;
|
||||
}
|
||||
// passo alla successiva posizione
|
||||
++ nPos ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -277,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 ;
|
||||
}
|
||||
}
|
||||
@@ -318,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 ;
|
||||
|
||||
+119
-53
@@ -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)
|
||||
@@ -123,12 +127,17 @@ 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 avvio vero
|
||||
if ( bFirst) {
|
||||
// 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() ;
|
||||
@@ -139,6 +148,7 @@ Simulator::Start( bool bFirst)
|
||||
ResetInterpolation() ;
|
||||
ResetAxes() ;
|
||||
ResetAuxAxes() ;
|
||||
|
||||
// porto la macchina in home
|
||||
if ( ! GoHome())
|
||||
bOk = false ;
|
||||
@@ -989,11 +999,21 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
|
||||
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) ;
|
||||
double dSqCoeff = (( i < 3) ? 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) ;
|
||||
@@ -1016,6 +1036,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
|
||||
@@ -1164,7 +1190,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 ;
|
||||
@@ -1282,8 +1308,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) ;
|
||||
@@ -1296,8 +1325,8 @@ 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())
|
||||
}
|
||||
@@ -1314,7 +1343,17 @@ Simulator::ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVm
|
||||
}
|
||||
}
|
||||
// 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 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1353,44 +1392,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->AvoidBox( frObj, vtDiag, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeBoxClosedSurfTm( frObj, vtDiag, m_dSafeDist, *pSTM) ;
|
||||
}
|
||||
else if ( m_CollObj[j].nType == MCH_SIM_COB_CYL) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = pVZM->AvoidCylinder( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeCylClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_dSafeDist, *pSTM) ;
|
||||
}
|
||||
else if ( m_CollObj[j].nType == MCH_SIM_COB_SPHE) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = pVZM->AvoidSphere( frObj.Orig(), m_CollObj[j].dPar1, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeSpheClosedSurfTm( frObj.Orig(), m_CollObj[j].dPar1, m_dSafeDist, *pSTM) ;
|
||||
}
|
||||
else if ( m_CollObj[j].nType == MCH_SIM_COB_CONE) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = pVZM->AvoidConeFrustum( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeConeFrustumClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist, *pSTM) ;
|
||||
}
|
||||
}
|
||||
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->AvoidSurfTm( *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 ;
|
||||
@@ -1579,8 +1636,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) ;
|
||||
@@ -1973,6 +2032,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 ;
|
||||
}
|
||||
@@ -2025,10 +2088,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) ;
|
||||
@@ -2111,6 +2171,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]) ;
|
||||
@@ -2120,10 +2181,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 ;
|
||||
@@ -2158,7 +2223,8 @@ Simulator::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||
}
|
||||
}
|
||||
// Aggiorno visualizzazione
|
||||
ExeDraw() ;
|
||||
if ( bViewAllFrames || ( i % 2) == 0 || i == nStep)
|
||||
ExeDraw() ;
|
||||
// Verifico collisioni
|
||||
int nCdInd, nObjInd ;
|
||||
bool bCollCheck = ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
|
||||
|
||||
+12
-2
@@ -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) ;
|
||||
|
||||
@@ -1328,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 ;
|
||||
}
|
||||
@@ -1669,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 ;
|
||||
}
|
||||
|
||||
|
||||
+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)) ; }
|
||||
|
||||
+7
-4
@@ -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) ;
|
||||
|
||||
@@ -2607,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) ;
|
||||
}
|
||||
@@ -2678,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