Compare commits
176 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f0e295d9d6 | |||
| 1b97ec5310 | |||
| 66c7aa5d0c | |||
| 5699de3954 | |||
| 4a1ae0de84 | |||
| ac45a259b6 | |||
| f7251bf3bd | |||
| ed1cd66164 | |||
| 054dc530fb | |||
| 9534c0342d | |||
| bf602419fc | |||
| e1ef39ad72 | |||
| 8648a2c61b | |||
| 96c96383c3 | |||
| f3ea5fed05 | |||
| a4831980e7 | |||
| ec78d61f63 | |||
| e8e757d4bd | |||
| 1dc0206bea | |||
| 614532c2a0 | |||
| 20b56583c3 | |||
| 47951fc21e | |||
| 932700d4b2 | |||
| 40f1e051a4 | |||
| c3542be20a | |||
| e1c69e207d | |||
| 67b34008c5 | |||
| 1bb839e9f4 | |||
| 083f896d50 | |||
| 83c83fb5f0 | |||
| b577dfe86b | |||
| 624bc499a2 | |||
| 79e1e9fefd | |||
| dcb3e6984f | |||
| 0722c496ac | |||
| 04a252418c | |||
| 7dd75bc14b | |||
| 3a6da43acc | |||
| dd45642748 | |||
| 97e95741b9 | |||
| 73739a2931 | |||
| 690c53a5dc | |||
| f9964a2f3c | |||
| 39b5434c22 | |||
| 00881757a7 | |||
| 4be087a16d | |||
| b6ef052c50 | |||
| 1ec2188326 | |||
| 58fe1d1f8f | |||
| 8fed51ca79 | |||
| 708fe02b9b | |||
| b418e2d3ef | |||
| 0ba49c41eb | |||
| 4925ab462c | |||
| 1f09c33e46 | |||
| f0eccf0efc | |||
| 6040a7c43d | |||
| 984f206d56 | |||
| 1ba62546b0 | |||
| d7712e133e | |||
| 6d6da429e4 | |||
| aace2ff81d | |||
| 616026d74e | |||
| 00c97b0503 | |||
| 9a749e0f20 | |||
| b88c276bb0 | |||
| 3b2b185fd1 | |||
| ed58f649f3 | |||
| 5801b85a31 | |||
| e8e8a209b1 | |||
| 9005ea481f | |||
| 0748186661 | |||
| e8099c11e0 | |||
| 561796b625 | |||
| 74996adf48 | |||
| fc29cbd471 | |||
| 22c691f9e5 | |||
| 9351b9b2d8 | |||
| 8a289d07b8 | |||
| 8ce8982ca6 | |||
| 1e6120184f | |||
| a1c50a1797 | |||
| 9389b62ff1 | |||
| cda17543fe | |||
| 66f763a772 | |||
| a1300b26b9 | |||
| ac7c5e2e93 | |||
| ab56d95f77 | |||
| 6e359a5740 | |||
| 4c5849dc7b | |||
| 97c9f10813 | |||
| fd920a2786 | |||
| 63300c9620 | |||
| 3480d3dae6 | |||
| be03fea253 | |||
| 4ab7788d6d | |||
| 2bd9b292fd | |||
| 84d21c48af | |||
| cfb8e0553d | |||
| 0c9575f754 | |||
| 04bb4165c9 | |||
| 564817122f | |||
| 37de3713ff | |||
| 117c87c2b5 | |||
| c856a2c4c2 | |||
| 2ab5a38ffb | |||
| 2973f3f627 | |||
| 46aa62244c | |||
| 2133351006 | |||
| 63381e4cc9 | |||
| 1ba961c2fc | |||
| 286a9906b7 | |||
| ae9bc56917 | |||
| 8282548bf0 | |||
| e8aa3dadd7 | |||
| 517d93ba8a | |||
| 9e16e604ec | |||
| 06261b64be | |||
| 7bad9a5cc6 | |||
| ec5590bd29 | |||
| 799aef3d5a | |||
| eab9c2085a | |||
| 4b346b39ba | |||
| 14d9819153 | |||
| d12d6bcfb6 | |||
| d83ea12f1f | |||
| 043a2043aa | |||
| 5f5c0d9a8f | |||
| d162bb58f3 | |||
| da8ba3a23f | |||
| bd1e7e04ee | |||
| 75fa4a3f90 | |||
| 34a26f7d3e | |||
| bf8fd98d8c | |||
| f36c4288d4 | |||
| d78003437d | |||
| f2a70b9fe0 | |||
| 2e5caf2def | |||
| ec021af82f | |||
| d0383b7949 | |||
| c2fc8dabf5 | |||
| ff143a7fc5 | |||
| bd03f0f259 | |||
| be7d023031 | |||
| 266f125f2d | |||
| b66db767a0 | |||
| e773b5b4f7 | |||
| 69711359f5 | |||
| b569f7c631 | |||
| ed4df55645 | |||
| 21512c7e2b | |||
| 59a2e60677 | |||
| ee01fe5516 | |||
| dcbf9a497a | |||
| e92a37aa4f | |||
| bc6c7d8745 | |||
| dc0bb1876f | |||
| ca562d1c29 | |||
| be6750fd14 | |||
| 3f8d6867e2 | |||
| 9d447b875b | |||
| 15dd5d78e3 | |||
| 8f01a11205 | |||
| 21459f66d7 | |||
| 517a1021b5 | |||
| 037c52c913 | |||
| 857e96591a | |||
| 12abb88b28 | |||
| 1be259cf25 | |||
| 56e949015f | |||
| 85b76f68ff | |||
| 156ec315e0 | |||
| e851ed0a21 | |||
| fcc2289b93 | |||
| 8066f937e2 | |||
| 7282af4d9d |
@@ -473,6 +473,8 @@ CamData::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
if ( ! m_ptCen.Mirror( ptOn, vtNorm))
|
||||
return false ;
|
||||
m_dAngCen = - m_dAngCen ;
|
||||
if ( ! m_vtN.Mirror( vtNorm))
|
||||
return false ;
|
||||
if ( ! m_vtTool.Mirror( vtNorm))
|
||||
return false ;
|
||||
if ( ! m_vtCorr.Mirror( vtNorm))
|
||||
|
||||
@@ -72,6 +72,8 @@ class CamData : public IUserObj
|
||||
{ m_bToolShow = bShow ; return true ; }
|
||||
int GetMoveType( void) const
|
||||
{ return m_nMove ; }
|
||||
bool IsRapid( void) const
|
||||
{ return ( m_nMove == 0) ; }
|
||||
bool IsLine( void) const
|
||||
{ return ( m_nMove == 0 || m_nMove == 1) ; }
|
||||
bool IsArc( void) const
|
||||
|
||||
+22
-13
@@ -44,6 +44,7 @@ using namespace std ;
|
||||
// 2910 = "Error in Chiseling : link movements not calculable"
|
||||
// 2911 = "Error in Chiseling : link outstroke xx"
|
||||
// 2912 = "Error in Chiseling : post apply not calculable"
|
||||
// 2913 = "Error in Chiseling : special apply not calculable"
|
||||
// 2951 = "Warning in Chiseling : Skipped entity (xx)"
|
||||
// 2952 = "Warning in Chiseling : Plunges not found"
|
||||
// 2953 = "Warning in Chiseling : Tool name changed (xx)"
|
||||
@@ -497,8 +498,7 @@ Chiseling::Apply( bool bRecalc, bool bPostApply)
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 2901, "Error in Chiseling : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -508,8 +508,7 @@ Chiseling::Apply( bool bRecalc, bool bPostApply)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nChisels = nCurrChisels ;
|
||||
string sLog = string( "Chiseling apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
@@ -625,6 +624,16 @@ Chiseling::Update( bool bPostApply)
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 2913, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2913, "Error in Chiseling : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -635,11 +644,11 @@ Chiseling::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 2912, sErr) ;
|
||||
// esecuzione eventuali personalizzazioni finali
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 2912, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2912, "Error in Chiseling : post apply not calculable") ;
|
||||
return false ;
|
||||
@@ -769,7 +778,7 @@ Chiseling::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Chiseling::UpdateToolData( bool* pbChanged)
|
||||
Chiseling::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
@@ -820,9 +829,9 @@ Chiseling::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 2954, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ class Chiseling : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
|
||||
+1
-1
@@ -1639,7 +1639,7 @@ Disposition::SpecialUpdate( void)
|
||||
return true ;
|
||||
}
|
||||
// calcolo assi macchina
|
||||
if ( ! CalculateAxesValues( "", false)) {
|
||||
if ( ! CalculateAxesValues( "")) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 2008, "Error in Disposition : axes values not calculable") ;
|
||||
|
||||
+9
-1
@@ -74,7 +74,13 @@ class Disposition : public Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_DISP ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ return ( m_nShifts == 0) ; }
|
||||
{ if ( m_nShifts == 0)
|
||||
return true ;
|
||||
if ( nEmptyType == NEED_ONE_TP_OK)
|
||||
return ( ! IsAtLeastOnePathOk()) ;
|
||||
if ( nEmptyType == NEED_ALL_TP_OK)
|
||||
return ( ! AreAllPathsOk()) ;
|
||||
return false ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
@@ -83,6 +89,8 @@ class Disposition : public Operation
|
||||
const std::string& GetHeadName( void) const override ;
|
||||
int GetExitNbr( void) const override ;
|
||||
const std::string& GetToolTcPos( void) const override ;
|
||||
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const override
|
||||
{ return false ; }
|
||||
int GetSolCh( void) const override
|
||||
{ return 0 ; }
|
||||
bool NeedPrevHome( void) const override ;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <string>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string GetEMkVer( void) ;
|
||||
const std::string& GetEMkVer( void) ;
|
||||
ILogger* GetEMkLogger( void) ;
|
||||
const std::string& GetEMkKey( void) ;
|
||||
bool GetEMkNetHwKey( void) ;
|
||||
|
||||
+184
-33
@@ -18,6 +18,7 @@
|
||||
#include "DllMain.h"
|
||||
#include "Drilling.h"
|
||||
#include "OperationConst.h"
|
||||
#include "OperUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EXeCmdLogOff.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
@@ -26,10 +27,12 @@
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkChainCurves.h"
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
#include "/EgtDev/Include/EGnStringKeyVal.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EGkGeoFrame3d.h"
|
||||
#include "/EgtDev/Include/EgtIniFile.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -52,6 +55,7 @@ using namespace std ;
|
||||
// 2116 = "Error in Drilling : multi drilling head without valid tools"
|
||||
// 2117 = "Error in Drilling : incorrect multi drilling head"
|
||||
// 2118 = "Error in Drilling : Tool loading failed"
|
||||
// 2119 = "Error in Drilling : special apply not calculable"
|
||||
// 2151 = "Warning in Drilling : Skipped entity (xx)"
|
||||
// 2152 = "Warning in Drilling : No machinable path"
|
||||
// 2153 = "Warning in Drilling : Tool name changed (xx)"
|
||||
@@ -614,8 +618,7 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 2101, "Error in Drilling : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -625,8 +628,7 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione e i fori non lavorati
|
||||
m_nDrillings = nCurrDrillings ;
|
||||
m_vUndrilledId = vCurrUndrilledId ;
|
||||
@@ -691,16 +693,16 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
|
||||
// assegno ingombri dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetBBox( nClId) ;
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
|
||||
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
|
||||
if ( ! Update( bPostApply))
|
||||
return false ;
|
||||
|
||||
// aggiorno stato della lavorazione
|
||||
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
|
||||
// dichiaro successiva da aggiornare
|
||||
@@ -747,6 +749,44 @@ Drilling::Update( bool bPostApply)
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// se lavorazione in doppio, calcolo assi e movimenti di approccio e retrazione relativi
|
||||
if ( GetDoubleType( m_Params.m_sUserNotes) != 0) {
|
||||
// elimino le entità CLIMB, RISE e HOME della lavorazione in doppio
|
||||
RemoveClimbRiseHome( false) ;
|
||||
// recupero i dati della testa in doppio e la imposto
|
||||
string sDblTool ; string sDblTcPos ; string sDblHead ; int nDblExit ;
|
||||
bool bOk = GetDoubleToolData( sDblTool, sDblTcPos, sDblHead, nDblExit) &&
|
||||
m_pMchMgr->SetCalcTool( sDblTool, sDblHead, nDblExit) ;
|
||||
// imposto eventuale asse bloccato da lavorazione
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis, true) ;
|
||||
// eseguo il calcolo
|
||||
if ( bOk) {
|
||||
if ( ! CalculateDoubleAxesValues( sHint)) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 2109, "Error in Drilling : axes values not calculable for double") ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2110, "Error in Drilling : double outstroke ") ;
|
||||
bOk = false ;
|
||||
}
|
||||
}
|
||||
// ripristino testa principale
|
||||
m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()) ;
|
||||
// in caso di errore, esco
|
||||
if ( ! bOk)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 2119, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2119, "Error in Drilling : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -758,10 +798,10 @@ Drilling::Update( bool bPostApply)
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 2113, sErr) ;
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 2113, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2113, "Error in Drilling : post apply not calculable") ;
|
||||
return false ;
|
||||
@@ -828,7 +868,11 @@ Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
// eseguo la lavorazione richiesta
|
||||
switch ( nDrillType) {
|
||||
case DRILL_TYPE_STD :
|
||||
{ // elaboro i singoli fori
|
||||
{ // se vtAux impostato come parametro di lavorazione nelle UserNotes
|
||||
Vector3d vtAux ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
|
||||
vtAux.Normalize() ;
|
||||
// elaboro i singoli fori
|
||||
for ( int i = 0 ; i < int( m_vId.size()) ; ++ i) {
|
||||
const auto& vId = m_vId[i] ;
|
||||
// se richiesto preview
|
||||
@@ -841,7 +885,7 @@ Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
}
|
||||
// se richiesta lavorazione
|
||||
if ( nClId != GDB_ID_NULL) {
|
||||
if ( ! GenerateHoleCl( i, vId, MCH_PATH, nClId))
|
||||
if ( ! GenerateHoleCl( i, vId, MCH_PATH, nClId, 0, vtAux))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -2348,7 +2392,7 @@ Drilling::MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamTol
|
||||
// imposto elevazione da lunghezza foro con possibilità di sovrascrittura da info
|
||||
double dElev = hole.dLen ;
|
||||
double dMaxElev ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, "MaxElev", dMaxElev) && dElev > dMaxElev) {
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MAXELEV, dMaxElev) && dElev > dMaxElev) {
|
||||
dElev = dMaxElev ;
|
||||
hole.ptIni += hole.vtDir * ( dElev - hole.dLen) ;
|
||||
hole.dLen = dElev ;
|
||||
@@ -2714,7 +2758,7 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
|
||||
// imposto elevazione da lunghezza foro con possibilità di sovrascrittura da info
|
||||
double dElev = hole.dLen ;
|
||||
double dMaxElev ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, "MaxElev", dMaxElev) && dElev > dMaxElev) {
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MAXELEV, dMaxElev) && dElev > dMaxElev) {
|
||||
dElev = dMaxElev ;
|
||||
hole.ptIni += hole.vtDir * ( dElev - hole.dLen) ;
|
||||
hole.dLen = ( hole.dLen > 10 * EPS_SMALL ? max( dElev, 10 * EPS_SMALL) : dElev) ;
|
||||
@@ -2741,8 +2785,8 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPathId, KEY_ELEV, hole.dLen) ;
|
||||
// foro normale
|
||||
if ( m_Params.m_dStep < EPS_SMALL ||
|
||||
m_Params.m_dStep > hole.dLen - EPS_SMALL) {
|
||||
if ( ( m_Params.m_dStep < EPS_SMALL || m_Params.m_dStep > hole.dLen - 10 * EPS_SMALL) &&
|
||||
GetDoubleLastStep() > hole.dLen - 10 * EPS_SMALL) {
|
||||
if ( DoStandardDrilling( hole, nCircId, nPathId, dMHOff, vtA, currToolData)) {
|
||||
// aggiorno numero forature
|
||||
++ m_nDrillings ;
|
||||
@@ -3095,7 +3139,7 @@ Drilling::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::UpdateToolData( bool* pbChanged)
|
||||
Drilling::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
@@ -3146,9 +3190,9 @@ Drilling::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 2154, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -3246,7 +3290,7 @@ Drilling::GetHoleData( SelData Id, Hole& hole)
|
||||
hole.bBlind = true ;
|
||||
// se dichiarato passante o no (1/0)
|
||||
int nOpen ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, "Open", nOpen))
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_OPEN, nOpen))
|
||||
hole.bBlind = ( nOpen == 0) ;
|
||||
// se verticale ed arriva fino al fondo grezzo, allora passante
|
||||
else if ( hole.vtDir.IsZplus() && hole.dThick > dRbDist - EPS_SMALL)
|
||||
@@ -3292,6 +3336,49 @@ Drilling::VerifyHoleFromBottom( const Hole& hole, SelData Id)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::VerifyParallelDrilling( int nDouble, const Hole& hole)
|
||||
{
|
||||
// verifico se lavorazione in doppio valida
|
||||
if ( nDouble != 1 && nDouble != 2 && nDouble != 3)
|
||||
return false ;
|
||||
|
||||
// se la macchina non presenta nel file .ini la possibilità di lavorazione in doppio parallela, esco
|
||||
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
string sMachIni = pMch->GetMachineDir() + "\\" + pMch->GetMachineName() + ".ini" ;
|
||||
int nDrillingDouble = GetPrivateProfileInt( MACHININGS_SEC.c_str(), DRILLING_PARALLEL_KEY.c_str(), 0, sMachIni.c_str()) ;
|
||||
if ( nDrillingDouble != 1)
|
||||
return false ;
|
||||
|
||||
// recupero il piano di Mirror
|
||||
Point3d ptOn ; Vector3d vtNorm ;
|
||||
if ( ! CalcMirrorPlaneByDouble( nDouble, m_Params.m_sUserNotes, ptOn, vtNorm))
|
||||
return false ;
|
||||
Plane3d plMirror ;
|
||||
if ( ! plMirror.Set( ptOn, vtNorm))
|
||||
return false ;
|
||||
|
||||
// verifico subito che la normale del piano si trovi entro un grado rispetto alla direzione del foro ( tolleranza da .BTL)
|
||||
if ( abs( hole.vtDir * vtNorm) < cos( ( 1. - EPS_ANG_SMALL) * DEGTORAD))
|
||||
return false ;
|
||||
|
||||
// se il punto finale del foro si trova nel semipiano positivo di Mirroring e sufficientemente distante da esso, non eseguo
|
||||
// lavorazione in parallelo
|
||||
Point3d ptHoleEnd = hole.ptIni - hole.dLen * hole.vtDir ;
|
||||
const double SAFE_DIST_TOL = 5. ;
|
||||
double dDist = ( ptHoleEnd - ptOn) * vtNorm ;
|
||||
if ( dDist < EPS_SMALL)
|
||||
return true ;
|
||||
double dSafeTipDist = m_TParams.m_dTLen - m_TParams.m_dLen ;
|
||||
if ( dDist < dSafeTipDist + SAFE_DIST_TOL)
|
||||
return true ;
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double dMHOff, const Vector3d& vtA, const ToolData& currToolData)
|
||||
@@ -3534,13 +3621,24 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
if ( AddRapidMove( ptP2, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// parametri per foro in doppio
|
||||
int nDouble = GetDoubleType( m_Params.m_sUserNotes) ;
|
||||
bool bDouble = ( nDouble != 0) ;
|
||||
bool bDoubleParallel = false ;
|
||||
if ( bDouble)
|
||||
bDoubleParallel = VerifyParallelDrilling( nDouble, hole) ;
|
||||
double dDoubleLastStep = GetDoubleLastStep() ;
|
||||
// ciclo di affondamento a step
|
||||
const double MIN_STEP = 1 ;
|
||||
const double APPR_STEP = 1 ;
|
||||
const double MIN_MOVE = 1 ;
|
||||
double dStep = max( m_Params.m_dStep, MIN_STEP) ;
|
||||
int nStep = int( ceil( hole.dLen / dStep)) ;
|
||||
dStep = hole.dLen / nStep ;
|
||||
double dOrigStep = max( m_Params.m_dStep, MIN_STEP) ;
|
||||
double dSteppedLen = ( bDouble ? hole.dLen - dDoubleLastStep : hole.dLen) ;
|
||||
int nStep = int( ceil( dSteppedLen / dOrigStep)) ;
|
||||
double dStep = dSteppedLen / nStep ;
|
||||
if ( bDouble)
|
||||
++ nStep ;
|
||||
double dLastStep = ( bDouble ? dDoubleLastStep : dStep) ;
|
||||
if ( dReturnPos < - dStep + APPR_STEP + MIN_MOVE)
|
||||
dReturnPos = - dStep + APPR_STEP + MIN_MOVE ;
|
||||
double dCurrLen = 0 ;
|
||||
@@ -3561,7 +3659,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
return false ;
|
||||
}
|
||||
// lunghezza di fine step
|
||||
double dEndLen = dCurrLen + dStep ;
|
||||
double dEndLen = dCurrLen + ( i == nStep ? dLastStep : dStep) ;
|
||||
// 3 -> punto termine velocità ridotta iniziale (se previsto)
|
||||
if ( bStartSlow && ( i == 1 || dCurrLen < dStartSlowLen + EPS_SMALL)) {
|
||||
// lunghezza di esecuzione
|
||||
@@ -3580,8 +3678,15 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
Point3d ptP3 = hole.ptIni - hole.vtDir * dLen ;
|
||||
if ( bHoleEnd)
|
||||
ptP3 -= hole.vtDir * dAddLen ;
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( bDoubleParallel && i == nStep) {
|
||||
SetFlag( 105) ; // movimento in doppio parallelo
|
||||
if ( AddLinearMove( ptP3, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// aggiorno posizione e verifico se step completato
|
||||
dCurrLen = dLen ;
|
||||
if ( bHoleEnd || bStepEnd)
|
||||
@@ -3605,8 +3710,15 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
Point3d ptP4 = hole.ptIni - hole.vtDir * dLen ;
|
||||
if ( bHoleEnd)
|
||||
ptP4 -= hole.vtDir * dAddLen ;
|
||||
if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( bDoubleParallel && i == nStep) {
|
||||
SetFlag( 105) ; // movimento in doppio parallelo
|
||||
if ( AddLinearMove( ptP4, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// aggiorno posizione e verifico se step completato
|
||||
dCurrLen = dLen ;
|
||||
if ( bHoleEnd || bStepEnd)
|
||||
@@ -3629,8 +3741,15 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
Point3d ptP5 = hole.ptIni - hole.vtDir * dLen ;
|
||||
if ( bHoleEnd)
|
||||
ptP5 -= hole.vtDir * dAddLen ;
|
||||
if ( AddLinearMove( ptP5, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( bDoubleParallel && i == nStep) {
|
||||
SetFlag( 105) ; // movimento in doppio parallelo
|
||||
if ( AddLinearMove( ptP5, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( AddLinearMove( ptP5, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// aggiorno posizione
|
||||
dCurrLen = dLen ;
|
||||
}
|
||||
@@ -3638,6 +3757,22 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
|
||||
// 6 -> ritorno all'approccio del foro
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( bDoubleParallel) {
|
||||
SetFlag( 105) ; // movimento in doppio parallelo
|
||||
// aggiungo risalita aggiuntiva per lavorazione in doppio pari a due volte il LastStep
|
||||
Point3d ptEnd ; GetCurrPos( ptEnd) ;
|
||||
if ( AddLinearMove( ptEnd + min( dLastStep, dCurrLen) * hole.vtDir, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFeed( GetFeed()) ;
|
||||
GetCurrPos( ptEnd) ;
|
||||
if ( AddLinearMove( ptEnd + min( dLastStep, dCurrLen) * hole.vtDir, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
// aggiungo discensa di LastStep per simmetria con secondo utensile
|
||||
GetCurrPos( ptEnd) ;
|
||||
if ( AddLinearMove( ptEnd - dLastStep * hole.vtDir, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
SetFlag( 104) ; // risalita sopra il foro
|
||||
if ( AddLinearMove( ptP1, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
@@ -3673,6 +3808,22 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
Drilling::GetDoubleLastStep( void)
|
||||
{
|
||||
// se non è foratura in doppio, restituisco valore molto grande
|
||||
const double FALSE_LASTSTEP = 10000 ;
|
||||
if ( GetDoubleType( m_Params.m_sUserNotes) == 0)
|
||||
return FALSE_LASTSTEP ;
|
||||
// recupero valore
|
||||
const double MIN_LASTSTEP = 15 ;
|
||||
double dDoubleLastStep = m_Params.m_dStep ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_LASTSTEP, dDoubleLastStep))
|
||||
dDoubleLastStep = max( dDoubleLastStep, MIN_LASTSTEP) ;
|
||||
return dDoubleLastStep ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Debug Functions
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+3
-1
@@ -80,7 +80,7 @@ class Drilling : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
bool GetSkippedGeometry( SELVECTOR& vIds) const override ;
|
||||
@@ -105,6 +105,7 @@ class Drilling : public Machining
|
||||
bool GenerateHoleRegionPv( int nFirstId, int nCount, int nPvId) ;
|
||||
bool VerifyDiameter( double dHdiam, double dTdiam, double ddiamTol) ;
|
||||
bool VerifyHoleFromBottom( const Hole& hole, SelData Id) ;
|
||||
bool VerifyParallelDrilling( int nDouble, const Hole& hole) ;
|
||||
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double nMHOff, const Vector3d& vtA, const ToolData& currToolData) ;
|
||||
bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHOff, const Vector3d& vtA, const ToolData& currToolData) ;
|
||||
bool MultiHeadDrilling( const SELVECTOR& vId, int nClId, bool bFixed, TABMHDRILL& vDrills, double& dMHOff) ;
|
||||
@@ -128,6 +129,7 @@ class Drilling : public Machining
|
||||
bool MultiHeadOrderConfig( TABMHDRILL& tabDrills, const VECTORHOLE& vHoles, const Vector3d& vtTool, const Vector3d& vtAux) ;
|
||||
bool MultiHeadHoleToolsConfig( const VECTORHOLE& vHoles, int nConfig, INTINTVECTOR& vConfMask) ;
|
||||
int VerifyMultiParallelDrills( void) ;
|
||||
double GetDoubleLastStep( void) ;
|
||||
|
||||
/* debug functions */
|
||||
void PrintConfigs( const VECTORHOLE& vHoles) ;
|
||||
|
||||
+12
-10
@@ -31,8 +31,7 @@
|
||||
const int STR_DIM = 40 ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static HINSTANCE s_hModule = NULL ;
|
||||
static char s_szEMkNameVer[STR_DIM] ;
|
||||
static HINSTANCE s_hModule = NULL ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
extern "C" int APIENTRY
|
||||
@@ -62,21 +61,24 @@ DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
|
||||
const char*
|
||||
GetEMkVersion( void)
|
||||
{
|
||||
std::string sVer ;
|
||||
|
||||
GetModuleVersion( s_hModule, sVer) ;
|
||||
sprintf_s( s_szEMkNameVer, STR_DIM, "%s%s", EMK_STR, sVer.c_str()) ;
|
||||
static char s_szEMkNameVer[STR_DIM] = "" ;
|
||||
if ( s_szEMkNameVer[0] == '\0') {
|
||||
static std::string sVer ;
|
||||
GetModuleVersion( s_hModule, sVer) ;
|
||||
sprintf_s( s_szEMkNameVer, STR_DIM, "%s%s", EMK_STR, sVer.c_str()) ;
|
||||
}
|
||||
|
||||
return s_szEMkNameVer ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string
|
||||
const std::string&
|
||||
GetEMkVer( void)
|
||||
{
|
||||
std::string sVer ;
|
||||
GetModuleVersion( s_hModule, sVer) ;
|
||||
return sVer ;
|
||||
static std::string s_sVer ;
|
||||
if ( s_sVer.empty())
|
||||
GetModuleVersion( s_hModule, s_sVer) ;
|
||||
return s_sVer ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Binary file not shown.
+11
-4
@@ -105,7 +105,7 @@
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -132,7 +132,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@@ -167,7 +167,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
@@ -202,7 +202,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
||||
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@@ -331,6 +331,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EGkCurvePointDiffGeom.h" />
|
||||
<ClInclude Include="..\Include\EGkDistPointCurve.h" />
|
||||
<ClInclude Include="..\Include\EGkDistPointLine.h" />
|
||||
<ClInclude Include="..\Include\EGkDistPointSurfFr.h" />
|
||||
<ClInclude Include="..\Include\EGkDistPointSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkExtText.h" />
|
||||
<ClInclude Include="..\Include\EGkFrame3d.h" />
|
||||
@@ -348,6 +349,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EGkHashGrids2d.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersCurves.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersCurveSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersLineBox.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersLineSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersLineTria.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersPlaneSurfTm.h" />
|
||||
@@ -368,12 +370,15 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EGkSelection.h" />
|
||||
<ClInclude Include="..\Include\EGkSfrCreate.h" />
|
||||
<ClInclude Include="..\Include\EGkStmFromCurves.h" />
|
||||
<ClInclude Include="..\Include\EGkStmFromTriangleSoup.h" />
|
||||
<ClInclude Include="..\Include\EGkStmStandard.h" />
|
||||
<ClInclude Include="..\Include\EGkStringUtils3d.h" />
|
||||
<ClInclude Include="..\Include\EGkSurf.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfBezier.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfFlatRegion.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfLocal.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfTriMesh.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfTriMeshAux.h" />
|
||||
<ClInclude Include="..\Include\EGkTriangle3d.h" />
|
||||
<ClInclude Include="..\Include\EGkUiUnits.h" />
|
||||
<ClInclude Include="..\Include\EGkUserObj.h" />
|
||||
@@ -449,6 +454,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="MortisingData.h" />
|
||||
<ClInclude Include="Operation.h" />
|
||||
<ClInclude Include="OperationConst.h" />
|
||||
<ClInclude Include="OperUserNotesConst.h" />
|
||||
<ClInclude Include="OutputConst.h" />
|
||||
<ClInclude Include="Pocketing.h" />
|
||||
<ClInclude Include="PocketingData.h" />
|
||||
@@ -479,6 +485,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="TcPos.h" />
|
||||
<ClInclude Include="ToolData.h" />
|
||||
<ClInclude Include="ToolsMgr.h" />
|
||||
<ClInclude Include="ToolUserNotesConst.h" />
|
||||
<ClInclude Include="WaterJetting.h" />
|
||||
<ClInclude Include="WaterJettingData.h" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -782,6 +782,27 @@
|
||||
<ClInclude Include="Probing.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OperUserNotesConst.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ToolUserNotesConst.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkDistPointSurfFr.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkIntersLineBox.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkStmFromTriangleSoup.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkSurfBezier.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkSurfTriMeshAux.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtMachKernel.rc">
|
||||
|
||||
+55
-53
@@ -17,12 +17,14 @@
|
||||
#include "DllMain.h"
|
||||
#include "FiveAxisMilling.h"
|
||||
#include "OperationConst.h"
|
||||
#include "OperUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkArcSpecial.h"
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkSurfBezier.h"
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
#include "/EgtDev/Include/EGnStringKeyVal.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
@@ -41,6 +43,7 @@ using namespace std ;
|
||||
// 3308 = "Error in FiveAxisMilling : post apply not calculable"
|
||||
// 3309 = "Error in FiveAxisMilling : Tool loading failed"
|
||||
// 3310 = "Error in FiveAxisMilling : aggregate from bottom not allowed"
|
||||
// 3311 = "Error in FiveAxisMilling : special apply not calculable"
|
||||
// 3351 = "Warning in FiveAxisMilling : Skipped entity (xx)"
|
||||
// 3352 = "Warning in FiveAxisMilling : No machinable path"
|
||||
// 3353 = "Warning in FiveAxisMilling : Tool name changed (xx)"
|
||||
@@ -49,7 +52,7 @@ using namespace std ;
|
||||
//------------------------------ Constants -----------------------------------
|
||||
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
|
||||
static const string EVAR_MACHID = ".MACHID" ; // IN (int) identificativo della lavorazione
|
||||
static const string EVAR_GEOM = ".GEOM" ; // IN (table) tabella delle entità da lavorare
|
||||
static const string EVAR_GEOM = ".GEOM" ; // IN (table) tabella delle entità da lavorare
|
||||
static const string EVAR_DEPTH = ".DEPTH" ; // IN (string) affondamento (espressione numerica)
|
||||
static const string EVAR_TINVERT = ".TOOLINVERT" ; // IN (bool) flag di inversione direzione utensile
|
||||
static const string EVAR_INVERT = ".INVERT" ; // IN (bool) flag di inversione direzione lavorazione
|
||||
@@ -67,14 +70,14 @@ 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_TTHICK = ".TTHICK" ; // 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
|
||||
static const string EVAR_TIPFEED = ".TIPFEED" ; // IN (num) feed di punta dell'utensile
|
||||
static const string EVAR_ISROBOT = ".ISROBOT" ; // IN (bool) flag per indicare che la cinematica è di tipo robot
|
||||
static const string EVAR_ISROBOT = ".ISROBOT" ; // IN (bool) flag per indicare che la cinematica è di tipo robot
|
||||
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
|
||||
static const string EVAR_MILLS = ".MILLS" ; // OUT (int) numero di percorsi di lavoro
|
||||
static const string ON_PREVIEW = "OnPreview_" ;
|
||||
@@ -410,18 +413,17 @@ FiveAxisMilling::SetParam( int nType, const string& sVal)
|
||||
bool
|
||||
FiveAxisMilling::SetGeometry( const SELVECTOR& vIds)
|
||||
{
|
||||
// verifico validità gestore DB geometrico
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
|
||||
int nType = GEO_NONE ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili (curve o superfici)
|
||||
for ( const auto& Id : vIds) {
|
||||
// test sull'entità
|
||||
// test sull'entità
|
||||
int nSubs ;
|
||||
if ( ! VerifyGeometry( Id, nSubs, nType)) {
|
||||
if ( ! VerifyGeometry( Id, nSubs)) {
|
||||
string sInfo = "Warning in FiveAxisMilling : Skipped entity " + ToString( Id) ;
|
||||
m_pMchMgr->SetWarning( 3351, sInfo) ;
|
||||
continue ;
|
||||
@@ -443,7 +445,7 @@ FiveAxisMilling::Preview( bool bRecalc)
|
||||
// reset numero percorsi di lavoro generati
|
||||
m_nMills = 0 ;
|
||||
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
@@ -461,7 +463,7 @@ FiveAxisMilling::Preview( bool bRecalc)
|
||||
|
||||
// recupero gruppo per geometria di Preview
|
||||
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nPvId == GDB_ID_NULL) {
|
||||
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nPvId == GDB_ID_NULL)
|
||||
@@ -544,7 +546,7 @@ FiveAxisMilling::Preview( bool bRecalc)
|
||||
bool
|
||||
FiveAxisMilling::Apply( bool bRecalc, bool bPostApply)
|
||||
{
|
||||
// se calcoli già in corso, esco
|
||||
// se calcoli già in corso, esco
|
||||
if ( m_bRunning) {
|
||||
LOG_DBG_INFO( GetEMkLogger(), "FiveAxisMilling::Apply already running") ;
|
||||
return true ;
|
||||
@@ -563,18 +565,17 @@ FiveAxisMilling::MyApply( bool bRecalc, bool bPostApply)
|
||||
int nCurrMills = m_nMills ;
|
||||
m_nMills = 0 ;
|
||||
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 3301, "Error in FiveAxisMilling : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// non è prevista fresatura 5 assi con aggregato da sotto
|
||||
// non è prevista fresatura 5 assi con aggregato da sotto
|
||||
if ( IsAggrBottom( m_TParams.m_sHead)) {
|
||||
m_pMchMgr->SetLastError( 3310, "Error in FiveAxisMilling : aggregate from bottom not allowed") ;
|
||||
return false ;
|
||||
@@ -585,8 +586,7 @@ FiveAxisMilling::MyApply( bool bRecalc, bool bPostApply)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nMills = nCurrMills ;
|
||||
string sLog = string( "FiveAxisMilling apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
@@ -609,7 +609,7 @@ FiveAxisMilling::MyApply( bool bRecalc, bool bPostApply)
|
||||
|
||||
// recupero gruppo per geometria di lavorazione (Cutter Location)
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nClId == GDB_ID_NULL) {
|
||||
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nClId == GDB_ID_NULL)
|
||||
@@ -710,7 +710,7 @@ FiveAxisMilling::MyApply( bool bRecalc, bool bPostApply)
|
||||
bool
|
||||
FiveAxisMilling::Update( bool bPostApply)
|
||||
{
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
@@ -720,7 +720,7 @@ FiveAxisMilling::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)
|
||||
// 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
|
||||
@@ -730,7 +730,9 @@ FiveAxisMilling::Update( bool bPostApply)
|
||||
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
|
||||
if ( ! m_Params.m_sInitAngs.empty())
|
||||
sHint = m_Params.m_sInitAngs ;
|
||||
if ( ! CalculateAxesValues( sHint)) {
|
||||
double dSingConeAng = 0.1 ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_SINGCONEANG, dSingConeAng) ;
|
||||
if ( ! CalculateAxesValues( sHint, false, dSingConeAng)) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 3304, "Error in FiveAxisMilling : axes values not calculable") ;
|
||||
@@ -742,6 +744,16 @@ FiveAxisMilling::Update( bool bPostApply)
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! PostApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 3311, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 3311, "Error in FiveAxisMilling : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -753,10 +765,10 @@ FiveAxisMilling::Update( bool bPostApply)
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 3308, sErr) ;
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 3308, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 3308, "Error in FiveAxisMilling : post apply not calculable") ;
|
||||
return false ;
|
||||
@@ -880,7 +892,7 @@ FiveAxisMilling::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMilling::UpdateToolData( bool* pbChanged)
|
||||
FiveAxisMilling::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
@@ -931,9 +943,9 @@ FiveAxisMilling::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 3354, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -941,7 +953,7 @@ FiveAxisMilling::UpdateToolData( bool* pbChanged)
|
||||
bool
|
||||
FiveAxisMilling::GetGeometry( SELVECTOR& vIds) const
|
||||
{
|
||||
// restituisco l'elenco delle entità
|
||||
// restituisco l'elenco delle entità
|
||||
vIds = m_vId ;
|
||||
return true ;
|
||||
}
|
||||
@@ -960,14 +972,14 @@ FiveAxisMilling::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& pt
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMilling::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
FiveAxisMilling::VerifyGeometry( SelData Id, int& nSubs)
|
||||
{
|
||||
// ammessi : tutte curve o tutte facce di trimesh
|
||||
// ammessi : curve o superfici
|
||||
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
|
||||
if ( pGObj == nullptr)
|
||||
return false ;
|
||||
// se ammesse curve ed è tale
|
||||
if ( nType != GEO_SURF && ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// se curva ed è tale
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
const ICurve* pCurve = nullptr ;
|
||||
// se direttamente la curva
|
||||
if ( Id.nSub == SEL_SUB_ALL) {
|
||||
@@ -988,25 +1000,15 @@ FiveAxisMilling::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
}
|
||||
return ( pCurve != nullptr) ;
|
||||
}
|
||||
// se altrimenti ammesse superfici trimesh ed è tale
|
||||
else if ( nType != GEO_CURVE && ( pGObj->GetType() & GEO_SURF) != 0) {
|
||||
// se altrimenti è superficie trimesh
|
||||
else if ( pGObj->GetType() == SRF_TRIMESH) {
|
||||
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
|
||||
if ( pSurf == nullptr)
|
||||
return false ;
|
||||
// se direttamente la superficie
|
||||
if ( Id.nSub == SEL_SUB_ALL) {
|
||||
nSubs = pSurf->GetFacetCount() ;
|
||||
return true ;
|
||||
}
|
||||
// altrimenti faccia di superficie trimesh
|
||||
else {
|
||||
// se faccia non esistente
|
||||
if ( Id.nSub > pSurf->GetFacetCount())
|
||||
return false ;
|
||||
// tutto bene
|
||||
nSubs = 0 ;
|
||||
return true ;
|
||||
}
|
||||
return ( pSurf != nullptr && pSurf->GetFacetCount() >= 1) ;
|
||||
}
|
||||
// se altrimenti è superficie Bezier
|
||||
else if ( pGObj->GetType() == SRF_BEZIER) {
|
||||
const ISurfBezier* pSurf = ::GetSurfBezier( pGObj) ;
|
||||
return ( pSurf != nullptr && pSurf->IsValid()) ;
|
||||
}
|
||||
// altrimenti errore
|
||||
else
|
||||
@@ -1018,7 +1020,7 @@ double
|
||||
FiveAxisMilling::GetApproxLinTol( void) const
|
||||
{
|
||||
double dLinTol ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, "LinTol", dLinTol))
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_LINTOL, dLinTol))
|
||||
return dLinTol ;
|
||||
else
|
||||
return Operation::GetApproxLinTol() ;
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ class FiveAxisMilling : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
@@ -74,7 +74,7 @@ class FiveAxisMilling : public Machining
|
||||
|
||||
private :
|
||||
bool MyApply( bool bRecalc, bool bPostApply) ;
|
||||
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
|
||||
bool VerifyGeometry( SelData Id, int& nSubs) ;
|
||||
double GetApproxLinTol( void) const override ;
|
||||
|
||||
private :
|
||||
|
||||
+25
-15
@@ -17,6 +17,7 @@
|
||||
#include "DllMain.h"
|
||||
#include "GenMachining.h"
|
||||
#include "OperationConst.h"
|
||||
#include "OperUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
@@ -40,6 +41,7 @@ using namespace std ;
|
||||
// 2807 = "Error in GenMachining : link outstroke xx"
|
||||
// 2808 = "Error in GenMachining : post apply not calculable"
|
||||
// 2809 = "Error in GenMachining : Tool loading failed"
|
||||
// 2810 = "Error in GenMachining : special apply not calculable"
|
||||
// 2851 = "Warning in GenMachining : Skipped entity (xx)"
|
||||
// 2852 = "Warning in GenMachining : No machinable path"
|
||||
// 2853 = "Warning in GenMachining : Tool name changed (xx)"
|
||||
@@ -551,8 +553,7 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 2801, "Error in GenMachining : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -562,8 +563,7 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nMills = nCurrMills ;
|
||||
string sLog = string( "GenMachining apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
@@ -715,9 +715,19 @@ GenMachining::Update( bool bPostApply)
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 2810, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2810, "Error in GenMachining : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
bool bVpl ;
|
||||
if ( ! FromString( ExtractInfo( m_Params.m_sUserNotes, "Vpl:"), bVpl))
|
||||
if ( ! FromString( ExtractInfo( m_Params.m_sUserNotes, UN_VPL_COLON), bVpl))
|
||||
bVpl = true ;
|
||||
if ( ! AdjustStartEndMovements( bVpl)) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -728,11 +738,11 @@ GenMachining::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 2808, sErr) ;
|
||||
// esecuzione eventuali personalizzazioni finali
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 2808, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2808, "Error in GenMachining : post apply not calculable") ;
|
||||
return false ;
|
||||
@@ -856,7 +866,7 @@ GenMachining::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GenMachining::UpdateToolData( bool* pbChanged)
|
||||
GenMachining::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
@@ -907,9 +917,9 @@ GenMachining::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 2854, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -982,7 +992,7 @@ double
|
||||
GenMachining::GetApproxLinTol( void) const
|
||||
{
|
||||
double dLinTol ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, "LinTol", dLinTol))
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_LINTOL, dLinTol))
|
||||
return dLinTol ;
|
||||
else
|
||||
return Operation::GetApproxLinTol() ;
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ class GenMachining : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
|
||||
+8
-3
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2026
|
||||
//----------------------------------------------------------------------------
|
||||
// File : GeoCalc.cpp Data : 12.05.15 Versione : 1.6e3
|
||||
// File : GeoCalc.cpp Data : 08.05.26 Versione : 3.1e2
|
||||
// Contenuto : Funzioni varie e speciali di calcolo geometrico.
|
||||
//
|
||||
//
|
||||
@@ -14,6 +14,7 @@
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "GeoCalc.h"
|
||||
#include "\EgtDev\Include\EGkAngle.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
@@ -33,7 +34,7 @@ GetRotationComponent( const Vector3d& vtDir1, double dComp, const Vector3d& vtDi
|
||||
Vector3d vtU = vtPvZW ;
|
||||
if ( ! vtU.Normalize()) {
|
||||
// determino se equiversi o controversi
|
||||
bool bEquiv = ( vtDir2 * vtRotAx) > 0 ;
|
||||
bool bEquiv = ( vtDir2 * vtRotAx > 0) ;
|
||||
// se le componenti concordano, angolo indeterminato
|
||||
if ( abs( dT0w - ( bEquiv ? dComp : - dComp)) < 0.5 * SIN_EPS_ANG_SMALL) {
|
||||
bDet = false ;
|
||||
@@ -86,6 +87,10 @@ GetRotationComponent( const Vector3d& vtDir1, double dComp, const Vector3d& vtDi
|
||||
double dDeltaAngRad = acos( dNumer / dDenom) ;
|
||||
dAng1Deg = ( dOffsAngRad + dDeltaAngRad) * RADTODEG ;
|
||||
dAng2Deg = ( dOffsAngRad - dDeltaAngRad) * RADTODEG ;
|
||||
if ( abs( dAng1Deg) <= abs( dAng2Deg))
|
||||
dAng2Deg = AngleNearAngle( dAng2Deg, dAng1Deg) ;
|
||||
else
|
||||
dAng1Deg = AngleNearAngle( dAng1Deg, dAng2Deg) ;
|
||||
bDet = true ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
+29
-2
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Radice della gestione delle lavorazioni
|
||||
const std::string MACH_BASE = "MachBase" ;
|
||||
@@ -78,6 +77,12 @@ const std::string MACHININGS_DIR = "Machinings" ;
|
||||
// Nome file delle lavorazioni
|
||||
const std::string MACHININGS_FILE = "Machinings.data" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Sezione Generale nel file INI di macchina
|
||||
const std::string GENERAL_SEC = "General" ;
|
||||
// Chiave per materiale caratteristico
|
||||
const std::string MATERIAL_KEY = "Material" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Sezione tastature nel file INI di macchina
|
||||
const std::string PROBING_SEC = "Probing" ;
|
||||
@@ -135,6 +140,21 @@ const std::string TOOLHOLDER_SEC = "ToolHolder" ;
|
||||
const std::string MACHININGS_SEC = "Machinings" ;
|
||||
// Chiave per abilitare discesa e risalita in rapido da fresature con estremi fuori dal grezzo
|
||||
const std::string RAPIDONOUT_KEY = "RapidOnOut" ;
|
||||
// Chiave per Drilling in Doppio in Parallelo
|
||||
const std::string DRILLING_PARALLEL_KEY = "DrillingDoubleNT" ;
|
||||
// Chiave per Pocketing in Doppio in Parallelo
|
||||
const std::string POCKETING_PARALLEL_KEY = "PocketingDoubleNT" ;
|
||||
// Chiave per Ottimizzazione delle Feed in PocketingNT
|
||||
const std::string POCKETING_FEED_KEY = "PocketingAdjustFeedNT" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Tipo di Collegamento tra le lavorazioni (LinkType)
|
||||
enum LINKTYPE {
|
||||
LINK_NULL = 0,
|
||||
LINK_HOME_TO_MACH = 1,
|
||||
LINK_MACH_TO_HOME = 2,
|
||||
LINK_MACH_TO_MACH = 3
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Minimo spessore del grezzo
|
||||
@@ -143,6 +163,7 @@ const double RAW_MIN_H = 1 ;
|
||||
//----------------------------------------------------------------------------
|
||||
// Minima feed
|
||||
const double FEED_MIN = 1 ;
|
||||
constexpr double FEED_MAX_REDUCE = 5 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Massimo angolo al centro per archi di CL
|
||||
@@ -161,5 +182,11 @@ const std::string NST_PARTREG_LAYER = "Region" ;
|
||||
//----------------------------------------------------------------------------
|
||||
// Minima componente zeta di versore utensile per lavorazione da sopra (-45deg)
|
||||
const double MIN_ZDIR_TOP_TOOL = -0.7072 ;
|
||||
// Minima componente zeta di versose utensile èer mortasatura quasi verticale (45deg)
|
||||
// Minima componente zeta di versore utensile per mortasatura quasi verticale (45deg)
|
||||
const double MIN_ZDIR_VERT_CHSAW = 0.7072 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valore di default del peso del primo asse rotante di macchina
|
||||
static const double ROT1_WEIGHT_DFLT = 1 ;
|
||||
// Valore di default per angolo di apertura del cono di direzioni coincidenti con singolarità
|
||||
static const double SING_CONE_ANG_DFLT = 0.01 ;
|
||||
|
||||
@@ -214,10 +214,11 @@ class MachMgr : public IMachMgr
|
||||
int GetCurrSetup( void) const override ;
|
||||
bool GetDefaultSetupName( std::string& sName) const override ;
|
||||
bool ImportSetup( const std::string& sName) override ;
|
||||
bool ExistsCurrSetup( void) const 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 FindToolInCurrSetup( const std::string& sTool) const override ;
|
||||
bool GetToolSetupPosInCurrSetup( const std::string& sTool, std::string& sTcPos) const override ;
|
||||
bool GetToolsInCurrSetupPos( const std::string& sTcPos, STRVECTOR& vsTools) const override ;
|
||||
bool UpdateCurrSetup( void) override ;
|
||||
bool EraseCurrSetup( void) override ;
|
||||
// Machinings DataBase
|
||||
@@ -303,6 +304,7 @@ class MachMgr : public IMachMgr
|
||||
bool RemoveMachiningPreview( void) override ;
|
||||
bool MachiningApply( bool bRecalc, bool bPostApply = true) override ;
|
||||
bool MachiningUpdate( bool bPostApply = true) override ;
|
||||
bool ChangePreviewMachiningToolShow( int nLookFlag) override ;
|
||||
bool PreparePreviewMachiningTool( void) const override ;
|
||||
bool RemovePreviewMachiningTool( void) const override ;
|
||||
int GetPreviewMachiningToolStepCount( void) const override ;
|
||||
@@ -316,13 +318,19 @@ class MachMgr : public IMachMgr
|
||||
bool IsMachiningEmpty( int nEmptyType = 0) const override ;
|
||||
bool GetMachiningStartPoint( Point3d& ptStart) const override ;
|
||||
bool GetMachiningEndPoint( Point3d& ptEnd) const override ;
|
||||
bool GetMachiningStartAxes( bool bSkipClimb, DBLVECTOR& vAxVal) const override ;
|
||||
bool GetMachiningEndAxes( bool bSkipRise, DBLVECTOR& vAxVal) const override ;
|
||||
// CL Entities Interrogations
|
||||
bool GetClEntMove( int nEntId, int& nMove) const override ;
|
||||
bool GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const override ;
|
||||
bool GetClEntIndex( int nEntId, int& nIndex) const override ;
|
||||
bool GetClEntFeed( int nEntId, double& dFeed) const override ;
|
||||
bool GetClEntAxesStatus( int nEntId, int& nStatus) const override ;
|
||||
bool GetClEntAxesMask( int nEntId, int& nMask) const override ;
|
||||
bool GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const override ;
|
||||
bool GetClEntTDir( int nEntId, Vector3d& vtTDir) const override ;
|
||||
bool GetClEntCDir( int nEntId, Vector3d& vtCDir) const override ;
|
||||
bool GetClEntADir( int nEntId, Vector3d& vtADir) const override ;
|
||||
// Simulation
|
||||
bool SimInit( void) override ;
|
||||
bool SimStart( bool bFirst) override ;
|
||||
@@ -342,21 +350,25 @@ 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 GetAllCurrAxesNames( STRVECTOR& vAxName) const override ;
|
||||
bool SetCalcSolCh( int nScc, bool bExact) override ;
|
||||
bool SetRotAxisBlock( const std::string& sAxis, double dVal) override ;
|
||||
bool GetRotAxisBlocked( int nInd, std::string& sAxis, double& dVal) const override ;
|
||||
bool GetCalcTable( std::string& sTable) const override ;
|
||||
bool GetCalcTool( std::string& sTool) const override ;
|
||||
bool GetCalcHead( std::string& sHead) const override ;
|
||||
bool GetCalcExit( int& nExit) const override ;
|
||||
bool GetCalcSolCh( int& nScc, bool& bExact) const override ;
|
||||
bool GetAllCurrAxesNames( STRVECTOR& vAxName) const override ;
|
||||
bool GetRotAxisBlocked( int nInd, std::string& sAxis, double& dVal) const override ;
|
||||
bool GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const override ;
|
||||
bool GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const override ;
|
||||
bool GetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
|
||||
int& nStat, double& dX, double& dY, double& dZ) const override ;
|
||||
double& dX, double& dY, double& dZ) const override ;
|
||||
bool GetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
int& nStat, double& dX, double& dY, double& dZ) const override ;
|
||||
double& dX, double& dY, double& dZ) const override ;
|
||||
bool GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const override ;
|
||||
bool GetCalcTipFromPositions( double dX, double dY, double dZ, double dAngA, double dAngB,
|
||||
bool bOverall, bool bBottom, Point3d& ptTip) const override ;
|
||||
bool GetCalcTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
|
||||
@@ -366,6 +378,7 @@ class MachMgr : public IMachMgr
|
||||
bool GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const override ;
|
||||
bool LimitAngleToStroke( int nInd, double& dAng) const override ;
|
||||
bool VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) const override ;
|
||||
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const override ;
|
||||
std::string GetOutstrokeInfo( bool bMM = true) const override ;
|
||||
// Machine
|
||||
int GetBaseId( const std::string& sBase) const override ;
|
||||
@@ -461,7 +474,7 @@ class MachMgr : public IMachMgr
|
||||
bool GetCurrAxisMax( int nInd, double& dHome) const ;
|
||||
bool GetCurrAxisMin( int nInd, double& dHome) const ;
|
||||
const Frame3d& GetCurrLinAxesFrame( void) const ;
|
||||
bool GetCurrIsCenter( void) const ;
|
||||
bool GetCurrIsMcent( void) const ;
|
||||
bool GetCurrIsRobot( void) const ;
|
||||
bool ApplyRotAxisBlock( void) ;
|
||||
void ClearRotAxisBlock( void)
|
||||
@@ -473,19 +486,21 @@ class MachMgr : public IMachMgr
|
||||
double GetCalcRot1W( void) const ;
|
||||
bool GetCalcMaxDeltaR2OnFirst( void) const ;
|
||||
bool GetCalcPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ;
|
||||
bool SetCalcSolCh( int nScc, bool bExact) ;
|
||||
bool VerifyAngleOutstroke( int nInd, double dAng) const ;
|
||||
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const ;
|
||||
bool ExistProtectedAreas( void) const ;
|
||||
// Operations
|
||||
bool GetOperationNewName( std::string& sName) const ;
|
||||
const ToolData* GetMachiningToolData( void) const ;
|
||||
// Simulation
|
||||
bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
|
||||
bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
|
||||
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
|
||||
bool SimRemoveCollisionObj( int nFrameId) ;
|
||||
bool SimGetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
|
||||
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) const ;
|
||||
bool SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
|
||||
bool SimOnCollision( int nCdInd, int nObjInd, int& nErr) ;
|
||||
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag, double dPar1, double dPar2,
|
||||
const INTVECTOR& vVmill, bool bFirst) ;
|
||||
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
|
||||
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) ;
|
||||
bool SimEnableToolsForVmill( bool bEnable) ;
|
||||
int SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
|
||||
bool SimSaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) ;
|
||||
|
||||
+73
-1
@@ -2,7 +2,7 @@
|
||||
// EgalTech 2019-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachMgrClEntities.cpp Data : 27.10.23 Versione : 2.5j4
|
||||
// Contenuto : Implementazione interrogazione entità CL della classe MachMgr.
|
||||
// Contenuto : Implementazione interrogazione entità CL della classe MachMgr.
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -76,6 +76,24 @@ MachMgr::GetClEntIndex( int nEntId, int& nIndex) const
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntFeed( int nEntId, double& dFeed) const
|
||||
{
|
||||
// default
|
||||
dFeed = 0 ;
|
||||
// verifico validita GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero l'oggetto CamData
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero la feed
|
||||
dFeed = pCamData->GetFeed() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntAxesStatus( int nEntId, int& nStatus) const
|
||||
@@ -129,3 +147,57 @@ MachMgr::GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const
|
||||
vAxes = pCamData->GetAxesVal() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntTDir( int nEntId, Vector3d& vtTDir) const
|
||||
{
|
||||
// default
|
||||
vtTDir = V_NULL ;
|
||||
// verifico validità GeomBD
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero l'oggetto CamData
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero TDir
|
||||
vtTDir = pCamData->GetToolDir() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntCDir( int nEntId, Vector3d& vtCDir) const
|
||||
{
|
||||
// default
|
||||
vtCDir = V_NULL ;
|
||||
// verifico validità 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 CDir
|
||||
vtCDir = pCamData->GetCorrDir() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntADir( int nEntId, Vector3d& vtADir) const
|
||||
{
|
||||
// default
|
||||
vtADir = V_NULL ;
|
||||
// verifico validità 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 ADir
|
||||
vtADir = pCamData->GetAuxDir() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
+2
-1
@@ -15,6 +15,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "DllMain.h"
|
||||
#include "MachMgr.h"
|
||||
#include "ToolUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/EgtIniFile.h"
|
||||
@@ -881,7 +882,7 @@ MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType, const
|
||||
// Verifico se sovrascritto da nota dell'utensile
|
||||
string sVal ;
|
||||
if ( ! sUserNotes.empty() &&
|
||||
GetValInNotes( sUserNotes, "TH", sVal) &&
|
||||
GetValInNotes( sUserNotes, TUN_TH, sVal) &&
|
||||
ExistsFile( sToolHolderDir + "\\" + sVal))
|
||||
sToolHolder = sVal ;
|
||||
// Se non trovato ancora, esco
|
||||
|
||||
+41
-9
@@ -555,6 +555,17 @@ MachMgr::SetCalcSolCh( int nScc, bool bExact)
|
||||
return pMch->SetSolCh( nScc, bExact) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcSolCh( int& nScc, bool& bExact) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// recupero il criterio di scelta della soluzione
|
||||
return pMch->GetSolCh( nScc, bExact) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcTable( string& sTable) const
|
||||
@@ -624,7 +635,7 @@ bool
|
||||
MachMgr::GetCalcMaxDeltaR2OnFirst( void) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetCurrMaxDeltaR2OnFirst() : true) ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetCurrCalcMaxDeltaR2OnFirst() : true) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -741,12 +752,12 @@ MachMgr::GetCurrLinAxesFrame( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCurrIsCenter( void) const
|
||||
MachMgr::GetCurrIsMcent( void) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_CENTER) ;
|
||||
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_MCENT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -764,8 +775,19 @@ bool
|
||||
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetAngles( vtDirT, vtDirA, nStat, dAngA1, dAngB1, dAngA2, dAngB2) : false) ;
|
||||
nStat = 0 ; dAngA1 = 0 ; dAngB1 = 0 ; dAngA2 = 0 ; dAngB2 = 0 ;
|
||||
DBLVECTOR vAng1, vAng2 ;
|
||||
if ( ! GetCalcAngles( vtDirT, vtDirA, nStat, vAng1, vAng2))
|
||||
return false ;
|
||||
if ( vAng1.size() >= 1) {
|
||||
dAngA1 = vAng1[0] ;
|
||||
dAngA2 = vAng2[0] ;
|
||||
if ( vAng1.size() >= 2) {
|
||||
dAngB1 = vAng1[1] ;
|
||||
dAngB2 = vAng2[1] ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -773,6 +795,7 @@ bool
|
||||
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const
|
||||
{
|
||||
const_cast<MachMgr*>(this)->ApplyRotAxisBlock() ;
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetAngles( vtDirT, vtDirA, nStat, vAng1, vAng2) : false) ;
|
||||
}
|
||||
@@ -780,20 +803,29 @@ MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
|
||||
int& nStat, double& dX, double& dY, double& dZ) const
|
||||
double& dX, double& dY, double& dZ) const
|
||||
{
|
||||
DBLVECTOR vAng( 2) ; vAng[0] = dAngA ; vAng[1] = dAngB ;
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, nStat, dX, dY, dZ) : false) ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, dX, dY, dZ) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
int& nStat, double& dX, double& dY, double& dZ) const
|
||||
double& dX, double& dY, double& dZ) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, nStat, dX, dY, dZ) : false) ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, dX, dY, dZ) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetRobotAngles( ptP, vtDirT, vtDirA, vAng1, vAng2) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+57
-9
@@ -184,14 +184,11 @@ MachMgr::GetOperationPhase( int nId) const
|
||||
bool
|
||||
MachMgr::GetOperationNewName( string& sName) const
|
||||
{
|
||||
// il parametro nome deve essere valido
|
||||
if ( &sName == nullptr)
|
||||
return false ;
|
||||
// il gruppo per le operazioni deve essere presente nella macchinata corrente
|
||||
if ( GetCurrOperId() == GDB_ID_NULL)
|
||||
return false ;
|
||||
// se nome vuoto, assegno radice standard
|
||||
if ( sName.empty())
|
||||
if ( ! IsValidVal( sName))
|
||||
sName = "Oper" ;
|
||||
// se presenti caratteri vietati, li sostituisco
|
||||
ValidateVal( sName) ;
|
||||
@@ -218,6 +215,9 @@ MachMgr::SetOperationName( int nId, const string& sName)
|
||||
// verifico che faccia parte del gruppo delle operazioni
|
||||
if ( pIter->GetParentId() != GetCurrOperId())
|
||||
return false ;
|
||||
// verifico che il nome sia valido
|
||||
if ( ! IsValidVal( sName))
|
||||
return false ;
|
||||
// verifico che il nome non sia già usato da una operazione
|
||||
if ( GetOperationId( sName) != GDB_ID_NULL)
|
||||
return false ;
|
||||
@@ -232,10 +232,10 @@ MachMgr::GetOperationName( int nId) const
|
||||
// recupero l'operazione
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
|
||||
if ( IsNull( pIter) || ! pIter->GoTo( nId))
|
||||
return 0 ;
|
||||
return "" ;
|
||||
// verifico che faccia parte del gruppo delle operazioni
|
||||
if ( pIter->GetParentId() != GetCurrOperId())
|
||||
return 0 ;
|
||||
return "" ;
|
||||
// recupero il nome dell'operazione riferita
|
||||
string sName ;
|
||||
pIter->GetName( sName) ;
|
||||
@@ -247,12 +247,12 @@ int
|
||||
MachMgr::GetOperationId( const string& sName) const
|
||||
{
|
||||
// verifica dei parametri
|
||||
if ( &sName == nullptr || sName.empty())
|
||||
return false ;
|
||||
if ( ! IsValidVal( sName))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero l'identificativo dell'operazione con il nome indicato
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
return GDB_ID_NULL ;
|
||||
bool bIter = pIter->GoToFirstInGroup( GetCurrOperId()) ;
|
||||
while ( bIter) {
|
||||
// verifico il nome
|
||||
@@ -1106,6 +1106,22 @@ MachMgr::MachiningUpdate( bool bPostApply)
|
||||
return pMch->Update( bPostApply) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ChangePreviewMachiningToolShow( int nLookFlag)
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
if ( nCurrMchId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// ne recupero il gestore
|
||||
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// eseguo
|
||||
return pMch->ChangeToolPreviewShow( nLookFlag) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::PreparePreviewMachiningTool( void) const
|
||||
@@ -1328,3 +1344,35 @@ MachMgr::GetMachiningEndPoint( Point3d& ptEnd) const
|
||||
// restituisco il punto finale dell'ultimo percorso di lavorazione
|
||||
return pMch->GetEndPoint( ptEnd) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetMachiningStartAxes( bool bSkipClimb, DBLVECTOR& vAxVal) const
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
if ( nCurrMchId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// ne recupero il gestore
|
||||
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// recupero i valori
|
||||
return pMch->GetInitialAxesValues( bSkipClimb, true, vAxVal) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetMachiningEndAxes( bool bSkipRise, DBLVECTOR& vAxVal) const
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
if ( nCurrMchId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// ne recupero il gestore
|
||||
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// recupero i valori
|
||||
return pMch->GetFinalAxesValues( bSkipRise, true, vAxVal) ;
|
||||
}
|
||||
|
||||
+25
-5
@@ -28,6 +28,7 @@
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
||||
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
||||
#include "/EgtDev/Include/EGkSurfBezier.h"
|
||||
#include "/EgtDev/Include/EGkCAvSilhouetteSurfTm.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
@@ -376,6 +377,10 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
|
||||
int nRawGroupId = GetCurrRawGroupId() ;
|
||||
if ( nRawGroupId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// verifico che la superficie sia chiusa
|
||||
const ISurf* pSurf = GetSurf( m_pGeomDB->GetGeoObj( nSurfId)) ;
|
||||
if ( pSurf == nullptr || ! pSurf->IsClosed())
|
||||
return GDB_ID_NULL ;
|
||||
// recupero l'ingombro della superficie in globale
|
||||
BBox3d b3Surf ;
|
||||
if ( ! m_pGeomDB->GetGlobalBBox( nSurfId, b3Surf))
|
||||
@@ -389,8 +394,23 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
|
||||
bool bOk = m_pGeomDB->SetName( nRawId, MACH_RAW_PART) ;
|
||||
// assegno la fase al gruppo
|
||||
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
|
||||
// copio la superficie nel gruppo
|
||||
int nId = m_pGeomDB->CopyGlob( nSurfId, GDB_ID_NULL, nRawId) ;
|
||||
// creo il grezzo
|
||||
int nId = GDB_ID_NULL ;
|
||||
// partendo da superficie Trimesh copio
|
||||
if ( pSurf->GetType() == SRF_TRIMESH)
|
||||
nId = m_pGeomDB->CopyGlob( nSurfId, GDB_ID_NULL, nRawId) ;
|
||||
// partendo da superficie Bezier devo recuperare la Trimesh ausiliaria e copiarla
|
||||
else if ( pSurf->GetType() == SRF_BEZIER) {
|
||||
const ISurfBezier* pSbez = GetSurfBezier( pSurf) ;
|
||||
const ISurfTriMesh* pAuxStm = ( pSbez != nullptr ? pSbez->GetAuxSurf() : nullptr) ;
|
||||
PtrOwner<ISurfTriMesh> pStm( pAuxStm != nullptr ? pAuxStm->Clone() : nullptr) ;
|
||||
if ( ! IsNull( pStm)) {
|
||||
Frame3d frSbez ;
|
||||
m_pGeomDB->GetGlobFrame( nSurfId, frSbez) ;
|
||||
pStm->LocToLoc( frSbez, frRaw) ;
|
||||
nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pStm)) ;
|
||||
}
|
||||
}
|
||||
bOk = bOk && ( nId != GDB_ID_NULL) ;
|
||||
// assegno il nome al solido
|
||||
bOk = bOk && m_pGeomDB->SetName( nId, MACH_RAW_SOLID) ;
|
||||
@@ -407,7 +427,7 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
|
||||
if ( IsNull( pCrvCompo))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero la superficie trimesh
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nId)) ;
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// recupero l'ingombro della superficie in locale
|
||||
@@ -640,12 +660,12 @@ MachMgr::AddRawPart( int nSfrUpId, int nSfrDownId, double dHeight, Color cCol)
|
||||
bOk = bOk && ( nSurfUpId != GDB_ID_NULL) ;
|
||||
bOk = bOk && m_pGeomDB->SetName( nSurfUpId, MACH_RAW_UP_REG) ;
|
||||
bOk = bOk && m_pGeomDB->SetMaterial( nSurfUpId, cCol) ;
|
||||
bOk = bOk && m_pGeomDB->SetStatus( nSurfUpId, GDB_ST_OFF) ;
|
||||
bOk = bOk && m_pGeomDB->SetMode( nSurfUpId, GDB_MD_HIDDEN) ;
|
||||
int nSurfDownId = ( bOk ? m_pGeomDB->CopyGlob( nSfrDownId, GDB_ID_NULL, nRawId) : GDB_ID_NULL) ;
|
||||
bOk = bOk && ( nSurfDownId != GDB_ID_NULL) ;
|
||||
bOk = bOk && m_pGeomDB->SetName( nSurfDownId, MACH_RAW_DOWN_REG) ;
|
||||
bOk = bOk && m_pGeomDB->SetMaterial( nSurfDownId, cCol) ;
|
||||
bOk = bOk && m_pGeomDB->SetStatus( nSurfDownId, GDB_ST_OFF) ;
|
||||
bOk = bOk && m_pGeomDB->SetMode( nSurfDownId, GDB_MD_HIDDEN) ;
|
||||
}
|
||||
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
|
||||
+10
-3
@@ -71,6 +71,13 @@ MachMgr::ImportSetup( const string& sName)
|
||||
return m_stuMgr.Save() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ExistsCurrSetup( void) const
|
||||
{
|
||||
return m_stuMgr.Exists() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::VerifyCurrSetup( STRVECTOR& vsErrors)
|
||||
@@ -125,21 +132,21 @@ MachMgr::VerifyCurrSetup( STRVECTOR& vsErrors)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::FindToolInCurrSetup( const string& sTool)
|
||||
MachMgr::FindToolInCurrSetup( const string& sTool) const
|
||||
{
|
||||
return m_stuMgr.FindTool( sTool) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos)
|
||||
MachMgr::GetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos) const
|
||||
{
|
||||
return m_stuMgr.GetToolSetupPos( sTool, sTcPos) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools)
|
||||
MachMgr::GetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools) const
|
||||
{
|
||||
return m_stuMgr.GetToolsInSetupPos( sTcPos, vsTools) ;
|
||||
}
|
||||
|
||||
@@ -176,6 +176,29 @@ MachMgr::SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, co
|
||||
return m_pSimul->AddCollisionObj( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SimRemoveCollisionObj( int nFrameId)
|
||||
{
|
||||
// verifico simulatore
|
||||
if ( m_pSimul == nullptr)
|
||||
return false ;
|
||||
// rimuovo gli oggetti da verificare per la collisione con il grezzo con FrameId indicato
|
||||
return m_pSimul->RemoveCollisionObj( nFrameId) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SimGetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
|
||||
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) const
|
||||
{
|
||||
// verifico simulatore
|
||||
if ( m_pSimul == nullptr)
|
||||
return false ;
|
||||
// recupero i dati dell'oggetto di collisione di posizione indicata nel relativo vettore
|
||||
return m_pSimul->GetCollisionObj( nPos, nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
|
||||
|
||||
+6
-3
@@ -34,6 +34,7 @@ Machine::Machine( void)
|
||||
{
|
||||
m_pMchMgr = nullptr ;
|
||||
m_pGeomDB = nullptr ;
|
||||
m_nContextId = 0 ;
|
||||
m_nGroupId = GDB_ID_NULL ;
|
||||
m_nTempGroupId = GDB_ID_NULL ;
|
||||
m_dAxisMaxAdjust = EPS_SMALL ;
|
||||
@@ -48,7 +49,8 @@ Machine::Machine( void)
|
||||
m_nCalcHeadId = GDB_ID_NULL ;
|
||||
m_nCalcExitId = GDB_ID_NULL ;
|
||||
m_nCalcToolId = GDB_ID_NULL ;
|
||||
m_dCalcRot1W = 1 ;
|
||||
m_dCalcRot1W = ROT1_WEIGHT_DFLT ;
|
||||
m_dSingConeAng = SING_CONE_ANG_DFLT ;
|
||||
m_bCalcMaxDeltaR2On1 = true ;
|
||||
m_nCalcSolCh = MCH_SCC_NONE ;
|
||||
m_bSolChExact = false ;
|
||||
@@ -64,6 +66,7 @@ Machine::Machine( void)
|
||||
m_frLinAx.Reset( false) ;
|
||||
m_frRobot.Reset( false) ;
|
||||
m_nCalcChainType = KIN_CHAIN_NONE ;
|
||||
m_dPrevAngA = NAN ;
|
||||
m_nMachineLook = MCH_LOOK_NONE ;
|
||||
}
|
||||
|
||||
@@ -89,6 +92,7 @@ Machine::Clear( void)
|
||||
// reset membri
|
||||
m_pMchMgr = nullptr ;
|
||||
m_pGeomDB = nullptr ;
|
||||
m_nContextId = 0 ;
|
||||
m_sName.clear() ;
|
||||
m_sMachineDir.clear() ;
|
||||
m_nGroupId = GDB_ID_NULL ;
|
||||
@@ -108,6 +112,7 @@ Machine::Init( const string& sMachineName, const string& sMachineDir, MachMgr* p
|
||||
return false ;
|
||||
m_pMchMgr = pMchMgr ;
|
||||
m_pGeomDB = m_pMchMgr->GetGeomDB() ;
|
||||
m_nContextId = m_pMchMgr->GetContextId() ;
|
||||
// verifico direttorio dati macchina
|
||||
m_sMachineDir = sMachineDir ;
|
||||
if ( ! ExistsDirectory( m_sMachineDir))
|
||||
@@ -137,9 +142,7 @@ Machine::Init( const string& sMachineName, const string& sMachineDir, MachMgr* p
|
||||
// in caso di errore, cancello tutta la geometria
|
||||
if ( ! bOk) {
|
||||
m_pGeomDB->Erase( m_nGroupId) ;
|
||||
m_pGeomDB->Erase( m_nTempGroupId) ;
|
||||
m_nGroupId = GDB_ID_NULL ;
|
||||
m_nTempGroupId = GDB_ID_NULL ;
|
||||
m_sName.clear() ;
|
||||
m_sMachineDir.clear() ;
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ class Machine
|
||||
bool LoadAllTools( void) ;
|
||||
bool UnloadAllTools( void) ;
|
||||
bool ResetHeadSet( const std::string& sHead) ;
|
||||
const STRVECTOR& GetHSet( const std::string& sHead) const ;
|
||||
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const ;
|
||||
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const ;
|
||||
bool GetAxisOffset( const std::string& sAxis, double& dOffset) const ;
|
||||
@@ -135,7 +136,11 @@ class Machine
|
||||
bool IsCurrToolFloating( void) const ;
|
||||
double GetCurrRot1W( void) const
|
||||
{ return m_dCalcRot1W ; }
|
||||
bool GetCurrMaxDeltaR2OnFirst( void) const
|
||||
bool SetSingConeAng( double dAng)
|
||||
{ m_dSingConeAng = dAng ; return true ;}
|
||||
double GetCurrSingConeAng( void) const
|
||||
{ return m_dSingConeAng ; }
|
||||
bool GetCurrCalcMaxDeltaR2OnFirst( void) const
|
||||
{ return m_bCalcMaxDeltaR2On1 ; }
|
||||
std::string GetKinematicAxis( int nInd) const ;
|
||||
bool BlockKinematicRotAxis( const std::string& sName, double dVal) ;
|
||||
@@ -145,6 +150,8 @@ class Machine
|
||||
bool IsKinematicRotAxisBlocked( int nInd) const ;
|
||||
bool GetKinematicRotAxisBlocked( int nInd, std::string& sName, double& dVal) const ;
|
||||
bool SetSolCh( int nScc, bool bExact) ;
|
||||
bool GetSolCh( int& nScc, bool& bExact)
|
||||
{ nScc = m_nCalcSolCh ; bExact = m_bSolChExact ; return true ; }
|
||||
int GetCurrLinAxes( void) const ;
|
||||
int GetCurrRotAxes( void) const ;
|
||||
bool GetCurrAxisName( int nInd, std::string& sAxName) const ;
|
||||
@@ -161,13 +168,13 @@ class Machine
|
||||
const Frame3d& GetCurrLinAxesFrame( void) const
|
||||
{ return m_frLinAx ; }
|
||||
int GetCurrKinematicChainType( void) const
|
||||
{ return m_nCalcChainType ; }
|
||||
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ;
|
||||
{ return m_nCalcChainType ; }
|
||||
bool SetPrevAngA( double dAngA) const
|
||||
{ m_dPrevAngA = dAngA ; return true ; }
|
||||
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
|
||||
bool GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
int& nStat, double& dX, double& dY, double& dZ) const ;
|
||||
double& dX, double& dY, double& dZ) const ;
|
||||
bool GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
|
||||
bool GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
|
||||
@@ -261,7 +268,6 @@ class Machine
|
||||
TcPos* GetTcPos( int nGroup) const ;
|
||||
Exit* GetExit( int nGroup) const ;
|
||||
bool AddHeadToSet( const std::string& sHSet, const std::string& sName) ;
|
||||
const STRVECTOR& GetHSet( const std::string& sHead) const ;
|
||||
bool EnableHeadInSet( const std::string& sHead) ;
|
||||
bool LoadTool( Exit* pExit, const std::string& sTool) ;
|
||||
bool ModifyMachineHeadAuxDirection( const std::string& sHead, const Vector3d& vtADir) ;
|
||||
@@ -275,6 +281,10 @@ class Machine
|
||||
const Vector3d& vtDirH, const Vector3d& vtDirI,
|
||||
int nNumRotAx, const KinAxis& RotAx1, const KinAxis& RotAx2,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ;
|
||||
bool GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
const Vector3d& vtDirH, const Vector3d& vtDirI,
|
||||
const KinAxis& RotAx1, const KinAxis& RotAx2, const KinAxis& RotAx3,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngC1, double& dAngA2, double& dAngB2, double& dAngC2) const ;
|
||||
bool GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const ;
|
||||
bool GetBackDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const ;
|
||||
bool GetSccDir( int nSolCh, const Vector3d& vtDirA, Vector3d& vtDirScc) const ;
|
||||
@@ -291,6 +301,7 @@ class Machine
|
||||
// generali
|
||||
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
|
||||
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
|
||||
int m_nContextId ; // indice contesto corrente (1-based)
|
||||
LuaMgr m_LuaMgr ; // interprete lua della macchina
|
||||
Writer m_Writer ; // scrittore di file di testo
|
||||
// dati macchina
|
||||
@@ -316,6 +327,7 @@ class Machine
|
||||
int m_nCalcExitId ; // uscita corrente per calcoli
|
||||
int m_nCalcToolId ; // utensile corrente per calcoli
|
||||
double m_dCalcRot1W ; // peso del primo asse rotante per i confronti
|
||||
double m_dSingConeAng ; // angolo di apertura del cono di direzioni considerate coincidenti con asse singolare
|
||||
bool m_bCalcMaxDeltaR2On1 ; // flag utilizzo controllo massimo delta secondo asse rotante su inizio lavorazione
|
||||
int m_nCalcSolCh ; // criterio di scelta della soluzione
|
||||
bool m_bSolChExact ; // flag per scelta soluzione da soddisfare esattamente
|
||||
@@ -338,6 +350,7 @@ class Machine
|
||||
int m_nCalcChainType ; // tipologia testa attiva (nulla, centro di lavoro o robot)
|
||||
Point3d m_ptWristCen ; // centro del polso sferico nel riferimento testa/uscita di calcolo
|
||||
Vector3d m_vtWristRef ; // direzione del polso sferico nel riferimento testa/uscita di calcolo
|
||||
mutable double m_dPrevAngA ; // angolo precedente di riferimento per soluzione indeterminata
|
||||
mutable OutStroke m_OutstrokeInfo ; // informazioni su ultima extra corsa
|
||||
// stato di visualizzazione
|
||||
int m_nMachineLook ; // stato di visualizzazione della macchina
|
||||
@@ -394,6 +407,8 @@ class Machine
|
||||
static int LuaEmtSetWarning( lua_State* L) ;
|
||||
static int LuaEmtAddCollisionObj( lua_State* L) ;
|
||||
static int LuaEmtAddCollisionObjEx( lua_State* L) ;
|
||||
static int LuaEmtRemoveCollisionObj( lua_State* L) ;
|
||||
static int LuaEmtGetCollisionObj( lua_State* L) ;
|
||||
static int LuaEmtExecCollisionCheck( lua_State* L) ;
|
||||
static int LuaEmtOnCollision( lua_State* L) ;
|
||||
static int LuaEmtSetToolForVmill( lua_State* L) ;
|
||||
@@ -410,15 +425,15 @@ Machine::LuaSetGlobVar( const std::string& sVar, const T& Val)
|
||||
{
|
||||
// imposto contesto corretto
|
||||
int nOldCtx = ExeGetCurrentContext() ;
|
||||
if ( nOldCtx != m_pMchMgr->GetContextId())
|
||||
ExeSetCurrentContext( m_pMchMgr->GetContextId()) ;
|
||||
if ( nOldCtx != m_nContextId)
|
||||
ExeSetCurrentContext( m_nContextId) ;
|
||||
// imposto l'oggetto corrente per Lua
|
||||
Machine* pOldMchLua = m_pMchLua ;
|
||||
m_pMchLua = this ;
|
||||
// eseguo l'assegnamento
|
||||
bool bOk = ::LuaSetGlobVar( m_LuaMgr.GetLuaState(), sVar, Val) ;
|
||||
// ripristino contesto originale
|
||||
if ( nOldCtx != m_pMchMgr->GetContextId())
|
||||
if ( nOldCtx != m_nContextId)
|
||||
ExeSetCurrentContext( nOldCtx) ;
|
||||
// ripristino dell'oggetto corrente per Lua
|
||||
m_pMchLua = pOldMchLua ;
|
||||
@@ -432,15 +447,15 @@ Machine::LuaGetGlobVar( const std::string& sVar, T& Val)
|
||||
{
|
||||
// imposto contesto corretto
|
||||
int nOldCtx = ExeGetCurrentContext() ;
|
||||
if ( nOldCtx != m_pMchMgr->GetContextId())
|
||||
ExeSetCurrentContext( m_pMchMgr->GetContextId()) ;
|
||||
if ( nOldCtx != m_nContextId)
|
||||
ExeSetCurrentContext( m_nContextId) ;
|
||||
// imposto l'oggetto corrente per Lua
|
||||
Machine* pOldMchLua = m_pMchLua ;
|
||||
m_pMchLua = this ;
|
||||
// eseguo la lettura
|
||||
bool bOk = ::LuaGetGlobVar( m_LuaMgr.GetLuaState(), sVar, Val) ;
|
||||
// ripristino contesto originale
|
||||
if ( nOldCtx != m_pMchMgr->GetContextId())
|
||||
if ( nOldCtx != m_nContextId)
|
||||
ExeSetCurrentContext( nOldCtx) ;
|
||||
// ripristino dell'oggetto corrente per Lua
|
||||
m_pMchLua = pOldMchLua ;
|
||||
|
||||
+436
-163
@@ -371,7 +371,9 @@ Machine::ResetCurrTool( void)
|
||||
m_nCalcHeadId = GDB_ID_NULL ;
|
||||
m_nCalcExitId = GDB_ID_NULL ;
|
||||
m_nCalcToolId = GDB_ID_NULL ;
|
||||
m_dCalcRot1W = 1 ;
|
||||
m_dCalcRot1W = ROT1_WEIGHT_DFLT ;
|
||||
m_dSingConeAng = SING_CONE_ANG_DFLT ;
|
||||
m_bCalcMaxDeltaR2On1 = true ;
|
||||
m_nCalcSolCh = MCH_SCC_NONE ;
|
||||
m_dCalcTLen = 0 ;
|
||||
m_dCalcTRad = 0 ;
|
||||
@@ -547,65 +549,118 @@ Machine::CalculateKinematicChain( void)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se nessun asse lineare deve essere un robot (in futuro va permesso un lineare di tavola)
|
||||
// se nessun asse lineare deve essere un robot (in futuro andrà permesso un lineare di testa o di tavola)
|
||||
if ( m_nTabLinAxes == 0 && m_nHeadLinAxes == 0) {
|
||||
// verifico ci siano 6 assi rotanti tutti di testa (in futuro va permesso un rotante di tavola)
|
||||
if ( m_nTabRotAxes != 0 || m_nHeadRotAxes != 6) {
|
||||
// se 6 assi rotanti tutti di testa
|
||||
if ( m_nTabRotAxes == 0 && m_nHeadRotAxes == 6) {
|
||||
// riordino gli assi rotanti
|
||||
swap( m_vCalcRotAx[0], m_vCalcRotAx[5]) ;
|
||||
swap( m_vCalcRotAx[1], m_vCalcRotAx[4]) ;
|
||||
swap( m_vCalcRotAx[2], m_vCalcRotAx[3]) ;
|
||||
// determino il riferimento canonico del robot
|
||||
if ( ! m_frRobot.Set( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, m_vCalcRotAx[3].vtDir)) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : impossible canonic frame")
|
||||
return false ;
|
||||
}
|
||||
// porto tutti gli assi cinematici e i dati testa nel riferimento canonico
|
||||
for ( int i = 0 ; i < m_nHeadRotAxes ; ++ i) {
|
||||
m_vCalcRotAx[i].ptPos.ToLoc( m_frRobot) ;
|
||||
m_vCalcRotAx[i].vtDir.ToLoc( m_frRobot) ;
|
||||
}
|
||||
m_ptCalcPos.ToLoc( m_frRobot) ;
|
||||
m_vtCalcDir.ToLoc( m_frRobot) ;
|
||||
m_vtCalcADir.ToLoc( m_frRobot) ;
|
||||
// direzione assi rotanti deve essere Z Y Y X Y X
|
||||
if ( ! m_vCalcRotAx[0].vtDir.IsZ() ||
|
||||
! m_vCalcRotAx[1].vtDir.IsY() ||
|
||||
! m_vCalcRotAx[2].vtDir.IsY() ||
|
||||
! m_vCalcRotAx[3].vtDir.IsX() ||
|
||||
! m_vCalcRotAx[4].vtDir.IsY() ||
|
||||
! m_vCalcRotAx[5].vtDir.IsX()) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not ZYY-XYX")
|
||||
return false ;
|
||||
}
|
||||
// verifico che gli ultimi 3 assi formino un polso sferico (ovvero passino per uno stesso punto)
|
||||
if ( abs( m_vCalcRotAx[3].ptPos.y - m_vCalcRotAx[5].ptPos.y) > EPS_SMALL ||
|
||||
abs( m_vCalcRotAx[3].ptPos.z - m_vCalcRotAx[5].ptPos.z) > EPS_SMALL ||
|
||||
abs( m_vCalcRotAx[4].ptPos.z - m_vCalcRotAx[3].ptPos.z) > EPS_SMALL) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not spherical Wrist")
|
||||
return false ;
|
||||
}
|
||||
// calcolo il centro del polso in coordinate globali (R5.x, R6.y, R5.z)
|
||||
Point3d ptCenG( m_vCalcRotAx[4].ptPos.x, m_vCalcRotAx[5].ptPos.y, m_vCalcRotAx[4].ptPos.z) ;
|
||||
// recupero il riferimento dell'uscita (da posizione, direzione utensile e direzione ausiliaria)
|
||||
Frame3d frExit ;
|
||||
if ( ! frExit.Set( m_ptCalcPos, m_vtCalcDir, m_vtCalcADir))
|
||||
return false ;
|
||||
// calcolo il centro del polso in locale a questo riferimento
|
||||
m_ptWristCen = GetToLoc( ptCenG, frExit) ;
|
||||
// calcolo la direzione di riferimento del polso in locale a questo riferimento
|
||||
m_vtWristRef = GetToLoc( m_vCalcRotAx[5].vtDir, frExit) ;
|
||||
// dichiaro tipo robot
|
||||
m_nCalcChainType = KIN_CHAIN_ROBOT ;
|
||||
return true ;
|
||||
}
|
||||
// se altrimenti 6 assi rotanti tutti di tavola
|
||||
else if ( m_nTabRotAxes == 6 && m_nHeadRotAxes == 0) {
|
||||
// riordino gli assi rotanti
|
||||
swap( m_vCalcRotAx[0], m_vCalcRotAx[5]) ;
|
||||
swap( m_vCalcRotAx[1], m_vCalcRotAx[4]) ;
|
||||
swap( m_vCalcRotAx[2], m_vCalcRotAx[3]) ;
|
||||
// determino il riferimento canonico del robot
|
||||
if ( ! m_frRobot.Set( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, m_vCalcRotAx[3].vtDir)) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : impossible canonic frame")
|
||||
return false ;
|
||||
}
|
||||
// porto tutti gli assi cinematici e i dati testa nel riferimento canonico
|
||||
for ( int i = 0 ; i < m_nTabRotAxes ; ++ i) {
|
||||
m_vCalcRotAx[i].ptPos.ToLoc( m_frRobot) ;
|
||||
m_vCalcRotAx[i].vtDir.ToLoc( m_frRobot) ;
|
||||
}
|
||||
m_ptCalcPos.ToLoc( m_frRobot) ;
|
||||
m_vtCalcDir.ToLoc( m_frRobot) ;
|
||||
m_vtCalcADir.ToLoc( m_frRobot) ;
|
||||
// direzione assi rotanti deve essere Z Y Y X Y X
|
||||
if ( ! m_vCalcRotAx[0].vtDir.IsZ() ||
|
||||
! m_vCalcRotAx[1].vtDir.IsY() ||
|
||||
! m_vCalcRotAx[2].vtDir.IsY() ||
|
||||
! m_vCalcRotAx[3].vtDir.IsX() ||
|
||||
! m_vCalcRotAx[4].vtDir.IsY() ||
|
||||
! m_vCalcRotAx[5].vtDir.IsX()) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not ZYY-XYX")
|
||||
return false ;
|
||||
}
|
||||
// verifico che gli ultimi 3 assi formino un polso sferico (ovvero passino per uno stesso punto)
|
||||
if ( abs( m_vCalcRotAx[3].ptPos.y - m_vCalcRotAx[5].ptPos.y) > EPS_SMALL ||
|
||||
abs( m_vCalcRotAx[3].ptPos.z - m_vCalcRotAx[5].ptPos.z) > EPS_SMALL ||
|
||||
abs( m_vCalcRotAx[4].ptPos.z - m_vCalcRotAx[3].ptPos.z) > EPS_SMALL) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not spherical Wrist")
|
||||
return false ;
|
||||
}
|
||||
// calcolo il centro del polso in coordinate globali (R5.x, R6.y, R5.z)
|
||||
Point3d ptCenG( m_vCalcRotAx[4].ptPos.x, m_vCalcRotAx[5].ptPos.y, m_vCalcRotAx[4].ptPos.z) ;
|
||||
// recupero il riferimento dell'uscita (da posizione, direzione utensile e direzione ausiliaria)
|
||||
Frame3d frExit ;
|
||||
if ( ! frExit.Set( m_ptCalcPos, m_vtCalcDir, m_vtCalcADir))
|
||||
return false ;
|
||||
// calcolo il centro del polso in locale a questo riferimento
|
||||
m_ptWristCen = GetToLoc( ptCenG, frExit) ;
|
||||
// calcolo la direzione di riferimento del polso in locale a questo riferimento
|
||||
m_vtWristRef = GetToLoc( m_vCalcRotAx[5].vtDir, frExit) ;
|
||||
// dichiaro tipo robot
|
||||
m_nCalcChainType = KIN_CHAIN_ROBOT ;
|
||||
return true ;
|
||||
}
|
||||
// altrimenti errore
|
||||
else {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : number or type")
|
||||
return false ;
|
||||
}
|
||||
// riordino gli assi rotanti
|
||||
swap( m_vCalcRotAx[0], m_vCalcRotAx[5]) ;
|
||||
swap( m_vCalcRotAx[1], m_vCalcRotAx[4]) ;
|
||||
swap( m_vCalcRotAx[2], m_vCalcRotAx[3]) ;
|
||||
// determino il riferimento canonico del robot
|
||||
if ( ! m_frRobot.Set( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, m_vCalcRotAx[3].vtDir)) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : impossible canonic frame")
|
||||
return false ;
|
||||
}
|
||||
// porto tutti gli assi cinematici e i dati testa nel riferimento canonico
|
||||
for ( int i = 0 ; i < m_nHeadRotAxes ; ++ i) {
|
||||
m_vCalcRotAx[i].ptPos.ToLoc( m_frRobot) ;
|
||||
m_vCalcRotAx[i].vtDir.ToLoc( m_frRobot) ;
|
||||
}
|
||||
m_ptCalcPos.ToLoc( m_frRobot) ;
|
||||
m_vtCalcDir.ToLoc( m_frRobot) ;
|
||||
m_vtCalcADir.ToLoc( m_frRobot) ;
|
||||
// direzione assi rotanti deve essere Z Y Y X Y X
|
||||
if ( ! m_vCalcRotAx[0].vtDir.IsZ() ||
|
||||
! m_vCalcRotAx[1].vtDir.IsY() ||
|
||||
! m_vCalcRotAx[2].vtDir.IsY() ||
|
||||
! m_vCalcRotAx[3].vtDir.IsX() ||
|
||||
! m_vCalcRotAx[4].vtDir.IsY() ||
|
||||
! m_vCalcRotAx[5].vtDir.IsX()) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not ZYY-XYX")
|
||||
return false ;
|
||||
}
|
||||
// verifico che gli ultimi 3 assi formino un polso sferico (ovvero passino per uno stesso punto)
|
||||
if ( abs( m_vCalcRotAx[3].ptPos.y - m_vCalcRotAx[5].ptPos.y) > EPS_SMALL ||
|
||||
abs( m_vCalcRotAx[3].ptPos.z - m_vCalcRotAx[5].ptPos.z) > EPS_SMALL ||
|
||||
abs( m_vCalcRotAx[4].ptPos.z - m_vCalcRotAx[3].ptPos.z) > EPS_SMALL) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not spherical Wrist")
|
||||
return false ;
|
||||
}
|
||||
// calcolo il centro del polso in coordinate globali (R5.x, R6.y, R5.z)
|
||||
Point3d ptCenG( m_vCalcRotAx[4].ptPos.x, m_vCalcRotAx[5].ptPos.y, m_vCalcRotAx[4].ptPos.z) ;
|
||||
// recupero il riferimento dell'uscita (da posizione, direzione utensile e direzione ausiliaria)
|
||||
Frame3d frExit ;
|
||||
if ( ! frExit.Set( m_ptCalcPos, m_vtCalcDir, m_vtCalcADir))
|
||||
return false ;
|
||||
// calcolo il centro del polso in locale a questo riferimento
|
||||
m_ptWristCen = GetToLoc( ptCenG, frExit) ;
|
||||
// calcolo la direzione di riferimento del polso in locale a questo riferimento
|
||||
m_vtWristRef = GetToLoc( m_vCalcRotAx[5].vtDir, frExit) ;
|
||||
// dichiaro tipo robot
|
||||
m_nCalcChainType = KIN_CHAIN_ROBOT ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
// verifiche sugli assi lineari :
|
||||
// aggiusto gli indici di ordine sulla sua catena cinematica (1-based)
|
||||
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( m_vCalcLinAx) ; ++ i) {
|
||||
if ( m_vCalcLinAx[i].bHead)
|
||||
m_vCalcLinAx[i].nInd += m_nHeadLinAxes + m_nHeadRotAxes + 1 ;
|
||||
else
|
||||
@@ -687,9 +742,36 @@ Machine::CalculateKinematicChain( void)
|
||||
}
|
||||
}
|
||||
}
|
||||
// se più di 3
|
||||
// se 4 va bene ( due dovranno poi avere valore assegnato)
|
||||
else if ( m_vCalcRotAx.size() == 4) {
|
||||
int n2ndHeadRotAx = - 1 ;
|
||||
// se tutti e quattro di testa, devo invertire il primo con il quarto e il secondo con il terzo
|
||||
if ( m_vCalcRotAx[0].bHead && m_vCalcRotAx[1].bHead && m_vCalcRotAx[2].bHead && m_vCalcRotAx[3].bHead) {
|
||||
swap( m_vCalcRotAx[0], m_vCalcRotAx[3]) ;
|
||||
swap( m_vCalcRotAx[1], m_vCalcRotAx[2]) ;
|
||||
n2ndHeadRotAx = 1 ;
|
||||
}
|
||||
// se altrimenti ultimi tre di testa, devo invertire il secondo con il quarto
|
||||
else if ( m_vCalcRotAx[1].bHead && m_vCalcRotAx[2].bHead && m_vCalcRotAx[3].bHead) {
|
||||
swap( m_vCalcRotAx[1], m_vCalcRotAx[3]) ;
|
||||
n2ndHeadRotAx = 2 ;
|
||||
}
|
||||
// se altrimenti ultimi due di testa, devo invertirne l'ordine
|
||||
else if ( m_vCalcRotAx[2].bHead && m_vCalcRotAx[3].bHead) {
|
||||
swap( m_vCalcRotAx[2], m_vCalcRotAx[3]) ;
|
||||
n2ndHeadRotAx = 3 ;
|
||||
}
|
||||
// impongo limiti di corsa sul secondo asse rotante di testa
|
||||
if ( n2ndHeadRotAx > 0) {
|
||||
Head* pHead = GetHead( m_nCalcHeadId) ;
|
||||
if ( pHead != nullptr) {
|
||||
m_vCalcRotAx[n2ndHeadRotAx].stroke.Min = max( m_vCalcRotAx[n2ndHeadRotAx].stroke.Min, pHead->GetRot2Stroke().Min) ;
|
||||
m_vCalcRotAx[n2ndHeadRotAx].stroke.Max = min( m_vCalcRotAx[n2ndHeadRotAx].stroke.Max, pHead->GetRot2Stroke().Max) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// altrimenti più di 4 non ancora gestito, quindi errore
|
||||
else {
|
||||
// altrimenti non ancora gestito, quindi errore
|
||||
LOG_ERROR( GetEMkLogger(), "Rotary Axes not manageable")
|
||||
return false ;
|
||||
}
|
||||
@@ -729,7 +811,7 @@ Machine::CalculateKinematicChain( void)
|
||||
}
|
||||
}
|
||||
// dichiaro tipo centro di lavoro
|
||||
m_nCalcChainType = KIN_CHAIN_CENTER ;
|
||||
m_nCalcChainType = KIN_CHAIN_MCENT ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -809,7 +891,7 @@ Machine::BlockKinematicRotAxis( int nId, double dVal)
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// cerco l'asse rotante di calcolo con questo identificativo
|
||||
for ( size_t i = 0 ; i < m_vCalcRotAx.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( m_vCalcRotAx) ; ++ i) {
|
||||
if ( m_vCalcRotAx[i].nGrpId == nId) {
|
||||
if ( dVal < m_vCalcRotAx[i].stroke.Min || dVal > m_vCalcRotAx[i].stroke.Max) {
|
||||
m_vCalcRotAx[i].bFixed = false ;
|
||||
@@ -838,7 +920,7 @@ Machine::FreeKinematicRotAxis( int nId)
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// cerco l'asse rotante di calcolo con questo identificativo
|
||||
for ( size_t i = 0 ; i < m_vCalcRotAx.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( m_vCalcRotAx) ; ++ i) {
|
||||
if ( m_vCalcRotAx[i].nGrpId == nId) {
|
||||
m_vCalcRotAx[i].bFixed = false ;
|
||||
return true ;
|
||||
@@ -912,31 +994,6 @@ Machine::SetSolCh( int nScc, bool bExact)
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const
|
||||
{
|
||||
// assegno dati
|
||||
Vector3d vtDirH = m_vtCalcDir ;
|
||||
Vector3d vtDirI = m_vtCalcADir ;
|
||||
int nNumRotAx = 0 ;
|
||||
KinAxis RotAx1 ;
|
||||
if ( m_vCalcRotAx.size() >= 1) {
|
||||
++ nNumRotAx ;
|
||||
RotAx1 = m_vCalcRotAx[0] ;
|
||||
}
|
||||
KinAxis RotAx2 ;
|
||||
if ( m_vCalcRotAx.size() >= 2) {
|
||||
++ nNumRotAx ;
|
||||
RotAx2 = m_vCalcRotAx[1] ;
|
||||
}
|
||||
|
||||
// eseguo calcolo
|
||||
return GetMyAngles( vtDirT, vtDirA, vtDirH, vtDirI, nNumRotAx, RotAx1, RotAx2,
|
||||
nStat, dAngA1, dAngB1, dAngA2, dAngB2) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
@@ -948,19 +1005,19 @@ Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
Vector3d vtDirH = m_vtCalcDir ;
|
||||
Vector3d vtDirI = m_vtCalcADir ;
|
||||
int nNumRotAx = 0 ;
|
||||
KinAxis RotAx[2] ;
|
||||
KinAxis RotAx[3] ;
|
||||
INTVECTOR vBloHeAx ;
|
||||
for ( size_t i = 0 ; i < m_vCalcRotAx.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( m_vCalcRotAx) ; ++ i) {
|
||||
// se asse libero
|
||||
if ( ! m_vCalcRotAx[i].bFixed) {
|
||||
// verifico di non superare il limite
|
||||
if ( nNumRotAx >= 2)
|
||||
if ( nNumRotAx >= 3)
|
||||
return false ;
|
||||
// assegno l'asse
|
||||
RotAx[nNumRotAx] = m_vCalcRotAx[i] ;
|
||||
// se asse di testa, lo aggiorno con precedenti bloccati di testa (applicati in ordine contrario)
|
||||
if ( RotAx[nNumRotAx].bHead) {
|
||||
for ( size_t k = vBloHeAx.size() ; k >= 1 ; -- k) {
|
||||
for ( int k = ssize( vBloHeAx) ; k >= 1 ; -- k) {
|
||||
int nA = vBloHeAx[k-1] ;
|
||||
RotAx[nNumRotAx].ptPos.Rotate( m_vCalcRotAx[nA].ptPos, m_vCalcRotAx[nA].vtDir, m_vCalcRotAx[nA].dFixVal) ;
|
||||
RotAx[nNumRotAx].vtDir.Rotate( m_vCalcRotAx[nA].vtDir, m_vCalcRotAx[nA].dFixVal) ;
|
||||
@@ -977,7 +1034,7 @@ Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
vtDirTm.Rotate( m_vCalcRotAx[i].vtDir, m_vCalcRotAx[i].dFixVal) ;
|
||||
vtDirAm.Rotate( m_vCalcRotAx[i].vtDir, m_vCalcRotAx[i].dFixVal) ;
|
||||
// aggiorno eventuali assi già inseriti (sicuramente di tavola)
|
||||
for ( size_t j = 0 ; int( j) < nNumRotAx ; ++ j) {
|
||||
for ( int j = 0 ; j < nNumRotAx ; ++ j) {
|
||||
RotAx[j].ptPos.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, m_vCalcRotAx[i].dFixVal) ;
|
||||
RotAx[j].vtDir.Rotate( m_vCalcRotAx[i].vtDir, m_vCalcRotAx[i].dFixVal) ;
|
||||
}
|
||||
@@ -988,42 +1045,83 @@ Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
vBloHeAx.push_back( int( i)) ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// aggiorno direzioni utensile e ausiliaria su testa con eventuali assi bloccati di testa (applico in ordine contrario)
|
||||
for ( size_t k = vBloHeAx.size() ; k >= 1 ; -- k) {
|
||||
for ( int k = ssize( vBloHeAx) ; k >= 1 ; -- k) {
|
||||
int nA = vBloHeAx[k-1] ;
|
||||
vtDirH.Rotate( m_vCalcRotAx[nA].vtDir, m_vCalcRotAx[nA].dFixVal) ;
|
||||
vtDirI.Rotate( m_vCalcRotAx[nA].vtDir, m_vCalcRotAx[nA].dFixVal) ;
|
||||
}
|
||||
|
||||
// eseguo calcolo
|
||||
double dAngA1, dAngB1, dAngA2, dAngB2 ;
|
||||
if ( ! GetMyAngles( vtDirTm, vtDirAm, vtDirH, vtDirI, nNumRotAx, RotAx[0], RotAx[1],
|
||||
nStat, dAngA1, dAngB1, dAngA2, dAngB2))
|
||||
return false ;
|
||||
// assegno gli angoli
|
||||
int nRotAxInd = 1 ;
|
||||
for ( size_t i = 0 ; i < m_vCalcRotAx.size() ; ++i) {
|
||||
if ( m_vCalcRotAx[i].bFixed) {
|
||||
vAng1.push_back( m_vCalcRotAx[i].dFixVal) ;
|
||||
vAng2.push_back( m_vCalcRotAx[i].dFixVal) ;
|
||||
}
|
||||
else {
|
||||
if ( nRotAxInd == 1) {
|
||||
vAng1.push_back( dAngA1) ;
|
||||
vAng2.push_back( dAngA2) ;
|
||||
// fino a due assi rotanti liberi
|
||||
if ( nNumRotAx <= 2) {
|
||||
// eseguo calcolo
|
||||
double dAngA1, dAngB1, dAngA2, dAngB2 ;
|
||||
if ( ! GetMyAngles( vtDirTm, vtDirAm, vtDirH, vtDirI, nNumRotAx, RotAx[0], RotAx[1],
|
||||
nStat, dAngA1, dAngB1, dAngA2, dAngB2))
|
||||
return false ;
|
||||
// assegno gli angoli
|
||||
int nRotAxInd = 1 ;
|
||||
for ( int i = 0 ; i < ssize( m_vCalcRotAx) ; ++i) {
|
||||
if ( m_vCalcRotAx[i].bFixed) {
|
||||
vAng1.push_back( m_vCalcRotAx[i].dFixVal) ;
|
||||
vAng2.push_back( m_vCalcRotAx[i].dFixVal) ;
|
||||
}
|
||||
else if ( nRotAxInd == 2) {
|
||||
vAng1.push_back( dAngB1) ;
|
||||
vAng2.push_back( dAngB2) ;
|
||||
else {
|
||||
if ( nRotAxInd == 1) {
|
||||
vAng1.push_back( dAngA1) ;
|
||||
vAng2.push_back( dAngA2) ;
|
||||
}
|
||||
else if ( nRotAxInd == 2) {
|
||||
vAng1.push_back( dAngB1) ;
|
||||
vAng2.push_back( dAngB2) ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
++ nRotAxInd ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
++ nRotAxInd ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
// altrimenti tre assi rotanti liberi
|
||||
else {
|
||||
// verifico siano del tipo XYX (primo e terzo paralleli, secondo ortogonale a questi)
|
||||
if ( ! AreSameOrOppositeVectorApprox( RotAx[0].vtDir, RotAx[2].vtDir) ||
|
||||
! AreOrthoApprox( RotAx[0].vtDir, RotAx[1].vtDir))
|
||||
return false ;
|
||||
// eseguo calcolo
|
||||
double dAngA1, dAngB1, dAngC1, dAngA2, dAngB2, dAngC2 ;
|
||||
if ( ! GetMyAngles( vtDirTm, vtDirAm, vtDirH, vtDirI, RotAx[0], RotAx[1], RotAx[2],
|
||||
nStat, dAngA1, dAngB1, dAngC1, dAngA2, dAngB2, dAngC2))
|
||||
return false ;
|
||||
// assegno gli angoli
|
||||
int nRotAxInd = 1 ;
|
||||
for ( int i = 0 ; i < ssize( m_vCalcRotAx) ; ++i) {
|
||||
if ( m_vCalcRotAx[i].bFixed) {
|
||||
vAng1.push_back( m_vCalcRotAx[i].dFixVal) ;
|
||||
vAng2.push_back( m_vCalcRotAx[i].dFixVal) ;
|
||||
}
|
||||
else {
|
||||
if ( nRotAxInd == 1) {
|
||||
vAng1.push_back( dAngA1) ;
|
||||
vAng2.push_back( dAngA2) ;
|
||||
}
|
||||
else if ( nRotAxInd == 2) {
|
||||
vAng1.push_back( dAngB1) ;
|
||||
vAng2.push_back( dAngB2) ;
|
||||
}
|
||||
else if ( nRotAxInd == 3) {
|
||||
vAng1.push_back( dAngC1) ;
|
||||
vAng2.push_back( dAngC2) ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
++ nRotAxInd ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1171,8 +1269,30 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
vtDirI1.Rotate( vtAx1, dAngA1) ;
|
||||
}
|
||||
|
||||
// verifica per direzione singolare (direzione fresa molto vicina a direzione primo asse rotante)
|
||||
if ( nNumRotAx == 2 && nStat == 2 && abs( dAngB2 - dAngB1) < 2 * m_dSingConeAng) {
|
||||
nStat = 1 ;
|
||||
bDet1 = false ;
|
||||
dAngB1 = ( dAngB1 + dAngB2) / 2 ;
|
||||
// ripristino direzioni fresa e ausiliaria su testa
|
||||
vtDirH1.Rotate( vtAx1, -dAngA1) ;
|
||||
vtDirI1.Rotate( vtAx1, -dAngA1) ;
|
||||
// provo a determinare primo angolo con la direzione ausiliaria
|
||||
bool bDetX ;
|
||||
Vector3d vtSccDir ;
|
||||
bool bSccDir = GetSccDir( m_nCalcSolCh, vtDirAn, vtSccDir) ;
|
||||
vtDirI1.GetRotation( vtSccDir, vtAx1, dAngA1, bDetX) ;
|
||||
if ( bDetX)
|
||||
bDet1 = bSccDir ;
|
||||
else
|
||||
dAngA1 = 0 ;
|
||||
// aggiornamento direzioni fresa e ausiliaria su testa
|
||||
vtDirH1.Rotate( vtAx1, dAngA1) ;
|
||||
vtDirI1.Rotate( vtAx1, dAngA1) ;
|
||||
}
|
||||
|
||||
// verifiche per criterio scelta soluzione
|
||||
if ( nStat >= 2) {
|
||||
if ( nStat == 2) {
|
||||
if ( ! VerifyScc( vtDirI2, vtDirAn, m_nCalcSolCh, m_bSolChExact))
|
||||
-- nStat ;
|
||||
}
|
||||
@@ -1188,7 +1308,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
}
|
||||
|
||||
// verifiche dei limiti di corsa
|
||||
if ( nStat >= 2) {
|
||||
if ( nStat == 2) {
|
||||
// se non riesco ad aggiustare, elimino
|
||||
if ( ! AdjustAngleInStroke( RotAx1.stroke, dAngA2) ||
|
||||
( nNumRotAx == 2 && ! AdjustAngleInStroke( RotAx2.stroke, dAngB2)))
|
||||
@@ -1208,16 +1328,120 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
}
|
||||
|
||||
// modifico stato per angolo indeterminato
|
||||
if ( ( nStat >= 2 && ! bDet2) || ( nStat >= 1 && ! bDet1))
|
||||
if ( ( nStat == 2 && ! bDet2) || ( nStat >= 1 && ! bDet1))
|
||||
nStat = - nStat ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
const Vector3d& vtDirH, const Vector3d& vtDirI,
|
||||
const KinAxis& RotAx1, const KinAxis& RotAx2, const KinAxis& RotAx3,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngC1, double& dAngA2, double& dAngB2, double& dAngC2) const
|
||||
{
|
||||
// annullo tutti gli angoli
|
||||
nStat = 0 ; dAngA1 = 0 ; dAngB1 = 0 ; dAngC1 = 0 ; dAngA2 = 0 ; dAngB2 = 0 ; dAngC2 = 0 ;
|
||||
|
||||
// direzione fresa normalizzata
|
||||
Vector3d vtDirTn = vtDirT ;
|
||||
if ( ! vtDirTn.Normalize())
|
||||
return false ;
|
||||
// direzione ausiliaria normalizzata
|
||||
Vector3d vtDirAn = vtDirA ;
|
||||
if ( ! vtDirAn.Normalize())
|
||||
return false ;
|
||||
|
||||
// riferimento fresa su testa a riposo
|
||||
Frame3d frTzero ;
|
||||
frTzero.Set( ORIG, vtDirH, vtDirI) ;
|
||||
// riferimento fresa richiesto
|
||||
Frame3d frTool ;
|
||||
frTool.Set( ORIG, vtDirTn, vtDirAn) ;
|
||||
// riferimento intrinseco primi due assi rotanti
|
||||
Frame3d frWrist ;
|
||||
frWrist.Set( ORIG, RotAx1.vtDir, RotAx2.vtDir ^ RotAx1.vtDir) ;
|
||||
|
||||
// direzione terzo asse rotante con testa a riposo
|
||||
Vector3d vtCzero = GetToLoc( RotAx3.vtDir, frTzero) ;
|
||||
// direzione richiesta terzo asse rotante
|
||||
Vector3d vtCen = GetToGlob( vtCzero, frTool) ;
|
||||
|
||||
// calcolo primi due assi rotanti
|
||||
Vector3d vtCenL = GetToLoc( vtCen, frWrist) ;
|
||||
vtCenL.ToSpherical( nullptr, &dAngB1, &dAngA1) ;
|
||||
if ( dAngA1 > ANG_STRAIGHT)
|
||||
dAngA1 -= ANG_FULL ;
|
||||
if ( dAngA1 > ANG_RIGHT) {
|
||||
dAngA1 -= ANG_STRAIGHT ;
|
||||
dAngB1 = -dAngB1 ;
|
||||
}
|
||||
else if ( dAngA1 < -ANG_RIGHT) {
|
||||
dAngA1 += ANG_STRAIGHT ;
|
||||
dAngB1 = -dAngB1 ;
|
||||
}
|
||||
dAngA2 = dAngA1 + ( dAngA1 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT) ;
|
||||
dAngB2 = -dAngB1 ;
|
||||
|
||||
// se soluzione indeterminata e suggerito angolo precedente valido
|
||||
if ( abs( dAngB1) < EPS_ANG_SMALL / 2 && isfinite( m_dPrevAngA) && VerifyAngleOutstroke( 1, m_dPrevAngA)) {
|
||||
nStat = 1 ;
|
||||
dAngA1 = m_dPrevAngA ;
|
||||
dAngB1 = 0 ;
|
||||
}
|
||||
else
|
||||
nStat = 2 ;
|
||||
|
||||
// calcolo il terzo asse rotante del polso
|
||||
Vector3d vtR3 = RotAx3.vtDir ;
|
||||
vtR3.Rotate( RotAx2.vtDir, dAngB1) ;
|
||||
vtR3.Rotate( RotAx1.vtDir, dAngA1) ;
|
||||
Vector3d vtTool = vtDirH ;
|
||||
vtTool.Rotate( RotAx2.vtDir, dAngB1) ;
|
||||
vtTool.Rotate( RotAx1.vtDir, dAngA1) ;
|
||||
bool bDetC1 ;
|
||||
if ( ! vtTool.GetRotation( vtDirTn, vtR3, EPS_SMALL, dAngC1, bDetC1) || ! bDetC1) {
|
||||
Vector3d vtAux = vtDirI ;
|
||||
vtAux.Rotate( RotAx2.vtDir, dAngB1) ;
|
||||
vtAux.Rotate( RotAx1.vtDir, dAngA1) ;
|
||||
if ( ! vtAux.GetRotation( vtDirAn, vtR3, EPS_SMALL, dAngC1, bDetC1) || ! bDetC1) {
|
||||
LOG_ERROR( GetEMkLogger(), "Error : R3 not calculable (machine)")
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
dAngC2 = dAngC1 + ( dAngC1 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT) ;
|
||||
|
||||
// verifiche dei limiti di corsa
|
||||
if ( nStat >= 2) {
|
||||
// se non riesco ad aggiustare, elimino
|
||||
if ( ! AdjustAngleInStroke( RotAx1.stroke, dAngA2) ||
|
||||
! AdjustAngleInStroke( RotAx2.stroke, dAngB2) ||
|
||||
! AdjustAngleInStroke( RotAx3.stroke, dAngC2))
|
||||
-- nStat ;
|
||||
}
|
||||
if ( nStat >= 1) {
|
||||
// se non riesco ad aggiustare, elimino
|
||||
if ( ! AdjustAngleInStroke( RotAx1.stroke, dAngA1) ||
|
||||
! AdjustAngleInStroke( RotAx2.stroke, dAngB1) ||
|
||||
! AdjustAngleInStroke( RotAx3.stroke, dAngC1)) {
|
||||
-- nStat ;
|
||||
// riloco eventuale soluzione rimasta
|
||||
if ( nStat >= 1) {
|
||||
dAngA1 = dAngA2 ;
|
||||
dAngB1 = dAngB2 ;
|
||||
dAngC1 = dAngC2 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
int& nStat, double& dX, double& dY, double& dZ) const
|
||||
double& dX, double& dY, double& dZ) const
|
||||
{
|
||||
// la posizione deve essere espressa rispetto allo ZERO MACCHINA
|
||||
// il punto è dato rispetto alla posizione home della tavola
|
||||
@@ -1278,7 +1502,6 @@ Machine::GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
dZ = ptPos.z ;
|
||||
|
||||
// tutto ok
|
||||
nStat = 0 ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1296,7 +1519,7 @@ Machine::GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& v
|
||||
vtNew = vtDir ;
|
||||
|
||||
// ciclo sugli assi di testa dall'ultimo (prima assi di tavola, poi di testa)
|
||||
for ( size_t i = m_vCalcRotAx.size() ; i >= 1 ; -- i) {
|
||||
for ( int i = ssize( m_vCalcRotAx) ; i >= 1 ; -- i) {
|
||||
// se asse di testa
|
||||
if ( m_vCalcRotAx[i-1].bHead)
|
||||
vtNew.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
|
||||
@@ -1323,7 +1546,7 @@ Machine::GetBackDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3
|
||||
vtNew = vtDir ;
|
||||
|
||||
// ciclo sugli assi dall'ultimo (prima assi di tavola, poi di testa)
|
||||
for ( size_t i = m_vCalcRotAx.size() ; i >= 1 ; -- i) {
|
||||
for ( int i = ssize( m_vCalcRotAx) ; i >= 1 ; -- i) {
|
||||
// se asse di testa
|
||||
if ( m_vCalcRotAx[i-1].bHead)
|
||||
vtNew.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
|
||||
@@ -1348,7 +1571,7 @@ Machine::GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
|
||||
return false ;
|
||||
|
||||
// se centro di lavoro
|
||||
if ( m_nCalcChainType == KIN_CHAIN_CENTER) {
|
||||
if ( m_nCalcChainType == KIN_CHAIN_MCENT) {
|
||||
// aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa
|
||||
ptNose = m_ptCalcPos ;
|
||||
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
|
||||
@@ -1401,7 +1624,7 @@ Machine::GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
|
||||
return false ;
|
||||
|
||||
// se centro di lavoro
|
||||
if ( m_nCalcChainType == KIN_CHAIN_CENTER) {
|
||||
if ( m_nCalcChainType == KIN_CHAIN_MCENT) {
|
||||
// aggiorno posizione tip utensile a riposo mediante ciclo inverso sugli assi rotanti di testa
|
||||
ptTip = m_ptCalcPos - m_vtCalcDir * m_dCalcTLen ;
|
||||
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
|
||||
@@ -1514,7 +1737,7 @@ Machine::GetPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Ve
|
||||
vtDir = vtPart ;
|
||||
|
||||
// ciclo sugli assi dal primo (solo assi di tavola)
|
||||
for ( size_t i = 1 ; i <= m_vCalcRotAx.size() ; ++ i) {
|
||||
for ( int i = 1 ; i <= ssize( m_vCalcRotAx) ; ++ i) {
|
||||
// se asse di tavola
|
||||
if ( ! m_vCalcRotAx[i-1].bHead)
|
||||
vtDir.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
|
||||
@@ -1522,7 +1745,7 @@ Machine::GetPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Ve
|
||||
|
||||
// eseguo rotazione inversa eventuale asse rotante speciale di testa
|
||||
if ( m_nHeadSpecRotAxis != -1) {
|
||||
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
|
||||
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= ssize( m_vCalcRotAx))
|
||||
return false ;
|
||||
int i = m_nHeadSpecRotAxis ;
|
||||
vtDir.Rotate( m_vCalcRotAx[i].vtDir, -vAng[i]) ;
|
||||
@@ -1624,8 +1847,19 @@ Machine::AdjustAngleInStroke( const STROKE& Stroke, double& dAng) const
|
||||
dAng += ANG_FULL ;
|
||||
while ( dAng > Stroke.Max)
|
||||
dAng -= ANG_FULL ;
|
||||
// verifico
|
||||
return ( dAng >= Stroke.Min && dAng <= Stroke.Max) ;
|
||||
// se nei limiti, tutto bene
|
||||
if ( dAng >= Stroke.Min && dAng <= Stroke.Max)
|
||||
return true ;
|
||||
// altrimenti, determino il valore con il minimo outstroke
|
||||
if ( dAng < Stroke.Min) {
|
||||
if ( abs( dAng - Stroke.Min) > abs( dAng + ANG_FULL - Stroke.Max))
|
||||
dAng += ANG_FULL ;
|
||||
}
|
||||
else {
|
||||
if ( abs( dAng - Stroke.Max) > abs( dAng - ANG_FULL - Stroke.Min))
|
||||
dAng -= ANG_FULL ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
// altrimenti asse rotante senza corsa
|
||||
else {
|
||||
@@ -1651,7 +1885,7 @@ bool
|
||||
Machine::GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const
|
||||
{
|
||||
// se angolo fittizio (non esiste l'asse rotante corrispondente), non c'è alcunchè da fare
|
||||
if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size()))
|
||||
if ( nInd < 0 || nInd >= ssize( m_vCalcRotAx))
|
||||
return true ;
|
||||
// cerco l'angolo più vicino stando nella corsa
|
||||
while ( dAng - dAngRef > ANG_STRAIGHT + EPS_ANG_ZERO && dAng - ANG_FULL >= m_vCalcRotAx[nInd].stroke.Min)
|
||||
@@ -1667,7 +1901,7 @@ bool
|
||||
Machine::LimitAngleToStroke( int nInd, double& dAng) const
|
||||
{
|
||||
// se angolo fittizio (non esiste l'asse rotante corrispondente), non c'è alcunchè da fare
|
||||
if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size()))
|
||||
if ( nInd < 0 || nInd >= ssize( m_vCalcRotAx))
|
||||
return true ;
|
||||
// se angolo fuori corsa, lo porto all'estremo più vicino
|
||||
dAng = Clamp( dAng, m_vCalcRotAx[nInd].stroke.Min, m_vCalcRotAx[nInd].stroke.Max) ;
|
||||
@@ -1679,7 +1913,7 @@ bool
|
||||
Machine::VerifyAngleOutstroke( int nInd, double dAng) const
|
||||
{
|
||||
// se angolo fittizio (non esiste l'asse rotante corrispondente), va bene
|
||||
if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size()))
|
||||
if ( nInd < 0 || nInd >= ssize( m_vCalcRotAx))
|
||||
return true ;
|
||||
// se angolo fuori corsa, errore
|
||||
if ( dAng < m_vCalcRotAx[nInd].stroke.Min)
|
||||
@@ -1700,41 +1934,49 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng
|
||||
m_OutstrokeInfo.Clear() ;
|
||||
// verifica degli assi lineari
|
||||
DBLVECTOR vLin( 3) ; vLin[0] = dX ; vLin[1] = dY ; vLin[2] = dZ ;
|
||||
for ( size_t i = 0 ; i < m_vCalcLinAx.size() && i < vLin.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( m_vCalcLinAx) && i < ssize( vLin) ; ++ i) {
|
||||
if ( vLin[i] < m_vCalcLinAx[i].stroke.Min) {
|
||||
if ( nStat == 0) {
|
||||
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcLinAx[i].nGrpId)->GetName() ;
|
||||
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcLinAx[i].nGrpId)->GetToken() ;
|
||||
m_OutstrokeInfo.bLinear = true ;
|
||||
m_OutstrokeInfo.dExtra = vLin[i] - m_vCalcLinAx[i].stroke.Min ;
|
||||
m_OutstrokeInfo.sAuxInfo = " (L" + ToString( int(i) + 1) + "-) " ;
|
||||
}
|
||||
nStat += ( 1 << ( 2 * i)) ;
|
||||
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcLinAx[i].nGrpId)->GetName() ;
|
||||
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcLinAx[i].nGrpId)->GetToken() ;
|
||||
m_OutstrokeInfo.bLinear = true ;
|
||||
m_OutstrokeInfo.dExtra = vLin[i] - m_vCalcLinAx[i].stroke.Min ;
|
||||
m_OutstrokeInfo.sAuxInfo = " (L" + ToString( int(i) + 1) + "-) " ;
|
||||
}
|
||||
else if( vLin[i] > m_vCalcLinAx[i].stroke.Max) {
|
||||
else if ( vLin[i] > m_vCalcLinAx[i].stroke.Max) {
|
||||
if ( nStat == 0) {
|
||||
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcLinAx[i].nGrpId)->GetName() ;
|
||||
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcLinAx[i].nGrpId)->GetToken() ;
|
||||
m_OutstrokeInfo.bLinear = true ;
|
||||
m_OutstrokeInfo.dExtra = vLin[i] - m_vCalcLinAx[i].stroke.Max ;
|
||||
m_OutstrokeInfo.sAuxInfo = " (L" + ToString( int(i) + 1) + "+) " ;
|
||||
}
|
||||
nStat += ( 2 << ( 2 * i)) ;
|
||||
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcLinAx[i].nGrpId)->GetName() ;
|
||||
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcLinAx[i].nGrpId)->GetToken() ;
|
||||
m_OutstrokeInfo.bLinear = true ;
|
||||
m_OutstrokeInfo.dExtra = vLin[i] - m_vCalcLinAx[i].stroke.Max ;
|
||||
m_OutstrokeInfo.sAuxInfo = " (L" + ToString( int(i) + 1) + "+) " ;
|
||||
}
|
||||
}
|
||||
// verifica degli assi rotanti
|
||||
for ( size_t i = 0 ; i < m_vCalcRotAx.size() && i < vAng.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize(m_vCalcRotAx) && i < ssize( vAng) ; ++ i) {
|
||||
if ( vAng[i] < m_vCalcRotAx[i].stroke.Min) {
|
||||
if ( nStat == 0) {
|
||||
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcRotAx[i].nGrpId)->GetName() ;
|
||||
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcRotAx[i].nGrpId)->GetToken() ;
|
||||
m_OutstrokeInfo.bLinear = false ;
|
||||
m_OutstrokeInfo.dExtra = vAng[i] - m_vCalcRotAx[i].stroke.Min ;
|
||||
m_OutstrokeInfo.sAuxInfo = " (R" + ToString( int(i) + 1) + "-) " ;
|
||||
}
|
||||
nStat += ( 64 << ( 2 * i)) ;
|
||||
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcRotAx[i].nGrpId)->GetName() ;
|
||||
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcRotAx[i].nGrpId)->GetToken() ;
|
||||
m_OutstrokeInfo.bLinear = false ;
|
||||
m_OutstrokeInfo.dExtra = vAng[i] - m_vCalcRotAx[i].stroke.Min ;
|
||||
m_OutstrokeInfo.sAuxInfo = " (R" + ToString( int(i) + 1) + "-) " ;
|
||||
}
|
||||
else if( vAng[i] > m_vCalcRotAx[i].stroke.Max) {
|
||||
else if ( vAng[i] > m_vCalcRotAx[i].stroke.Max) {
|
||||
if ( nStat == 0) {
|
||||
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcRotAx[i].nGrpId)->GetName() ;
|
||||
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcRotAx[i].nGrpId)->GetToken() ;
|
||||
m_OutstrokeInfo.bLinear = false ;
|
||||
m_OutstrokeInfo.dExtra = vAng[i] - m_vCalcRotAx[i].stroke.Max ;
|
||||
m_OutstrokeInfo.sAuxInfo = " (R" + ToString( int(i) + 1) + "+) " ;
|
||||
}
|
||||
nStat += ( 128 << ( 2 * i)) ;
|
||||
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcRotAx[i].nGrpId)->GetName() ;
|
||||
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcRotAx[i].nGrpId)->GetToken() ;
|
||||
m_OutstrokeInfo.bLinear = false ;
|
||||
m_OutstrokeInfo.dExtra = vAng[i] - m_vCalcRotAx[i].stroke.Max ;
|
||||
m_OutstrokeInfo.sAuxInfo = " (R" + ToString( int(i) + 1) + "+) " ;
|
||||
}
|
||||
}
|
||||
// verifica delle aree protette
|
||||
@@ -1856,9 +2098,9 @@ Machine::GetOutstrokeInfo( bool bMM) const
|
||||
if ( m_OutstrokeInfo.sAxName == AXIS_NAME_PROTECTEDAREAS)
|
||||
return m_OutstrokeInfo.sAuxInfo ;
|
||||
else if ( bMM || ! m_OutstrokeInfo.bLinear)
|
||||
return m_OutstrokeInfo.sAxToken + "=" + ToString( m_OutstrokeInfo.dExtra, 1) + m_OutstrokeInfo.sAuxInfo ;
|
||||
return m_OutstrokeInfo.sAxToken + "=" + ToString( m_OutstrokeInfo.dExtra, 2) + m_OutstrokeInfo.sAuxInfo ;
|
||||
else
|
||||
return m_OutstrokeInfo.sAxToken + "=" + ToString( m_OutstrokeInfo.dExtra / ONEINCH, 2) + m_OutstrokeInfo.sAuxInfo ;
|
||||
return m_OutstrokeInfo.sAxToken + "=" + ToString( m_OutstrokeInfo.dExtra / ONEINCH, 3) + m_OutstrokeInfo.sAuxInfo ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -2145,15 +2387,14 @@ Machine::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vecto
|
||||
Vector3d vtDirAL = GetToLoc( vtDirA, m_frRobot) ;
|
||||
// riferimento utensile
|
||||
Frame3d frTool ;
|
||||
frTool.Set( ORIG, vtDirTL, vtDirAL) ;
|
||||
if ( ! frTool.Set( ORIG, vtDirTL, vtDirAL)) {
|
||||
LOG_ERROR( GetEMkLogger(), "Error : tool reference not defined (robot)")
|
||||
return false ;
|
||||
}
|
||||
// deduco la posizione richiesta del centro del polso
|
||||
Point3d ptCen = ptPL + m_ptWristCen.x * frTool.VersX() +
|
||||
m_ptWristCen.y * frTool.VersY() +
|
||||
( m_dCalcTLen + m_ptWristCen.z) * frTool.VersZ() ;
|
||||
Point3d ptCen = ptPL + GetToGlob( m_ptWristCen + m_dCalcTLen * Z_AX, frTool) ;
|
||||
// deduco la direzione richiesta del centro del polso
|
||||
Vector3d vtCen = m_vtWristRef.x * frTool.VersX() +
|
||||
m_vtWristRef.y * frTool.VersY() +
|
||||
m_vtWristRef.z * frTool.VersZ() ;
|
||||
Vector3d vtCen = GetToGlob( m_vtWristRef, frTool) ;
|
||||
// calcolo il primo asse rotante
|
||||
Vector3d vtArm = ptCen - m_vCalcRotAx[0].ptPos ;
|
||||
double dAng1 ; bool bDet1 ;
|
||||
@@ -2177,7 +2418,14 @@ Machine::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vecto
|
||||
double dCosB = ( dDistR2R3 * dDistR2R3 + dDistR2Cen * dDistR2Cen - dDistR3R5 * dDistR3R5) / ( 2 * dDistR2R3 * dDistR2Cen) ;
|
||||
double dCosC = ( dDistR3R5 * dDistR3R5 + dDistR2Cen * dDistR2Cen - dDistR2R3 * dDistR2R3) / ( 2 * dDistR3R5 * dDistR2Cen) ;
|
||||
if ( abs( dCosB) > 1 || abs( dCosC) > 1) {
|
||||
LOG_ERROR( GetEMkLogger(), "Error : position unreachable (robot)")
|
||||
double dDeltaOut = dDistR2Cen - ( dDistR2R3 + dDistR3R5) ;
|
||||
double dDeltaIn = dDistR2Cen - abs( dDistR2R3 - dDistR3R5) ;
|
||||
string sErr = "Error : position for the robot unreachable" ;
|
||||
if ( dDeltaOut > 0)
|
||||
sErr += " (Out=" + ToString( dDeltaOut, 3) + ")" ;
|
||||
else if ( dDeltaIn < 0)
|
||||
sErr += " (In=" + ToString( dDeltaIn, 3) + ")" ;
|
||||
LOG_ERROR( GetEMkLogger(), sErr.c_str())
|
||||
return false ;
|
||||
}
|
||||
double dAngB = acos( dCosB) * RADTODEG ;
|
||||
@@ -2236,5 +2484,30 @@ Machine::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vecto
|
||||
vAng1.push_back( dAng6) ;
|
||||
vAng2.push_back( dAng6 + ( dAng6 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT)) ;
|
||||
|
||||
// verifiche dei limiti di corsa
|
||||
bool bAng1 = true, bAng2 = true ;
|
||||
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
|
||||
if ( ! AdjustAngleInStroke( m_vCalcRotAx[i].stroke, vAng1[i]))
|
||||
bAng1 = false ;
|
||||
if ( ! AdjustAngleInStroke( m_vCalcRotAx[i].stroke, vAng2[i]))
|
||||
bAng2 = false ;
|
||||
}
|
||||
if ( bAng2) {
|
||||
if ( ! bAng1) {
|
||||
vAng1 = vAng2 ;
|
||||
vAng2.clear() ;
|
||||
swap( bAng1, bAng2) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
vAng2.clear() ;
|
||||
}
|
||||
if ( ! bAng1) {
|
||||
int nStat ;
|
||||
VerifyOutstroke( 0, 0, 0, vAng1, true, nStat) ;
|
||||
LOG_ERROR( GetEMkLogger(), GetOutstrokeInfo().c_str())
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -144,6 +144,10 @@ Machine::LuaInit( const string& sMachineName)
|
||||
m_LuaMgr.RegisterFunction( "EmtAddCollisionObj", Machine::LuaEmtAddCollisionObj) ;
|
||||
// registro la funzione estesa per aggiungere un oggetto da verificare per la collisione in simulazione
|
||||
m_LuaMgr.RegisterFunction( "EmtAddCollisionObjEx", Machine::LuaEmtAddCollisionObjEx) ;
|
||||
// registro la funzione per rimuovere oggetti con dato FrameId da verificare per la collisione in simulazione
|
||||
m_LuaMgr.RegisterFunction( "EmtRemoveCollisionObj", Machine::LuaEmtRemoveCollisionObj) ;
|
||||
// registro la funzione per avere i dati dell'oggetto con posizione indicata nel vettore da verificare per la collisione in simulazione
|
||||
m_LuaMgr.RegisterFunction( "EmtGetCollisionObj", Machine::LuaEmtGetCollisionObj) ;
|
||||
// registro la funzione di esecuzione della verifica di collisione in simulazione
|
||||
m_LuaMgr.RegisterFunction( "EmtExecCollisionCheck", Machine::LuaEmtExecCollisionCheck) ;
|
||||
// registro la funzione di gestione della collisione in simulazione
|
||||
@@ -1428,6 +1432,65 @@ Machine::LuaEmtAddCollisionObjEx( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtRemoveCollisionObj( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nFrameId
|
||||
int nFrameId ;
|
||||
LuaCheckParam( L, 1, nFrameId)
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// assegno i dati
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimRemoveCollisionObj( nFrameId)) ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtGetCollisionObj( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nPos
|
||||
int nPos ;
|
||||
LuaCheckParam( L, 1, nPos)
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// recupero i dati
|
||||
int nInd ;
|
||||
bool bToolOn ;
|
||||
int nFrameId ;
|
||||
int nType ;
|
||||
Vector3d vtMove ;
|
||||
double dPar1 ;
|
||||
double dPar2 ;
|
||||
double dPar3 ;
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr &&
|
||||
m_pMchLua->m_pMchMgr->SimGetCollisionObj( nPos, nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3)) ;
|
||||
// assegno risultato
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, true) ;
|
||||
LuaSetParam( L, nInd) ;
|
||||
LuaSetParam( L, bToolOn) ;
|
||||
LuaSetParam( L, nFrameId) ;
|
||||
LuaSetParam( L, nType) ;
|
||||
LuaSetParam( L, vtMove) ;
|
||||
LuaSetParam( L, dPar1) ;
|
||||
LuaSetParam( L, dPar2) ;
|
||||
LuaSetParam( L, dPar3) ;
|
||||
return 9 ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtExecCollisionCheck( lua_State* L)
|
||||
|
||||
+79
-30
@@ -33,7 +33,7 @@ using namespace std ;
|
||||
int
|
||||
Machine::LuaEmtAddRapidStart( lua_State* L)
|
||||
{
|
||||
// 6 o 7 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag [, bToolShow]
|
||||
// 6, 7 o 8 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag [, nFlag2] [, bToolShow]
|
||||
int nPathId ;
|
||||
LuaCheckParam( L, 1, nPathId)
|
||||
Point3d ptP ;
|
||||
@@ -46,8 +46,12 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
|
||||
LuaCheckParam( L, 5, vtAux)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 6, nFlag)
|
||||
int nFlag2 = 0 ;
|
||||
bool bToolShow = false ;
|
||||
LuaGetParam( L, 7, bToolShow) ;
|
||||
if ( LuaGetParam( L, 7, nFlag2))
|
||||
LuaGetParam( L, 8, bToolShow) ;
|
||||
else
|
||||
LuaGetParam( L, 7, bToolShow) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -73,6 +77,7 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
|
||||
pCam->SetEndPoint( ptP) ;
|
||||
pCam->SetFeed( 0) ;
|
||||
pCam->SetFlag( nFlag) ;
|
||||
pCam->SetFlag2( nFlag2) ;
|
||||
pCam->SetToolShow( bToolShow) ;
|
||||
// associo questo oggetto a quello geometrico
|
||||
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
|
||||
@@ -89,7 +94,7 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtAddRapidMove( lua_State* L)
|
||||
{
|
||||
// 7 o 8 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag [, bToolShow]
|
||||
// 7, 8 o 9 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag [, nFlag2] [, bToolShow]
|
||||
int nPathId ;
|
||||
LuaCheckParam( L, 1, nPathId)
|
||||
Point3d ptIni ;
|
||||
@@ -104,8 +109,12 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
|
||||
LuaCheckParam( L, 6, vtAux)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 7, nFlag)
|
||||
int nFlag2 = 0 ;
|
||||
bool bToolShow = false ;
|
||||
LuaGetParam( L, 8, bToolShow) ;
|
||||
if ( LuaGetParam( L, 8, nFlag2))
|
||||
LuaGetParam( L, 9, bToolShow) ;
|
||||
else
|
||||
LuaGetParam( L, 8, bToolShow) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -131,6 +140,7 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
|
||||
pCam->SetEndPoint( ptFin) ;
|
||||
pCam->SetFeed( 0) ;
|
||||
pCam->SetFlag( nFlag) ;
|
||||
pCam->SetFlag2( nFlag2) ;
|
||||
pCam->SetToolShow( bToolShow) ;
|
||||
// associo questo oggetto a quello geometrico
|
||||
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
|
||||
@@ -147,7 +157,7 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtAddLinearMove( lua_State* L)
|
||||
{
|
||||
// 8 o 9 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag [, bToolShow]
|
||||
// 8, 9 o 10 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag [, nFlag2] [, bToolShow]
|
||||
int nPathId ;
|
||||
LuaCheckParam( L, 1, nPathId)
|
||||
Point3d ptIni ;
|
||||
@@ -164,8 +174,12 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
|
||||
LuaCheckParam( L, 7, dFeed)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 8, nFlag)
|
||||
int nFlag2 = 0 ;
|
||||
bool bToolShow = false ;
|
||||
LuaGetParam( L, 9, bToolShow) ;
|
||||
if ( LuaGetParam( L, 9, nFlag2))
|
||||
LuaGetParam( L, 10, bToolShow) ;
|
||||
else
|
||||
LuaGetParam( L, 9, bToolShow) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -191,6 +205,7 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
|
||||
pCam->SetEndPoint( ptFin) ;
|
||||
pCam->SetFeed( dFeed) ;
|
||||
pCam->SetFlag( nFlag) ;
|
||||
pCam->SetFlag2( nFlag2) ;
|
||||
pCam->SetToolShow( bToolShow) ;
|
||||
// associo questo oggetto a quello geometrico
|
||||
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
|
||||
@@ -281,28 +296,36 @@ Machine::LuaEmtAddArcMove( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtAddClimb( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : nMachId, vAxVal, nMask, nFlag, nFlag2 [, sInfo]
|
||||
// 5 o 6 o 7 parametri : nMachId [, sMain], vAxVal, nMask, nFlag, nFlag2 [, sInfo]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
string sMain = MCH_CL ;
|
||||
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
DBLVECTOR vAxVal ;
|
||||
LuaCheckParam( L, 2, vAxVal)
|
||||
LuaCheckParam( L, 2 + nOffs, vAxVal)
|
||||
int nMask ;
|
||||
LuaCheckParam( L, 3, nMask)
|
||||
LuaCheckParam( L, 3 + nOffs, nMask)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 4, nFlag)
|
||||
LuaCheckParam( L, 4 + nOffs, nFlag)
|
||||
int nFlag2 ;
|
||||
LuaCheckParam( L, 5, nFlag2)
|
||||
LuaCheckParam( L, 5 + nOffs, nFlag2)
|
||||
string sInfo = "" ;
|
||||
LuaGetParam( L, 6, sInfo) ;
|
||||
LuaGetParam( L, 6 + nOffs, sInfo) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// verifica "Main" e "Double"
|
||||
if ( ! EqualNoCase( sMain, MCH_CL) && ! EqualNoCase( sMain, MCH_DBL))
|
||||
return luaL_error( L, ( " Error in EmtAddClimb : " + sMain).c_str()) ;
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// imposto la discesa (primo movimento del primo percorso della lavorazione)
|
||||
bool bOk = ( pOper != nullptr && pOper->AddSpecialClimb( vAxVal, ( nMask >= 0), GDB_ID_NULL, nFlag, nFlag2, nMask, sInfo, false)) ;
|
||||
bool bOk = ( pOper != nullptr && pOper->AddSpecialClimb( vAxVal, ( nMask >= 0), GDB_ID_NULL, bMain, nFlag, nFlag2, nMask, sInfo, false)) ;
|
||||
if ( ! bOk)
|
||||
return luaL_error( L, " Error in EmtAddClimb") ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
|
||||
return 1 ;
|
||||
@@ -312,18 +335,24 @@ Machine::LuaEmtAddClimb( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtRemoveClimb( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nMachId
|
||||
// 1 o 2 parametri : nMachId [, sMain]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
string sMain = MCH_CL ;
|
||||
LuaGetParam( L, 2, sMain) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// verifica "Main" e "Double"
|
||||
if ( ! EqualNoCase( sMain, MCH_CL) && ! EqualNoCase( sMain, MCH_DBL))
|
||||
return luaL_error( L, ( " Error in EmtAddClimb : " + sMain).c_str()) ;
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// elimino le discese (primi movimenti "CLIMB" del primo percorso della lavorazione)
|
||||
bool bOk = ( pOper != nullptr && pOper->RemoveClimb()) ;
|
||||
bool bOk = ( pOper != nullptr && pOper->RemoveClimb( GDB_ID_NULL, bMain)) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
|
||||
return 1 ;
|
||||
@@ -333,28 +362,36 @@ Machine::LuaEmtRemoveClimb( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtAddRise( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : nMachId, vAxVal, nMask, nFlag, nFlag2 [, sInfo]
|
||||
// 5 o 6 o 7 parametri : nMachId [, sMain], vAxVal, nMask, nFlag, nFlag2 [, sInfo]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
string sMain = MCH_CL ;
|
||||
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
DBLVECTOR vAxVal ;
|
||||
LuaCheckParam( L, 2, vAxVal)
|
||||
LuaCheckParam( L, 2 + nOffs, vAxVal)
|
||||
int nMask ;
|
||||
LuaCheckParam( L, 3, nMask)
|
||||
LuaCheckParam( L, 3 + nOffs, nMask)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 4, nFlag)
|
||||
LuaCheckParam( L, 4 + nOffs, nFlag)
|
||||
int nFlag2 ;
|
||||
LuaCheckParam( L, 5, nFlag2)
|
||||
LuaCheckParam( L, 5 + nOffs, nFlag2)
|
||||
string sInfo = "" ;
|
||||
LuaGetParam( L, 6, sInfo) ;
|
||||
LuaGetParam( L, 6 + nOffs, sInfo) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// verifica "Main" e "Double"
|
||||
if ( ! EqualNoCase( sMain, MCH_CL) && ! EqualNoCase( sMain, MCH_DBL))
|
||||
return luaL_error( L, ( " Error in EmtAddClimb : " + sMain).c_str()) ;
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// aggiungo la risalita (ultimo movimento dell'ultimo percorso della lavorazione)
|
||||
bool bOk = ( pOper != nullptr && pOper->AddSpecialRise( vAxVal, ( nMask >= 0), GDB_ID_NULL, nFlag, nFlag2, nMask, sInfo)) ;
|
||||
bool bOk = ( pOper != nullptr && pOper->AddSpecialRise( vAxVal, ( nMask >= 0), GDB_ID_NULL, bMain, nFlag, nFlag2, nMask, sInfo)) ;
|
||||
if ( ! bOk)
|
||||
return luaL_error( L, " Error in EmtAddRise") ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
|
||||
return 1 ;
|
||||
@@ -364,18 +401,24 @@ Machine::LuaEmtAddRise( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtRemoveRise( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nMachId
|
||||
// 1 o 2 parametri : nMachId [, bMain]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
string sMain = MCH_CL ;
|
||||
LuaGetParam( L, 2, sMain) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// verifica "Main" e "Double"
|
||||
if ( ! EqualNoCase( sMain, MCH_CL) && ! EqualNoCase( sMain, MCH_DBL))
|
||||
return luaL_error( L, ( " Error in EmtAddClimb : " + sMain).c_str()) ;
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// elimino le risalite (ultimi movimenti "RISE" dell'ultimo percorso della lavorazione)
|
||||
bool bOk = ( pOper != nullptr && pOper->RemoveRise()) ;
|
||||
bool bOk = ( pOper != nullptr && pOper->RemoveRise( GDB_ID_NULL, bMain)) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
|
||||
return 1 ;
|
||||
@@ -385,11 +428,14 @@ Machine::LuaEmtRemoveRise( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtGetInitialAxesPos( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nMachId [, bSkipClimb]
|
||||
// 1 o 2 o 3 parametri : nMachId [, sMain] [, bSkipClimb]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
string sMain = MCH_CL ;
|
||||
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
bool bSkipClimb = true ;
|
||||
LuaGetParam( L, 2, bSkipClimb) ;
|
||||
LuaGetParam( L, 2 + nOffs, bSkipClimb) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -399,7 +445,7 @@ Machine::LuaEmtGetInitialAxesPos( lua_State* L)
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// acquisico il valore iniziale degli assi macchina
|
||||
DBLVECTOR vAxesVal ;
|
||||
bool bOk = ( pOper != nullptr && pOper->GetInitialAxesValues( bSkipClimb, vAxesVal)) ;
|
||||
bool bOk = ( pOper != nullptr && pOper->GetInitialAxesValues( bSkipClimb, bMain, vAxesVal)) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vAxesVal) ;
|
||||
else
|
||||
@@ -412,11 +458,14 @@ Machine::LuaEmtGetInitialAxesPos( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtGetFinalAxesPos( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nMachId [, bSkipRise]
|
||||
// 1 o 2 o 3 parametri : nMachId [, sMain] [, bSkipRise]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
bool bSkipRise = true ;
|
||||
LuaGetParam( L, 2, bSkipRise) ;
|
||||
string sMain = MCH_CL ;
|
||||
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
LuaGetParam( L, 2 + nOffs, bSkipRise) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -426,7 +475,7 @@ Machine::LuaEmtGetFinalAxesPos( lua_State* L)
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// acquisico il valore finale degli assi macchina
|
||||
DBLVECTOR vAxesVal ;
|
||||
bool bOk = ( pOper != nullptr && pOper->GetFinalAxesValues( bSkipRise, vAxesVal)) ;
|
||||
bool bOk = ( pOper != nullptr && pOper->GetFinalAxesValues( bSkipRise, bMain, vAxesVal)) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vAxesVal) ;
|
||||
else
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ enum MchSelType { MCH_SLT_FIXEDEXITS = 0,
|
||||
//----------------------------------------------------------------------------
|
||||
// Tipo della catena cinematica
|
||||
enum KinChainType { KIN_CHAIN_NONE = 0,
|
||||
KIN_CHAIN_CENTER = 1,
|
||||
KIN_CHAIN_MCENT = 1,
|
||||
KIN_CHAIN_ROBOT = 2} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+1026
-98
File diff suppressed because it is too large
Load Diff
+30
-4
@@ -8,6 +8,7 @@
|
||||
//
|
||||
//
|
||||
// Modifiche : 07.06.15 DS Creazione modulo.
|
||||
// 24.02.26 RE Aggiunta Gestione Preview per Utensile e Testa
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -25,6 +26,7 @@ class Machining : public Operation
|
||||
int GetExitNbr( void) const override ;
|
||||
const std::string& GetToolTcPos( void) const override ;
|
||||
bool NeedPrevHome( void) const override ;
|
||||
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const override ;
|
||||
|
||||
public :
|
||||
virtual bool Prepare( const std::string& sMchName) = 0 ;
|
||||
@@ -40,7 +42,7 @@ class Machining : public Operation
|
||||
virtual bool GetParam( int nType, int& nVal) const = 0 ;
|
||||
virtual bool GetParam( int nType, double& dVal) const = 0 ;
|
||||
virtual bool GetParam( int nType, std::string& sVal) const = 0 ;
|
||||
virtual bool UpdateToolData( bool* pbChanged = nullptr) = 0 ;
|
||||
virtual bool UpdateToolData( void) = 0 ;
|
||||
virtual const ToolData& GetToolData( void) const = 0 ;
|
||||
virtual bool GetGeometry( SELVECTOR& vIds) const = 0 ;
|
||||
virtual bool GetSkippedGeometry( SELVECTOR& vIds) const
|
||||
@@ -49,19 +51,43 @@ class Machining : public Operation
|
||||
public :
|
||||
bool GetStartPoint( Point3d& ptStart) const ;
|
||||
bool GetEndPoint( Point3d& ptEnd) const ;
|
||||
bool PrepareToolPreview( void) const ;
|
||||
bool RemoveToolPreview( void) const ;
|
||||
bool ChangeToolPreviewShow( int nFlag) ;
|
||||
bool PrepareToolPreview( void) ;
|
||||
bool RemoveToolPreview( void) ;
|
||||
int GetToolPreviewStepCount( void) const ;
|
||||
int ToolPreview( int nEntId, int nStep) const ;
|
||||
bool ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const ;
|
||||
|
||||
protected :
|
||||
Machining( void) ;
|
||||
~Machining( void) ;
|
||||
bool SpecialApply( std::string& sErr) ;
|
||||
bool PostApply( std::string& sErr) ;
|
||||
int GetDoubleType( const std::string& sUserNotes) const ;
|
||||
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit, double& dDblLen) const ;
|
||||
bool CalcMirrorPlaneByDouble( int nDouble, const std::string& sUserNotes, Point3d& ptOn, Vector3d& vtNorm) const ;
|
||||
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) const ;
|
||||
bool ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const ;
|
||||
|
||||
private :
|
||||
int GetToolPreviewNext( int nEntId, int nParentId, int nStId) const ;
|
||||
int GetToolPreviewPrev( int nEntId, int nParentId, int nStId) const ;
|
||||
bool MyPrepareToolPreview( bool bDouble) ;
|
||||
bool MyChangeToolPreviewShow( int nLookFlag, bool bDouble) ;
|
||||
bool MyToolPreview( int nEntId, bool bDouble) const ;
|
||||
bool MyShowMultiDrillingTool( const INTVECTOR& vActExit) const ;
|
||||
|
||||
private :
|
||||
int m_nLookFlag ; // flag di Visualizzazione per Preview
|
||||
// lavorazione singola
|
||||
int m_nPreviewHeadId ; // Id del gruppo della testa di Preview
|
||||
int m_nPreviewExitId ; // Id del gruppo dell'uscita di Preview
|
||||
int m_nPreviewToolTip ; // Id del gruppo contenente il punto ToolTip
|
||||
INTVECTOR m_vPreviewAxisIds ; // indici degli assi di Preview
|
||||
// lavorazione in doppio
|
||||
int m_nPreviewHeadIdDBL ; // Id del gruppo della testa di Preview
|
||||
int m_nPreviewExitIdDBL ; // Id del gruppo dell'uscita di Preview
|
||||
int m_nPreviewToolTipDBL ; // Id del gruppo contenente il punto di ToolTip
|
||||
INTVECTOR m_vPreviewAxisIdsDBL ; // indici degli assi di Preview
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+31
-31
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachiningDataFactory.h Data : 05.06.15 Versione : 1.6f1
|
||||
// File : MachiningDataFactory.h Data : 31.10.25 Versione : 2.7k1
|
||||
// Contenuto : Factory della classe MachiningData.
|
||||
//
|
||||
//
|
||||
@@ -26,35 +26,6 @@
|
||||
#define MCHDATA_CREATE( nType) MachiningDataFactory::Create( nType)
|
||||
#define MCHDATA_GETLIST( vsList) MachiningDataFactory::GetList( vsList)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
class MachiningDataRegister
|
||||
{
|
||||
public :
|
||||
static bool DoRegister( int nType, const std::string& sName)
|
||||
{ if ( ! MachiningDataFactory::Register( nType, sName, Create))
|
||||
return false ;
|
||||
GetTypePrivate() = nType ;
|
||||
GetNamePrivate() = sName ;
|
||||
return true ; }
|
||||
static MachiningData* Create( void)
|
||||
{ return new(nothrow) T ; }
|
||||
static int GetType( void)
|
||||
{ return GetTypePrivate() ; }
|
||||
static const std::string& GetName( void)
|
||||
{ return GetNamePrivate() ; }
|
||||
|
||||
private :
|
||||
MachiningDataRegister( void) {}
|
||||
~MachiningDataRegister( void) {}
|
||||
static int& GetTypePrivate( void)
|
||||
{ static int s_nType ;
|
||||
return s_nType ; }
|
||||
static std::string& GetNamePrivate( void)
|
||||
{ static std::string s_sName ;
|
||||
return s_sName ; }
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class MachiningDataFactory
|
||||
{
|
||||
@@ -108,3 +79,32 @@ class MachiningDataFactory
|
||||
return s_CreatorMap ;
|
||||
}
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
class MachiningDataRegister
|
||||
{
|
||||
public :
|
||||
static bool DoRegister( int nType, const std::string& sName)
|
||||
{ if ( ! MachiningDataFactory::Register( nType, sName, Create))
|
||||
return false ;
|
||||
GetTypePrivate() = nType ;
|
||||
GetNamePrivate() = sName ;
|
||||
return true ; }
|
||||
static MachiningData* Create( void)
|
||||
{ return new( std::nothrow) T ; }
|
||||
static int GetType( void)
|
||||
{ return GetTypePrivate() ; }
|
||||
static const std::string& GetName( void)
|
||||
{ return GetNamePrivate() ; }
|
||||
|
||||
private :
|
||||
MachiningDataRegister( void) {}
|
||||
~MachiningDataRegister( void) {}
|
||||
static int& GetTypePrivate( void)
|
||||
{ static int s_nType ;
|
||||
return s_nType ; }
|
||||
static std::string& GetNamePrivate( void)
|
||||
{ static std::string s_sName ;
|
||||
return s_sName ; }
|
||||
} ;
|
||||
|
||||
+4
-1
@@ -30,10 +30,13 @@ RegisterPocketing( void)
|
||||
if ( bFirst) {
|
||||
std::string sIniPath ;
|
||||
ExeGetIniFile( sIniPath) ;
|
||||
if ( GetPrivateProfileInt( SEC_MACH, KEY_POCKETING, 1, sIniPath.c_str()) == 2)
|
||||
int nPockType = GetPrivateProfileInt( SEC_MACH, KEY_POCKETING, 2, sIniPath.c_str()) ;
|
||||
if ( nPockType == 2)
|
||||
UserObjRegister<PocketingNT>::DoRegister( GetOperationClass( OPER_POCKETING)) ;
|
||||
else
|
||||
UserObjRegister<Pocketing>::DoRegister( GetOperationClass( OPER_POCKETING)) ;
|
||||
std::string sInfo = "Mach-Pocketing=" + ToString( nPockType) ;
|
||||
LOG_INFO( GetEMkLogger(), sInfo.c_str())
|
||||
bFirst = false ;
|
||||
}
|
||||
return true ;
|
||||
|
||||
+120
-44
@@ -21,6 +21,7 @@
|
||||
#include "Milling.h"
|
||||
#include "GeoConst.h"
|
||||
#include "OperationConst.h"
|
||||
#include "OperUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EXeCmdLogOff.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
@@ -49,13 +50,6 @@ const double OSC_MIN_LEN = 0.1 ;
|
||||
const double LIM_DOWN_APPRZ = -0.5 ;
|
||||
const double DELTA_ELEV_RAD = 4.0 ;
|
||||
const double LIM_SIN_DIFF_DIR = 0.175 ;
|
||||
// Parametri avanzati da UserNotes
|
||||
const string UN_MAXELEV = "MaxElev" ;
|
||||
const string UN_OUTRAW = "OutRaw" ;
|
||||
const string UN_SIDEELEV = "SideElev" ;
|
||||
const string UN_TRIMEXT = "TrimExt" ;
|
||||
const string UN_VTFACEUSE = "VtFaceUse" ;
|
||||
const string UN_EDGESFACEUSE = "EdgesFaceUse" ;
|
||||
|
||||
//------------------------------ Errors --------------------------------------
|
||||
// 2301 = "Error in Milling : UpdateToolData failed"
|
||||
@@ -83,6 +77,7 @@ const string UN_EDGESFACEUSE = "EdgesFaceUse" ;
|
||||
// 2323 = "Error in Milling : machining depth (xxx) bigger than MaxDepth (yyy)"
|
||||
// 2324 = "Error in Milling : LeadOut must be out of rawpart"
|
||||
// 2325 = "Error in Milling : Mirror for Double calculation failed"
|
||||
// 2326 = "Error in Milling : special apply not calculable"
|
||||
// 2351 = "Warning in Milling : Skipped entity (xx)"
|
||||
// 2352 = "Warning in Milling : No machinable path"
|
||||
// 2353 = "Warning in Milling : Tool name changed (xx)"
|
||||
@@ -736,8 +731,7 @@ Milling::Apply( bool bRecalc, bool bPostApply)
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 2301, "Error in Milling : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -748,8 +742,7 @@ Milling::Apply( bool bRecalc, bool bPostApply)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nMills = nCurrMills ;
|
||||
string sLog = string( "Milling apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
@@ -856,16 +849,16 @@ Milling::Apply( bool bRecalc, bool bPostApply)
|
||||
// assegno ingombri dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetBBox( nClId) ;
|
||||
|
||||
// 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( 2325, "Error in Milling : Mirror for Double calculation failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
|
||||
if ( ! Update( bPostApply))
|
||||
return false ;
|
||||
|
||||
// aggiorno stato della lavorazione
|
||||
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
|
||||
// dichiaro successiva da aggiornare
|
||||
@@ -912,6 +905,44 @@ Milling::Update( bool bPostApply)
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// se lavorazione in doppio, calcolo assi e movimenti di approccio e retrazione relativi
|
||||
if ( GetDoubleType( m_Params.m_sUserNotes) != 0) {
|
||||
// elimino le entità CLIMB, RISE e HOME della lavorazione in doppio
|
||||
RemoveClimbRiseHome( false) ;
|
||||
// recupero i dati della testa in doppio e la imposto
|
||||
string sDblTool ; string sTcPos; string sDblHead ; int nDblExit ;
|
||||
bool bOk = GetDoubleToolData( sDblTool, sTcPos, sDblHead, nDblExit) &&
|
||||
m_pMchMgr->SetCalcTool( sDblTool, sDblHead, nDblExit) ;
|
||||
// imposto eventuale asse bloccato da lavorazione
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis, true) ;
|
||||
// eseguo il calcolo
|
||||
if ( bOk) {
|
||||
if ( ! CalculateDoubleAxesValues( sHint)) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 2317, "Error in Milling : axes values not calculable for double") ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2318, "Error in Milling : double outstroke ") ;
|
||||
bOk = false ;
|
||||
}
|
||||
}
|
||||
// ripristino testa principale
|
||||
m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()) ;
|
||||
// in caso di errore, esco
|
||||
if ( ! bOk)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 2326, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2326, "Error in Milling : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio e fine di ogni singolo percorso di lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -922,11 +953,11 @@ Milling::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 2321, sErr) ;
|
||||
// esecuzione eventuali personalizzazioni finali
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 2321, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2321, "Error in Milling : post apply not calculable") ;
|
||||
return false ;
|
||||
@@ -1131,7 +1162,7 @@ Milling::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::UpdateToolData( bool* pbChanged)
|
||||
Milling::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
@@ -1182,9 +1213,9 @@ Milling::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 2354, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -2006,6 +2037,15 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sPathName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, GREEN) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
|
||||
|
||||
// creo l'anteprima del percorso
|
||||
if ( ! GenerateMillingPv( nPxId, pCompo, dRbDist, dDepth))
|
||||
return false ;
|
||||
@@ -3316,7 +3356,9 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
dSawStartElev = dSawStartElev2 ;
|
||||
bSideStart = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( bSideStart)
|
||||
bMidRetract = true ;
|
||||
if ( ! bGeomAboveStart && ! bAhUnderStart && ! bUhAboveStart && ! bSideStart && bOk) {
|
||||
m_pMchMgr->SetLastError( 2314, "Error in Milling : LeadIn must be out of rawpart") ;
|
||||
bOk = false ;
|
||||
@@ -3507,6 +3549,8 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
bSideEnd = true ;
|
||||
}
|
||||
}
|
||||
if ( bSideEnd)
|
||||
bMidRetract = true ;
|
||||
if ( ! bGeomAboveEnd && ! bAhUnderEnd && ! bUhAboveEnd && ! bSideEnd && bOk) {
|
||||
m_pMchMgr->SetLastError( 2324, "Error in Milling : LeadOut must be out of rawpart") ;
|
||||
bOk = false ;
|
||||
@@ -3990,8 +4034,9 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
}
|
||||
bool bAdjustLoPerp = ( m_Params.m_dLoPerp > 10 * EPS_SMALL) ;
|
||||
if ( bAdjustLoPerp) {
|
||||
m_Params.m_dLoTang = 0 ;
|
||||
m_Params.m_dLoPerp = 0. ;
|
||||
double dNewLoPerp = max( 0., m_Params.m_dLoPerp - ( nStep - 1) * dStep) ;
|
||||
m_Params.m_dLoTang *= dNewLoPerp / m_Params.m_dLoPerp ;
|
||||
m_Params.m_dLoPerp = dNewLoPerp ;
|
||||
}
|
||||
|
||||
// ciclo sugli step
|
||||
@@ -4015,11 +4060,16 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
if ( ! TrimExtendCurveToClosedStm( pMyCompo, nTriExtCstm, bInvert))
|
||||
pMyCompo.Set( pMyCopy) ;
|
||||
}
|
||||
// dopo primo step annullo parametri di attacco
|
||||
if ( j > 1 && bAdjustLiPerp) {
|
||||
// se necessario e invertito oppure step successivo annullo parametri di attacco
|
||||
if ( bAdjustLiPerp && ( bInvert || j == 2)) {
|
||||
m_Params.m_dLiPerp = 0. ;
|
||||
m_Params.m_dLiTang = 0. ;
|
||||
}
|
||||
// se necessario e non invertito oppure step successivo annullo parametri di uscita
|
||||
if ( bAdjustLoPerp && ( ! bInvert || j == 2)) {
|
||||
m_Params.m_dLoPerp = 0. ;
|
||||
m_Params.m_dLoTang = 0. ;
|
||||
}
|
||||
// ciclo sulle curve elementari
|
||||
int nMaxInd = pMyCompo->GetCurveCount() - 1 ;
|
||||
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
|
||||
@@ -4744,7 +4794,9 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
|
||||
int nType = GetLeadInType() ;
|
||||
double dTang = m_Params.m_dLiTang ;
|
||||
double dPerp = m_Params.m_dLiPerp ;
|
||||
double dElev = min( m_Params.m_dLiElev, dStElev + GetLeadInOutToler()) ;
|
||||
double dElev = m_Params.m_dLiElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLiElev, dStElev + GetLeadInOutToler()) ;
|
||||
// se step invertito
|
||||
if ( bInvert) {
|
||||
// va aggiustato se non zigzag o spirale
|
||||
@@ -4760,7 +4812,9 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
|
||||
if ( m_Params.m_nLeadOutType != MILL_LO_AS_LI) {
|
||||
dTang = m_Params.m_dLoTang ;
|
||||
dPerp = m_Params.m_dLoPerp ;
|
||||
dElev = min( m_Params.m_dLoElev, dStElev + GetLeadInOutToler()) ;
|
||||
dElev = m_Params.m_dLoElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLoElev, dStElev + GetLeadInOutToler()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4866,7 +4920,9 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
int nType = GetLeadInType() ;
|
||||
double dTang = m_Params.m_dLiTang ;
|
||||
double dPerp = m_Params.m_dLiPerp ;
|
||||
double dElev = min( m_Params.m_dLiElev, dStElev + GetLeadInOutToler()) ;
|
||||
double dElev = m_Params.m_dLiElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLiElev, dStElev + GetLeadInOutToler()) ;
|
||||
// se step invertito
|
||||
if ( bInvert) {
|
||||
// va aggiustato se non zigzag o spirale
|
||||
@@ -4882,7 +4938,9 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
if ( m_Params.m_nLeadOutType != MILL_LO_AS_LI) {
|
||||
dTang = m_Params.m_dLoTang ;
|
||||
dPerp = m_Params.m_dLoPerp ;
|
||||
dElev = min( m_Params.m_dLoElev, dStElev + GetLeadInOutToler()) ;
|
||||
dElev = m_Params.m_dLoElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLoElev, dStElev + GetLeadInOutToler()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5104,7 +5162,9 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect
|
||||
int nType = GetLeadOutType() ;
|
||||
double dTang = m_Params.m_dLoTang ;
|
||||
double dPerp = m_Params.m_dLoPerp ;
|
||||
double dElev = min( m_Params.m_dLoElev, dEndElev + GetLeadInOutToler()) ;
|
||||
double dElev = m_Params.m_dLoElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLoElev, dEndElev + GetLeadInOutToler()) ;
|
||||
// se uscita come ingresso o step invertito
|
||||
if ( nType == MILL_LO_AS_LI || bInvert) {
|
||||
int nLiType = GetLeadInType() ;
|
||||
@@ -5123,7 +5183,9 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect
|
||||
dTang = 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
dPerp = dTang ;
|
||||
}
|
||||
dElev = min( m_Params.m_dLiElev, dEndElev + GetLeadInOutToler()) ;
|
||||
dElev = m_Params.m_dLiElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLiElev, dEndElev + GetLeadInOutToler()) ;
|
||||
}
|
||||
// senso di rotazione da dir tg a dir esterna
|
||||
bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) ||
|
||||
@@ -5235,7 +5297,9 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
int nType = GetLeadOutType() ;
|
||||
double dTang = m_Params.m_dLoTang ;
|
||||
double dPerp = m_Params.m_dLoPerp ;
|
||||
double dElev = min( m_Params.m_dLoElev, dEndElev + GetLeadInOutToler()) ;
|
||||
double dElev = m_Params.m_dLoElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLoElev, dEndElev + GetLeadInOutToler()) ;
|
||||
// se uscita come ingresso o step invertito
|
||||
if ( nType == MILL_LO_AS_LI || bInvert) {
|
||||
int nLiType = GetLeadInType() ;
|
||||
@@ -5254,7 +5318,9 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
dTang = 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
dPerp = dTang ;
|
||||
}
|
||||
dElev = min( m_Params.m_dLiElev, dEndElev + GetLeadInOutToler()) ;
|
||||
dElev = m_Params.m_dLiElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLiElev, dEndElev + GetLeadInOutToler()) ;
|
||||
}
|
||||
// senso di rotazione da dir tg a dir esterna
|
||||
bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) ||
|
||||
@@ -6450,25 +6516,35 @@ Milling::CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bI
|
||||
// verifico curva
|
||||
if ( pCompo == nullptr)
|
||||
return false ;
|
||||
// se utensile centrato, direzione di correzione nulla
|
||||
if ( m_Params.m_nWorkSide == MILL_WS_CENTER)
|
||||
return true ;
|
||||
// calcolo del versore correzione
|
||||
Vector3d vtCorr = CalcCorrDir( pCompo, dU, bInvertSide, bSawSpecial) ;
|
||||
// versore correzione nullo per default
|
||||
Vector3d vtCorr ;
|
||||
// se utensile non centrato, calcolo del versore correzione
|
||||
if ( m_Params.m_nWorkSide != MILL_WS_CENTER)
|
||||
vtCorr = CalcCorrDir( pCompo, dU, bInvertSide, bSawSpecial) ;
|
||||
// imposto versore correzione
|
||||
SetCorrDir( vtCorr) ;
|
||||
// se rinvio da sotto in uso, non devo impostare direzione aux da correzione
|
||||
if ( m_bAggrBottom)
|
||||
return true ;
|
||||
// se impostato uso direttamente da lavorazione, imposto anche come versore aux
|
||||
if ( m_Params.m_nSolCh == MCH_SCC_ADIR_NEAR || m_Params.m_nSolCh == MCH_SCC_ADIR_FAR)
|
||||
if ( m_Params.m_nSolCh == MCH_SCC_ADIR_NEAR || m_Params.m_nSolCh == MCH_SCC_ADIR_FAR) {
|
||||
SetAuxDir( vtCorr) ;
|
||||
return true ;
|
||||
}
|
||||
// se standard o nullo o suo opposto
|
||||
if ( m_Params.m_nSolCh == MCH_SCC_STD || m_Params.m_nSolCh == MCH_SCC_NONE || m_Params.m_nSolCh == MCH_SCC_OPPOSITE) {
|
||||
// verifico se richiesto dalla testa
|
||||
if ( m_nHeadSolCh == MCH_SCC_ADIR_NEAR || m_nHeadSolCh == MCH_SCC_ADIR_FAR)
|
||||
if ( m_nHeadSolCh == MCH_SCC_ADIR_NEAR || m_nHeadSolCh == MCH_SCC_ADIR_FAR) {
|
||||
SetAuxDir( vtCorr) ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// reset o assegnamento da parametro di lavorazione nelle UserNotes
|
||||
Vector3d vtAux ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
|
||||
vtAux.Normalize() ;
|
||||
SetAuxDir( vtAux) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class Milling : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
|
||||
+50
-40
@@ -17,6 +17,7 @@
|
||||
#include "DllMain.h"
|
||||
#include "Mortising.h"
|
||||
#include "OperationConst.h"
|
||||
#include "OperUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
@@ -45,6 +46,7 @@ using namespace std ;
|
||||
// 2511 = "Error in Mortising : post apply not calculable"
|
||||
// 2512 = "Error in Mortising : Tool MaxMaterial too small (xx)"
|
||||
// 2513 = "Error in Mortising : Closed path not allowed"
|
||||
// 2514 = "Error in Mortising : special apply not calculable"
|
||||
// 2551 = "Warning in Mortising : Skipped entity (xx)"
|
||||
// 2552 = "Warning in Mortising : Plunges not found"
|
||||
// 2553 = "Warning in Mortising : Tool name changed (xx)"
|
||||
@@ -414,16 +416,16 @@ Mortising::SetParam( int nType, const string& sVal)
|
||||
bool
|
||||
Mortising::SetGeometry( const SELVECTOR& vIds)
|
||||
{
|
||||
// verifico validità gestore DB geometrico
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
|
||||
int nType = GEO_NONE ;
|
||||
for ( const auto& Id : vIds) {
|
||||
// test sull'entità
|
||||
// test sull'entità
|
||||
int nSubs ;
|
||||
if ( ! VerifyGeometry( Id, nSubs, nType)) {
|
||||
string sInfo = "Warning in Mortising : Skipped entity " + ToString( Id) ;
|
||||
@@ -447,14 +449,14 @@ Mortising::Preview( bool bRecalc)
|
||||
// reset numero percorsi di lavoro generati
|
||||
m_nMortises = 0 ;
|
||||
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
// recupero gruppo per geometria ausiliaria
|
||||
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
|
||||
bool bChain = false ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nAuxId == GDB_ID_NULL) {
|
||||
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nAuxId == GDB_ID_NULL)
|
||||
@@ -482,7 +484,7 @@ Mortising::Preview( bool bRecalc)
|
||||
}
|
||||
// recupero gruppo per geometria di Preview
|
||||
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nPvId == GDB_ID_NULL) {
|
||||
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nPvId == GDB_ID_NULL)
|
||||
@@ -512,13 +514,12 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
|
||||
int nCurrMortises = m_nMortises ;
|
||||
m_nMortises = 0 ;
|
||||
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 2501, "Error in Mortising : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -528,8 +529,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nMortises = nCurrMortises ;
|
||||
string sLog = string( "Mortising apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
@@ -547,7 +547,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
|
||||
// recupero gruppo per geometria ausiliaria
|
||||
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
|
||||
bool bChain = false ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nAuxId == GDB_ID_NULL) {
|
||||
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nAuxId == GDB_ID_NULL)
|
||||
@@ -564,7 +564,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
|
||||
|
||||
// recupero gruppo per vista ausiliaria
|
||||
int nAuxViewId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUXVIEW) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nAuxViewId == GDB_ID_NULL) {
|
||||
nAuxViewId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nAuxViewId == GDB_ID_NULL)
|
||||
@@ -580,7 +580,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
|
||||
|
||||
// recupero gruppo per geometria di lavorazione (Cutter Location)
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nClId == GDB_ID_NULL) {
|
||||
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nClId == GDB_ID_NULL)
|
||||
@@ -632,7 +632,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
|
||||
bool
|
||||
Mortising::Update( bool bPostApply)
|
||||
{
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
@@ -642,7 +642,7 @@ 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)
|
||||
// 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
|
||||
@@ -652,7 +652,7 @@ Mortising::Update( bool bPostApply)
|
||||
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
|
||||
if ( ! m_Params.m_sInitAngs.empty())
|
||||
sHint = m_Params.m_sInitAngs ;
|
||||
if ( ! CalculateAxesValues( sHint, true, true)) {
|
||||
if ( ! CalculateAxesValues( sHint, true)) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 2507, "Error in Mortising : axes values not calculable") ;
|
||||
@@ -664,6 +664,16 @@ Mortising::Update( bool bPostApply)
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 2514, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2514, "Error in Mortising : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -674,11 +684,11 @@ Mortising::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 2511, sErr) ;
|
||||
// esecuzione eventuali personalizzazioni finali
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 2511, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2511, "Error in Mortising : post apply not calculable") ;
|
||||
return false ;
|
||||
@@ -817,7 +827,7 @@ Mortising::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Mortising::UpdateToolData( bool* pbChanged)
|
||||
Mortising::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
@@ -868,9 +878,9 @@ Mortising::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 2554, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -878,7 +888,7 @@ Mortising::UpdateToolData( bool* pbChanged)
|
||||
bool
|
||||
Mortising::GetGeometry( SELVECTOR& vIds) const
|
||||
{
|
||||
// restituisco l'elenco delle entità
|
||||
// restituisco l'elenco delle entità
|
||||
vIds = m_vId ;
|
||||
return true ;
|
||||
}
|
||||
@@ -891,7 +901,7 @@ Mortising::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
|
||||
if ( pGObj == nullptr)
|
||||
return false ;
|
||||
// se ammesse curve ed è tale
|
||||
// se ammesse curve ed è tale
|
||||
if ( nType != GEO_SURF && ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
const ICurve* pCurve = nullptr ;
|
||||
// se direttamente la curva
|
||||
@@ -913,7 +923,7 @@ Mortising::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
}
|
||||
return ( pCurve != nullptr) ;
|
||||
}
|
||||
// se altrimenti ammesse superfici trimesh ed è tale
|
||||
// se altrimenti ammesse superfici trimesh ed è tale
|
||||
else if ( nType != GEO_CURVE && ( pGObj->GetType() & GEO_SURF) != 0) {
|
||||
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
|
||||
if ( pSurf == nullptr)
|
||||
@@ -1048,7 +1058,7 @@ Mortising::Chain( int nGrpDestId)
|
||||
for ( const auto& Id : m_vId) {
|
||||
// prendo curva
|
||||
vpCrvs.emplace_back( GetCurve( Id)) ;
|
||||
// ne verifico la validità
|
||||
// ne verifico la validità
|
||||
if ( IsNull( vpCrvs.back())) {
|
||||
string sInfo = "Warning in Mortising : Skipped entity " + ToString( Id) ;
|
||||
m_pMchMgr->SetWarning( 2551, sInfo) ;
|
||||
@@ -1167,7 +1177,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// recupero gruppo per geometria temporanea
|
||||
const string GRP_TEMP = "Temp" ;
|
||||
int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nTempId == GDB_ID_NULL) {
|
||||
nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nTempId == GDB_ID_NULL)
|
||||
@@ -1231,7 +1241,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
m_pMchMgr->SetWarning( 2555, "Warning in Mortising : skipped Path too short") ;
|
||||
return true ;
|
||||
}
|
||||
// se una sola entità circonferenza completa, la divido in due per poterla allungare
|
||||
// se una sola entità circonferenza completa, la divido in due per poterla allungare
|
||||
if ( pCompo->GetCurveCount() == 1 && pCompo->IsClosed())
|
||||
pCompo->AddJoint( 0.5) ;
|
||||
// eventuali allungamenti
|
||||
@@ -1331,7 +1341,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
return false ;
|
||||
// eventuale imposizione massima elevazione da note utente
|
||||
double dMaxElev ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, "MaxElev", dMaxElev) && dElev > dMaxElev)
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MAXELEV, dMaxElev) && dElev > dMaxElev)
|
||||
dElev = dMaxElev ;
|
||||
|
||||
// ingombro aggiuntivo da larghezza sega a catena quando inclinata rispetto al movimento
|
||||
@@ -1342,7 +1352,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
|
||||
// affondamento speciale da note utente (!!! da trasformare in parametro come gli altri !!!)
|
||||
int nPlunge = 0 ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, "Plunge", nPlunge) ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_PLUNGE, nPlunge) ;
|
||||
|
||||
// verifico che lo step dell'utensile sia sensato
|
||||
double dOkStep = ( nPlunge == MORTISE_PLUNGE_STEP || nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ ? m_Params.m_dStep : 0) ;
|
||||
@@ -1363,7 +1373,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se lo step supera la capacità dell'utensile
|
||||
// se lo step supera la capacità dell'utensile
|
||||
if ( dOkStep > m_TParams.m_dMaxMat + EPS_SMALL) {
|
||||
dOkStep = m_TParams.m_dMaxMat ;
|
||||
string sInfo = "Warning in Mortising : machining step (" + ToString( m_Params.m_dStep, 1) +
|
||||
@@ -1511,7 +1521,7 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
|
||||
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
|
||||
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
|
||||
|
||||
// verifico se affondamento ripetuto è veramente tale
|
||||
// verifico se affondamento ripetuto è veramente tale
|
||||
if ( ( nPlunge == MORTISE_PLUNGE_START_END || nPlunge == MORTISE_PLUNGE_START_TO_END) && Dist( ptStart, ptEnd) < 10 * EPS_SMALL)
|
||||
nPlunge = MORTISE_PLUNGE_START ;
|
||||
|
||||
@@ -1535,7 +1545,7 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
|
||||
int kMax = ( int) floor( dLen / m_TParams.m_dDiam) ;
|
||||
for ( int k = 0 ; k <= kMax ; ++ k) {
|
||||
Point3d ptNewStart = ptStart + vtDir * k * m_TParams.m_dDiam ;
|
||||
// se non è finale
|
||||
// se non è finale
|
||||
if ( k != kMax || ! AreSamePointEpsilon( ptNewStart, ptEnd, 10 * EPS_SMALL)) {
|
||||
if ( ! GenerateOnePlungeCl( ptNewStart, ptEnd, vtTool, dDepth, dElev, dOkStep, MORTISE_PLUNGE_START, k == 0))
|
||||
return false ;
|
||||
@@ -1567,7 +1577,7 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
{
|
||||
// compensazione elevazione/affondamento
|
||||
double dDelta = dElev - dDepth ;
|
||||
// pre-calcolo step per modalità con step
|
||||
// pre-calcolo step per modalità con step
|
||||
int nStep = 1 ;
|
||||
double dStep = dElev ;
|
||||
if ( nPlunge == MORTISE_PLUNGE_STEP || nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ) {
|
||||
@@ -1577,7 +1587,7 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
dStep = dElev / nStep ;
|
||||
}
|
||||
|
||||
// determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
|
||||
// determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
|
||||
double dSafeZ = GetSafeZ() + GetDeltaSafeZ( vtTool) ;
|
||||
double dStartElev = 0 ;
|
||||
Point3d ptLi = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * dDelta ;
|
||||
@@ -1689,7 +1699,7 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
}
|
||||
}
|
||||
|
||||
// determino se la fine dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
|
||||
// determino se la fine dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
|
||||
double dEndElev = 0 ;
|
||||
Point3d ptLo = ptLast + vtTool * dDelta ;
|
||||
bool bUnderEnd = GetAhPointUnderRaw( ptLo, vtTool, 0,
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ class Mortising : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2025-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : OperUserNotesConst.h Data : 10.11.25 Versione : 2.7k3
|
||||
// Contenuto : Costanti per le note utente delle operazioni.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 10.11.25 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Generali
|
||||
static const std::string UN_MAXELEV = "MaxElev" ;
|
||||
static const std::string UN_TRIMEXT = "TrimExt" ;
|
||||
static const std::string UN_OPEN = "Open" ;
|
||||
static const std::string UN_LINTOL = "LinTol" ;
|
||||
static const std::string UN_DOUBLE = "DOUBLE" ;
|
||||
static const std::string UN_MIRRORAX = "MirrorAx" ;
|
||||
static const std::string UN_DELTAZ = "DeltaZ" ;
|
||||
static const std::string UN_VTAUXDIR = "VtAuxDir" ;
|
||||
static const std::string UN_STARTZMAX = "StartZmax" ;
|
||||
|
||||
// Solo per Drilling
|
||||
static const std::string UN_LASTSTEP = "LastStep" ;
|
||||
|
||||
// Solo per FiveAxisMilling
|
||||
static const std::string UN_SINGCONEANG = "SingConeAng" ;
|
||||
|
||||
// Solo per GenMachining
|
||||
static const std::string UN_VPL_COLON = "Vpl:" ;
|
||||
|
||||
// Solo per Milling
|
||||
static const std::string UN_OUTRAW = "OutRaw" ;
|
||||
static const std::string UN_SIDEELEV = "SideElev" ;
|
||||
static const std::string UN_VTFACEUSE = "VtFaceUse" ;
|
||||
static const std::string UN_EDGESFACEUSE = "EdgesFaceUse" ;
|
||||
|
||||
// Solo per Mortising
|
||||
static const std::string UN_PLUNGE = "Plunge" ;
|
||||
|
||||
// Solo per Pocketing o PocketingNT
|
||||
static const std::string UN_OPENOUTRAW = "OpenOutRaw" ;
|
||||
static const std::string UN_OPENMINSAFE = "OpenMinSafe" ;
|
||||
static const std::string UN_MAXOPTSIZE = "MaxOptSize" ;
|
||||
static const std::string UN_PROJEXT = "ExtProj" ;
|
||||
static const std::string UN_ADJUSTFEED = "AdjustFeed" ;
|
||||
static const std::string UN_MINFEED = "MinFeed" ;
|
||||
|
||||
// Solo per Sawing
|
||||
static const std::string UN_DOWNSE = "DownSE" ;
|
||||
static const std::string UN_FSTA = "Fsta" ;
|
||||
static const std::string UN_FEND = "Fend" ;
|
||||
static const std::string UN_SWE = "SWE" ;
|
||||
static const std::string UN_EWE = "EWE" ;
|
||||
|
||||
// Solo per SurfFinishing
|
||||
static const std::string UN_SKIPMAXDOWN = "SkipMaxDown" ;
|
||||
static const std::string UN_SPLITANGLE = "SplitAngle" ;
|
||||
static const std::string UN_TYPE = "Type" ;
|
||||
static const std::string UN_STEPNUMBER = "StepNumber" ;
|
||||
static const std::string UN_BITANGANG = "BiTangAng" ;
|
||||
static const std::string UN_OPTIMALTYPE = "OptimalType" ;
|
||||
static const std::string UN_ANGLETOL = "AngleTol" ;
|
||||
|
||||
// Solo per SurfRoughing
|
||||
static const std::string UN_PLANEZ = "PlaneZ" ;
|
||||
static const std::string UN_ORDER = "Order" ;
|
||||
static const std::string UN_SUPP_RAD_OFFS = "SuppRadOffs" ;
|
||||
// come per PocketingNT, viene usato il parametro UN_MINFEED
|
||||
|
||||
// Solo per Waterjetting
|
||||
static const std::string UN_START = "START" ;
|
||||
+1502
-533
File diff suppressed because it is too large
Load Diff
+58
-40
@@ -45,7 +45,7 @@ class Operation : public IUserObj
|
||||
{ m_nPhase = nPhase ; return true ; }
|
||||
virtual int GetPhase( void) const
|
||||
{ return m_nPhase ; }
|
||||
virtual bool RemoveHome( void) ;
|
||||
virtual bool RemoveHome( bool bMain = true) ;
|
||||
std::string GetName( void) const ;
|
||||
|
||||
public :
|
||||
@@ -53,12 +53,17 @@ class Operation : public IUserObj
|
||||
virtual bool IsEmpty( int nEmptyType = 0) const = 0 ;
|
||||
virtual bool UpdateStatus( int nModif) = 0 ;
|
||||
|
||||
public :
|
||||
bool GetInitialAxesValues( bool bSkipClimb, bool bMain, DBLVECTOR& vAxVal) const ;
|
||||
bool GetFinalAxesValues( bool bSkipRise, bool bMain, DBLVECTOR& vAxVal) const ;
|
||||
|
||||
protected :
|
||||
virtual const std::string& GetToolName( void) const = 0 ;
|
||||
virtual const std::string& GetHeadName( void) const = 0 ;
|
||||
virtual int GetExitNbr( void) const = 0 ;
|
||||
virtual int GetSolCh( void) const = 0 ;
|
||||
virtual const std::string& GetToolTcPos( void) const = 0 ;
|
||||
virtual bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const = 0 ;
|
||||
virtual bool NeedPrevHome( void) const = 0 ;
|
||||
virtual bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
|
||||
{ return true ; }
|
||||
@@ -120,10 +125,10 @@ class Operation : public IUserObj
|
||||
bool IsAtLeastOnePathOk( void) const ;
|
||||
bool AreAllPathsOk( void) const ;
|
||||
bool GetToolpathsStatus( int& nCnt, int& nEmpty) const ;
|
||||
int GetFirstFullToolpath( void) const ;
|
||||
int GetNextFullToolpath( int nClPathId) const ;
|
||||
int GetLastFullToolpath( void) const ;
|
||||
int GetPrevFullToolpath( int nClPathId) const ;
|
||||
int GetFirstFullToolpath( bool bMain = true) const ;
|
||||
int GetNextFullToolpath( int nClPathId, bool bMain = true) const ;
|
||||
int GetLastFullToolpath( bool bMain = true) const ;
|
||||
int GetPrevFullToolpath( int nClPathId, bool bMain = true) const ;
|
||||
bool UpdateFollowingOperationsStatus( int nModif) ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
@@ -173,16 +178,15 @@ class Operation : public IUserObj
|
||||
bool CalcAndSetBBox( int nClId) ;
|
||||
bool CalcAndSetAxesBBox( void) ;
|
||||
|
||||
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ;
|
||||
|
||||
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
|
||||
std::string ExtractHint( const std::string& sNotes) const ;
|
||||
bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ;
|
||||
bool CalculateAxesValues( const std::string& sHint, bool bRotContOnNext = true, bool bSolChExact = false) ;
|
||||
bool SetBlockedRotAxis( const std::string& sBlockedAxis, bool bToolSetOk = false) const ;
|
||||
bool CalculateAxesValues( const std::string& sHint, bool bSolChExact = false, double dSingConeAng = 0) ;
|
||||
bool CalculateDoubleAxesValues( const std::string& sHint, bool bSolChExact = false, double dSingConeAng = 0) ;
|
||||
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
|
||||
bool RemoveClimbRiseHome( void) ;
|
||||
bool RemoveClimbRiseHome( bool bMain = true) ;
|
||||
double GetDeltaSafeZ( const Vector3d& vtTool) const ;
|
||||
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int* pnLKAMO = nullptr) const ;
|
||||
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, double dStartOffsX, const DBLVECTOR& vAxEnd, int* pnLKAMO = nullptr) const ;
|
||||
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
|
||||
bool IsAggrBottom( const std::string& sHead) const ;
|
||||
|
||||
@@ -199,51 +203,63 @@ class Operation : public IUserObj
|
||||
typedef std::vector<Position> POSVECTOR ;
|
||||
|
||||
private :
|
||||
bool GetInitialAxesValues( bool bSkipClimb, DBLVECTOR& vAxVal) const ;
|
||||
bool GetClPathInitialAxesValues( int nClPathId, bool bSkipClimb, DBLVECTOR& vAxVal) const ;
|
||||
bool GetFinalAxesValues( bool bSkipRise, DBLVECTOR& vAxVal) const ;
|
||||
bool GetClPathFinalAxesValues( int nClPathId, bool bSkipRise, DBLVECTOR& vAxVal) const ;
|
||||
bool GetInitialToolDir( bool bSkipClimb, Vector3d& vtTool) const ;
|
||||
bool GetClPathInitialToolDir( int nClPathId, bool bSkipClimb, Vector3d& vtTool) const ;
|
||||
bool GetFinalToolDir( bool bSkipRise, Vector3d& vtTool) const ;
|
||||
bool GetClPathFinalToolDir( int nClPathId, bool bSkipRise, Vector3d& vtTool) const ;
|
||||
const CamData* GetInitialCamData( bool bSkipClimb) const ;
|
||||
const CamData* GetInitialCamData( bool bSkipClimb, bool bMain = true) const ;
|
||||
const CamData* GetClPathInitialCamData( int nClPathId, bool bSkipClimb) const ;
|
||||
const CamData* GetFinalCamData( bool bSkipRise) const ;
|
||||
const CamData* GetFinalCamData( bool bSkipRise, bool bMain = true) const ;
|
||||
const CamData* GetClPathFinalCamData( int nClPathId, bool bSkipRise) const ;
|
||||
bool CalculateClPathCenterAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
|
||||
bool ApplyHintToPrevAxRot( const std::string& sHint, const Machine* pMch, DBLVECTOR& vAxRotPrec) ;
|
||||
bool CalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome,
|
||||
DBLVECTOR& vAxRotPrec) ;
|
||||
bool EraseAddedPoints( int nClPathId) ;
|
||||
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
|
||||
bool CalculateRotAxesValues( bool bFirst, const Vector3d& vtTool, const Vector3d& vtAux,
|
||||
double dRot1W, bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec, DBLVECTOR& vAxRot) ;
|
||||
bool VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec,
|
||||
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal,
|
||||
int nCnt, int nEntId, double dRot1W, int nMoveType, bool bToolShow, bool& bAdded, bool& bAxError) ;
|
||||
bool CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
|
||||
bool MyCalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome,
|
||||
DBLVECTOR& vAxRotPrec, bool bFirstTry, int& nOutStrC) ;
|
||||
bool CalculateMcentRotAxesValues( bool bFirst, const Vector3d& vtTool, const Vector3d& vtAux,
|
||||
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec,
|
||||
DBLVECTOR& vAxRot) ;
|
||||
bool VerifyMcentLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec,
|
||||
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal,
|
||||
int nCnt, int nEntId, int nMoveType, bool bToolShow, bool& bAdded, bool& bAxError) ;
|
||||
bool CalculateClPathRobotAxesValues( int nClPathId, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome,
|
||||
DBLVECTOR& vAxRotPrec) ;
|
||||
bool CalculateRobotAxesValues( bool bFirst, const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtAux,
|
||||
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec,
|
||||
DBLVECTOR& vAxRot) ;
|
||||
bool VerifyRobotLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec,
|
||||
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal,
|
||||
int nCnt, int nEntId, int nMoveType, bool bToolShow, bool& bAdded, bool& bAxError) ;
|
||||
bool GetAxisMidForTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nAxisOrder, Machine* pMch,
|
||||
DBLVECTOR& vAxMid) const ;
|
||||
bool OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
|
||||
Machine* pMch, const INTVECTOR& vRawId, const INTVECTOR& vFxtId) const ;
|
||||
bool AdjustStartEndMovementsStd( bool bVerifyPreviousLink) ;
|
||||
bool AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOpe, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
|
||||
bool AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOpe, const DBLVECTOR& vAxPrev, double dPrevOffsX, bool bMaxZ) ;
|
||||
bool AdjustStartEndMovementsNew( void) ;
|
||||
bool ManageSpecialLink( Operation* pPrevOpe, int nPrevClPathId, Operation* pNextOpe, int nNextClPathId) ;
|
||||
bool ToolChangeNeeded( const Operation& Ope1, const Operation& Ope2) const ;
|
||||
bool AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL,
|
||||
bool MoveHeadFromHomeToMach( bool bMain, const std::string& sToolName, const std::string& sHeadName, int nExitNbr, int nStartZMax,
|
||||
int nOtherLinkType) ;
|
||||
bool MoveHeadFromMachToMach( Operation* pPrevOpe,
|
||||
bool bPrevMain, const std::string& sPrevToolName, const std::string& sPrevHeadName, int nPrevExitNbr,
|
||||
bool bCurrMain, const std::string& sCurrToolName, const std::string& sCurrHeadName, int nCurrExitNbr,
|
||||
bool bToolChange, int nStartZMax, int nOtherLinkType, int nOtherLinkType1) ;
|
||||
bool MoveHeadFromMachToHome( Operation* pPrevOpe, bool bCurrMain, const std::string& sCurrToolName, const std::string& sCurrHeadName, int nCurrExitNbr,
|
||||
int nStartZMax, int nOtherLinkType) ;
|
||||
bool ManageDoubleOperNew( Operation* pPrevOpe) ;
|
||||
bool ManageSpecialLink( Operation* pPrevOpe, int nPrevClPathId, bool bPrevMain, Operation* pNextOpe, int nNextClPathId, bool bNextMain,
|
||||
int nStartZMax, int nOtherLinkType = LINK_NULL) ;
|
||||
bool ToolChangeNeeded( const Operation& Ope1, bool bMain1, const Operation& Ope2, bool bMain2) const ;
|
||||
bool AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, bool bMain = true,
|
||||
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "", bool bFirst = true) ;
|
||||
bool RemoveClimb( int nClPathId = GDB_ID_NULL) ;
|
||||
bool AddRise( DBLVECTOR& vAxVal, double dDelta = NAN, int nClPathId = GDB_ID_NULL, int nToMinMaxZ = 0) ;
|
||||
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL,
|
||||
bool RemoveClimb( int nClPathId = GDB_ID_NULL, bool bMain = true) ;
|
||||
bool AddRise( DBLVECTOR& vAxVal, double dDelta = NAN, int nClPathId = GDB_ID_NULL, bool bMain = true, int nToMinMaxZ = 0) ;
|
||||
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, bool bMain = true,
|
||||
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "") ;
|
||||
bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
|
||||
bool AddHome( void) ;
|
||||
bool RemoveRise( int nClPathId = GDB_ID_NULL, bool bMain = true) ;
|
||||
bool AddHome( bool bMain = true) ;
|
||||
bool AddRobotClimb( int nEntId, double dDeltaZ = NAN) ;
|
||||
bool CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const Vector3d& vtA, double dDeltaZ,
|
||||
DBLVECTOR& vAx, double* pdNewDeltaZ = nullptr) const ;
|
||||
@@ -262,7 +278,9 @@ class Operation : public IUserObj
|
||||
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
|
||||
bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, DBLVECTOR& vAxNew, bool& bModif) ;
|
||||
bool SpecialLink( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nLinkType,
|
||||
const Operation* pPrevOpe, const Operation* pNextOpe) ;
|
||||
const Operation* pPrevOpe, bool bPrevMain, const Operation* pNextOpe, bool bNextMain,
|
||||
int nStartZMax, int nOtherLinkType = LINK_NULL) ;
|
||||
bool SpecialPrevMachiningOffset( const Operation* pPrevOpe, double& dOffsetX) ;
|
||||
|
||||
protected :
|
||||
int m_nOwnerId ; // identificativo dell'oggetto geometrico possessore
|
||||
|
||||
@@ -88,6 +88,7 @@ static const std::string GVAR_MAXMIN = ".MAXMIN" ; // (double/s) minimo di
|
||||
static const std::string GVAR_MAXMAX = ".MAXMAX" ; // (double/s) massimo di ingombro degli assi della lavorazione
|
||||
static const std::string GVAR_PATHID = ".PATHID" ; // (int) identificativo percorso di lavorazione
|
||||
static const std::string GVAR_PATHIND = ".PATHIND" ; // (int) indice percorso di lavorazione
|
||||
static const std::string GVAR_DBLPATHID = ".DBLPATHID" ; // (int) identificativo eventuale percorso di lavorazione in doppio
|
||||
static const std::string GVAR_START = ".START" ; // (Point3d) punto iniziale del percorso originale
|
||||
static const std::string GVAR_END = ".END" ; // (Point3d) punto finale del percorso originale
|
||||
static const std::string GVAR_EXTR = ".EXTR" ; // (Vector3d) versore estrusione
|
||||
|
||||
+87
-29
@@ -18,6 +18,7 @@
|
||||
#include "DllMain.h"
|
||||
#include "Pocketing.h"
|
||||
#include "OperationConst.h"
|
||||
#include "OperUserNotesConst.h"
|
||||
#include "MachiningConst.h"
|
||||
#include "GeoConst.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
@@ -46,12 +47,6 @@ using namespace std ;
|
||||
//------------------------------ Constants ------------------------------------
|
||||
static int LINK_CURVE_PROP = -3 ;
|
||||
static string KEY_OPEN = "OPEN" ;
|
||||
// Parametri avanzati da UserNotes
|
||||
const string UN_MAXELEV = "MaxElev" ;
|
||||
const string UN_OPEN = "Open" ;
|
||||
const string UN_OPENOUTRAW = "OpenOutRaw" ;
|
||||
const string UN_OPENMINSAFE = "OpenMinSafe" ;
|
||||
const string UN_MAXOPTSIZE = "MaxOptSize" ;
|
||||
|
||||
//------------------------------ Errors --------------------------------------
|
||||
// 2401 = "Error in Pocketing : UpdateToolData failed"
|
||||
@@ -85,6 +80,7 @@ const string UN_MAXOPTSIZE = "MaxOptSize" ;
|
||||
// 2430 = "Error in Pocketing : adjust open edges failed"
|
||||
// 2431 = "Error in Pocketing : LeadIn with Mill NoTip in material"
|
||||
// 2432 = "Error in Pocketing : Mirror for Double calculation failed"
|
||||
// 2433 = "Error in Pocketing : special apply not calculable"
|
||||
// 2451 = "Warning in Pocketing : Skipped entity (xx)"
|
||||
// 2452 = "Warning in Pocketing : No machinable pocket"
|
||||
// 2453 = "Warning in Pocketing : Tool name changed (xx)"
|
||||
@@ -627,8 +623,7 @@ Pocketing::Apply( bool bRecalc, bool bPostApply)
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 2401, "Error in Pocketing : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -638,8 +633,7 @@ Pocketing::Apply( bool bRecalc, bool bPostApply)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nPockets = nCurrPockets ;
|
||||
string sLog = string( "Pocketing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
@@ -726,15 +720,15 @@ Pocketing::Apply( bool bRecalc, bool bPostApply)
|
||||
// assegno ingombri dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetBBox( nClId) ;
|
||||
|
||||
// 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( 2432, "Error in Pocketing : Mirror for Double calculation failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
|
||||
if ( ! Update( bPostApply))
|
||||
return false ;
|
||||
|
||||
// aggiorno stato della lavorazione
|
||||
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
|
||||
@@ -782,6 +776,44 @@ Pocketing::Update( bool bPostApply)
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// se lavorazione in doppio, calcolo assi e movimenti di approccio e retrazione relativi
|
||||
if ( GetDoubleType( m_Params.m_sUserNotes) != 0) {
|
||||
// elimino le entità CLIMB, RISE e HOME della lavorazione in doppio
|
||||
RemoveClimbRiseHome( false) ;
|
||||
// recupero i dati della testa in doppio e la imposto
|
||||
string sDblTool ; string sDblTcPos ; string sDblHead ; int nDblExit ;
|
||||
bool bOk = GetDoubleToolData( sDblTool, sDblTcPos, sDblHead, nDblExit) &&
|
||||
m_pMchMgr->SetCalcTool( sDblTool, sDblHead, nDblExit) ;
|
||||
// imposto eventuale asse bloccato da lavorazione
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis, true) ;
|
||||
// eseguo il calcolo
|
||||
if ( bOk) {
|
||||
if ( ! CalculateDoubleAxesValues( sHint)) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 2423, "Error in Pocketing : axes values not calculable for double") ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2424, "Error in Pocketing : double outstroke ") ;
|
||||
bOk = false ;
|
||||
}
|
||||
}
|
||||
// ripristino testa principale
|
||||
m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()) ;
|
||||
// in caso di errore, esco
|
||||
if ( ! bOk)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 2433, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2433, "Error in Pocketing : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -792,11 +824,11 @@ Pocketing::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 2427, sErr) ;
|
||||
// esecuzione eventuali personalizzazioni finali
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 2427, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2427, "Error in Pocketing : post apply not calculable") ;
|
||||
return false ;
|
||||
@@ -950,7 +982,7 @@ Pocketing::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::UpdateToolData( bool* pbChanged)
|
||||
Pocketing::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
@@ -1001,9 +1033,9 @@ Pocketing::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 2454, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -2618,7 +2650,7 @@ Pocketing::OptimizedZigZag( int nPathId, const Vector3d& vtTool, double dDepth,
|
||||
|
||||
// recupero gli id dei lati chiusi
|
||||
INTVECTOR vnInfoClosed ;
|
||||
for( int i = 0 ; i < pCrvPocket->GetCurveCount() ; i ++) {
|
||||
for ( int i = 0 ; i < pCrvPocket->GetCurveCount() ; i ++) {
|
||||
int nProp ;
|
||||
if ( pCrvPocket->GetCurveTempProp( i, nProp) && nProp == 0)
|
||||
vnInfoClosed.push_back( i) ;
|
||||
@@ -3468,7 +3500,7 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
|
||||
int nMaxInd = pMCrv->GetCurveCount() - 1 ;
|
||||
int nMaxRInd = pRCrv->GetCurveCount() - 1 ;
|
||||
|
||||
|
||||
// ciclo sugli step
|
||||
Point3d ptP1 ;
|
||||
for ( int j = 1 ; j <= nStep ; ++ j) {
|
||||
@@ -3514,8 +3546,15 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
if ( GetLeadInType() == POCKET_LI_ZIGZAG ||
|
||||
GetLeadInType() == POCKET_LI_HELIX ||
|
||||
GetLeadInType() == POCKET_LI_GLIDE) {
|
||||
ptP1 += vtExtr * ( dStElev + LIO_ELEV_TOL) ;
|
||||
dStElev = -LIO_ELEV_TOL ;
|
||||
// se lucidatura forzo il valore al parametro di elevazione in ingresso
|
||||
if ( m_TParams.m_nType == TT_MILL_POLISHING) {
|
||||
ptP1 += vtExtr * max( m_Params.m_dLiElev, dStElev + LIO_ELEV_TOL) ;
|
||||
dStElev = 0 ;
|
||||
}
|
||||
else {
|
||||
ptP1 += vtExtr * ( dStElev + LIO_ELEV_TOL) ;
|
||||
dStElev = -LIO_ELEV_TOL ;
|
||||
}
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bSplitArcs, bOutStart || bForcedOutStart)) {
|
||||
@@ -5126,6 +5165,14 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
|
||||
SetFlag( 0) ;
|
||||
}
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
// se impostato come parametro di lavorazione nelle UserNotes
|
||||
Vector3d vtAux ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
|
||||
vtAux.Normalize() ;
|
||||
SetAuxDir( vtAux) ;
|
||||
}
|
||||
// se sopra attacco c'è spazio per sicurezza o approccio
|
||||
double dSafeDist = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
|
||||
if ( ! bBottomOutStart && dElev + max( dSafeDist, dAppr) > 10 * EPS_SMALL) {
|
||||
@@ -5475,8 +5522,19 @@ Pocketing::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector
|
||||
Vector3d vtMove = ptEnd - ptIni ;
|
||||
pCrv->Translate( vtMove) ;
|
||||
Point3d ptFin ; pCrv->GetEndPoint( ptFin) ;
|
||||
ptFin += vtN * 1.0 ;
|
||||
pCrv->ModifyEnd( ptFin) ;
|
||||
// se lucidatura forzo la stessa quota dell'ingresso
|
||||
if ( m_TParams.m_nType == TT_MILL_POLISHING) {
|
||||
double dExtraElev = max( m_Params.m_dLiElev, 1.0) ;
|
||||
double dNini = ( ptEnd - ORIG) * vtN ;
|
||||
double dNfin = dNini + dExtraElev ;
|
||||
ptFin += vtN * dExtraElev ;
|
||||
// distribuisco l'elevazione extra uniformemente su tutta la curva
|
||||
AdjustCurveSlope( pCrv, dNini, dNfin) ;
|
||||
}
|
||||
else {
|
||||
ptFin += vtN * 1.0 ;
|
||||
pCrv->ModifyEnd( ptFin) ;
|
||||
}
|
||||
// emetto (con eventuale spezzatura)
|
||||
AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) ;
|
||||
// determino elevazione su fine uscita
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ class Pocketing : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
|
||||
+18
-2
@@ -115,7 +115,7 @@ PocketingData::Clone( void) const
|
||||
bool
|
||||
PocketingData::CopyFrom( const MachiningData* pMdata)
|
||||
{
|
||||
// è inutile copiare se sorgente coincide con destinazione
|
||||
// è inutile copiare se sorgente coincide con destinazione
|
||||
if ( pMdata == this)
|
||||
return true ;
|
||||
// la sorgente deve essere dello stesso tipo
|
||||
@@ -150,6 +150,8 @@ PocketingData::CopyFrom( const MachiningData* pMdata)
|
||||
m_dLiElev = pSdata->m_dLiElev ;
|
||||
m_nLeadOutType = pSdata->m_nLeadOutType ;
|
||||
m_dLoTang = pSdata->m_dLoTang ;
|
||||
m_dEpicyclesDist = pSdata->m_dEpicyclesDist ;
|
||||
m_dEpicyclesRad = pSdata->m_dEpicyclesRad ;
|
||||
m_sSysNotes = pSdata->m_sSysNotes ;
|
||||
m_sUserNotes = pSdata->m_sUserNotes ;
|
||||
return true ;
|
||||
@@ -194,6 +196,8 @@ PocketingData::SameAs(const MachiningData* pMdata) const
|
||||
abs( m_dLiElev - pSdata->m_dLiElev) < EPS_MACH_LEN_PAR &&
|
||||
m_nLeadOutType == pSdata->m_nLeadOutType &&
|
||||
abs( m_dLoTang - pSdata->m_dLoTang) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dEpicyclesDist - pSdata->m_dEpicyclesDist) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dEpicyclesRad - pSdata->m_dEpicyclesRad) < EPS_MACH_LEN_PAR &&
|
||||
m_sSysNotes == pSdata->m_sSysNotes &&
|
||||
m_sUserNotes == pSdata->m_sUserNotes) ;
|
||||
}
|
||||
@@ -202,7 +206,7 @@ PocketingData::SameAs(const MachiningData* pMdata) const
|
||||
int
|
||||
PocketingData::GetSize( void) const
|
||||
{
|
||||
// in debug verifico validità ultimo campo
|
||||
// in debug verifico validità ultimo campo
|
||||
assert( sPocketingKey[KEY_UUID] == "UUID") ;
|
||||
return KEY_ZZZ ;
|
||||
}
|
||||
@@ -534,6 +538,12 @@ PocketingData::SetParam( int nType, double dVal)
|
||||
case MPA_LOTANG :
|
||||
m_dLoTang = dVal ;
|
||||
return true ;
|
||||
case MPA_EPICYCLESDIST :
|
||||
m_dEpicyclesDist = dVal ;
|
||||
return true ;
|
||||
case MPA_EPICYCLESRAD :
|
||||
m_dEpicyclesRad = dVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
@@ -669,6 +679,12 @@ PocketingData::GetParam( int nType, double& dVal) const
|
||||
case MPA_LOTANG :
|
||||
dVal = m_dLoTang ;
|
||||
return true ;
|
||||
case MPA_EPICYCLESDIST :
|
||||
dVal = m_dEpicyclesDist ;
|
||||
return true ;
|
||||
case MPA_EPICYCLESRAD :
|
||||
dVal = m_dEpicyclesRad ;
|
||||
return true ;
|
||||
}
|
||||
dVal = 0 ;
|
||||
return false ;
|
||||
|
||||
+1901
-521
File diff suppressed because it is too large
Load Diff
+28
-14
@@ -33,6 +33,7 @@ struct PathInfoPO {
|
||||
PtrOwner<ICurveComposite> pCrvPath ; // percorso del centro utensile
|
||||
PtrOwner<ICurveComposite> pCrvGlideIn ; // curva per LeadIn a guida
|
||||
PtrOwner<ICurveComposite> pCrvGlideOut ; // curva per LeadOut a guida
|
||||
PtrOwner<ICurveComposite> pCrvZigZagIn ; // curva per LeadIn a ZigZag ( caso speciale)
|
||||
PtrOwner<ICurveComposite> pCrvRet ; // curva di ritorno ( per ora solo caso fori)
|
||||
} ;
|
||||
// tipo percorso
|
||||
@@ -93,7 +94,7 @@ class PocketingNT : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
@@ -103,18 +104,21 @@ class PocketingNT : public Machining
|
||||
private :
|
||||
bool MyApply( bool bRecalc, bool bPostApply) ;
|
||||
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
|
||||
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
|
||||
bool AdjustCurvesByStmTopology( const ISurfTriMesh* pSurf, const Frame3d& frGlob, const ISurfTriMesh* pStmTrim, ICURVEPLIST& lstPC) ;
|
||||
bool GetCurves( const SelData& Id, const ISurfTriMesh* pStmRaw, const ISurfTriMesh* pStmTrim, ICURVEPLIST& lstPC) ;
|
||||
bool SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen = nullptr) ;
|
||||
bool SetSfrLoopsAllTempProp( int nSfrId, ISurfFlatRegion* pSfr) ;
|
||||
bool ResetCurveAllTempProp( ICurve* pCurve) ;
|
||||
bool Chain( int nGrpDestId) ;
|
||||
ISurfTriMesh* GetRaw( void) ;
|
||||
ISurfTriMesh* GetStmTrim( void) ;
|
||||
ISurfTriMesh* GetExtrusionStm( const ISurfFlatRegion* pSfr, const Vector3d& vtExtr) ;
|
||||
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) ;
|
||||
ISurfFlatRegion* GetSfrRawProjection( const ISurfTriMesh* pStmRaw, const ISurfFlatRegion* pSfr, const Vector3d& vtTool) ;
|
||||
Point3d GetStartPointsFromSteps( const STEPINFOPOVECTOR& vStepInfo, int nCrvType) ;
|
||||
Point3d GetStartPointsByHead( const STEPINFOPOVECTOR& vStepInfo) const ;
|
||||
Point3d GetStartPointsFromSteps( const STEPINFOPOVECTOR& vStepInfo, int nCrvType) const ;
|
||||
bool ChooseRawPart( const ISurfFlatRegion* pSfrChunk, ISurfTriMesh* pStm) const ;
|
||||
bool ManageOpenEdges( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmPart) ;
|
||||
bool ManageLeadInLeadOutGlideCrvs( STEPINFOPOVECTOR& vStepInfo) ;
|
||||
bool GetHomogeneousParts( const ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) const ;
|
||||
bool ExtendOpenEdges( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm) ;
|
||||
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmExtrusion) ;
|
||||
@@ -126,12 +130,15 @@ class PocketingNT : public Machining
|
||||
double dRad, double dLen, double& dElev) ;
|
||||
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
|
||||
bool GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) ;
|
||||
bool CalcGeoExtSurfFr( const ISurfFlatRegion* pSfrPock, const Vector3d& vtTool, double dDepth, const ISurfTriMesh* pStmRaw,
|
||||
const SELVECTOR& vGeoSel, ISURFFRPOVECTOR& vSfrGeoExt) ;
|
||||
bool CalcLimitRegion( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrRaw, ISurfFlatRegion* pSfrLimit) ;
|
||||
bool CalcPaths( STEPINFOPOVECTOR& vStepInfo) ;
|
||||
bool CalcRetCurve( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath,
|
||||
const Vector3d& vtTool, bool bHolePocketing, bool bInVsOut, ICurveComposite* pCrvGlide) ;
|
||||
bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dElev, double dStep, bool bSplitArcs) ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) ;
|
||||
bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dStep, bool bSplitArcs, Point3d& ptPockStart, Point3d& ptPockEnd) ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
double GetRightStartFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
|
||||
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;
|
||||
bool AddEpicycles( ICurveComposite * pCompo, ICurveComposite * pCrv, ICurveComposite * pCrvBound = nullptr) ;
|
||||
@@ -145,19 +152,20 @@ class PocketingNT : public Machining
|
||||
double dElev, double dAppr, bool bSplitArcs) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bSplitArcs) ;
|
||||
bool CalcFirstElevation( const Point3d& ptStart, const Point3d& ptP1, const Vector3d& vtTool, const StepInfoPO& currStep,
|
||||
double dSafeZ, double dStep, double& dCurrElev) ;
|
||||
bool CalcFirstElevation( const Point3d& ptP1, const Vector3d& vtTool,
|
||||
const StepInfoPO& currStep, double dSafeZ, double dStep, double& dCurrElev,
|
||||
double& dEscapeElev, Vector3d& vtEscape) const ;
|
||||
bool CalcLastElevation( const Point3d& ptP1, const Vector3d& vtTool,
|
||||
const StepInfoPO& currStep, double dSafeZ, double dStep, double& dCurrElev,
|
||||
double& dEscapeElev, Vector3d& vtEscape) const ;
|
||||
bool CalcLeadInStart( Point3d& ptStart, const Vector3d& vtTool, const ICurveComposite* pCrvPath, Point3d& ptP1) ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
const ISurfFlatRegion* pSfr, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
|
||||
bool bNoneForced, bool bSkipControl) ;
|
||||
const ISurfFlatRegion* pSfr, const ICurveComposite* pRCrv, const ICurveComposite* pRZigZag,
|
||||
bool bAtLeft, bool bSplitArcs, bool bNoneForced, bool bSkipControl) ;
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN, const ISurfFlatRegion* pSfr,
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1) ;
|
||||
double GetRadiusForStartEndElevation( void) ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
bool GetForcedClosed( void) ;
|
||||
bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ;
|
||||
bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ;
|
||||
bool AdjustContourStart( ICurveComposite* pCompo) ;
|
||||
bool ManageSmoothLink( const PathInfoPO& currPath, const PathInfoPO& nextPath, bool bSamePlane,
|
||||
bool& bSmoothEnd, bool& bForceLinear) ;
|
||||
bool CheckSafetyLink( const Point3d& ptCurr, const Vector3d& vtCurr,
|
||||
@@ -167,7 +175,13 @@ class PocketingNT : public Machining
|
||||
bool VerifyLeadInHelix( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptCen, double dHelixRad) ;
|
||||
bool VerifyLeadInZigZag( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptPa, const Point3d& ptPb) ;
|
||||
bool VerifyLeadInOutGlide( const ISurfFlatRegion* pSfr, ICurveComposite* pCrvGlide) ;
|
||||
bool AddSpecialLeadInZigZag( const ICurveComposite* pCompoPath, const Point3d& ptStart, const Vector3d& vtTool, int nStep, double dStep) ;
|
||||
bool CalcDistanceFromRawSurface( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist, Vector3d& vtNorm) ;
|
||||
bool VerifyParallelPocketing( int nDouble, const STEPINFOPOVECTOR& vStepInfo) const ;
|
||||
bool CalcDoubleParallelPenultimateStep( int nDouble, int nIdDblS, double dStep, double dLastStep, const Point3d& ptNeatEnd, const Vector3d& vtEnd,
|
||||
const INTVECTOR& vLeadOutId, const ISurfFlatRegion* pSfrLimit, const Vector3d& vtTool,
|
||||
bool bSplitArcs, double dMinFeed) ;
|
||||
double GetDoubleLastStep( void) ;
|
||||
// debug
|
||||
void DebugDrawSfr( const ISurfFlatRegion* pSfr, bool bUniform, int nlayer = GDB_ID_ROOT) ;
|
||||
void DebugDrawLoop( const ICurveComposite* pCrvCompo, int nLayer, bool bUniform) ;
|
||||
|
||||
+24
-14
@@ -17,6 +17,7 @@
|
||||
#include "DllMain.h"
|
||||
#include "Probing.h"
|
||||
#include "OperationConst.h"
|
||||
#include "OperUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
@@ -40,6 +41,7 @@ using namespace std ;
|
||||
// 3407 = "Error in Probing : link outstroke xx"
|
||||
// 3408 = "Error in Probing : post apply not calculable"
|
||||
// 3409 = "Error in Probing : Tool loading failed"
|
||||
// 3410 = "Error in Probing : special apply not calculable"
|
||||
// 3451 = "Warning in Probing : Skipped entity (xx)"
|
||||
// 3452 = "Warning in Probing : No machinable path"
|
||||
// 3453 = "Warning in Probing : Tool name changed (xx)"
|
||||
@@ -520,8 +522,7 @@ Probing::Apply( bool bRecalc, bool bPostApply)
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 3401, "Error in Probing : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -531,8 +532,7 @@ Probing::Apply( bool bRecalc, bool bPostApply)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nMills = nCurrMills ;
|
||||
string sLog = string( "Probing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
@@ -680,6 +680,16 @@ Probing::Update( bool bPostApply)
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 3410, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 3410, "Error in Probing : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -690,11 +700,11 @@ Probing::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 3408, sErr) ;
|
||||
// esecuzione eventuali personalizzazioni finali
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 3408, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 3408, "Error in Probing : post apply not calculable") ;
|
||||
return false ;
|
||||
@@ -812,7 +822,7 @@ Probing::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::UpdateToolData( bool* pbChanged)
|
||||
Probing::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
@@ -863,9 +873,9 @@ Probing::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 3454, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -938,7 +948,7 @@ double
|
||||
Probing::GetApproxLinTol( void) const
|
||||
{
|
||||
double dLinTol ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, "LinTol", dLinTol))
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_LINTOL, dLinTol))
|
||||
return dLinTol ;
|
||||
else
|
||||
return Operation::GetApproxLinTol() ;
|
||||
|
||||
@@ -64,7 +64,7 @@ class Probing : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
|
||||
+18
-7
@@ -29,11 +29,8 @@
|
||||
using namespace std ;
|
||||
|
||||
//------------------------------ Errors --------------------------------------
|
||||
// 1001 = "Error with setup : xxx"
|
||||
// 1002 = "Error opening Cnc file"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const string ERR_EXT = ".err" ;
|
||||
// 1002 = "Error with setup : xxx"
|
||||
// 1003 = "Error opening Cnc file"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Processor::Processor( void)
|
||||
@@ -401,6 +398,13 @@ Processor::ProcessMachining( int nOpId, int nOpInd)
|
||||
bool
|
||||
Processor::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
|
||||
{
|
||||
// verifico se Path in doppio
|
||||
int nDblPathId = GDB_ID_NULL ;
|
||||
int nDblId = m_pGeomDB->GetFirstNameInGroup( nOpId, MCH_DBL) ;
|
||||
if ( nDblId != GDB_ID_NULL) {
|
||||
string sCLPathName ; m_pGeomDB->GetName( nClPathId, sCLPathName) ;
|
||||
nDblPathId = m_pGeomDB->GetFirstNameInGroup( nDblId, sCLPathName) ;
|
||||
}
|
||||
// Recupero punti di inizio e fine del percorso
|
||||
Point3d ptStart ;
|
||||
m_pGeomDB->GetInfo( nClPathId, KEY_START, ptStart) ;
|
||||
@@ -427,7 +431,7 @@ Processor::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
|
||||
int nAS = 0 ;
|
||||
m_pGeomDB->GetInfo( nClPathId, KEY_AS_TOT, nAS) ;
|
||||
// Emetto inizio percorso di lavoro
|
||||
if ( ! OnPathStart( nClPathId, nClPathInd, nAS, ptStart, ptEnd, vtExtr,
|
||||
if ( ! OnPathStart( nClPathId, nClPathInd, nDblPathId, nAS, ptStart, ptEnd, vtExtr,
|
||||
ptMin, ptMax, vAxMin, vAxMax, dElev, vActiveExit))
|
||||
return false ;
|
||||
|
||||
@@ -966,18 +970,25 @@ Processor::OnMachiningEnd( void)
|
||||
{
|
||||
// chiamo la funzione di fine lavorazione
|
||||
bool bOk = CallOnMachiningEnd() ;
|
||||
// reset eventuale Path in double
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Processor::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
Processor::OnPathStart( int nClPathId, int nClPathInd, int nDblPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
|
||||
{
|
||||
// assegno identificativo e indice percorso di lavorazione
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHIND, nClPathInd) ;
|
||||
// assegno identificativo eventuale percorso in doppio
|
||||
if ( nDblPathId == GDB_ID_NULL)
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DBLPATHID, nDblPathId) ;
|
||||
// assegno numero di dati ausiliari iniziali
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXTOT, nAS) ;
|
||||
// assegno punti iniziale e finale e versore estrusione del percorso originale
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ class Processor
|
||||
bool OnMachiningStart( int nOpId, int nOpInd, double dSpeed, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
|
||||
bool OnMachiningEnd( void) ;
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nDblPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
|
||||
bool OnPathEnd( int nAE) ;
|
||||
|
||||
+63
-42
@@ -4,7 +4,7 @@
|
||||
// File : SawFinishing.cpp Data : 23.04.19 Versione : 2.1d3
|
||||
// Contenuto : Implementazione gestione finitura superficie con lama.
|
||||
//
|
||||
// Note : Questa lavorazione è sempre espressa nel riferimento globale.
|
||||
// Note : Questa lavorazione è sempre espressa nel riferimento globale.
|
||||
//
|
||||
// Modifiche : 05.04.16 DS Creazione modulo.
|
||||
// 23.04.19 DS Aggiunte cornici curve.
|
||||
@@ -51,6 +51,7 @@ using namespace std ;
|
||||
// 2713 = "Error in SawFinishing : link movements not calculable"
|
||||
// 2714 = "Error in SawFinishing : link outstroke xx"
|
||||
// 2715 = "Error in SawFinishing : post apply not calculable"
|
||||
// 2716 = "Error in SawFinishing : special apply not calculable"
|
||||
// 2751 = "Warning in SawFinishing : Skipped entity (xx)"
|
||||
// 2752 = "Warning in SawFinishing : No machinable path"
|
||||
// 2753 = "Warning in SawFinishing : Tool name changed (xx)"
|
||||
@@ -446,15 +447,15 @@ SawFinishing::SetParam( int nType, const string& sVal)
|
||||
bool
|
||||
SawFinishing::SetGeometry( const SELVECTOR& vIds)
|
||||
{
|
||||
// verifico validità gestore DB geometrico
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili
|
||||
for ( const auto& Id : vIds) {
|
||||
// test sull'entità
|
||||
// test sull'entità
|
||||
int nSubs ;
|
||||
if ( ! VerifyGeometry( Id, nSubs)) {
|
||||
string sInfo = "Warning in SawFinishing : Skipped entity " + ToString( Id) ;
|
||||
@@ -487,13 +488,12 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
|
||||
int nCurrCuts = m_nCuts ;
|
||||
m_nCuts = 0 ;
|
||||
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 2701, "Error in SawFinishing : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -503,8 +503,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nCuts = nCurrCuts ;
|
||||
string sLog = string( "SawFinishing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
@@ -521,7 +520,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
|
||||
|
||||
// recupero gruppo per geometria ausiliaria
|
||||
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nAuxId == GDB_ID_NULL) {
|
||||
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nAuxId == GDB_ID_NULL)
|
||||
@@ -543,7 +542,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
|
||||
|
||||
// recupero gruppo per geometria di lavorazione (Cutter Location)
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nClId == GDB_ID_NULL) {
|
||||
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nClId == GDB_ID_NULL)
|
||||
@@ -590,7 +589,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
|
||||
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
|
||||
if ( ! Update( bPostApply))
|
||||
return false ;
|
||||
|
||||
|
||||
// aggiorno stato della lavorazione
|
||||
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
|
||||
// dichiaro successiva da aggiornare
|
||||
@@ -605,7 +604,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
|
||||
bool
|
||||
SawFinishing::Update( bool bPostApply)
|
||||
{
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
@@ -615,7 +614,7 @@ 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)
|
||||
// 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
|
||||
@@ -637,6 +636,16 @@ SawFinishing::Update( bool bPostApply)
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 2716, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2716, "Error in SawFinishing : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -647,11 +656,11 @@ SawFinishing::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 2715, sErr) ;
|
||||
// esecuzione eventuali personalizzazioni finali
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 2715, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2715, "Error in SawFinishing : post apply not calculable") ;
|
||||
return false ;
|
||||
@@ -796,7 +805,7 @@ SawFinishing::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishing::UpdateToolData( bool* pbChanged)
|
||||
SawFinishing::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
@@ -847,9 +856,9 @@ SawFinishing::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 2754, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -857,7 +866,7 @@ SawFinishing::UpdateToolData( bool* pbChanged)
|
||||
bool
|
||||
SawFinishing::GetGeometry( SELVECTOR& vIds) const
|
||||
{
|
||||
// restituisco l'elenco delle entità
|
||||
// restituisco l'elenco delle entità
|
||||
vIds = m_vId ;
|
||||
return true ;
|
||||
}
|
||||
@@ -952,7 +961,7 @@ SawFinishing::GetCurve( SelData Id)
|
||||
bool
|
||||
SawFinishing::AdjustGeometry( int nAuxId)
|
||||
{
|
||||
// sgrossatura di cornici diritte : due o più curve (sezioni e guida rettilinea)
|
||||
// sgrossatura di cornici diritte : due o più curve (sezioni e guida rettilinea)
|
||||
// sgrossatura di cornici curve : due curve (sezione e guida curva)
|
||||
size_t nCrvCount = m_vId.size() ;
|
||||
if ( nCrvCount >= 2) {
|
||||
@@ -976,7 +985,7 @@ SawFinishing::AdjustGeometry( int nAuxId)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// l'ultima curva è la guida
|
||||
// l'ultima curva è la guida
|
||||
PtrOwner<ICurve> pGuide( GetCurve( m_vId[nCrvCount-1])) ;
|
||||
if ( IsNull( pGuide))
|
||||
return false ;
|
||||
@@ -1115,6 +1124,9 @@ SawFinishing::CalculateStraightAlongToolPath( int nAuxId, int nClId)
|
||||
SetToolDir( vtTool) ;
|
||||
SetCorrAuxDir( vtCorr) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Classifico i tratti a seconda della pendenza (salita, discesa, verticale, orizzontale)
|
||||
INTVECTOR vnClass ;
|
||||
ClassifySection( pCrv, vnClass) ;
|
||||
@@ -1190,7 +1202,7 @@ SawFinishing::CalculateStraightAlongToolPath( int nAuxId, int nClId)
|
||||
}
|
||||
}
|
||||
}
|
||||
// se c'è qualcosa in sospeso
|
||||
// se c'è qualcosa in sospeso
|
||||
if ( nStatus != CCL_VERT) {
|
||||
bSkipMax = false ;
|
||||
bool bInvert = ( nStatus == CCL_RISE) ;
|
||||
@@ -1311,6 +1323,9 @@ SawFinishing::CalculateStraightAcrossToolPath( int nAuxId, int nClId)
|
||||
SetToolDir( vtTool) ;
|
||||
SetCorrAuxDir( vtCorr) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Inizializzo contatore tagli
|
||||
m_nCuts = 0 ;
|
||||
|
||||
@@ -1383,7 +1398,7 @@ SawFinishing::CalculateCurvedAlongToolPath( int nAuxId, int nClId)
|
||||
// recupero il suo riferimento
|
||||
Frame3d frGdL ;
|
||||
m_pGeomDB->GetGlobFrame( nGuideId, frGdL) ;
|
||||
// porto la curva in globale (dovrebbe già avere riferimento globale)
|
||||
// porto la curva in globale (dovrebbe già avere riferimento globale)
|
||||
pGuide->ToGlob( frGdL) ;
|
||||
// recupero il box globale della linea guida
|
||||
BBox3d b3Guide ;
|
||||
@@ -1422,6 +1437,9 @@ SawFinishing::CalculateCurvedAlongToolPath( int nAuxId, int nClId)
|
||||
SetPathId( nPxId) ;
|
||||
SetToolDir( vtTool) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Classifico i tratti a seconda della pendenza (salita, discesa, verticale, orizzontale)
|
||||
INTVECTOR vnClass ;
|
||||
ClassifySection( pCrv, vnClass) ;
|
||||
@@ -1498,7 +1516,7 @@ SawFinishing::CalculateCurvedAlongToolPath( int nAuxId, int nClId)
|
||||
}
|
||||
}
|
||||
}
|
||||
// se c'è qualcosa in sospeso
|
||||
// se c'è qualcosa in sospeso
|
||||
if ( nStatus != CCL_VERT) {
|
||||
bSkipMax = false ;
|
||||
bool bInvert = ( nStatus == CCL_RISE) ;
|
||||
@@ -1542,7 +1560,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
|
||||
// recupero il suo riferimento
|
||||
Frame3d frGdL ;
|
||||
m_pGeomDB->GetGlobFrame( nGuideId, frGdL) ;
|
||||
// porto la curva in globale (dovrebbe già avere riferimento globale)
|
||||
// porto la curva in globale (dovrebbe già avere riferimento globale)
|
||||
pGuide->ToGlob( frGdL) ;
|
||||
// recupero il box globale della linea guida
|
||||
BBox3d b3Guide ;
|
||||
@@ -1618,6 +1636,9 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
|
||||
SetPathId( nPxId) ;
|
||||
SetToolDir( vtTool) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Inizializzo contatore tagli
|
||||
m_nCuts = 0 ;
|
||||
|
||||
@@ -1645,7 +1666,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
|
||||
vtCorr.Rotate( Z_AX, dAngRotDeg - 90) ;
|
||||
// flag di inizio
|
||||
bool bFirst = ( dLen < EPS_SMALL) ;
|
||||
// se non è inizio
|
||||
// se non è inizio
|
||||
bool bCorner = false ;
|
||||
Vector3d vtPrev ;
|
||||
if ( ! bFirst) {
|
||||
@@ -1786,7 +1807,7 @@ SawFinishing::CalculateSection( int nSectGrpId, ICurve*& pSect)
|
||||
bool
|
||||
SawFinishing::TrimSection( ICurve* pCrv)
|
||||
{
|
||||
// se parametri di accorciamento iniziale e finale sono nulli, non faccio alcunché
|
||||
// se parametri di accorciamento iniziale e finale sono nulli, non faccio alcunché
|
||||
if ( m_Params.m_dStartAddLen > - EPS_SMALL && m_Params.m_dEndAddLen > -EPS_SMALL)
|
||||
return true ;
|
||||
|
||||
@@ -1839,7 +1860,7 @@ SawFinishing::CalculateGuideLine( int nGuideId, const BBox3d& b3Sect,
|
||||
// recupero il suo riferimento
|
||||
Frame3d frGdL ;
|
||||
m_pGeomDB->GetGlobFrame( nGuideId, frGdL) ;
|
||||
// porto la curva in globale (dovrebbe già avere riferimento globale)
|
||||
// porto la curva in globale (dovrebbe già avere riferimento globale)
|
||||
pGuide->ToGlob( frGdL) ;
|
||||
// recupero gli estremi della linea guida
|
||||
pGuide->GetStartPoint( ptGdStart) ;
|
||||
@@ -2222,14 +2243,14 @@ SawFinishing::CalcAlongZigZagCut( const Point3d& ptStart, const Point3d& ptEnd,
|
||||
if ( AddLinearMove( ptNewStart) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se il precedente è più fuori
|
||||
// se il precedente è più fuori
|
||||
else if ( dDiff > 0) {
|
||||
// allungo nuova passata
|
||||
SetFeed( ( bVert ? GetVertFeed() : GetFeed())) ;
|
||||
if ( AddLinearMove( ptNewStart - dDiff * vtNewDir) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se il corrente è più fuori
|
||||
// se il corrente è più fuori
|
||||
else {
|
||||
// allungo passata precedente
|
||||
if ( AddLinearMove( ptLast + dDiff * vtNewDir) == GDB_ID_NULL)
|
||||
@@ -2598,7 +2619,7 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
|
||||
GetCurrPos( ptCurr) ;
|
||||
// differenza tra corrente e nuovo lungo direzione ortogonale
|
||||
double dOrtStartDiff = ( ptNewStart - ptCurr) * vtOrtStart ;
|
||||
// se punto corrente più fuori, aggiungo punto fuori allo stesso modo sul nuovo
|
||||
// se punto corrente più fuori, aggiungo punto fuori allo stesso modo sul nuovo
|
||||
if ( dOrtStartDiff < - 10 * EPS_SMALL) {
|
||||
Point3d ptOut = ptNewStart + ( - dOrtStartDiff * vtOrtStart) ;
|
||||
SetFlag( 0) ;
|
||||
@@ -2606,7 +2627,7 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
|
||||
if ( ! SameAsCurrPos( ptOut) && AddLinearMove( ptOut) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se altrimenti più dentro, aggiungo punto fuori allo stesso modo sul corrente
|
||||
// se altrimenti più dentro, aggiungo punto fuori allo stesso modo sul corrente
|
||||
else if ( dOrtStartDiff > 10 * EPS_SMALL) {
|
||||
Point3d ptOut = ptCurr + ( dOrtStartDiff * vtOrtStart) ;
|
||||
SetFlag( 0) ;
|
||||
@@ -2641,14 +2662,14 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
|
||||
if ( AddLinearMove( ptNewStart) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se il precedente è più fuori
|
||||
// se il precedente è più fuori
|
||||
else if ( dDiff > 0) {
|
||||
// allungo nuova passata
|
||||
SetFeed( ( bVert ? GetVertFeed() : GetFeed())) ;
|
||||
if ( AddLinearMove( ptNewStart - dDiff * vtDirStart) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se il corrente è più fuori
|
||||
// se il corrente è più fuori
|
||||
else {
|
||||
// allungo passata precedente
|
||||
if ( AddLinearMove( ptLast + dDiff * vtDirStart) == GDB_ID_NULL)
|
||||
@@ -2660,7 +2681,7 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
|
||||
}
|
||||
}
|
||||
}
|
||||
// se non ci sono già, vado all'inizio dell'arco
|
||||
// se non ci sono già, vado all'inizio dell'arco
|
||||
if ( ! SameAsCurrPos( ptStart) && AddLinearMove( ptStart) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// 3 -> movimento di lato al punto finale
|
||||
@@ -2822,7 +2843,7 @@ SawFinishing::AddCornerApproach( const Point3d& ptP, const Vector3d& vtCorr, con
|
||||
{
|
||||
// impongo minima distanza di approccio
|
||||
dAppr = max( dAppr, 1.0) ;
|
||||
// recupero posizione precedente (correzione precedente è passata perchè già impostata la nuova)
|
||||
// recupero posizione precedente (correzione precedente è passata perchè già impostata la nuova)
|
||||
Point3d ptPrev ;
|
||||
if ( ! GetCurrPos( ptPrev))
|
||||
return false ;
|
||||
@@ -2933,7 +2954,7 @@ SawFinishing::GetHeightOnSection( const ICurve* pSect, double dX, double dYmin,
|
||||
dY = aInfo.IciA[0].ptI.y ;
|
||||
return true ;
|
||||
}
|
||||
// se non c'è intersezione assegno il minimo
|
||||
// se non c'è intersezione assegno il minimo
|
||||
dY = dYmin ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ class SawFinishing : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
|
||||
+892
-213
File diff suppressed because it is too large
Load Diff
+13
-8
@@ -68,7 +68,7 @@ class SawRoughing : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
@@ -79,19 +79,24 @@ class SawRoughing : public Machining
|
||||
bool VerifyGeometry( SelData Id, int& nSubs) ;
|
||||
ICurve* GetCurve( SelData Id) ;
|
||||
bool AdjustGeometry( int nAuxId) ;
|
||||
bool CalculateToolPath( int nAuxId, int nClId) ;
|
||||
bool CalculateToolPath( int nAuxId, int nPvId, int nClId) ;
|
||||
bool CalculateCurvedToolPath( int nAuxId, int nClId) ;
|
||||
bool GeneratePreView( int nPathId, const ICurve* pSect, const Frame3d& frSect, double dGuideLen,
|
||||
const Vector3d& vtGdDir, const BBox3d& b3Raw) ;
|
||||
bool CalculateSection( int nSectGrpId, ICurve*& pSect) ;
|
||||
bool TrimSection( ICurve* pCrv) ;
|
||||
bool CalculateGuideLine( int nGuideId, const BBox3d& b3Sect,
|
||||
Point3d& ptGdStart, Point3d& ptGdEnd, Vector3d& vtGdDir) ;
|
||||
bool CalculateGuideLine( int nGuideId, const BBox3d& b3Sect, Point3d& ptGdStart, Point3d& ptGdEnd, Vector3d& vtGdDir) ;
|
||||
bool AdaptGuideLineToRaw( Point3d& ptGdStart, Point3d& ptGdEnd, const Vector3d& vtGdDir, const BBox3d& b3Raw) const ;
|
||||
bool CalculateOneWayCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast) ;
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast, const BBox3d& b3Raw) ;
|
||||
bool CalculateZigZagCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast,
|
||||
int& nCount) ;
|
||||
int& nCount, const BBox3d& b3Raw) ;
|
||||
bool CalculateZConstCut( const ICurve* pCrv, double dXmin, double dXmax, bool bIncludeMax, bool bIncludeMin,
|
||||
const Point3d& ptGdStart, const Point3d& ptGdEnd, const Vector3d& vtGdDir, const Frame3d& frSect,
|
||||
const BBox3d& b3Raw, double dDepth, bool bFirstInterval, bool bLastInterval, int& nCount) ;
|
||||
bool CalculateCurvedZigZagCut( const ICurve* pCut, const Vector3d& vtTool, double dElev, bool bFirst, bool bLast,
|
||||
int& nCount) ;
|
||||
int& nCount) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtCorr, bool bFirst,
|
||||
double dSafeZ, double dElev, double dAppr) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr) ;
|
||||
@@ -118,7 +123,7 @@ class SawRoughing : public Machining
|
||||
{ return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
|
||||
|
||||
private :
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
bool m_bStraight ; // flag per cornici diritte/curve
|
||||
SawRoughingData m_Params ; // parametri lavorazione
|
||||
ToolData m_TParams ; // parametri utensile
|
||||
|
||||
+133
-37
@@ -18,6 +18,7 @@
|
||||
#include "Sawing.h"
|
||||
#include "GeoConst.h"
|
||||
#include "OperationConst.h"
|
||||
#include "OperUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EXeCmdLogOff.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
@@ -56,6 +57,7 @@ using namespace std ;
|
||||
// 2217 = "Error in Sawing : link movements not calculable"
|
||||
// 2218 = "Error in Sawing : link outstroke xxx"
|
||||
// 2219 = "Error in Sawing : post apply not calculable"
|
||||
// 2220 = "Error in Sawing : special apply not calculable"
|
||||
// 2251 = "Warning in Sawing : Skipped entity xxx"
|
||||
// 2252 = "Warning in Sawing : No machinable path"
|
||||
// 2253 = "Warning in Sawing : Tool name changed (xx)"
|
||||
@@ -643,8 +645,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 2201, "Error in Sawing : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -654,8 +655,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nCuts = nCurrCuts ;
|
||||
string sLog = string( "Sawing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
@@ -700,7 +700,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
|
||||
|
||||
// verifiche per attacchi/uscite senza approcci e retrazioni
|
||||
int nDownSE = 0 ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, "DownSE", nDownSE) ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_DOWNSE, nDownSE) ;
|
||||
m_bDownSE = ( nDownSE != 0 && m_Params.m_nStepType == SAW_ST_TOANDFROM) ;
|
||||
|
||||
// recupero gruppo per geometria di lavorazione (Cutter Location)
|
||||
@@ -783,6 +783,16 @@ Sawing::Update( bool bPostApply)
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 2220, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2220, "Error in Sawing : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -793,11 +803,11 @@ Sawing::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 2219, sErr) ;
|
||||
// esecuzione eventuali personalizzazioni finali
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 2219, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2219, "Error in Sawing : post apply not calculable") ;
|
||||
return false ;
|
||||
@@ -1034,7 +1044,7 @@ Sawing::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Sawing::UpdateToolData( bool* pbChanged)
|
||||
Sawing::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
@@ -1081,9 +1091,9 @@ Sawing::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 2254, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1593,6 +1603,15 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
double dThick ;
|
||||
pCompo->GetThickness( dThick) ;
|
||||
|
||||
// aggiusto eventuali normali inverse di archi rispetto ad estrusione
|
||||
const ICurve* pCrv = pCompo->GetFirstCurve() ;
|
||||
while ( pCrv != nullptr) {
|
||||
const ICurveArc* pArc = GetCurveArc( pCrv) ;
|
||||
if ( pArc != nullptr && pArc->GetNormVersor() * vtExtr < 0)
|
||||
const_cast<ICurveArc*>(pArc)->InvertN() ;
|
||||
pCrv = pCompo->GetNextCurve() ;
|
||||
}
|
||||
|
||||
// recupero distanza da fondo dei grezzi interessati dal percorso
|
||||
double dRbDist, dAllRbDist ;
|
||||
double dToler = 2 * m_TParams.m_dThick + tan( abs( m_Params.m_dSideAngle) * DEGTORAD) * m_TParams.m_dMaxMat ;
|
||||
@@ -1870,8 +1889,8 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
|
||||
// Eventuale variazioni di velocità all'inizio e alla fine del percorso
|
||||
FseVar FvVar ;
|
||||
if ( pCrvP == nullptr) {
|
||||
string sFsta = ExtractInfo( m_Params.m_sUserNotes, "Fsta=") ;
|
||||
if ( ! sFsta.empty()) {
|
||||
string sFsta ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_FSTA, sFsta)) {
|
||||
string sLen, sPu ;
|
||||
SplitFirst( sFsta, ",", sLen, sPu) ;
|
||||
if ( FromString( sLen, FvVar.dLenStart))
|
||||
@@ -1881,8 +1900,8 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
|
||||
}
|
||||
}
|
||||
if ( pCrvN == nullptr) {
|
||||
string sFend = ExtractInfo( m_Params.m_sUserNotes, "Fend=") ;
|
||||
if ( ! sFend.empty()) {
|
||||
string sFend ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_FEND, sFend)) {
|
||||
string sLen, sPu ;
|
||||
SplitFirst( sFend, ",", sLen, sPu) ;
|
||||
if ( FromString( sLen, FvVar.dLenEnd))
|
||||
@@ -1895,10 +1914,10 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
|
||||
// recupero eventuali estensioni dei baffi (whiskers)
|
||||
double dStartWhiskExt = 0 ;
|
||||
if ( m_Params.m_nLeadInType == SAW_LI_CENT)
|
||||
GetValInNotes( m_Params.m_sUserNotes, "SWE", dStartWhiskExt) ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_SWE, dStartWhiskExt) ;
|
||||
double dEndWhiskExt = 0 ;
|
||||
if ( m_Params.m_nLeadOutType == SAW_LO_CENT)
|
||||
GetValInNotes( m_Params.m_sUserNotes, "EWE", dEndWhiskExt) ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_EWE, dEndWhiskExt) ;
|
||||
|
||||
// Se richiesto Preview
|
||||
if ( nPvId != GDB_ID_NULL) {
|
||||
@@ -1934,6 +1953,14 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso (tenendo conto degli allungamenti in vera lavorazione)
|
||||
Vector3d vtMidDir ; pLine->GetMidDir( vtMidDir) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, pLine->GetStart() - dStartWhiskExt * vtMidDir) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, pLine->GetEnd() + dEndWhiskExt * vtMidDir) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
|
||||
|
||||
// punti notevoli
|
||||
Point3d ptIni = pLine->GetStart() + dElev * vtCorr ;
|
||||
@@ -2114,7 +2141,7 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
m_pGeomDB->SetName( nPxId, sName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Vector3d( 0, 0, 1)) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, pLine->GetStart()) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, pLine->GetEnd()) ;
|
||||
@@ -2147,6 +2174,15 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
double dActLstep = GetStepLast() ;
|
||||
// direzione della linea
|
||||
Vector3d vtDir ; pLine->GetStartDir( vtDir) ;
|
||||
// parametri per partenza/arrivo a feed ridotta
|
||||
double dCutLen ; pLine->GetLength( dCutLen) ;
|
||||
double dStartFraz = FvVar.dLenStart / dCutLen ;
|
||||
double dEndFraz = FvVar.dLenEnd / dCutLen ;
|
||||
if ( dStartFraz + dEndFraz > 1) {
|
||||
dStartFraz /= ( dStartFraz + dEndFraz) ;
|
||||
dEndFraz = 1 - dStartFraz ;
|
||||
}
|
||||
double dMidFraz = 1 - dEndFraz ;
|
||||
|
||||
// Se una sola passata
|
||||
if ( m_Params.m_nStepType != SAW_ST_TOANDFROM &&
|
||||
@@ -2195,16 +2231,6 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
}
|
||||
// 3 -> movimento di lato al punto finale
|
||||
if ( FvVar.dLenStart > EPS_SMALL || FvVar.dLenEnd > EPS_SMALL) {
|
||||
// lunghezza del taglio
|
||||
double dCutLen ; pLine->GetLength( dCutLen) ;
|
||||
double dStartFraz = FvVar.dLenStart / dCutLen ;
|
||||
double dEndFraz = FvVar.dLenEnd / dCutLen ;
|
||||
double dMidFraz = 1 - dEndFraz ;
|
||||
if ( dStartFraz + dEndFraz > 1) {
|
||||
dStartFraz /= ( dStartFraz + dEndFraz) ;
|
||||
dEndFraz = 1 - dStartFraz ;
|
||||
dMidFraz = dStartFraz ;
|
||||
}
|
||||
// punto finale
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
// 3a -> eventuale movimento di lato a feed ridotta di inizio percorso
|
||||
@@ -2280,9 +2306,38 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
if ( AddLinearMove( ptP2) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// movimento di lato
|
||||
SetFeed( ( ! bSideAng ? ( i == 0 ? GetBackFeed() : GetFeed()) : GetSideAngFeed())) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
double dCurrFeed = ( ! bSideAng ? ( i == 0 ? GetBackFeed() : GetFeed()) : GetSideAngFeed()) ;
|
||||
if ( FvVar.dLenStart > EPS_SMALL || FvVar.dLenEnd > EPS_SMALL) {
|
||||
// scambio opportunamente le frazioni (dispari vanno, pari tornano)
|
||||
double dCurrStartFraz = dStartFraz ;
|
||||
double dCurrEndFraz = dEndFraz ;
|
||||
if ( IsEven( i))
|
||||
swap( dCurrStartFraz, dCurrEndFraz) ;
|
||||
double dCurrMidFraz = 1 - dCurrEndFraz ;
|
||||
// 3a -> eventuale movimento di lato a feed ridotta di inizio percorso
|
||||
if ( dCurrStartFraz * dCutLen > EPS_SMALL) {
|
||||
SetFeed( FvVar.dPuStart * dCurrFeed) ;
|
||||
if ( AddLinearMove( Media( ptP2, ptP3, dCurrStartFraz)) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 3b -> eventuale movimento di lato a feed normale
|
||||
if ( ( dCurrMidFraz - dCurrStartFraz) * dCutLen > EPS_SMALL) {
|
||||
SetFeed( dCurrFeed) ;
|
||||
if ( AddLinearMove( Media( ptP2, ptP3, dCurrMidFraz)) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 3c -> eventuale movimento di lato a feed ridotta di fine percorso
|
||||
if ( dCurrEndFraz * dCutLen > EPS_SMALL) {
|
||||
SetFeed( FvVar.dPuEnd * dCurrFeed) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
SetFeed( dCurrFeed) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// 4 -> retrazione
|
||||
if ( ! AddRetract( pLine->GetStart(), vtCorr, dSafeZ, dElev, dAppr))
|
||||
@@ -2316,10 +2371,33 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
if ( AddLinearMove( ptP2) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// movimento di lato al punto finale
|
||||
SetFeed( ( ! bSideAng ? GetFeed() : GetSideAngFeed())) ;
|
||||
double dCurrFeed = ( ! bSideAng ? GetFeed() : GetSideAngFeed()) ;
|
||||
Point3d ptP3 = pLine->GetEnd() + vtCorr * dDelta ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( FvVar.dLenStart > EPS_SMALL || FvVar.dLenEnd > EPS_SMALL) {
|
||||
// 3a -> eventuale movimento di lato a feed ridotta di inizio percorso
|
||||
if ( dStartFraz * dCutLen > EPS_SMALL) {
|
||||
SetFeed( FvVar.dPuStart * dCurrFeed) ;
|
||||
if ( AddLinearMove( Media( ptP2, ptP3, dStartFraz)) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 3b -> eventuale movimento di lato a feed normale
|
||||
if ( ( dMidFraz - dStartFraz) * dCutLen > EPS_SMALL) {
|
||||
SetFeed( dCurrFeed) ;
|
||||
if ( AddLinearMove( Media( ptP2, ptP3, dMidFraz)) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 3c -> eventuale movimento di lato a feed ridotta di fine percorso
|
||||
if ( dEndFraz * dCutLen > EPS_SMALL) {
|
||||
SetFeed( FvVar.dPuEnd * dCurrFeed) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
SetFeed( dCurrFeed) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se non è ultimo passo
|
||||
if ( i != 0) {
|
||||
// movimento di risalita sopra il punto finale
|
||||
@@ -2506,6 +2584,15 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
// assegno il vettore estrusione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso
|
||||
Point3d ptStart ; pCrv->GetStartPoint( ptStart) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
|
||||
Point3d ptEnd ; pCrv->GetEndPoint( ptEnd) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
|
||||
|
||||
// disabilito eventuale registrazione comandi EXE (riabilitazione automatica)
|
||||
CmdLogOff cmdLogOff ;
|
||||
@@ -3288,6 +3375,15 @@ Sawing::GenerateIntArcPv( const ICurveArc* pArc,
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso
|
||||
Point3d ptStart ; pArc->GetStartPoint( ptStart) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
|
||||
Point3d ptEnd ; pArc->GetEndPoint( ptEnd) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
|
||||
|
||||
// disabilito eventuale registrazione comandi EXE (riabilitazione automatica)
|
||||
CmdLogOff cmdLogOff ;
|
||||
|
||||
@@ -69,7 +69,7 @@ class Sawing : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
|
||||
@@ -53,6 +53,9 @@ class __declspec( novtable) ISimulator
|
||||
virtual bool GetMoveInfo( int& nGmove, double& dFeed) const = 0 ;
|
||||
virtual bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
|
||||
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) = 0 ;
|
||||
virtual bool RemoveCollisionObj( int nFrameId) = 0 ;
|
||||
virtual bool GetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
|
||||
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) = 0 ;
|
||||
virtual bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) = 0 ;
|
||||
virtual bool OnCollision( int nCdInd, int nObjInd, int& nErr) = 0 ;
|
||||
virtual bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
|
||||
|
||||
+90
-18
@@ -48,9 +48,10 @@ using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const double MIN_STEP = 1.0 ;
|
||||
static const double MAX_STEP = 500.0 ;
|
||||
static const double MID_STEP = 50.0 ;
|
||||
static const double MAX_STEP = 500.0 ;
|
||||
static const double COLL_STEP = 10. ;
|
||||
static const double MAX_COLL_STEP = 100. ;
|
||||
static const double SQ_COEFF_ROT_MOVE = 100. ;
|
||||
static const double COEFF_LIM = 0.999 ;
|
||||
static const double SAFEDIST_STD = 5.0 ;
|
||||
@@ -959,6 +960,13 @@ SimulatorMP::FindAndManagePathStart( int& nStatus)
|
||||
// se trovato nuovo CLpath con entità, gestisco inizio percorso di lavoro
|
||||
if ( m_nEntId != GDB_ID_NULL) {
|
||||
++ m_nCLPathInd ;
|
||||
// verifico se Path in doppio
|
||||
int nDBLPathId = GDB_ID_NULL ;
|
||||
int nDBLId = m_pGeomDB->GetFirstNameInGroup( m_nOpId, MCH_DBL) ;
|
||||
if ( nDBLId != GDB_ID_NULL) {
|
||||
string sCLPathName ; m_pGeomDB->GetName( m_nCLPathId, sCLPathName) ;
|
||||
nDBLPathId = m_pGeomDB->GetFirstNameInGroup( nDBLId, sCLPathName) ;
|
||||
}
|
||||
// recupero punti di inizio e fine percorso
|
||||
Point3d ptStart ;
|
||||
m_pGeomDB->GetInfo( m_nCLPathId, KEY_START, ptStart) ;
|
||||
@@ -989,7 +997,7 @@ SimulatorMP::FindAndManagePathStart( int& nStatus)
|
||||
m_nAuxEInd = 0 ;
|
||||
m_nAuxETot = 0 ;
|
||||
// richiamo gestione evento inizio percorso di lavoro
|
||||
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, m_nAuxSTot, ptStart, ptEnd, vtExtr,
|
||||
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, nDBLPathId, m_nAuxSTot, ptStart, ptEnd, vtExtr,
|
||||
ptMin, ptMax, vAxMin, vAxMax, dElev, vActiveExit)) {
|
||||
nStatus = CalcStatusOnError( ERR_NONE) ;
|
||||
return false ;
|
||||
@@ -1111,11 +1119,17 @@ SimulatorMP::ManageSingleMove( int& nStatus, double& dMove)
|
||||
break ;
|
||||
case CamData::AS_OUTSTROKE : {
|
||||
DBLVECTOR OutAxes = pCamData->GetAxesVal() ;
|
||||
for ( size_t i = OutAxes.size() ; i < 5 ; ++ i)
|
||||
OutAxes.emplace_back( 0) ;
|
||||
DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ;
|
||||
int nStat ;
|
||||
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], vAng, true, nStat) ;
|
||||
if ( ! m_pMchMgr->GetCurrIsRobot()) {
|
||||
for ( size_t i = OutAxes.size() ; i < 5 ; ++ i)
|
||||
OutAxes.emplace_back( 0) ;
|
||||
DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ;
|
||||
int nStat ;
|
||||
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], vAng, true, nStat) ;
|
||||
}
|
||||
else {
|
||||
int nStat ;
|
||||
m_pMachine->VerifyOutstroke( 0, 0, 0, OutAxes, true, nStat) ;
|
||||
}
|
||||
nStatus = MCH_SIM_OUTSTROKE ;
|
||||
return false ; }
|
||||
case CamData::AS_DIR_ERR :
|
||||
@@ -1126,6 +1140,16 @@ SimulatorMP::ManageSingleMove( int& nStatus, double& dMove)
|
||||
return false ;
|
||||
}
|
||||
DBLVECTOR AxesEnd = pCamData->GetAxesVal() ;
|
||||
// Controllo che il numero di valori corrisponda con quello degli assi
|
||||
int nEndsCnt = int( AxesEnd.size()) ;
|
||||
int nAxesCnt = int( m_AxesName.size()) ;
|
||||
if ( nEndsCnt != nAxesCnt) {
|
||||
nStatus = MCH_SIM_ERR ;
|
||||
m_pMchMgr->SetLastError( 1003, "Error : mismatch between the number of values and of axes") ;
|
||||
string sOut = "Error : " + ToString( nEndsCnt) + " values vs " + ToString( nAxesCnt) + " axes" ;
|
||||
LOG_ERROR( GetEMkLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
// Tipo di movimento
|
||||
int nMoveType = pCamData->GetMoveType() ;
|
||||
// Se inizio di nuova entità, mascheratura movimento
|
||||
@@ -1574,6 +1598,8 @@ SimulatorMP::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
|
||||
continue ;
|
||||
// recupero il riferimento
|
||||
Frame3d frCd ; m_pGeomDB->GetGlobFrame( m_CdId[i], frCd) ;
|
||||
// recupero il nome
|
||||
string sCdName ; m_pGeomDB->GetName( m_CdId[i], sCdName) ;
|
||||
// ciclo sugli oggetti con cui verificare
|
||||
for ( int j = 0 ; j < int( m_CollObj.size()) ; ++ j) {
|
||||
// se modo hidden è da saltare
|
||||
@@ -1588,6 +1614,10 @@ SimulatorMP::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 contiene info con nome da saltare, verifico se è il caso
|
||||
string sCollSkip ;
|
||||
if ( m_pGeomDB->GetInfo( m_CollObj[j].nFrameId, "CollSkip", sCollSkip) && sCollSkip == sCdName)
|
||||
continue ;
|
||||
// esecuzione controlli di collisione
|
||||
bool bOk = true ;
|
||||
// oggetti che richiedono frame associato (Box, Cylinder, Sphere, Cone)
|
||||
@@ -1661,8 +1691,8 @@ FindCollisionMarkId( const IGeomDB* pGeomDB, int nCollId)
|
||||
int nCollParId = pGeomDB->GetParentId( nCollId) ;
|
||||
string sCollParName = "COLLISION" ;
|
||||
pGeomDB->GetName( nCollParId, sCollParName) ;
|
||||
// COLLISION per parti generiche di macchina, BASE e MOBILE per fixtures
|
||||
if ( sCollParName != "COLLISION" && sCollParName != "BASE" && sCollParName != "MOBILE")
|
||||
// COLLISION* per parti generiche di macchina, BASE e MOBILE per fixtures
|
||||
if ( sCollParName.rfind( "COLLISION", 0) != 0 && sCollParName != "BASE" && sCollParName != "MOBILE")
|
||||
return nCollParId ;
|
||||
else {
|
||||
int nCollGprId = pGeomDB->GetParentId( nCollParId) ;
|
||||
@@ -1938,6 +1968,8 @@ SimulatorMP::OnMachiningEnd( void)
|
||||
{
|
||||
// chiamo la funzione di fine lavorazione
|
||||
bool bOk = CallFunction( ON_SIMUL_MACHINING_END, true) ;
|
||||
// reset eventuale Path in double
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
|
||||
// forzo aggiornamento posizione assi (possono essere stati mossi nello script)
|
||||
UpdateAxesPos() ;
|
||||
return bOk ;
|
||||
@@ -1945,13 +1977,18 @@ SimulatorMP::OnMachiningEnd( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SimulatorMP::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
|
||||
SimulatorMP::OnPathStart( int nClPathId, int nClPathInd, int nDBLPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
|
||||
{
|
||||
// assegno identificativo e indice percorso di lavorazione
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHIND, nClPathInd) ;
|
||||
// assegno identificativo percorso di lavorazione in doppio
|
||||
if ( nDBLPathId == GDB_ID_NULL)
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DBLPATHID, nDBLPathId) ;
|
||||
// assegno numero di dati ausiliari iniziali
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXTOT, nAS) ;
|
||||
// assegno punti iniziale e finale e versore estrusione
|
||||
@@ -2127,9 +2164,9 @@ SimulatorMP::OnMoveStart( const CamData* pCamData, const CamData* pNextCamData,
|
||||
bool bNeg = ( sLink.find( '-') != string::npos) ;
|
||||
string sMainAxis = sLink ; ReplaceString( sMainAxis, "-", "") ;
|
||||
int nInd = 0 ;
|
||||
for ( int i = 0 ; nInd == 0 && i < int( m_AxesName.size()) ; ++ i) {
|
||||
if ( m_AxesName[i] == sMainAxis)
|
||||
nInd = i + 1 ;
|
||||
for ( int j = 0 ; nInd == 0 && j < ssize( m_AxesName) ; ++ j) {
|
||||
if ( m_AxesName[j] == sMainAxis)
|
||||
nInd = j + 1 ;
|
||||
}
|
||||
// se trovato asse principale di riferimento
|
||||
if ( nInd > 0) {
|
||||
@@ -2162,11 +2199,17 @@ SimulatorMP::OnMoveStart( const CamData* pCamData, const CamData* pNextCamData,
|
||||
}
|
||||
}
|
||||
// altrimenti errore
|
||||
else
|
||||
else {
|
||||
bOk = false ;
|
||||
string sErr = " Error in OnMoveStart : Wrong Move AuxAxis " + ToString( i) ;
|
||||
LOG_ERROR( GetEMkLogger(), sErr.c_str())
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
bOk = false ;
|
||||
string sErr = " Error in OnMoveStart : Wrong Name AuxAxis " + ToString( i) ;
|
||||
LOG_ERROR( GetEMkLogger(), sErr.c_str())
|
||||
}
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
@@ -2314,6 +2357,34 @@ SimulatorMP::AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, c
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SimulatorMP::RemoveCollisionObj( int nFrameId)
|
||||
{
|
||||
erase_if( m_CollObj, [nFrameId]( CollObj Item) { return ( Item.nFrameId == nFrameId) ; }) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SimulatorMP::GetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
|
||||
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3)
|
||||
{
|
||||
// posizione nel vettore non valida
|
||||
if ( nPos < 0 || nPos >= ssize( m_CollObj))
|
||||
return false ;
|
||||
// assegno i dati
|
||||
nInd = m_CollObj[nPos].nInd ;
|
||||
bToolOn = m_CollObj[nPos].bToolOn ;
|
||||
nFrameId = m_CollObj[nPos].nFrameId ;
|
||||
nType = m_CollObj[nPos].nType ;
|
||||
vtMove = m_CollObj[nPos].vtMove ;
|
||||
dPar1 = m_CollObj[nPos].dPar1 ;
|
||||
dPar2 = m_CollObj[nPos].dPar2 ;
|
||||
dPar3 = m_CollObj[nPos].dPar3 ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SimulatorMP::SetToolForVmill( const string& sTool, const string& sHead, int nExit, int nFlag, double dPar1, double dPar2,
|
||||
@@ -2524,6 +2595,7 @@ SimulatorMP::ExecCmdData( int& nStatus)
|
||||
static const int STEP_RAPID = -2 ;
|
||||
static const int STEP_RAPROT = -3 ;
|
||||
static const int STEP_COLLROT = -4 ;
|
||||
double dMaxStep = ( NeedCollisionCheck() ? MAX_COLL_STEP : MAX_STEP) ;
|
||||
int nStep = 1 ;
|
||||
for ( int i = 0 ; i < nAxCount ; ++ i) {
|
||||
double dMove = abs( CmdCurr.vAxNaEpSt[i].dEndPos - vPrev[i]) ;
|
||||
@@ -2538,7 +2610,7 @@ SimulatorMP::ExecCmdData( int& nStatus)
|
||||
else // STEP_COLLROT
|
||||
dStep = min( 0.4 * m_dStep, 10.) ;
|
||||
}
|
||||
dStep = max( dStep, 1.) ;
|
||||
dStep = Clamp( dStep, MIN_STEP, dMaxStep) ;
|
||||
int nAxStep = int( dMove / dStep) + 1 ;
|
||||
nStep = max( nStep, nAxStep) ;
|
||||
}
|
||||
|
||||
+4
-1
@@ -40,6 +40,9 @@ class SimulatorMP : public ISimulator
|
||||
bool GetMoveInfo( int& nGmove, double& dFeed) const override ;
|
||||
bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
|
||||
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) override ;
|
||||
bool RemoveCollisionObj( int nFrameId) override ;
|
||||
bool GetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
|
||||
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) override ;
|
||||
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) override ;
|
||||
bool OnCollision( int nCdInd, int nObjInd, int& nErr) override ;
|
||||
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
|
||||
@@ -101,7 +104,7 @@ class SimulatorMP : public ISimulator
|
||||
bool OnMachiningEnd( void) ;
|
||||
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
|
||||
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nDBLPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
|
||||
bool OnPathEnd( int nAE) ;
|
||||
|
||||
+113
-29
@@ -40,6 +40,7 @@
|
||||
#include "/EgtDev/Include/EGnGetKeyData.h"
|
||||
#include "/EgtDev/Include/EgtPerfCounter.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EgtIniFile.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
|
||||
@@ -50,9 +51,10 @@ using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const double MIN_STEP = 1.0 ;
|
||||
static const double MAX_STEP = 500.0 ;
|
||||
static const double MID_STEP = 50.0 ;
|
||||
static const double MAX_STEP = 500.0 ;
|
||||
static const double COLL_STEP = 10. ;
|
||||
static const double MAX_COLL_STEP = 100. ;
|
||||
static const double SQ_COEFF_ROT_MOVE = 100. ;
|
||||
static const double COEFF_LIM = 0.999 ;
|
||||
static const double SAFEDIST_STD = 5.0 ;
|
||||
@@ -95,6 +97,7 @@ SimulatorSP::SimulatorSP( void)
|
||||
m_bEnableVm = false ;
|
||||
m_dSafeDist = SAFEDIST_STD ;
|
||||
m_bEnableTrace = false ;
|
||||
m_nTraceGroup = GDB_ID_NULL ;
|
||||
m_nCurrTrace = GDB_ID_NULL ;
|
||||
m_nAxesMask = 0 ;
|
||||
m_bEnabAxes = true ;
|
||||
@@ -902,6 +905,13 @@ SimulatorSP::FindAndManagePathStart( int& nStatus)
|
||||
// se trovato nuovo CLpath con entità, gestisco inizio percorso di lavoro
|
||||
if ( m_nEntId != GDB_ID_NULL) {
|
||||
++ m_nCLPathInd ;
|
||||
// verifico se Path in doppio
|
||||
int nDBLPathId = GDB_ID_NULL ;
|
||||
int nDBLId = m_pGeomDB->GetFirstNameInGroup( m_nOpId, MCH_DBL) ;
|
||||
if ( nDBLId != GDB_ID_NULL) {
|
||||
string sCLPathName ; m_pGeomDB->GetName( m_nCLPathId, sCLPathName) ;
|
||||
nDBLPathId = m_pGeomDB->GetFirstNameInGroup( nDBLId, sCLPathName) ;
|
||||
}
|
||||
// recupero punti di inizio e fine percorso
|
||||
Point3d ptStart ;
|
||||
m_pGeomDB->GetInfo( m_nCLPathId, KEY_START, ptStart) ;
|
||||
@@ -932,7 +942,7 @@ SimulatorSP::FindAndManagePathStart( int& nStatus)
|
||||
m_nAuxEInd = 0 ;
|
||||
m_nAuxETot = 0 ;
|
||||
// richiamo gestione evento inizio percorso di lavoro
|
||||
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, m_nAuxSTot, ptStart, ptEnd, vtExtr,
|
||||
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, nDBLPathId, m_nAuxSTot, ptStart, ptEnd, vtExtr,
|
||||
ptMin, ptMax, vAxMin, vAxMax, dElev, vActiveExit)) {
|
||||
nStatus = CalcStatusOnError( 0) ;
|
||||
return false ;
|
||||
@@ -1054,11 +1064,17 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove)
|
||||
break ;
|
||||
case CamData::AS_OUTSTROKE : {
|
||||
DBLVECTOR OutAxes = pCamData->GetAxesVal() ;
|
||||
for ( size_t i = OutAxes.size() ; i < 5 ; ++ i)
|
||||
OutAxes.emplace_back( 0) ;
|
||||
DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ;
|
||||
int nStat ;
|
||||
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], vAng, true, nStat) ;
|
||||
if ( ! m_pMchMgr->GetCurrIsRobot()) {
|
||||
for ( int i = int( OutAxes.size()) ; i <= 5 ; ++ i)
|
||||
OutAxes.emplace_back( 0) ;
|
||||
DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ;
|
||||
int nStat ;
|
||||
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], vAng, true, nStat) ;
|
||||
}
|
||||
else {
|
||||
int nStat ;
|
||||
m_pMachine->VerifyOutstroke( 0, 0, 0, OutAxes, true, nStat) ;
|
||||
}
|
||||
nStatus = MCH_SIM_OUTSTROKE ;
|
||||
return false ; }
|
||||
case CamData::AS_DIR_ERR :
|
||||
@@ -1069,6 +1085,16 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove)
|
||||
return false ;
|
||||
}
|
||||
DBLVECTOR AxesEnd = pCamData->GetAxesVal() ;
|
||||
// Controllo che il numero di valori corrisponda con quello degli assi
|
||||
int nEndsCnt = int( AxesEnd.size()) ;
|
||||
int nAxesCnt = int( m_AxesName.size()) ;
|
||||
if ( nEndsCnt != nAxesCnt) {
|
||||
nStatus = MCH_SIM_ERR ;
|
||||
m_pMchMgr->SetLastError( 1003, "Error : mismatch between the number of values and of axes") ;
|
||||
string sOut = "Error : " + ToString( nEndsCnt) + " values vs " + ToString( nAxesCnt) + " axes" ;
|
||||
LOG_ERROR( GetEMkLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
// Tipo di movimento
|
||||
int nMoveType = pCamData->GetMoveType() ;
|
||||
// Se inizio di nuova entità, mascheratura movimento
|
||||
@@ -1521,6 +1547,8 @@ SimulatorSP::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
|
||||
continue ;
|
||||
// recupero il riferimento
|
||||
Frame3d frCd ; m_pGeomDB->GetGlobFrame( m_CdId[i], frCd) ;
|
||||
// recupero il nome
|
||||
string sCdName ; m_pGeomDB->GetName( m_CdId[i], sCdName) ;
|
||||
// ciclo sugli oggetti con cui verificare
|
||||
for ( int j = 0 ; j < int( m_CollObj.size()) ; ++ j) {
|
||||
// se modo hidden è da saltare
|
||||
@@ -1535,6 +1563,10 @@ SimulatorSP::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 contiene info con nome da saltare, verifico se è il caso
|
||||
string sCollSkip ;
|
||||
if ( m_pGeomDB->GetInfo( m_CollObj[j].nFrameId, "CollSkip", sCollSkip) && sCollSkip == sCdName)
|
||||
continue ;
|
||||
// esecuzione controlli di collisione
|
||||
bool bOk = true ;
|
||||
// oggetti che richiedono frame associato (Box, Cylinder, Sphere, Cone)
|
||||
@@ -1608,8 +1640,8 @@ FindCollisionMarkId( const IGeomDB* pGeomDB, int nCollId)
|
||||
int nCollParId = pGeomDB->GetParentId( nCollId) ;
|
||||
string sCollParName = "COLLISION" ;
|
||||
pGeomDB->GetName( nCollParId, sCollParName) ;
|
||||
// COLLISION per parti generiche di macchina, BASE e MOBILE per fixtures
|
||||
if ( sCollParName != "COLLISION" && sCollParName != "BASE" && sCollParName != "MOBILE")
|
||||
// COLLISION* per parti generiche di macchina, BASE e MOBILE per fixtures
|
||||
if ( sCollParName.rfind( "COLLISION", 0) != 0 && sCollParName != "BASE" && sCollParName != "MOBILE")
|
||||
return nCollParId ;
|
||||
else {
|
||||
int nCollGprId = pGeomDB->GetParentId( nCollParId) ;
|
||||
@@ -1655,13 +1687,13 @@ SimulatorSP::EnableToolTipTrace( bool bEnable)
|
||||
{
|
||||
if ( bEnable != m_bEnableTrace) {
|
||||
if ( bEnable) {
|
||||
|
||||
;
|
||||
}
|
||||
else {
|
||||
int nTraceCrvId = m_nCurrTrace ;
|
||||
int nTraceCrvId = m_pGeomDB->GetFirstInGroup( m_nTraceGroup) ;
|
||||
while ( nTraceCrvId != GDB_ID_NULL) {
|
||||
m_pGeomDB->SetStatus( nTraceCrvId, GDB_ST_OFF) ;
|
||||
nTraceCrvId = m_pGeomDB->GetPrev( nTraceCrvId) ;
|
||||
nTraceCrvId = m_pGeomDB->GetNext( nTraceCrvId) ;
|
||||
}
|
||||
m_nCurrTrace = GDB_ID_NULL ;
|
||||
}
|
||||
@@ -1681,25 +1713,33 @@ SimulatorSP::TraceToolTipMove( int nMoveType)
|
||||
int nTraceGrpId ;
|
||||
if ( ! m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_TOOLTRACE, nTraceGrpId))
|
||||
return false ;
|
||||
m_nTraceGroup = nTraceGrpId ;
|
||||
// recupero posizione utensile corrente
|
||||
int nExitId = m_pMachine->GetExitId( m_sHead, m_nExit) ;
|
||||
Frame3d frExit ;
|
||||
if ( ! m_pGeomDB->GetGroupGlobFrame( nExitId, frExit))
|
||||
return false ;
|
||||
Point3d ptTip = frExit.Orig() - m_dTLen * frExit.VersZ() ;
|
||||
// determino se tracciare uscita mandrino o punta utensile e aggiusto di conseguenza
|
||||
static const string TRACE_ONEXIT = "OnExit" ;
|
||||
bool bOnExit = false ;
|
||||
m_pGeomDB->GetInfo( m_nTraceGroup, TRACE_ONEXIT, bOnExit) ;
|
||||
Point3d ptTip = frExit.Orig() - ( ! bOnExit ? m_dTLen : 0) * frExit.VersZ() ;
|
||||
// disabilito gestione segnalazione modifiche progetto
|
||||
SetModifiedOff modOff ;
|
||||
// eseguo tracciatura
|
||||
static string TRACE_MOVE = "Move" ;
|
||||
static const string TRACE_MOVE = "Move" ;
|
||||
static const int TRACE_MAX_LINE = 1000 ;
|
||||
if ( m_nCurrTrace == GDB_ID_NULL) {
|
||||
m_nCurrTrace = ExeCreateGeoPoint( nTraceGrpId, ptTip, GDB_ID_ROOT) ;
|
||||
m_pGeomDB->SetInfo( m_nCurrTrace, TRACE_MOVE, nMoveType) ;
|
||||
m_pGeomDB->SetStipple( m_nCurrTrace, ( nMoveType == 0 ? 3 : 0), 0x8C8C) ;
|
||||
}
|
||||
else {
|
||||
const ICurveComposite* pCC = GetCurveComposite( m_pGeomDB->GetGeoObj( m_nCurrTrace)) ;
|
||||
int nCount = ( pCC != nullptr ? pCC->GetCurveCount() : 0) ;
|
||||
int nTraMove ;
|
||||
m_pGeomDB->GetInfo( m_nCurrTrace, TRACE_MOVE, nTraMove) ;
|
||||
if ( ( nMoveType == 0) == ( nTraMove == 0))
|
||||
if ( ( nMoveType == 0) == ( nTraMove == 0) && nCount < TRACE_MAX_LINE)
|
||||
ExeAddCurveCompoLine( m_nCurrTrace, ptTip, true, GDB_ID_ROOT) ;
|
||||
else {
|
||||
Point3d ptPrev ; ExeEndPoint( m_nCurrTrace, GDB_ID_ROOT, ptPrev) ;
|
||||
@@ -1988,6 +2028,8 @@ SimulatorSP::OnMachiningEnd( void)
|
||||
return true ;
|
||||
// chiamo la funzione di fine lavorazione
|
||||
bool bOk = m_pMachine->LuaCallFunction( ON_SIMUL_MACHINING_END) ;
|
||||
// reset eventuale Path in double
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
|
||||
// forzo aggiornamento posizione assi (possono essere stati mossi nello script)
|
||||
UpdateAxesPos() ;
|
||||
return bOk ;
|
||||
@@ -1995,13 +2037,18 @@ SimulatorSP::OnMachiningEnd( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SimulatorSP::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
|
||||
SimulatorSP::OnPathStart( int nClPathId, int nClPathInd, int nDBLPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
|
||||
{
|
||||
// assegno identificativo e indice percorso di lavorazione
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHIND, nClPathInd) ;
|
||||
// assegno identificativo percorso di lavorazione in doppio
|
||||
if ( nDBLPathId == GDB_ID_NULL)
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DBLPATHID, nDBLPathId) ;
|
||||
// assegno numero di dati ausiliari iniziali
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXTOT, nAS) ;
|
||||
// assegno punti iniziale e finale e versore estrusione
|
||||
@@ -2199,9 +2246,9 @@ SimulatorSP::OnMoveStart( const CamData* pCamData, const CamData* pNextCamData,
|
||||
bool bNeg = ( sLink.find( '-') != string::npos) ;
|
||||
string sMainAxis = sLink ; ReplaceString( sMainAxis, "-", "") ;
|
||||
int nInd = 0 ;
|
||||
for ( int i = 0 ; nInd == 0 && i < int( m_AxesName.size()) ; ++ i) {
|
||||
if ( m_AxesName[i] == sMainAxis)
|
||||
nInd = i + 1 ;
|
||||
for ( int j = 0 ; nInd == 0 && j < ssize( m_AxesName) ; ++ j) {
|
||||
if ( m_AxesName[j] == sMainAxis)
|
||||
nInd = j + 1 ;
|
||||
}
|
||||
// se trovato asse principale di riferimento
|
||||
if ( nInd > 0) {
|
||||
@@ -2228,17 +2275,23 @@ SimulatorSP::OnMoveStart( const CamData* pCamData, const CamData* pNextCamData,
|
||||
m_AuxAxesEnd.emplace_back( dEnd) ;
|
||||
m_AuxAxesLink.emplace_back( 0) ;
|
||||
if ( ! m_pMachine->VerifyOutstroke( sName, dEnd)) {
|
||||
nErr = 1 ;
|
||||
nErr = ERR_OUTSTROKE ;
|
||||
bOk = false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// altrimenti errore
|
||||
else
|
||||
else {
|
||||
bOk = false ;
|
||||
string sErr = " Error in OnMoveStart : Wrong Move AuxAxis " + ToString( i) ;
|
||||
LOG_ERROR( GetEMkLogger(), sErr.c_str())
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
bOk = false ;
|
||||
string sErr = " Error in OnMoveStart : Wrong Name AuxAxis " + ToString( i) ;
|
||||
LOG_ERROR( GetEMkLogger(), sErr.c_str())
|
||||
}
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
@@ -2314,7 +2367,8 @@ SimulatorSP::OnResetMachine( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SimulatorSP::AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
|
||||
SimulatorSP::AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
|
||||
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
|
||||
{
|
||||
// verifiche sui parametri
|
||||
if ( nInd <= 0 || nFrameId <= GDB_ID_NULL)
|
||||
@@ -2345,6 +2399,35 @@ SimulatorSP::AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, c
|
||||
}
|
||||
// aggiungo al vettore
|
||||
m_CollObj.emplace_back( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SimulatorSP::RemoveCollisionObj( int nFrameId)
|
||||
{
|
||||
erase_if( m_CollObj, [nFrameId]( CollObj Item) { return ( Item.nFrameId == nFrameId) ; }) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SimulatorSP::GetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
|
||||
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3)
|
||||
{
|
||||
// posizione nel vettore non valida
|
||||
if ( nPos < 0 || nPos >= ssize( m_CollObj))
|
||||
return false ;
|
||||
// assegno i dati
|
||||
nInd = m_CollObj[nPos].nInd ;
|
||||
bToolOn = m_CollObj[nPos].bToolOn ;
|
||||
nFrameId = m_CollObj[nPos].nFrameId ;
|
||||
nType = m_CollObj[nPos].nType ;
|
||||
vtMove = m_CollObj[nPos].vtMove ;
|
||||
dPar1 = m_CollObj[nPos].dPar1 ;
|
||||
dPar2 = m_CollObj[nPos].dPar2 ;
|
||||
dPar3 = m_CollObj[nPos].dPar3 ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -2502,6 +2585,7 @@ SimulatorSP::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||
static const int STEP_RAPID = -2 ;
|
||||
static const int STEP_RAPROT = -3 ;
|
||||
static const int STEP_COLLROT = -4 ;
|
||||
double dMaxStep = ( NeedCollisionCheck() ? MAX_COLL_STEP : MAX_STEP) ;
|
||||
bool bViewAllFrames = true ;
|
||||
int nStep = 1 ;
|
||||
for ( int i = 0 ; i < nAxCount ; ++ i) {
|
||||
@@ -2517,11 +2601,11 @@ SimulatorSP::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||
bViewAllFrames = ( bIsRobot ? true : false) ;
|
||||
}
|
||||
else { // STEP_COLLROT
|
||||
dStep = min( 0.4 * m_dStep, 10.) ;
|
||||
dStep = min( 0.4 * m_dStep, COLL_STEP) ;
|
||||
bViewAllFrames = ( bIsRobot ? true : false) ;
|
||||
}
|
||||
}
|
||||
dStep = max( dStep, 1.) ;
|
||||
dStep = Clamp( dStep, MIN_STEP, dMaxStep) ;
|
||||
int nAxStep = int( dMove / dStep) + 1 ;
|
||||
nStep = max( nStep, nAxStep) ;
|
||||
}
|
||||
@@ -2554,7 +2638,7 @@ SimulatorSP::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||
}
|
||||
}
|
||||
// Aggiorno visualizzazione
|
||||
if ( bViewAllFrames || ( i % 4) == 0 || i == nStep)
|
||||
if ( bViewAllFrames || ( i % 8) == 0 || i == nStep)
|
||||
ExeDraw() ;
|
||||
// Verifico collisioni
|
||||
int nCdInd, nObjInd ;
|
||||
@@ -2590,7 +2674,7 @@ SimulatorSP::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||
// Gestione aggiornamenti...
|
||||
if ( ExeGetEnableUI()) {
|
||||
// Aggiornamento interfaccia
|
||||
ExeProcessEvents( 0, 4) ;
|
||||
ExeProcessEvents( 0, 0) ;
|
||||
while ( m_nUiStatus == MCH_UISIM_PAUSE) {
|
||||
ExeProcessEvents( 0, 4) ;
|
||||
}
|
||||
|
||||
+5
-1
@@ -40,6 +40,9 @@ class SimulatorSP : public ISimulator
|
||||
bool GetMoveInfo( int& nGmove, double& dFeed) const override ;
|
||||
bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
|
||||
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) override ;
|
||||
bool RemoveCollisionObj( int nFrameId) override ;
|
||||
bool GetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
|
||||
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) override ;
|
||||
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) override ;
|
||||
bool OnCollision( int nCdInd, int nObjInd, int& nErr) override ;
|
||||
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
|
||||
@@ -100,7 +103,7 @@ class SimulatorSP : public ISimulator
|
||||
bool OnMachiningEnd( void) ;
|
||||
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
|
||||
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nDBLPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
|
||||
bool OnPathEnd( int nAE) ;
|
||||
@@ -173,6 +176,7 @@ class SimulatorSP : public ISimulator
|
||||
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
|
||||
INTVECTOR m_nCollMarkId ; // elenco oggetti marcati per visualizzare meglio la collisione rilevata
|
||||
bool m_bEnableTrace ; // flag abilitazione tool tip trace
|
||||
int m_nTraceGroup ; // Id del gruppo in cui si inceriscono le curve di tracciatura
|
||||
int m_nCurrTrace ; // Id della curva composita corrente di trace
|
||||
int m_nAxesMask ; // maschera a bit di abilitazione movimento assi (solo se rapido)
|
||||
bool m_bEnabAxes ; // flag abilitazione movimento assi attivi
|
||||
|
||||
+2001
-1571
File diff suppressed because it is too large
Load Diff
+38
-25
@@ -34,7 +34,6 @@ class StmFromTriangleSoup ;
|
||||
struct PATH {
|
||||
PtrOwner<ICurveComposite> pCrvPath ;
|
||||
int nType ;
|
||||
double dSideAng ;
|
||||
} ;
|
||||
// vettore associato
|
||||
typedef std::vector<PATH> VECTORPATHS ;
|
||||
@@ -44,6 +43,7 @@ struct CollisionSfr {
|
||||
PNTUVVECT CollisionInfo ;
|
||||
bool bInSpiral ;
|
||||
bool bInZConst ;
|
||||
bool bOnBorder ;
|
||||
} ;
|
||||
// vettore associato
|
||||
typedef std::vector<CollisionSfr> VECTORCOLLISIONSFR ;
|
||||
@@ -93,7 +93,7 @@ class SurfFinishing : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
@@ -106,6 +106,7 @@ class SurfFinishing : public Machining
|
||||
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
|
||||
bool Chain( int nGrpDestId) ;
|
||||
bool GetSurfacesByIds( SURFLOCALVECTOR& vSrfLoc, SURFLOCALVECTOR& vSrfSuppLoc, Frame3d& frSurf) ;
|
||||
bool CalcRegionElevation( const ISurfFlatRegion* pSfr, const Vector3d& vtTool, double dRad, double dLen, double& dElev) const ; ;
|
||||
bool SetCAvTlStmForSurfaces( ICAvToolSurfTm* pCAvTlStm, const ISurfFlatRegion* pSfrCnt, double dDepth,
|
||||
double dToolLen, double dToolDiam, double dToolCornRad,
|
||||
double dToolSideAng, double dToolMaxMat, double dMachOffsR,
|
||||
@@ -114,7 +115,7 @@ class SurfFinishing : public Machining
|
||||
double dDepth, ISurfFlatRegion* pSfrCnt) ;
|
||||
bool ProcessCrvCompo( int nPathId, int nPvId, int nClId) ;
|
||||
bool ProcessSfr( int nPathId, int nPvId, int nClId) ;
|
||||
bool SimplifyCurve( ICurveComposite* pCompo,
|
||||
bool SimplifyCurve( ICurveComposite* pCompo, const Frame3d& frLocXY,
|
||||
double dMergeLinTol = 200. * EPS_SMALL, double dMergeAndTolDeg = 200. * EPS_ANG_SMALL,
|
||||
double dSmallDefLinTol = 150. * EPS_SMALL, double dSmallDefAngTolDeg = 2. * ANG_TOL_STD_DEG,
|
||||
double dArcApproxLinTol = 50. * EPS_SMALL, double dArcApproxAngTolDeg = ANG_TOL_STD_DEG) const ;
|
||||
@@ -123,21 +124,29 @@ class SurfFinishing : public Machining
|
||||
const Point3d ptStart_forced, const Point3d ptEnd_forced,
|
||||
ICurveComposite* pCrv) const ;
|
||||
// lavorazioni per superfici
|
||||
bool AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock,
|
||||
bool AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
|
||||
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
||||
bool AddOneWay( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock,
|
||||
bool AddOneWay( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
|
||||
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
||||
bool AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock,
|
||||
bool AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
|
||||
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs, bool bInVsOut) ;
|
||||
bool AddZConst( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
|
||||
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
||||
bool AddOptimal( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
|
||||
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
||||
bool AddPencil( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
|
||||
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
||||
bool AddZConst( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
|
||||
const ISurfFlatRegion* pSfrCnt, const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
||||
bool AddOptimal( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
|
||||
const ISurfFlatRegion* pSfrCntZigZag, const ISurfFlatRegion* pSfrCntZConst, const Vector3d& vtTool,
|
||||
double dDepth, double dElev, bool bSplitArcs) ;
|
||||
bool AddPencil( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
|
||||
const ISurfFlatRegion* pSfrCnt, const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
||||
// lavorazioni per curve
|
||||
bool AddProjection( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ICurveComposite* pCompo,
|
||||
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
||||
// creazione del percorso finale di lavorazione
|
||||
bool AddFinishing( const ISurfFlatRegion* pSfrCnt, ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ICRVCOMPOPOVECTOR& vCrvCompo,
|
||||
const Vector3d& vtTool, double dElev, double dDepth, bool bSplitArcs) ;
|
||||
// collisione con i percorsi di lavorazione
|
||||
bool CorrectPathByCollision( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const Vector3d& vtTool,
|
||||
double dDepth, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||
|
||||
bool WorkPencilCurves( const ICRVCOMPOPOVECTOR& vCrvCompo, const ISurfFlatRegion* pSfrCnt, int nPencilType, double dOffs, int nOffs,
|
||||
double dDepth, double dElev, double dLinTol, const Vector3d& vtTool, const SURFLOCALVECTOR& vSrfLoc,
|
||||
const Frame3d& frSurf, ICAvToolSurfTm* pCAvTlStm, bool bSplitArcs) ;
|
||||
@@ -152,7 +161,7 @@ class SurfFinishing : public Machining
|
||||
bool GetCurvesFromSurfTriMeshesOffset( const ISurfTriMesh * pStmOffs, double dBiTanAng, double dLinTol,
|
||||
int nOffs, const ISurfFlatRegion* pSfrCnt, ICRVCOMPOPOVECTOR& vCrvCompo ) ;
|
||||
bool ChooseFinishingForOptimal( const ISurfFlatRegion* pSfr, int nChunk, bool& bSpiral, double& dSideAng) ;
|
||||
bool OrderOptimalPathsByZLoc( const ISurfFlatRegion* pSfr, VECTORPATHS& vCrvPaths) ;
|
||||
bool OrderOptimalPathsByZLoc( const ISurfFlatRegion* pSfrCntZConst, const ISurfFlatRegion* pSfrCntZigZag, VECTORPATHS& vCrvPaths) const ;
|
||||
bool GetSfrBySilhouette( ICAvParSilhouettesSurfTm* pCavParSilh, double dDepth, double dSilTolSamp,
|
||||
double dSilTolLin, double dSilTolAng, ISurfFlatRegion* pSfrSil) ;
|
||||
bool ApproxSilhouetteClosedPLForOptimal( PolyLine& PL, double dSampleTol, double dMaxLinTol, double dAngTol, double dLinFeaTol, ICurveComposite* pCompoPL) ;
|
||||
@@ -166,10 +175,10 @@ class SurfFinishing : public Machining
|
||||
const DBLVECTOR& vdLinFeaTol, const DBLVECTOR& vdAngTol, const DBLVECTOR& vdMaxLinTol) const ;
|
||||
ISurfTriMesh* SplitStmTriaUnderClippingAngle( const SurfLocal SrfLoc, const Vector3d& vtTest, double dClippingAngle,
|
||||
double dFrontTriaTolerAng, double& dMaxFrontTriaRad) const ;
|
||||
bool CalcOptimalZConstCurves( const ISurfFlatRegion* pSfrZConst, const ISurfFlatRegion* pSfrCnt,
|
||||
const Frame3d& frSurf, const Vector3d& vtTool, double dDepth,
|
||||
const SURFLOCALVECTOR& vSrfLoc, ICAvToolSurfTm* pCAvTlStm, VECTORPATHS& vPaths) const ;
|
||||
bool CalcOptimalSpiralCurves( const ISurfFlatRegion* pSfrSpiral, const ISurfFlatRegion* pSfrCnt, const Frame3d& frSurf,
|
||||
bool CalcOptimalZConstCurves( const ISurfFlatRegion* pSfrLoc, const SURFLOCALVECTOR& vSrfLoc,
|
||||
const Frame3d& frSurf, const Vector3d& vtTool, double dAngDegSplit,
|
||||
double dAngDegTol, double dDepth, ICAvToolSurfTm* pCAvTlStm, VECTORPATHS& vPaths, ISurfFlatRegion* pSfrProj) const ;
|
||||
bool CalcOptimalZigZagCurves( const ISurfFlatRegion* pSfrLoc, const Frame3d& frSurf,
|
||||
const Vector3d& vtTool, double dDepth, ICAvToolSurfTm* pCAvTlStm, VECTORPATHS& vPaths) const ;
|
||||
bool GetOptimalSfr( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfrLoc, const Vector3d& vtTool,
|
||||
double dDepth, double dElev, ISurfFlatRegion* pSfrSpiral, ISurfFlatRegion* pSfrZConst) const ;
|
||||
@@ -185,20 +194,24 @@ class SurfFinishing : public Machining
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, bool bSplitArcs) ;
|
||||
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, const Vector3d& vtNorm, Point3d& ptP1) const ;
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Point3d& ptP1, const Vector3d& vtTool, bool bSplitArcs) ;
|
||||
bool GetLastGoodPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, Point3d& ptP1) const ;
|
||||
bool GetLastGoodPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const Point3d& ptStart,
|
||||
const Point3d& ptEnd, const Vector3d& vtInit, const Vector3d& vtTool,
|
||||
bool bLeadInVsOut, Point3d& ptP1) const ;
|
||||
bool GetLinkFromPaths( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, const ISurfFlatRegion* pSfrCnt,
|
||||
double dDepth, double dSafeZ, ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, ICurveComposite* pCrvLink) const ;
|
||||
bool GetSurfaceNormalAtPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
const Point3d& ptTool, const Vector3d& vtTool, Vector3d& vtNorm) const ;
|
||||
bool GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) const ;
|
||||
int ProcessSquare( int nFlag, double dLevel, double dQPt0, double dQpt1, double dQpt2, double dQpt3,
|
||||
int& nI1s, int& nI1e, int& nI2s, int& nI2e) const ;
|
||||
Point3d CalcShapedPoint( const PNTUVVECT& myInfoStart, const PNTUVVECT& myInfoEnd, bool bSpiral, const Vector3d& vtAxL,
|
||||
const Vector3d& vtMoveL, double dCosSplitAngle, ICAvToolSurfTm* pCAvTlStm, int _nInd_debug) const ;
|
||||
bool TestSubEdges( std::unordered_map<int, Point3d>& umEdgePnt, const INTVECTOR& vEdgeInd, bool bSpiral, int nFirst, int nLast,
|
||||
Point3d CalcShapedPoint( const PNTUVVECT& myInfoStart, const PNTUVVECT& myInfoEnd, int nType, const Vector3d& vtAxL,
|
||||
const Vector3d& vtMoveL, double dCosSplitAngle, double dLimInfCosSplitAng,
|
||||
double dLimSupCosSplitAng, ICAvToolSurfTm* pCAvTlStm, int _nInd_debug) const ;
|
||||
bool TestSubEdges( std::unordered_map<int, Point3d>& umEdgePnt, const INTVECTOR& vEdgeInd, int nType, int nFirst, int nLast,
|
||||
const VECTORCOLLISIONSFR& vPntM, int nStepX, const Vector3d vtAxL, const Vector3d& vtMoveL,
|
||||
double dCosSplitAng, ICAvToolSurfTm* pCAvTlStm, int _nInd_debug) const ;
|
||||
bool MarchingSquares( const VECTORCOLLISIONSFR& vPntM, bool bSpiral, double dOffsTol, int nStepX, int nStepY, double dClippingAngle,
|
||||
const Vector3d& vtAxL, const Vector3d& vtMoveL, ICAvToolSurfTm* pCAvTlStm,
|
||||
double dCosSplitAng, double dLimInfCosSplitAng, double dLimSupCosSplitAng, ICAvToolSurfTm* pCAvTlStm, int _nInd_debug) const ;
|
||||
bool MarchingSquares( const VECTORCOLLISIONSFR& vPntM, int nType, double dOffsTol, int nStepX, int nStepY, double dClippingAngle,
|
||||
double dLimInfClippingAng, double dLimSupClippingAng, const Vector3d& vtAxL, const Vector3d& vtMoveL, ICAvToolSurfTm* pCAvTlStm,
|
||||
ICRVCOMPOPOVECTOR& vCrvCompo) const ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
|
||||
+1580
-265
File diff suppressed because it is too large
Load Diff
+95
-13
@@ -23,7 +23,6 @@
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
|
||||
|
||||
class ICAvToolSurfTm ;
|
||||
class ICAvParSilhouettesSurfTm ;
|
||||
|
||||
// struttura informazioni sui singoli percorsi
|
||||
@@ -38,23 +37,93 @@ struct PathInfoSR {
|
||||
// tipo percorso
|
||||
typedef std::vector<PathInfoSR> PATHINFOSRVECTOR ;
|
||||
|
||||
// struttura informazioni per Step/SubSteps durante la loro creazione [quindi temporanei]
|
||||
struct StepInfoSRTmp {
|
||||
StepInfoSRTmp( void)
|
||||
: nIndRef( -1), dDepth( 0), bSubStep( false), bPlaneZStep( false), dPercFeed( 0.),
|
||||
pSfrRemoved( nullptr), pSfrPlaneZ( nullptr) {}
|
||||
StepInfoSRTmp( int nIR, double dD, bool bSS, bool bPZ, double dPF, ISurfFlatRegion* pSR, ISurfFlatRegion* pSPZ)
|
||||
: nIndRef( nIR), dDepth( dD), bSubStep( bSS), bPlaneZStep( bPZ), dPercFeed( dPF),
|
||||
pSfrRemoved( pSR), pSfrPlaneZ( pSPZ) {}
|
||||
~StepInfoSRTmp() {
|
||||
delete( pSfrRemoved) ;
|
||||
delete( pSfrPlaneZ) ;
|
||||
}
|
||||
int nIndRef ; // ( usato solo per step intermedi ) posizione step precedente
|
||||
double dDepth ; // profondità posizione piano di svuotatura ( in negativo)
|
||||
bool bSubStep ; // flag per indicare se lo Step è un SubStep
|
||||
bool bPlaneZStep ; // flag per indicare se lo Step è un planeZ
|
||||
double dPercFeed ; // percentuale degli extra steps relativa agli step base ( per Feed ZLoc)
|
||||
ISurfFlatRegion* pSfrRemoved ; // regione PROGRESSIVA rimossa attuale
|
||||
ISurfFlatRegion* pSfrPlaneZ ; // regione individuata da PlaneZDetection
|
||||
} ;
|
||||
// vettore associato
|
||||
typedef std::vector<StepInfoSRTmp> STEPINFOTMPSRVECTOR ;
|
||||
|
||||
// struttura per salvataggio Sfr con parametri nel GeomDB
|
||||
struct SfrGeoDBInfo {
|
||||
SfrGeoDBInfo( ISurfFlatRegion* pMySfr, ISurfFlatRegion* pMySfrLimit, ISurfFlatRegion* pMySfrRemoved,
|
||||
bool bMySubSubStep, double dMyDepth, double dMyRelativeDepth, double dMyZLocCoefFeed)
|
||||
: bSubStep( bMySubSubStep), dDepth( dMyDepth), dRelativeDepth( dMyRelativeDepth), dZLocCoefFeed( dMyZLocCoefFeed) {
|
||||
pSfr.Set( pMySfr) ;
|
||||
pSfrLimit.Set( pMySfrLimit) ;
|
||||
pSfrRemoved.Set( pMySfrRemoved) ;
|
||||
}
|
||||
SfrGeoDBInfo()
|
||||
: bSubStep( true), dDepth( 0.), dRelativeDepth( 0.), dZLocCoefFeed( 1.) {
|
||||
pSfr.Set( nullptr) ;
|
||||
pSfrLimit.Set( nullptr) ;
|
||||
pSfrRemoved.Set( nullptr) ;
|
||||
}
|
||||
PtrOwner<ISurfFlatRegion> pSfr ; // superficie di Sgrossatura ( allo step corrente)
|
||||
PtrOwner<ISurfFlatRegion> pSfrLimit ; // superficie Limite ( allo step corrente)
|
||||
PtrOwner<ISurfFlatRegion> pSfrRemoved ; // supericie Rimossa ( allo step corrente)
|
||||
bool bSubStep ; // flag per indicare se Step semplice o meno ( Extra/PlaneZ)
|
||||
double dDepth ; // profondità
|
||||
double dRelativeDepth ; // profondità relativa
|
||||
double dZLocCoefFeed ; // coefficiente di riduzione della Feed complessivo
|
||||
} ;
|
||||
// vettore associato
|
||||
typedef std::vector<SfrGeoDBInfo> SFRGEODBINFOVECTOR ;
|
||||
|
||||
// struttura informazioni per Step/SubSteps complessivi
|
||||
struct StepInfoSR {
|
||||
double dDepth ; // profondità dello step attuale
|
||||
double dRelativeDepth ; // profondità relativa allo step al di sopra
|
||||
double dZlocCoeffFeed ; // coeffiziente riduzione Feed lungo Zloc
|
||||
double dZlocCoeffFeed ; // coefficiente riduzione Feed lungo Zloc
|
||||
int nSubType ; // tipo di lavorazione dello Step corrente
|
||||
bool bIsExtraStep ; // flag per SubStep o PlaneZStep
|
||||
bool bInverted ; // se percorsi invertiti
|
||||
PtrOwner<ISurfFlatRegion> pSfrPock ; // regione piana di svuotatura
|
||||
PtrOwner<ISurfFlatRegion> pSfrLimit ; // regione piana da non svuotare
|
||||
PtrOwner<ISurfFlatRegion> pSfrPock ; // regione piana di sgrossatura
|
||||
PtrOwner<ISurfFlatRegion> pSfrLimit ; // regione piana da non rovinare
|
||||
PATHINFOSRVECTOR vPaths ; // percorsi di Pocketing
|
||||
} ;
|
||||
// tipo step
|
||||
// vettore associato
|
||||
typedef std::vector<StepInfoSR> STEPINFOSRVECTOR ;
|
||||
// planeZ detection <SfrFace, dDepth>
|
||||
typedef std::pair<PtrOwner<ISurfFlatRegion>, double> PLANEZFACE ;
|
||||
typedef std::vector<PLANEZFACE> PLANEZFACEVECTOR ;
|
||||
// posizione reciproca tra Step/SubStep/PlaneZ
|
||||
enum { DOWN = 0, PLANAR = 1, ABOVE = 2} ;
|
||||
|
||||
// struttura per ordinamento mediante ZChunk
|
||||
struct StepData {
|
||||
PtrOwner<ISurfFlatRegion> pSfrChunk ; // regione piana di sgrossatura
|
||||
PtrOwner<ISurfFlatRegion> pSfrLimit ; // regione piana da non rovinare
|
||||
PtrOwner<ISurfFlatRegion> pSfrRemoved ; // regione piana rimossa alla Depth corrente
|
||||
bool bIsSubStep ; // Flag per Step base o Extra ( SubStep/PlaneZ)
|
||||
double dDepth ; // profondità
|
||||
double dRelativeDepth ; // profondità relativa
|
||||
double dZLocCoeffFeed ; // coefficiente di riduzione della Feed
|
||||
} ;
|
||||
// vettore di StepData
|
||||
typedef std::vector<StepData> STEPDATAVECTOR ;
|
||||
// Matrice di StepData
|
||||
typedef std::vector<STEPDATAVECTOR> STEPDATAMATRIX ;
|
||||
// ordine <Ind, ZMin, ZMax>
|
||||
typedef std::pair<int, std::pair<double, double>> INTDBLDBL ;
|
||||
// vettore associato
|
||||
typedef std::vector<INTDBLDBL> INTDBLDBLVECTOR ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class SurfRoughing : public Machining
|
||||
@@ -101,7 +170,7 @@ class SurfRoughing : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
@@ -117,8 +186,15 @@ class SurfRoughing : public Machining
|
||||
bool DetectPlaneZ( const CISURFTMPVECTOR& vpStm, const Frame3d& frCompo, const Vector3d& vtTool, PLANEZFACEVECTOR& vPlaneZ,
|
||||
double dMinDepth, double dMaxDepth) const ;
|
||||
bool CalcPaths( const INTINTVECTOR& vPocket, STEPINFOSRVECTOR& vStepInfo) const ;
|
||||
bool OrderByZChunk( SFRGEODBINFOVECTOR& vInfoSfrGeomDB, int nTempInd, const ISurfFlatRegion* pSfrSgro) const ;
|
||||
bool OrderZChunkSteps( STEPDATAMATRIX& vvDataSteps, STEPDATAMATRIX& vIndepChunkGroup,
|
||||
INTDBLDBLVECTOR& vMapGrpZLoc) const ;
|
||||
bool GetLinkFromPaths( STEPINFOSRVECTOR& vStepInfo, int i, int j, const Point3d& ptStart,
|
||||
const Vector3d& vtTool, double dSafeZ, double dExtraElev, double& dEndElev,
|
||||
ICurveComposite* pCrvLink) const ;
|
||||
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dLen, double& dElev) const ;
|
||||
bool AddPocket( const INTINTVECTOR& vPocket, const Vector3d& vtTool, double dElev, double dStep, double dSubStep, bool bSplitArcs) ;
|
||||
bool AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool, double dElev, double dStep,
|
||||
double dSubStep, bool bSplitArcs) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr, bool bOutStart, bool bAbsFirst) ;
|
||||
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr, bool bOutMove) ;
|
||||
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
|
||||
@@ -133,8 +209,13 @@ class SurfRoughing : public Machining
|
||||
ISurfTriMesh* GetStmOutSideSfr( const ISurfFlatRegion* pSfr, double dDepth, const ISurfTriMesh* pStmRaw, const Vector3d& vtExtr) const ;
|
||||
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) const ;
|
||||
ISurfFlatRegion* GetSfrSilhouette( ICAvParSilhouettesSurfTm* pCavParSilh, double dDepth, double Sil_tol, bool& bOk) const ;
|
||||
ISurfFlatRegion* GetSfrCornerColl( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrLimit,
|
||||
const ISurfFlatRegion* pSfrColl, const ISurfFlatRegion* pSfrSearchCorners) const ;
|
||||
bool GetToolCollisionRegion( const ISurfFlatRegion* pSfrSgro, double& dDepth, ISurfFlatRegion* pSfrColl,
|
||||
ISurfFlatRegion* pSfrSearchCorners) const ;
|
||||
bool GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) const ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
double GetRightStartFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
bool ResetCurveAllTempProp( ICurve* pCurve) const ;
|
||||
bool RemoveChunksUnderTolerance( ISurfFlatRegion* pSfr, double dTol, ISurfFlatRegion* pSfrLimit,
|
||||
@@ -142,10 +223,10 @@ class SurfRoughing : public Machining
|
||||
bool CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler) ;
|
||||
bool ModifySurfForOpenCloseEdges( ISurfFlatRegion* pSfr, const Vector3d& vtTool, const ICurveComposite* pCrvCompo) const ;
|
||||
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrRef) const ;
|
||||
bool SimplifyCurve( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvCheck) const ;
|
||||
bool SimplifyCurve( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvCheck, const Frame3d& frLocXY) const ;
|
||||
bool SimplyfySfr( ISurfFlatRegion* pSfr) const ;
|
||||
bool CheckSafetyLinearLink( const Point3d& ptCurr, const ISurfFlatRegion* pSfrLimit, const Vector3d& vtTool,
|
||||
const Point3d& ptDest, bool& bSafe) const ;
|
||||
bool CheckSafetyLinearLink( const Point3d& ptCurr, const Point3d& ptDest, const ISurfFlatRegion* pSfrCheck, const Vector3d& vtTool,
|
||||
bool& bSafe) const ;
|
||||
bool GetHomogeneousParts( const ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) const ;
|
||||
bool VerifyLeadInHelix( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptCen, double dHelixRad) const ;
|
||||
bool VerifyLeadInZigZag( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptPa, const Point3d& ptPb) const ;
|
||||
@@ -189,9 +270,9 @@ class SurfRoughing : public Machining
|
||||
return m_Params.m_nLeadOutType ; }
|
||||
|
||||
/* debug functions */
|
||||
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf, Color Col, bool bAlphaCoverage, std::string sName) ;
|
||||
void DrawFeed( const ICurve* pCrv, double dFeed) ;
|
||||
void DrawNormalShaderSurfTm( const ISurfTriMesh* pStm, std::string sName) ;
|
||||
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf, Color Col, bool bAlphaCoverage, std::string sName) const ;
|
||||
void DrawFeed( const ICurve* pCrv, double dFeed, int nLay) const ;
|
||||
void DrawNormalShaderSurfTm( const ISurfTriMesh* pStm, std::string sName) const ;
|
||||
/* end debug functions */
|
||||
|
||||
private :
|
||||
@@ -207,5 +288,6 @@ class SurfRoughing : public Machining
|
||||
double m_dStepToler ; // tolleranza di rimozione chunk per Steps
|
||||
double m_dSubStepToler ; // tolleranza di rimozione chunk per SubSteps
|
||||
bool m_bDetectPlaneZ ; // flag per calcolo piani in Zloc di Pocketing
|
||||
bool m_bOrderZ ; // flag per ordinamento Chunks secondo vtTool
|
||||
bool m_bRunning ; // flag di calcoli in corso
|
||||
} ;
|
||||
+17
-3
@@ -45,6 +45,7 @@ enum nSurfRoughingKey {
|
||||
KEY_NNU,
|
||||
KEY_OL,
|
||||
KEY_OR,
|
||||
KEY_OVL,
|
||||
KEY_PS,
|
||||
KEY_S,
|
||||
KEY_SA,
|
||||
@@ -78,6 +79,7 @@ static const array<string,KEY_ZZZ> sSurfRoughingKey = {
|
||||
"NNU",
|
||||
"OL",
|
||||
"OR",
|
||||
"OVL",
|
||||
"PS",
|
||||
"S",
|
||||
"SA",
|
||||
@@ -113,7 +115,7 @@ SurfRoughingData::Clone( void) const
|
||||
bool
|
||||
SurfRoughingData::CopyFrom( const MachiningData* pMdata)
|
||||
{
|
||||
// è inutile copiare se sorgente coincide con destinazione
|
||||
// è inutile copiare se sorgente coincide con destinazione
|
||||
if ( pMdata == this)
|
||||
return true ;
|
||||
// la sorgente deve essere dello stesso tipo
|
||||
@@ -138,6 +140,7 @@ SurfRoughingData::CopyFrom( const MachiningData* pMdata)
|
||||
m_bInvert = pSdata->m_bInvert ;
|
||||
m_sDepth = pSdata->m_sDepth ;
|
||||
m_dStartPos = pSdata->m_dStartPos ;
|
||||
m_dOverlap = pSdata->m_dOverlap ;
|
||||
m_dStep = pSdata->m_dStep ;
|
||||
m_dSubStep = pSdata->m_dSubStep ;
|
||||
m_dSideStep = pSdata->m_dSideStep ;
|
||||
@@ -183,6 +186,7 @@ SurfRoughingData::SameAs(const MachiningData* pMdata) const
|
||||
m_bInvert == pSdata->m_bInvert &&
|
||||
m_sDepth == pSdata->m_sDepth &&
|
||||
abs( m_dStartPos - pSdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dOverlap - pSdata->m_dOverlap) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dStep - pSdata->m_dStep) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dSubStep - pSdata->m_dSubStep) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dSideStep - pSdata->m_dSideStep) < EPS_MACH_LEN_PAR &&
|
||||
@@ -202,7 +206,7 @@ SurfRoughingData::SameAs(const MachiningData* pMdata) const
|
||||
int
|
||||
SurfRoughingData::GetSize( void) const
|
||||
{
|
||||
// in debug verifico validità ultimo campo
|
||||
// in debug verifico validità ultimo campo
|
||||
assert( sSurfRoughingKey[KEY_UUID] == "UUID") ;
|
||||
return KEY_ZZZ ;
|
||||
}
|
||||
@@ -294,6 +298,9 @@ SurfRoughingData::FromString( const string& sString, int& nKey)
|
||||
case KEY_OL :
|
||||
bOk = ::FromString( sVal, m_dOffsL) ;
|
||||
break ;
|
||||
case KEY_OVL :
|
||||
bOk = ::FromString( sVal, m_dOverlap) ;
|
||||
break ;
|
||||
case KEY_PS :
|
||||
bOk = ::FromString( sVal, m_dStartPos) ;
|
||||
break ;
|
||||
@@ -358,6 +365,7 @@ SurfRoughingData::ToString( int nInd) const
|
||||
case KEY_NNU : return ( sSurfRoughingKey[KEY_NNU] + "=" + m_sUserNotes) ;
|
||||
case KEY_OL : return ( sSurfRoughingKey[KEY_OL] + "=" + ::ToString( m_dOffsL)) ;
|
||||
case KEY_OR : return ( sSurfRoughingKey[KEY_OR] + "=" + ::ToString( m_dOffsR)) ;
|
||||
case KEY_OVL : return ( sSurfRoughingKey[KEY_OVL] + "=" + ::ToString( m_dOverlap)) ;
|
||||
case KEY_PS : return ( sSurfRoughingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
|
||||
case KEY_S : return ( sSurfRoughingKey[KEY_S] + "=" + ::ToString( m_dSpeed)) ;
|
||||
case KEY_SA : return ( sSurfRoughingKey[KEY_SA] + "=" + ::ToString( m_dSideAngle)) ;
|
||||
@@ -377,7 +385,7 @@ SurfRoughingData::ToString( int nInd) const
|
||||
bool
|
||||
SurfRoughingData::IsOptional( int nKey) const
|
||||
{
|
||||
return ( nKey == KEY_LIEL || nKey == KEY_SST) ;
|
||||
return ( nKey == KEY_LIEL || nKey == KEY_SST || nKey == KEY_OVL) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -502,6 +510,9 @@ SurfRoughingData::SetParam( int nType, double dVal)
|
||||
case MPA_OFFSL :
|
||||
m_dOffsL = dVal ;
|
||||
return true ;
|
||||
case MPA_OVERL :
|
||||
m_dOverlap = dVal ;
|
||||
return true ;
|
||||
case MPA_DEPTH :
|
||||
m_sDepth = ::ToString( dVal) ;
|
||||
return true ;
|
||||
@@ -643,6 +654,9 @@ SurfRoughingData::GetParam( int nType, double& dVal) const
|
||||
case MPA_OFFSL :
|
||||
dVal = m_dOffsL ;
|
||||
return true ;
|
||||
case MPA_OVERL :
|
||||
dVal = m_dOverlap ;
|
||||
return true ;
|
||||
case MPA_STARTPOS :
|
||||
dVal = m_dStartPos ;
|
||||
return true ;
|
||||
|
||||
+7
-6
@@ -23,16 +23,17 @@ struct SurfRoughingData : public MachiningData
|
||||
std::string m_sInitAngs ; // angoli iniziali suggeriti (Nome1=val1,Nome2=val2)
|
||||
std::string m_sBlockedAxis ; // eventuale asse rotante bloccato (Nome=val)
|
||||
int m_nSolCh ; // criterio scelta soluzione (quando possibili molteplici)
|
||||
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
|
||||
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
|
||||
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
|
||||
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
|
||||
double m_dTipFeed ; // velocità di lavorazione di testa ( se 0 da utensile)
|
||||
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
|
||||
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
|
||||
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
|
||||
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
|
||||
double m_dTipFeed ; // velocità di lavorazione di testa ( se 0 da utensile)
|
||||
double m_dOffsR ; // offset radiale ( se UNKNOWN_PAR da utensile)
|
||||
double m_dOffsL ; // offset longitudinale ( se UNKNOWN_PAR da utensile)
|
||||
bool m_bInvert ; // flag di inversione direzione lavorazione
|
||||
std::string m_sDepth ; // affondamento massimo (espressione numerica)
|
||||
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
|
||||
double m_dOverlap ; // distanza di sovrapposizione con il contorno
|
||||
double m_dStep ; // passo di affondamento (0=nessun passo)
|
||||
double m_dSideStep ; // distanza tra le passate
|
||||
double m_dSubStep ; // distanza tra le passate intermedie
|
||||
@@ -50,7 +51,7 @@ struct SurfRoughingData : public MachiningData
|
||||
SurfRoughingData( void)
|
||||
: m_ToolUuid(), m_nSolCh( 0), m_dSpeed( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
|
||||
m_dOffsR( UNKNOWN_PAR), m_dOffsL( UNKNOWN_PAR), m_bInvert( false),
|
||||
m_dStartPos( 0), m_dStep( 0), m_dSideStep( 0), m_dSubStep( 0), m_nSubType( 0), m_dSideAngle( 0),
|
||||
m_dStartPos( 0), m_dOverlap( 0), m_dStep( 0), m_dSideStep( 0), m_dSubStep( 0), m_nSubType( 0), m_dSideAngle( 0),
|
||||
m_nLeadInType( 0), m_dLiTang( 0), m_dLiElev( 0),
|
||||
m_nLeadOutType( 0), m_dLoTang( 0), m_dApprox( 0) {}
|
||||
SurfRoughingData* Clone( void) const override ;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2026-2026
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ToolUserNotesConst.h Data : 09.04.26 Versione : 3.1d3
|
||||
// Contenuto : Costanti per le note utente degli utensili.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 10.11.25 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Generali
|
||||
static const std::string TUN_TH = "TH" ;
|
||||
static const std::string TUN_DOUBLE = "DOUBLE" ;
|
||||
+296
-198
@@ -18,6 +18,7 @@
|
||||
#include "WaterJetting.h"
|
||||
#include "GeoConst.h"
|
||||
#include "OperationConst.h"
|
||||
#include "OperUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
@@ -57,6 +58,7 @@ using namespace std ;
|
||||
// 3219 = "Error in WaterJetting : Tool loading failed"
|
||||
// 3220 = "Error in WaterJetting : Center work not allowed with side angle"
|
||||
// 3221 = "Error in WaterJetting : Path plane different from XY"
|
||||
// 3222 = "Error in WaterJetting : special apply not calculable"
|
||||
// 3251 = "Warning in WaterJetting : Skipped entity (xx)"
|
||||
// 3252 = "Warning in WaterJetting : No machinable path"
|
||||
// 3253 = "Warning in WaterJetting : Tool name changed (xx)"
|
||||
@@ -66,6 +68,7 @@ using namespace std ;
|
||||
//----------------------------------------------------------------------------
|
||||
const double EXTRA_ACC_LEN = 0.5 ;
|
||||
const double INTANG_ROT_LEN = 5.0 ;
|
||||
const double LEN_TOL = 100 * EPS_SMALL ; // valore limite per gestione degli angoli
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
USEROBJ_REGISTER( GetOperationClass( OPER_WATERJETTING), WaterJetting) ;
|
||||
@@ -623,8 +626,7 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 3201, "Error in WaterJetting : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -635,8 +637,7 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nMills = nCurrMills ;
|
||||
string sLog = string( "WaterJetting apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
@@ -770,6 +771,16 @@ WaterJetting::Update( bool bPostApply)
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 3222, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 3222, "Error in WaterJetting : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -780,7 +791,7 @@ WaterJetting::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
// esecuzione eventuali personalizzazioni finali
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
@@ -965,7 +976,7 @@ WaterJetting::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
WaterJetting::UpdateToolData( bool* pbChanged)
|
||||
WaterJetting::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
@@ -1016,9 +1027,9 @@ WaterJetting::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 3254, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1204,9 +1215,6 @@ WaterJetting::Chain( int nGrpDestId)
|
||||
// vettore puntatori alle curve
|
||||
ICURVEPOVECTOR vpCrvs ;
|
||||
vpCrvs.reserve( m_vId.size()) ;
|
||||
// vettore selettori delle curve originali
|
||||
SELVECTOR vInds ;
|
||||
vInds.reserve( m_vId.size()) ;
|
||||
// recupero tutte le curve e le porto in globale
|
||||
for ( const auto& Id : m_vId) {
|
||||
// prendo le curve
|
||||
@@ -1216,14 +1224,16 @@ WaterJetting::Chain( int nGrpDestId)
|
||||
m_pMchMgr->SetWarning( 3251, sInfo) ;
|
||||
}
|
||||
for ( auto pCrv : lstPC) {
|
||||
// salvo l'id geometrico della curva nelle sue temp prop per i conti successivi
|
||||
pCrv->SetTempProp( Id.nId, 0) ;
|
||||
pCrv->SetTempProp( Id.nSub, 1) ;
|
||||
vpCrvs.emplace_back( pCrv) ;
|
||||
vInds.emplace_back( Id) ;
|
||||
}
|
||||
}
|
||||
// verifico se sono necessarie sistemazioni per collegamenti (bridges)
|
||||
// verifico se sono necessarie sistemazioni per collegamenti ( bridges)
|
||||
if ( abs( m_Params.m_dSideAngle) < EPS_ANG_SMALL &&
|
||||
m_pGeomDB->GetFirstNameInGroup( m_pMchMgr->GetCurrMachGroup(), MACH_BRIDGES_GROUP) != GDB_ID_NULL) {
|
||||
AdjustCurvesForBridges( vpCrvs, vInds) ;
|
||||
AdjustCurvesForBridges( vpCrvs) ;
|
||||
}
|
||||
// preparo i dati per il concatenamento
|
||||
bool bFirst = true ;
|
||||
@@ -1252,8 +1262,8 @@ WaterJetting::Chain( int nGrpDestId)
|
||||
}
|
||||
// recupero i percorsi concatenati
|
||||
int nCount = 0 ;
|
||||
INTVECTOR vnId2 ;
|
||||
while ( chainC.GetChainFromNear( ptNear, false, vnId2)) {
|
||||
INTVECTOR vnId ;
|
||||
while ( chainC.GetChainFromNear( ptNear, false, vnId)) {
|
||||
// creo una curva composita
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvCompo))
|
||||
@@ -1262,18 +1272,18 @@ WaterJetting::Chain( int nGrpDestId)
|
||||
Vector3d vtExtr = Z_AX ;
|
||||
double dThick = 0 ;
|
||||
// vettore Id originali
|
||||
SELVECTOR vId2 ;
|
||||
vId2.reserve( vnId2.size()) ;
|
||||
SELVECTOR vOrigId ;
|
||||
vOrigId.reserve( vnId.size()) ;
|
||||
// recupero le curve semplici e le inserisco nella curva composita
|
||||
for ( size_t i = 0 ; i < vnId2.size() ; ++ i) {
|
||||
int nId = abs( vnId2[i]) - 1 ;
|
||||
bool bInvert = ( vnId2[i] < 0) ;
|
||||
vId2.emplace_back( vInds[nId]) ;
|
||||
for ( int i = 0 ; i < int( vnId.size()) ; ++ i) {
|
||||
int nId = abs( vnId[i]) - 1 ;
|
||||
bool bInvert = ( vnId[i] < 0) ;
|
||||
// recupero la curva
|
||||
ICurve* pCrv = vpCrvs[nId] ;
|
||||
vOrigId.emplace_back( pCrv->GetTempProp( 0), pCrv->GetTempProp( 1)) ;
|
||||
// se necessario, la inverto
|
||||
if ( bInvert)
|
||||
pCrv->Invert() ;
|
||||
pCrv->Invert() ;
|
||||
// recupero eventuali estrusione e spessore
|
||||
Vector3d vtTemp ;
|
||||
if ( pCrv->GetExtrusion( vtTemp)) {
|
||||
@@ -1302,7 +1312,7 @@ WaterJetting::Chain( int nGrpDestId)
|
||||
if ( nPathId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPathId, MCH_PATH + ToString( ++ nCount)) ;
|
||||
m_pGeomDB->SetInfo( nPathId, KEY_IDS, ToString( vId2)) ;
|
||||
m_pGeomDB->SetInfo( nPathId, KEY_IDS, ToString( vOrigId)) ;
|
||||
// inserisco la curva composita nel gruppo destinazione
|
||||
int nNewId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, ::Release( pCrvCompo)) ;
|
||||
if ( nNewId == GDB_ID_NULL)
|
||||
@@ -1313,7 +1323,7 @@ WaterJetting::Chain( int nGrpDestId)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
WaterJetting::AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs, SELVECTOR& vInds)
|
||||
WaterJetting::AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs)
|
||||
{
|
||||
// Gruppo dei collegamenti
|
||||
struct Bridge {
|
||||
@@ -1344,44 +1354,49 @@ WaterJetting::AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs, SELVECTOR& vInds)
|
||||
}
|
||||
|
||||
// Verifico i collegamenti che interessano le geometrie della lavorazione
|
||||
double const DIST_MAX = 5 ;
|
||||
for ( int i = 0 ; i < int( vBridges.size()) ; ++ i) {
|
||||
// cerco le due curve interessate dal collegamento
|
||||
// cerco le due curve interessate dal collegamento calcolando e verificando anche la posizione dei punti di collegamento sulle
|
||||
// due curve
|
||||
double dMinLen = vBridges[i].dWidth + m_TParams.m_dDiam ;
|
||||
int nI1 = -1 ;
|
||||
for ( int j = 0 ; j < int( vInds.size()) ; ++ j) {
|
||||
if ( vInds[j].nId == vBridges[i].nEnt1) {
|
||||
nI1 = j ;
|
||||
break ;
|
||||
double dDist1, dU1, dLenP1, dLen1 ; int nF1 ;
|
||||
for ( int j = 0 ; j < int( vpCrvs.size()) ; ++ j) {
|
||||
// recupero l'id geometrico della curva dalla sua temp prop
|
||||
int nCrvId = vpCrvs[j]->GetTempProp() ;
|
||||
if ( nCrvId == vBridges[i].nEnt1) {
|
||||
DistPointCurve distPC1( vBridges[i].ptP1, *vpCrvs[j]) ;
|
||||
if ( distPC1.GetDist( dDist1) && dDist1 < DIST_MAX &&
|
||||
distPC1.GetParamAtMinDistPoint( 0, dU1, nF1) &&
|
||||
vpCrvs[j]->GetLengthAtParam( dU1, dLenP1) &&
|
||||
vpCrvs[j]->GetLength( dLen1) &&
|
||||
dLenP1 > dMinLen - EPS_SMALL &&
|
||||
( dLen1 - dLenP1) > dMinLen - EPS_SMALL) {
|
||||
nI1 = j ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
int nI2 = -1 ;
|
||||
for ( int j = 0 ; j < int( vInds.size()) ; ++ j) {
|
||||
if ( vInds[j].nId == vBridges[i].nEnt2) {
|
||||
nI2 = j ;
|
||||
break ;
|
||||
double dDist2, dU2, dLenP2, dLen2 ; int nF2 ;
|
||||
for ( int j = 0 ; j < int( vpCrvs.size()) ; ++ j) {
|
||||
int nCrvId = vpCrvs[j]->GetTempProp() ;
|
||||
if ( nCrvId == vBridges[i].nEnt2) {
|
||||
DistPointCurve distPC2( vBridges[i].ptP2, *vpCrvs[j]) ;
|
||||
if ( distPC2.GetDist( dDist2) && dDist2 < DIST_MAX &&
|
||||
distPC2.GetParamAtMinDistPoint( 0, dU2, nF2) &&
|
||||
vpCrvs[j]->GetLengthAtParam( dU2, dLenP2) &&
|
||||
vpCrvs[j]->GetLength( dLen2) &&
|
||||
dLenP2 > dMinLen - EPS_SMALL &&
|
||||
( dLen2 - dLenP2) > dMinLen - EPS_SMALL) {
|
||||
nI2 = j ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( nI1 == -1 || nI2 == -1)
|
||||
continue ;
|
||||
// calcolo e verifico la posizione dei punti di collegamento sulle due curve
|
||||
double const DIST_MAX = 5 ;
|
||||
double dDist1, dU1, dLenP1, dLen1 ; int nF1 ;
|
||||
DistPointCurve distPC1( vBridges[i].ptP1, *vpCrvs[nI1]) ;
|
||||
if ( ! distPC1.GetDist( dDist1) || dDist1 > DIST_MAX ||
|
||||
! distPC1.GetParamAtMinDistPoint( 0, dU1, nF1) ||
|
||||
! vpCrvs[nI1]->GetLengthAtParam( dU1, dLenP1) ||
|
||||
! vpCrvs[nI1]->GetLength( dLen1) ||
|
||||
dLenP1 < vBridges[i].dWidth + m_TParams.m_dDiam ||
|
||||
( dLen1 - dLenP1) < vBridges[i].dWidth + m_TParams.m_dDiam)
|
||||
continue ;
|
||||
double dDist2, dU2, dLenP2, dLen2 ; int nF2 ;
|
||||
DistPointCurve distPC2( vBridges[i].ptP2, *vpCrvs[nI2]) ;
|
||||
if ( ! distPC2.GetDist( dDist2) || dDist2 > DIST_MAX ||
|
||||
! distPC2.GetParamAtMinDistPoint( 0, dU2, nF2) ||
|
||||
! vpCrvs[nI2]->GetLengthAtParam( dU2, dLenP2) ||
|
||||
! vpCrvs[nI2]->GetLength( dLen2) ||
|
||||
dLenP2 < vBridges[i].dWidth + m_TParams.m_dDiam ||
|
||||
( dLen2 - dLenP2) < vBridges[i].dWidth + m_TParams.m_dDiam)
|
||||
continue ;
|
||||
|
||||
// spezzo le curve nei punti del collegamento e creo i segmenti di collegamento
|
||||
PtrOwner<ICurve> pCopy1( vpCrvs[nI1]->Clone()) ;
|
||||
PtrOwner<ICurve> pCopy2( vpCrvs[nI2]->Clone()) ;
|
||||
@@ -1399,15 +1414,11 @@ WaterJetting::AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs, SELVECTOR& vInds)
|
||||
Point3d ptBs ; vpCrvs[nI2]->GetEndPoint( ptBs) ;
|
||||
Point3d ptBe ; pCopy1->GetStartPoint( ptBe) ;
|
||||
pLinkB->Set( ptBs, ptBe) ;
|
||||
// inserisco le nuove curve nel vettore delle curve e aggiorno il vettore degli indici
|
||||
// inserisco le nuove curve nel vettore delle curve
|
||||
vpCrvs.emplace_back( Release( pCopy1)) ;
|
||||
vInds.emplace_back( vInds[nI1]) ;
|
||||
vpCrvs.emplace_back( Release( pCopy2)) ;
|
||||
vInds.emplace_back( vInds[nI2]) ;
|
||||
vpCrvs.emplace_back( Release( pLinkA)) ;
|
||||
vInds.emplace_back( 0, 0) ;
|
||||
vpCrvs.emplace_back( Release( pLinkB)) ;
|
||||
vInds.emplace_back( 0, 0) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -1498,7 +1509,9 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// recupero direzione utensile da estrusione
|
||||
Vector3d vtTool ;
|
||||
pCompo->GetExtrusion( vtTool) ;
|
||||
if ( ! ( vtTool - Z_AX).IsSmall()) {
|
||||
if ( vtTool.IsSmall())
|
||||
vtTool = Z_AX ;
|
||||
if ( ! AreSameVectorApprox( vtTool, Z_AX)) {
|
||||
m_pMchMgr->SetLastError( 3221, "Error in WaterJetting : Path plane different from XY") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1507,18 +1520,19 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
if ( pCompo->IsClosed()) {
|
||||
// recupero indicazione lato di inizio
|
||||
int nStart = 0 ;
|
||||
string sMyNotes = m_Params.m_sUserNotes ;
|
||||
ToUpper( sMyNotes) ;
|
||||
if ( sMyNotes.find( "START=XP") != string::npos)
|
||||
nStart = 1 ;
|
||||
else if ( sMyNotes.find( "START=XM") != string::npos)
|
||||
nStart = -1 ;
|
||||
else if ( sMyNotes.find( "START=YP") != string::npos)
|
||||
nStart = 2 ;
|
||||
else if ( sMyNotes.find( "START=YM") != string::npos)
|
||||
nStart = -2 ;
|
||||
else if ( sMyNotes.find( "START=") != string::npos)
|
||||
nStart = 11 ;
|
||||
string sStart ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_START, sStart)) {
|
||||
if ( sStart == "XP")
|
||||
nStart = 1 ;
|
||||
else if ( sStart == "XM")
|
||||
nStart = -1 ;
|
||||
else if ( sStart == "YP")
|
||||
nStart = 2 ;
|
||||
else if ( sStart == "YM")
|
||||
nStart = -2 ;
|
||||
else
|
||||
nStart = 11 ;
|
||||
}
|
||||
// se richiesta sistemazione punto di inizio
|
||||
if ( nStart != 0 && nStart != 11) {
|
||||
const double COS_ANG_PERD_TG = cos( 5 * DEGTORAD) ;
|
||||
@@ -1581,12 +1595,12 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
}
|
||||
// se altrimenti suggerito punto di inizio
|
||||
else if ( nStart == 11) {
|
||||
ReplaceString( sMyNotes, "(", "") ;
|
||||
ReplaceString( sMyNotes, ")", "") ;
|
||||
TrimLeft( sStart, "(") ;
|
||||
TrimRight( sStart, ")") ;
|
||||
Point3d ptStart ;
|
||||
double dPar ;
|
||||
int nFlag ;
|
||||
if ( GetValInNotes( sMyNotes, "START", ptStart) &&
|
||||
if ( FromString( sStart, ptStart) &&
|
||||
DistPointCurve( ptStart, *pCompo).GetParamAtMinDistPoint( 0, dPar, nFlag)) {
|
||||
pCompo->ChangeStartPoint( dPar) ;
|
||||
}
|
||||
@@ -1726,8 +1740,20 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sPathName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, GREEN) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, m_dElev) ;
|
||||
|
||||
// Sistemazioni per angoli interni
|
||||
AdjustPathForInternalAngles( pCompo) ;
|
||||
|
||||
// creo l'anteprima del percorso
|
||||
if ( ! GeneratePreView( nPxId, pCompo, dAddedOverlap))
|
||||
if ( ! GeneratePreView( nPxId, pCompo, vtTool, dAddedOverlap))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -1767,10 +1793,10 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, double dAddedOverlap)
|
||||
WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, const Vector3d& vtTool, double dAddedOverlap)
|
||||
{
|
||||
// colore taglio, dipendente da angolo di inclinazione
|
||||
Color colCut = LIME ;
|
||||
Color colCut = TEAL ;
|
||||
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL)
|
||||
colCut = FUCHSIA ;
|
||||
// creo copia della curva composita
|
||||
@@ -1783,11 +1809,12 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
|
||||
pCrv->TrimStartAtLen( dAddedOverlap) ;
|
||||
pCrv->Invert() ;
|
||||
}
|
||||
bool bClosed = pCrv->IsClosed() ;
|
||||
// calcolo la regione ridotta
|
||||
PtrOwner<ISurfFlatRegion> pSfr ;
|
||||
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
|
||||
double dRad = 0.5 * m_TParams.m_dDiam * dSideCoeff ;
|
||||
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), dRad, false, false)) ;
|
||||
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), dRad, false, true)) ;
|
||||
if ( IsNull( pSfr))
|
||||
return false ;
|
||||
// aggiungo eventuali anelli su angoli esterni
|
||||
@@ -1805,23 +1832,38 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
|
||||
m_pGeomDB->SetMaterial( nRRId, INVISIBLE) ;
|
||||
|
||||
// regione per attacco
|
||||
PtrOwner<ISurfFlatRegion> pSfrLI( GenerateLeadInPreview( pCompo)) ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrLI( GenerateLeadInPreview( pCompo, vtTool, bClosed)) ;
|
||||
if ( IsNull( pSfrLI))
|
||||
return false ;
|
||||
if ( pSfrLI->IsValid()) {
|
||||
// se regione definita la aggiungo alla regione completa
|
||||
if ( ! pSfrTot->Add( *pSfrLI))
|
||||
return false ;
|
||||
// aggiungo nel DB
|
||||
int nRLiId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfrLI)) ;
|
||||
if ( nRLiId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nRLiId, MCH_PV_RLICUT) ;
|
||||
m_pGeomDB->SetMaterial( nRLiId, INVISIBLE) ;
|
||||
if ( pSfrLI->IsValid()) {
|
||||
// se nessun attacco pSrfLI è solo un cerchio segnaposto, aggiungo la sua curva di bordo al DB
|
||||
if ( GetLeadInType() == WJET_LI_NONE) {
|
||||
PtrOwner<ICurve> pCrvLI( pSfrLI->GetLoop( 0, 0)) ;
|
||||
if ( IsNull( pCrvLI))
|
||||
return false ;
|
||||
int nCLIId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrvLI)) ;
|
||||
if ( nCLIId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// assegno nome e colore
|
||||
m_pGeomDB->SetName( nCLIId, MCH_PV_CUT) ;
|
||||
m_pGeomDB->SetMaterial( nCLIId, colCut) ;
|
||||
}
|
||||
// altrimenti aggiungo la regione
|
||||
else {
|
||||
// aggiungo alla regione completa
|
||||
if ( ! pSfrTot->Add( *pSfrLI))
|
||||
return false ;
|
||||
// aggiungo nel DB
|
||||
int nRLiId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfrLI)) ;
|
||||
if ( nRLiId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nRLiId, MCH_PV_RLICUT) ;
|
||||
m_pGeomDB->SetMaterial( nRLiId, INVISIBLE) ;
|
||||
}
|
||||
}
|
||||
|
||||
// regione per uscita
|
||||
PtrOwner<ISurfFlatRegion> pSfrLO( GenerateLeadOutPreview( pCompo)) ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrLO( GenerateLeadOutPreview( pCompo, vtTool)) ;
|
||||
if ( IsNull( pSfrLO))
|
||||
return false ;
|
||||
if ( pSfrLO->IsValid()) {
|
||||
@@ -1982,22 +2024,31 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ISurfFlatRegion*
|
||||
WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo)
|
||||
WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo, const Vector3d& vtN, bool bClosed)
|
||||
{
|
||||
// Creo la superficie
|
||||
PtrOwner<ISurfFlatRegion> pSfr( CreateSurfFlatRegion()) ;
|
||||
if ( IsNull( pSfr))
|
||||
return nullptr ;
|
||||
|
||||
// Assegno il tipo
|
||||
int nType = GetLeadInType() ;
|
||||
if ( nType == WJET_LI_NONE)
|
||||
return Release( pSfr) ;
|
||||
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
|
||||
double dRad = 0.49 * m_TParams.m_dDiam * dSideCoeff ; // non 0.5 per evitare problemi di coincidenza
|
||||
|
||||
// Recupero punto e direzione iniziali del percorso
|
||||
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
|
||||
Vector3d vtStart ; pCompo->GetStartDir( vtStart) ;
|
||||
// Recupero versore estrusione
|
||||
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
|
||||
|
||||
// Verifico il tipo
|
||||
int nType = GetLeadInType() ;
|
||||
if ( nType == WJET_LI_NONE) {
|
||||
// se nessun attacco e curva chiusa creo segnaposto per indicare punto di inizio
|
||||
if ( bClosed) {
|
||||
pSfr.Set( GetSurfFlatRegionDisk( dRad)) ;
|
||||
if ( ! IsNull( pSfr))
|
||||
pSfr->Translate( ptStart - ORIG) ;
|
||||
}
|
||||
return Release( pSfr) ;
|
||||
}
|
||||
// Calcolo punto iniziale dell'attacco
|
||||
Point3d ptP1 ;
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtN, pCompo, ptP1))
|
||||
@@ -2020,9 +2071,7 @@ WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo)
|
||||
default :
|
||||
return nullptr ;
|
||||
}
|
||||
// calcolo la regione
|
||||
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
|
||||
double dRad = 0.49 * m_TParams.m_dDiam * dSideCoeff ; // non 0.5 per evitare problemi di coincidenza
|
||||
// calcolo la regione
|
||||
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), dRad, false, false)) ;
|
||||
if ( IsNull( pSfr))
|
||||
return nullptr ;
|
||||
@@ -2040,7 +2089,7 @@ WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ISurfFlatRegion*
|
||||
WaterJetting::GenerateLeadOutPreview( const ICurveComposite* pCompo)
|
||||
WaterJetting::GenerateLeadOutPreview( const ICurveComposite* pCompo, const Vector3d& vtN)
|
||||
{
|
||||
// Creo la regione
|
||||
PtrOwner<ISurfFlatRegion> pSfr( CreateSurfFlatRegion()) ;
|
||||
@@ -2070,8 +2119,6 @@ WaterJetting::GenerateLeadOutPreview( const ICurveComposite* pCompo)
|
||||
// Recupero punto e direzione iniziali del percorso
|
||||
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtEnd ; pCompo->GetEndDir( vtEnd) ;
|
||||
// Recupero versore estrusione
|
||||
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
|
||||
// Calcolo la curva di uscita
|
||||
PtrOwner<ICurve> pCrv ;
|
||||
switch ( nType) {
|
||||
@@ -2113,55 +2160,61 @@ WaterJetting::AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* p
|
||||
for ( int i = 1 ; i <= nMaxInd ; ++ i) {
|
||||
// curva corrente
|
||||
const ICurve* pCrvC = pCompo->GetCurve( i) ;
|
||||
// Recupero versore estrusione
|
||||
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
|
||||
// direzione finale precedente
|
||||
// curva precedente
|
||||
const ICurve* pCrvP = pCompo->GetCurve( i - 1) ;
|
||||
// verifico che tratti abbiano lunghezza sufficiente per gestione angolo
|
||||
double dLenC ; pCrvC->GetLength( dLenC) ;
|
||||
double dLenP ; pCrvP->GetLength( dLenP) ;
|
||||
if ( dLenC < LEN_TOL || dLenP < LEN_TOL)
|
||||
continue ;
|
||||
// angolo tra direzione finale precedente e direzione iniziale corrente
|
||||
Vector3d vtEnd ; pCrvP->GetEndDir( vtEnd) ;
|
||||
// direzione iniziale corrente
|
||||
Vector3d vtStart ; pCrvC->GetStartDir( vtStart) ;
|
||||
// angolo tra le direzioni
|
||||
double dAng ; vtEnd.GetAngleXY( vtStart, dAng) ;
|
||||
// se previsto e angolo esterno, si aggiunge l'anello
|
||||
if ( m_Params.m_nExtCornerType == WJET_EC_LOOP && IsExternalAngle( dAng)) {
|
||||
// curva dell'anello
|
||||
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo))
|
||||
PtrOwner<ICurveComposite> pLoop( CreateCurveComposite()) ;
|
||||
if ( IsNull( pLoop))
|
||||
return false ;
|
||||
// lunghezza tratti lineari e loro punti estremi
|
||||
double dTgLen = 0.5 * m_TParams.m_dDiam * tan( 0.5 * dAng * DEGTORAD) ;
|
||||
double dTgLen = 0.5 * m_TParams.m_dDiam * tan( 0.5 * abs( dAng) * DEGTORAD) ;
|
||||
if ( m_Params.m_dSideAngle > EPS_ANG_SMALL) {
|
||||
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
|
||||
double dExtraLen = dW / tan( ( 180 - abs( dAng)) / 2 * DEGTORAD) ;
|
||||
double dExtraLen = dW / tan( 0.5 * ( 180 - abs( dAng)) * DEGTORAD) ;
|
||||
dTgLen += dExtraLen ;
|
||||
}
|
||||
Point3d ptP ; pCrvC->GetStartPoint( ptP) ;
|
||||
Point3d ptPe = ptP + vtEnd * dTgLen ;
|
||||
Point3d ptPs = ptP - vtStart * dTgLen ;
|
||||
// tratto prima dell'anello
|
||||
if ( ! pCompo->AddPoint( ptP) || ! pCompo->AddLine( ptPe))
|
||||
if ( ! pLoop->AddPoint( ptP) || ! pLoop->AddLine( ptPe))
|
||||
return false ;
|
||||
// anello
|
||||
if ( ! pCompo->AddArcTg( ptPs))
|
||||
if ( ! pLoop->AddArcTg( ptPs))
|
||||
return false ;
|
||||
// verifico che l'anello non interferisca con la curva di lavoro
|
||||
IntersCurveCurve intAC( *pLoop->GetLastCurve(), *pCompo) ;
|
||||
if ( intAC.GetIntersCount() > 0)
|
||||
continue ;
|
||||
// tratto dopo l'anello
|
||||
if ( ! pCompo->AddLine( ptP))
|
||||
if ( ! pLoop->AddLine( ptP))
|
||||
return false ;
|
||||
// lo porto in antiorario
|
||||
double dArea ;
|
||||
if ( ! pCompo->GetAreaXY( dArea))
|
||||
if ( ! pLoop->GetAreaXY( dArea))
|
||||
return false ;
|
||||
if ( dArea < 0)
|
||||
pCompo->Invert() ;
|
||||
pLoop->Invert() ;
|
||||
// ne eseguo l'offset
|
||||
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
|
||||
double Rad = 0.49 * m_TParams.m_dDiam * dSideCoeff ; // non 0.5 per evitare problemi di coincidenza
|
||||
if ( ! pCompo->SimpleOffset( Rad, ICurve::OFF_FILLET))
|
||||
if ( ! pLoop->SimpleOffset( Rad, ICurve::OFF_FILLET))
|
||||
return false ;
|
||||
// calcolo la regione
|
||||
PtrOwner<ISurfFlatRegion> pSfr ;
|
||||
SurfFlatRegionByContours SfrCntr ;
|
||||
SfrCntr.AddCurve( Release( pCompo)) ;
|
||||
SfrCntr.AddCurve( Release( pLoop)) ;
|
||||
pSfr.Set( SfrCntr.GetSurf()) ;
|
||||
// Unisco le due regioni
|
||||
if ( IsNull( pSfr) || ! pSPV->Add( *pSfr))
|
||||
@@ -2230,7 +2283,7 @@ WaterJetting::AdjustPathForInternalAngles( ICurveComposite* pCompo)
|
||||
double dExtraLen = dSlowLen + INTANG_ROT_LEN - dLen ;
|
||||
if ( dExtraLen > 0) {
|
||||
// se entità successiva è in tangenza e abbastanza lunga, allungo la corrente a scapito della successiva
|
||||
if ( ! bNextIntAng && dNextLen > dExtraLen) {
|
||||
if ( abs( dNextAng) < EPS_ANG_SMALL && dNextLen > dExtraLen) {
|
||||
double dU ; Point3d ptP ;
|
||||
if ( pCrvN->GetParamAtLength( dExtraLen, dU) &&
|
||||
pCrvN->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP))
|
||||
@@ -2247,7 +2300,7 @@ WaterJetting::AdjustPathForInternalAngles( ICurveComposite* pCompo)
|
||||
double dExtraLen = dSlowLen + INTANG_ROT_LEN - dLen ;
|
||||
if ( dExtraLen > 0) {
|
||||
// se entità precedente è in tangenza e abbastanza lunga, allungo la corrente a scapito della precedente
|
||||
if ( ! bPrevIntAng && dPrevLen > dExtraLen) {
|
||||
if ( abs( dPrevAng) < EPS_ANG_SMALL && dPrevLen > dExtraLen) {
|
||||
double dU ; Point3d ptP ;
|
||||
if ( pCrvP->GetParamAtLength( dPrevLen - dExtraLen, dU) &&
|
||||
pCrvP->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP))
|
||||
@@ -2266,13 +2319,12 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
{
|
||||
// numero punti di accelerazione/decelerazione
|
||||
const int ACC_PNT_NUM = 7 ;
|
||||
// lunghezza minima per poter suddividere con punti di accelerazione/decelerazione
|
||||
const double MIN_ACC_LEN = 1.0 ;
|
||||
|
||||
// recupero distanze di sicurezza
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
|
||||
// Recupero versore estrusione
|
||||
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
|
||||
|
||||
// verifico se la curva è chiusa a meno di eventuale dAddedOverlap
|
||||
bool bClosed = ( pCompo->IsClosed() || dAddedOverlap > EPS_SMALL) ;
|
||||
|
||||
@@ -2287,6 +2339,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
PtrOwner<ICurve> pCurve( pCrvC->Clone()) ;
|
||||
if ( IsNull( pCurve))
|
||||
return false ;
|
||||
double dLen ; pCurve->GetLength( dLen) ;
|
||||
double dUprev = 0 ;
|
||||
bool bSlowFull = false ; // modalità speciale per angoli interni con rallentamento uniforme su tutta l'entità
|
||||
// se prima entità, approccio e affondo
|
||||
@@ -2322,19 +2375,23 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
// direzione finale precedente
|
||||
const ICurve* pCrvP = pCompo->GetCurve( i - 1) ;
|
||||
Vector3d vtEnd ; pCrvP->GetEndDir( vtEnd) ;
|
||||
double dLenP ; pCrvP->GetLength( dLenP) ;
|
||||
// direzione iniziale corrente
|
||||
Vector3d vtStart ; pCrvC->GetStartDir( vtStart) ;
|
||||
// angolo tra le direzioni
|
||||
double dAng ;
|
||||
double dAng = 0 ;
|
||||
vtEnd.GetAngleXY( vtStart, dAng) ;
|
||||
// se tratto sotto la tolleranza, ignoro la gestione dell'angolo
|
||||
if ( dLen < LEN_TOL || dLenP < LEN_TOL)
|
||||
dAng = 0 ;
|
||||
// Se angolo esterno e richiesto anello esterno
|
||||
if ( IsExternalAngle( dAng) && m_Params.m_nExtCornerType == WJET_EC_LOOP) {
|
||||
// lunghezza tratti lineari
|
||||
double dTgLen = 0.5 * m_TParams.m_dDiam * tan( 0.5 * dAng * DEGTORAD) ;
|
||||
double dTgLen = 0.5 * m_TParams.m_dDiam * tan( 0.5 * abs( dAng) * DEGTORAD) ;
|
||||
if ( m_Params.m_dSideAngle > EPS_ANG_SMALL) {
|
||||
// se inclinazione positiva calcolo di quanto deve uscire per non rovinare lo spigolo
|
||||
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
|
||||
double dExtraLen = dW / tan( ( 180 - abs( dAng)) / 2 * DEGTORAD) ;
|
||||
double dExtraLen = dW / tan( 0.5 * ( 180 - abs( dAng)) * DEGTORAD) ;
|
||||
dTgLen += dExtraLen ;
|
||||
}
|
||||
// calcolo punti estremi
|
||||
@@ -2348,31 +2405,42 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
return false ;
|
||||
|
||||
// anello
|
||||
PtrOwner<ICurve> pCrvA( GetArc2PVN( ptPe, ptPs, vtEnd, vtN)) ;
|
||||
bool bLoopOk = true ;
|
||||
PtrOwner<ICurve> pCrvA( GetArc2PVN( ptPe, ptPs, vtEnd, vtTool)) ;
|
||||
if ( ! IsNull( pCrvA) && pCrvA->GetType() == CRV_ARC) {
|
||||
// suddivido l'anello in due parti per forzare il passaggio dalla posizione vtTool = Z_AX
|
||||
PtrOwner<ICurveComposite> pCompoArc( ConvertCurveToComposite( Release( ( pCrvA)))) ;
|
||||
if ( IsNull( pCompoArc))
|
||||
return false ;
|
||||
if ( pCompoArc->AddJoint( 0.5)) {
|
||||
// aggiungo il primo tratto
|
||||
Vector3d vtCorr = CalcCorrDir( pCompoArc, 1) ;
|
||||
SetToolCorrAuxDir( Z_AX, vtCorr) ;
|
||||
if ( AddCurveMove( pCompoArc->GetCurve(0), bSplitArcs) == GDB_ID_NULL)
|
||||
// verifico che l'anello non interferisca con la curva di lavoro
|
||||
IntersCurveCurve intAC( *pCrvA, *pCompo) ;
|
||||
if ( intAC.GetIntersCount() == 0) {
|
||||
// suddivido l'anello in due parti per forzare il passaggio dalla posizione vtTool = Z_AX
|
||||
PtrOwner<ICurveComposite> pCompoArc( ConvertCurveToComposite( Release( ( pCrvA)))) ;
|
||||
if ( IsNull( pCompoArc))
|
||||
return false ;
|
||||
// aggiungo secondo tratto
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i + 0.5) ;
|
||||
if ( AddCurveMove( pCompoArc->GetCurve(1), bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( pCompoArc->AddJoint( 0.5)) {
|
||||
// aggiungo il primo tratto
|
||||
Vector3d vtCorr = CalcCorrDir( pCompoArc, 1) ;
|
||||
SetToolCorrAuxDir( Z_AX, vtCorr) ;
|
||||
if ( AddCurveMove( pCompoArc->GetCurve( 0), bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// aggiungo secondo tratto
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i + 0.5) ;
|
||||
if ( AddCurveMove( pCompoArc->GetCurve( 1), bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
// se non è possibile suddividere anello
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i + 0.5) ;
|
||||
if ( AddCurveMove( pCompoArc, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// se non è possibile suddividere anello
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i + 0.5) ;
|
||||
if ( AddCurveMove( pCompoArc, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
bLoopOk = false ;
|
||||
}
|
||||
else {
|
||||
else
|
||||
bLoopOk = false ;
|
||||
|
||||
// se anello non possibile
|
||||
if ( ! bLoopOk) {
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i + 0.5) ;
|
||||
if ( AddLinearMove( ptPs, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
@@ -2391,9 +2459,12 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
// Feed ridotta
|
||||
double dMinFeed = GetActualReducedFeed() ;
|
||||
// ciclo sui punti di accelerazione
|
||||
for ( int j = 1 ; j <= ACC_PNT_NUM ; ++ j) {
|
||||
double dCoeff = j / double( ACC_PNT_NUM) ;
|
||||
double dU ; pCrvC->GetParamAtLength( dCoeff * dAccLen, dU) ;
|
||||
int nAccPntNum = dAccLen > MIN_ACC_LEN - EPS_SMALL ? ACC_PNT_NUM : 1 ;
|
||||
for ( int j = 1 ; j <= nAccPntNum ; ++ j) {
|
||||
double dCoeff = j / double( nAccPntNum) ;
|
||||
double dU = dUprev ; pCrvC->GetParamAtLength( dCoeff * dAccLen, dU) ;
|
||||
if ( abs( dU - dUprev) < EPS_SMALL)
|
||||
continue ;
|
||||
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
|
||||
if ( IsNull( pCrvT) || ! pCrvT->TrimStartEndAtParam( dUprev, dU))
|
||||
return false ;
|
||||
@@ -2434,15 +2505,19 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
}
|
||||
}
|
||||
if ( ! bSlowFull) {
|
||||
dAccLen = min( dFreeLen / 2 - EXTRA_ACC_LEN, ( bReduceFeed ? m_Params.m_dCornerSlowLen : INTANG_ROT_LEN)) ;
|
||||
double dMinLen = dFreeLen / 2 - EXTRA_ACC_LEN ;
|
||||
if ( dMinLen < EPS_SMALL && abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL)
|
||||
dMinLen = dFreeLen / 2 ;
|
||||
dAccLen = min( dMinLen, ( bReduceFeed ? m_Params.m_dCornerSlowLen : INTANG_ROT_LEN)) ;
|
||||
if ( m_Params.m_dSideAngle > 0) {
|
||||
// verifico sia rispettata la lunghezza minima per non rovinare l'angolo
|
||||
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
|
||||
double dSlowLen = dW / tan( ( 180 - abs( dAng)) / 2 * DEGTORAD) ;
|
||||
if ( dSlowLen > dFreeLen - EXTRA_ACC_LEN) {
|
||||
if ( dSlowLen > dFreeLen + EPS_SMALL) {
|
||||
m_pMchMgr->SetLastError( 3204, "Error in WaterJetting : entity too small near inside corner") ;
|
||||
return false ;
|
||||
}
|
||||
dAccLen = min( dSlowLen + m_Params.m_dCornerSlowLen, dFreeLen - EXTRA_ACC_LEN) ;
|
||||
dAccLen = max( dAccLen, dSlowLen) ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2453,13 +2528,14 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
double dUend ; pCrvC->GetParamAtLength( dAccLen, dUend) ;
|
||||
Vector3d vtTp = CalcToolDir( pCompo, i + dUsta) ;
|
||||
Vector3d vtTn = CalcToolDir( pCompo, i + dUend) ;
|
||||
int nAccPntNum = dAccLen > MIN_ACC_LEN - EPS_SMALL ? ACC_PNT_NUM : 1 ;
|
||||
// ciclo sui punti di accelerazione
|
||||
for ( int j = 1 ; j <= ACC_PNT_NUM ; ++ j) {
|
||||
double dCoeff = j / double( ACC_PNT_NUM) ;
|
||||
double dU ; pCrvC->GetParamAtLength( dCoeff * dAccLen, dU) ;
|
||||
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
|
||||
for ( int j = 1 ; j <= nAccPntNum ; ++ j) {
|
||||
double dCoeff = j / double( nAccPntNum) ;
|
||||
double dU = dUprev ; pCrvC->GetParamAtLength( dCoeff * dAccLen, dU) ;
|
||||
if ( abs( dUprev - dU) < EPS_SMALL)
|
||||
continue ;
|
||||
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
|
||||
if ( IsNull( pCrvT) || ! pCrvT->TrimStartEndAtParam( dUprev, dU))
|
||||
return false ;
|
||||
Vector3d vtTool = ( 1 - dCoeff) * vtTp + dCoeff * vtTn ;
|
||||
@@ -2485,8 +2561,13 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
// direzione iniziale successiva
|
||||
const ICurve* pCrvN = pCompo->GetCurve( i + 1) ;
|
||||
Vector3d vtStart ; pCrvN->GetStartDir( vtStart) ;
|
||||
double dLenN ; pCrvN->GetLength( dLenN) ;
|
||||
// angolo tra le direzioni
|
||||
double dAng ; vtEnd.GetAngleXY( vtStart, dAng) ;
|
||||
double dAng = 0 ;
|
||||
vtEnd.GetAngleXY( vtStart, dAng) ;
|
||||
// se tratto sotto la tolleranza, ignoro la gestione dell'angolo
|
||||
if ( dLen < LEN_TOL || dLenN < LEN_TOL)
|
||||
dAng = 0 ;
|
||||
// se angolo esterno e richiesto rallentamento esterno, aggiungo decelerazione
|
||||
if ( IsExternalAngle( dAng) && m_Params.m_nExtCornerType == WJET_EC_SLOW) {
|
||||
// lunghezza entità
|
||||
@@ -2496,9 +2577,10 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
// Feed ridotta
|
||||
double dMinFeed = GetActualReducedFeed() ;
|
||||
// ciclo sui punti di decelerazione
|
||||
for ( int j = 0 ; j < ACC_PNT_NUM ; ++ j) {
|
||||
double dCoeff = j / double( ACC_PNT_NUM) ;
|
||||
double dU ; pCrvC->GetParamAtLength( dLen - ( 1 - dCoeff) * dAccLen, dU) ;
|
||||
int nAccPntNum = dAccLen > MIN_ACC_LEN - EPS_SMALL ? ACC_PNT_NUM : 1 ;
|
||||
for ( int j = 0 ; j < nAccPntNum ; ++ j) {
|
||||
double dCoeff = j / double( nAccPntNum) ;
|
||||
double dU = dUprev ; pCrvC->GetParamAtLength( dLen - ( 1 - dCoeff) * dAccLen, dU) ;
|
||||
if ( abs( dUprev - dU) < EPS_SMALL)
|
||||
continue ;
|
||||
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
|
||||
@@ -2524,46 +2606,49 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
|
||||
// se prima entità e modalità WJET_IC_SLOW_FULL verifico se davvero applicabile controllando angolo con ultima entità
|
||||
if ( i == 0 && m_Params.m_nIntCornerType == WJET_IC_SLOW_FULL) {
|
||||
bSlowFull = true ;
|
||||
if ( bClosed) {
|
||||
// creo una copia della curva senza l'overlap aggiunto
|
||||
PtrOwner<ICurveComposite> pCrvTmp( pCompo->Clone()) ;
|
||||
double dLen ; pCrvTmp->GetLength( dLen) ;
|
||||
if ( IsNull( pCrvTmp) || ! pCrvTmp->TrimEndAtLen( dLen - dAddedOverlap))
|
||||
return false ;
|
||||
// verifico che anche angolo sullo start della curva sia di tipo prev
|
||||
const ICurve* pCrvLast = pCrvTmp->GetLastCurve() ;
|
||||
Vector3d vtStart ; pCurve->GetStartDir( vtStart) ;
|
||||
Vector3d vtEnd ; pCrvLast->GetEndDir( vtEnd) ;
|
||||
if ( AreSameVectorApprox( vtStart, vtEnd)) {
|
||||
// se curve in tangenza controllo angolo tra l'ultima e la penultima curva
|
||||
int nCrvNbr = pCrvTmp->GetCurveCount() ;
|
||||
const ICurve* pCrvP = pCrvTmp->GetCurve( nCrvNbr - 2) ;
|
||||
pCrvLast->GetStartDir( vtStart) ;
|
||||
pCrvP->GetEndDir( vtEnd) ;
|
||||
}
|
||||
// se angolo precedente non è interno il tratto non va realizzato in modalità full
|
||||
double dAngPrev ; vtEnd.GetAngleXY( vtStart, dAngPrev) ;
|
||||
if ( ! IsInternalAngle( dAngPrev))
|
||||
bSlowFull = false ;
|
||||
}
|
||||
// salvo il valore per l'ultima entità
|
||||
bStartSlowFull = bSlowFull ;
|
||||
bSlowFull = true ;
|
||||
if ( bClosed) {
|
||||
// creo una copia della curva senza l'overlap aggiunto
|
||||
PtrOwner<ICurveComposite> pCrvTmp( pCompo->Clone()) ;
|
||||
double dLen ; pCrvTmp->GetLength( dLen) ;
|
||||
if ( IsNull( pCrvTmp) || ! pCrvTmp->TrimEndAtLen( dLen - dAddedOverlap))
|
||||
return false ;
|
||||
// verifico che anche angolo sullo start della curva sia di tipo prev
|
||||
const ICurve* pCrvLast = pCrvTmp->GetLastCurve() ;
|
||||
Vector3d vtStart ; pCurve->GetStartDir( vtStart) ;
|
||||
Vector3d vtEnd ; pCrvLast->GetEndDir( vtEnd) ;
|
||||
if ( AreSameVectorApprox( vtStart, vtEnd)) {
|
||||
// se curve in tangenza controllo angolo tra l'ultima e la penultima curva
|
||||
int nCrvNbr = pCrvTmp->GetCurveCount() ;
|
||||
const ICurve* pCrvP = pCrvTmp->GetCurve( nCrvNbr - 2) ;
|
||||
pCrvLast->GetStartDir( vtStart) ;
|
||||
pCrvP->GetEndDir( vtEnd) ;
|
||||
}
|
||||
// se angolo precedente non è interno il tratto non va realizzato in modalità full
|
||||
double dAngPrev ; vtEnd.GetAngleXY( vtStart, dAngPrev) ;
|
||||
if ( ! IsInternalAngle( dAngPrev))
|
||||
bSlowFull = false ;
|
||||
}
|
||||
// salvo il valore per l'ultima entità
|
||||
bStartSlowFull = bSlowFull ;
|
||||
}
|
||||
|
||||
if ( bSlowFull)
|
||||
// sfrutto tutta la lunghezza a disposizone
|
||||
dAccLen = dFreeLen ;
|
||||
else {
|
||||
dAccLen = min( dFreeLen - EXTRA_ACC_LEN, ( bReduceFeed ? m_Params.m_dCornerSlowLen : INTANG_ROT_LEN)) ;
|
||||
double dMinLen = dFreeLen - EXTRA_ACC_LEN ;
|
||||
if ( dMinLen < EPS_SMALL && abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL)
|
||||
dMinLen = dFreeLen ;
|
||||
dAccLen = min( dMinLen, ( bReduceFeed ? m_Params.m_dCornerSlowLen : INTANG_ROT_LEN)) ;
|
||||
if ( m_Params.m_dSideAngle > 0) {
|
||||
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
|
||||
double dSlowLen = dW / tan( ( 180 - abs( dAng)) / 2 * DEGTORAD) ;
|
||||
if ( dSlowLen > dFreeLen - EXTRA_ACC_LEN) {
|
||||
if ( dSlowLen > dFreeLen + EPS_SMALL) {
|
||||
m_pMchMgr->SetLastError( 3204, "Error in WaterJetting : entity too small near inside corner") ;
|
||||
return false ;
|
||||
}
|
||||
dAccLen = min( dSlowLen + m_Params.m_dCornerSlowLen, dFreeLen - EXTRA_ACC_LEN) ;
|
||||
dAccLen = max( dAccLen, dSlowLen) ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2574,10 +2659,11 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
double dUend = 1 ;
|
||||
Vector3d vtTp = CalcToolDir( pCompo, i + dUsta) ;
|
||||
Vector3d vtTn = CalcToolDir( pCompo, i + dUend) ;
|
||||
int nAccPntNum = dAccLen > MIN_ACC_LEN - EPS_SMALL ? ACC_PNT_NUM : 1 ;
|
||||
// ciclo sui punti di decelerazione
|
||||
for ( int j = 0 ; j < ACC_PNT_NUM ; ++ j) {
|
||||
double dCoeff = j / double( ACC_PNT_NUM) ;
|
||||
double dU ; pCrvC->GetParamAtLength( dLen - ( 1 - dCoeff) * dAccLen, dU) ;
|
||||
for ( int j = 0 ; j < nAccPntNum ; ++ j) {
|
||||
double dCoeff = j / double( nAccPntNum) ;
|
||||
double dU = dUprev ; pCrvC->GetParamAtLength( dLen - ( 1 - dCoeff) * dAccLen, dU) ;
|
||||
if ( abs( dUprev - dU) < EPS_SMALL)
|
||||
continue ;
|
||||
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
|
||||
@@ -3023,11 +3109,17 @@ WaterJetting::CalcOffset( ICurveComposite* pCompo, double dSignOffs)
|
||||
if ( pCompo->IsClosed()) {
|
||||
Vector3d vtStart ; pCompo->GetStartDir( vtStart) ;
|
||||
Vector3d vtEnd ; pCompo->GetEndDir( vtEnd) ;
|
||||
if ( ! AreSameVectorEpsilon( vtStart, vtEnd, sin( 5 * DEGTORAD)))
|
||||
nFlag |= ICurve::OFF_FORCE_OPEN ;
|
||||
if ( ! AreSameVectorEpsilon( vtStart, vtEnd, sin( 5 * DEGTORAD))) {
|
||||
// se spigolo forzo apertura solo se è loop esterno
|
||||
double dArea = 0 ; pCompo->GetAreaXY( dArea) ;
|
||||
if ( ( dArea > 0 && m_Params.m_nWorkSide == WJET_WS_RIGHT) ||
|
||||
( dArea < 0 && m_Params.m_nWorkSide == WJET_WS_LEFT))
|
||||
nFlag |= ICurve::OFF_FORCE_OPEN ;
|
||||
}
|
||||
}
|
||||
// eseguo offset semplice
|
||||
if ( pCompo->SimpleOffset( dSignOffs, nFlag))
|
||||
constexpr double MAX_ANG_EXT = 135 ;
|
||||
if ( pCompo->SimpleOffset( dSignOffs, nFlag, MAX_ANG_EXT))
|
||||
return true ;
|
||||
// se curva piatta, provo con offset avanzato
|
||||
bool bOk = false ;
|
||||
@@ -3037,11 +3129,17 @@ WaterJetting::CalcOffset( ICurveComposite* pCompo, double dSignOffs)
|
||||
if ( OffsCrv.Make( pCompo, dSignOffs, nFlag)) {
|
||||
ICurve* pOffs = OffsCrv.GetLongerCurve() ;
|
||||
if ( pOffs != nullptr) {
|
||||
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
|
||||
Vector3d vtExtr ; pCompo->GetExtrusion( vtExtr) ;
|
||||
pCompo->Clear() ;
|
||||
pCompo->AddCurve( pOffs) ;
|
||||
// ripristino estrusione della curva compo ( rimossa dal Clear)
|
||||
pCompo->SetExtrusion( vtExtr) ;
|
||||
// ripristino punto iniziale
|
||||
double dPar ;
|
||||
int nFlagDist ;
|
||||
if ( DistPointCurve( ptStart, *pCompo).GetParamAtMinDistPoint( 0, dPar, nFlagDist))
|
||||
pCompo->ChangeStartPoint( dPar) ;
|
||||
bOk = true ;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -67,7 +67,7 @@ class WaterJetting : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
@@ -78,13 +78,13 @@ class WaterJetting : public Machining
|
||||
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
|
||||
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
|
||||
bool Chain( int nGrpDestId) ;
|
||||
bool AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs, SELVECTOR& vInds) ;
|
||||
bool AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs) ;
|
||||
bool VerifySideAngle( void) ;
|
||||
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
|
||||
bool AdjustPathForInternalAngles( ICurveComposite* pCompo) ;
|
||||
bool GeneratePreView( int nPathId, const ICurveComposite* pCompo, double dAddedOverlap) ;
|
||||
ISurfFlatRegion* GenerateLeadInPreview( const ICurveComposite* pCompo) ;
|
||||
ISurfFlatRegion* GenerateLeadOutPreview( const ICurveComposite* pCompo) ;
|
||||
bool GeneratePreView( int nPathId, const ICurveComposite* pCompo, const Vector3d& vtTool, double dAddedOverlap) ;
|
||||
ISurfFlatRegion* GenerateLeadInPreview( const ICurveComposite* pCompo, const Vector3d& vtN, bool bClosed) ;
|
||||
ISurfFlatRegion* GenerateLeadOutPreview( const ICurveComposite* pCompo, const Vector3d& vtN) ;
|
||||
bool AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
|
||||
bool AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool, bool bSplitArcs, double dAddedOverlap) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, bool bSplit) ;
|
||||
|
||||
Reference in New Issue
Block a user