72 Commits

Author SHA1 Message Date
Dario Sassi 01fda01f1a Merge branch 'master' of https://gitlab.steamware.net/egalware-cadcam/libreriebase/EgtMachKernel 2026-05-14 18:45:18 +02:00
Dario Sassi cd55865151 EgtMachKernel :
- corretta gestione assi rotanti bloccati (ora non più ammessi eventuali 360deg di offset)
- corretto default di cono per direzione singolare (sempre 0.01 deg).
2026-05-14 18:44:25 +02:00
Riccardo Elitropi bfe3fc1267 EgtMachKernel :
- In PocketingNT aggiunta gestione per ToolCompensation.
2026-05-14 15:25:56 +02:00
Dario Sassi f0e295d9d6 EgtMachKernel 3.1e3 :
- ricompilazione con cambio versione.
2026-05-12 09:49:18 +02:00
Riccardo Elitropi 1b97ec5310 EgtMachKernel :
- in PocketingNT, SurfFinishing e SurfRoughing aggiunto flag per Conventional Milling per curve di svuotatura singole.
2026-05-11 10:03:58 +02:00
SaraP 66c7aa5d0c EgtMachKernel :
- in PocketingData aggiunti i parametri degli epicicli in alcune funzioni dove mancavano.
2026-05-08 15:24:12 +02:00
Riccardo Elitropi 5699de3954 EgtMachkernel :
- in SurfRoughing piccola correzione per le Fixture.
2026-05-08 13:15:02 +02:00
Dario Sassi 4a1ae0de84 EgtMachKernel 3.1e2 :
- correzione scelta angoli più vicini a iniziale quando imposto anche MaxDeltaR2OnFirst
- correzione gestione soluzione indeterminata quando si è nel cono dichiarato di singolarità.
2026-05-08 11:11:20 +02:00
Riccardo Elitropi ac45a259b6 EgtMachKernel 3.1e1 :
- In PocketingNT aggiunta gestione lavorazioni in Doppio in Parallelo.
2026-05-04 17:13:00 +02:00
Dario Sassi f7251bf3bd EgtMachKernel :
- in simulazione Trace sta sull'uscita della testa se nel suo gruppo si mette la info OnExit=1.
2026-05-03 19:33:55 +02:00
Riccardo Elitropi ed1cd66164 EgtMachKernel 3.1d7 :
- in NewLink in SpecialLink() aggiunto parametro OTHERLINKTYPE per gestione lavorazioni in doppio
- Aggiunto controllo "Home" per Add/Remove Climb/Rise.
2026-04-30 14:36:03 +02:00
Dario Sassi 054dc530fb EgtMachKernel :
- modifica in fresatura per asse Aux da UserNotes anche con fresa centrata.
2026-04-28 13:21:16 +02:00
Riccardo Elitropi 9534c0342d EgtMachKernel :
- in PocketingNT aggiunto controllo per evitare di Trimmare con il grezzo le superfici di svuotatura riferite a percorsi Ottimizzati per Fori.
2026-04-28 11:06:21 +02:00
Riccardo Elitropi bf602419fc EgtMachKernel :
- in PocketingNT migliorate le entrate a ZigZag.
2026-04-23 17:08:53 +02:00
Riccardo Elitropi e1ef39ad72 EgtMachKernel :
- in MachConst aggiunte Key per lettura da file .ini della macchina per Drilling in doppio in parallelo e per calcolo Feeds in PocketingNT
- in Drilling migliorate le considerazioni per lavorazioni in Doppio con possibilità di movimenti in parallelo per gli utensili
- in Preview Utensile corretta la posizione del secondo Tool in caso di lavorazioni in doppio con utensili di lunghezza differente
- in Machining aggiunta la funzione per calcolare il piano di Mirroring
- in PocketingNT aggiunta la lettura dal file .ini della macchina per calcolo delle Feeds.
2026-04-22 13:16:17 +02:00
Riccardo Elitropi 8648a2c61b EgtMachKernel :
- in Machining corretta gestione di Preview utensile per lavorazioni in doppio.
2026-04-21 08:39:58 +02:00
Riccardo Elitropi 96c96383c3 EgtMachKernel :
- in Sgrossature aggiunti i controlli sulle Feed per gli ingressi.
2026-04-20 17:09:12 +02:00
Riccardo Elitropi f3ea5fed05 EgtMachKernel 3.1d6 :
- in PocketingNT aggiunto il parametro da note utenti "MinFeed"
- in PocketingNT corrette le Feed per gli ingressi.
2026-04-20 14:59:21 +02:00
Dario Sassi a4831980e7 EgtMachKernel :
- piccoli aggiustamenti.
2026-04-19 10:54:10 +02:00
Dario Sassi ec78d61f63 Merge branch 'master' of https://gitlab.steamware.net/egalware-cadcam/libreriebase/EgtMachKernel 2026-04-17 17:31:15 +02:00
Dario Sassi e8e757d4bd EgtMachKernel :
- corretto Double di CamData con arco (non faceva il mirror della normale)
- in CL aggiunto info su tipo di catena cinematica (KINTYPE=0/1/2).
2026-04-17 17:30:35 +02:00
Riccardo Elitropi 1dc0206bea EgtMachKernel :
- in Drilling in Doppio corretta la Feed nei movimenti in parallelo.
2026-04-17 15:27:28 +02:00
Dario Sassi 614532c2a0 EgtMachKernel 3.1d5 :
- aggiunta impostazione variabile EMT.DBLPATHID anche per generazione e simulazione quando è il caso.
2026-04-17 11:50:52 +02:00
Dario Sassi 20b56583c3 EgtMachKernel 3.1d4 :
- in fresatura con lama a ZigZag con SideStep correzione per attacco/uscita sbagliati con numero pari di step.
2026-04-15 19:03:44 +02:00
Riccardo Elitropi 47951fc21e EgtMachKernel :
- in PocketingNT aggiunta gestione di Superfici TriMesh con lati chiusi trimmati su più lati del grezzo.
2026-04-14 19:10:57 +02:00
Dario Sassi 932700d4b2 EgtMachKernel :
- corretta AddRobotClimb (aggiungeva entità in posizione non corretta)
- aggiunta gestione soluzione indeterminata con tre assi rotanti liberi.
2026-04-09 20:17:50 +02:00
Dario Sassi 40f1e051a4 EgtMachKernel 3.1d3 :
- piccole razionalizzazioni.
2026-04-09 09:47:25 +02:00
Riccardo Elitropi c3542be20a Merge commit 'e1c69e207dc2b46b5c1a1cb24d7aef223d69d15b' 2026-04-09 08:17:43 +02:00
Riccardo Elitropi e1c69e207d Merge commit '67b34008c514359dc8ef3c440de02127f970b0ed' into NewLink 2026-04-09 08:16:55 +02:00
Dario Sassi 67b34008c5 EgtMachKernel 3.1d2 :
- migliorata gestione Versore Direzione Ausiliaria per robot e centri di lavoro
- aggiunta anche a sgrossatura e finitura superfici.
2026-04-08 14:49:54 +02:00
Riccardo Elitropi 1bb839e9f4 Merge commit '083f896d50e8f859d8aa77b41586a87f9fd7ddb6' into NewLink 2026-04-08 10:25:13 +02:00
Riccardo Elitropi 083f896d50 EgtMachKernel :
- in pocketingNT aggiunta memorizzazione SelId al gruppo PathId corrente.
2026-04-08 09:45:36 +02:00
Dario Sassi 83c83fb5f0 EgtMacheKernel :
- aggiunta gestione calcolo angoli di macchine con tre assi rotanti liberi (di tipo ZYZ o equivalenti) purchè fornito versore ausiliario
- aggiunta possibilità di impostare versore ausiliario tramite UserNotes (VtAuxDir=Vx,Vy,Vz) in fresature, svuotature e forature con punta singola.
2026-04-07 17:50:13 +02:00
Riccardo Elitropi b577dfe86b EgtMachKernel :
- modifica nomi gruppi Paths per Sgrossature e PocketingNT sotto al gruppo CL.
In Sgrossature e Finiture migliorati i controlli sulla semplificazione delle curve mediante frame Locale.
2026-04-07 14:49:34 +02:00
Dario Sassi 624bc499a2 EgtMachKernel :
- in fresatura e taglio di lama portate info di Start, End, Extr e Elev anche nei gruppi P1, P2, ... di Preview
- in simulazione migliorato nascondere della traccia utensile.
2026-04-06 09:59:00 +02:00
Riccardo Elitropi 79e1e9fefd EgtMachKernel :
- in Preview utensile piccole modifiche e migliorie.
2026-04-03 16:21:53 +02:00
Riccardo Elitropi dcb3e6984f EgtMachKernel (NewLink) :
- Piccola correzione per passaggio parametro StartZMax per ultima lavorazione ( sia singola che in doppio).
2026-04-03 15:24:42 +02:00
Riccardo Elitropi 0722c496ac EgtMachKernel :
- in PocketingNT corretto parametro SideStep per Lucidature.
2026-04-03 11:07:27 +02:00
Riccardo Elitropi 04a252418c Merge commit '7dd75bc14bf47dbc51873e1a0231d64aa4c6cd06' into NewLink 2026-04-03 07:49:43 +02:00
Riccardo Elitropi 7dd75bc14b EgtMachKernel :
- piccola correzione in SurfRoughing per ordine ZChunk con un solo piano di svuotatura.
2026-04-02 12:41:53 +02:00
Riccardo Elitropi 3a6da43acc EgtMachKernel 4.1d1 :
- in Sgrossature aggiunto il parametro Overlap.
2026-04-01 18:01:28 +02:00
Dario Sassi dd45642748 EgtMachKernel :
- modifica a Preview di WaterJetting per permettere magnetico di pezzi con questa lavorazione.
2026-04-01 10:20:44 +02:00
Riccardo Elitropi 97e95741b9 Merge commit '73739a293149f41d60b7b75f480cc00b1f5b243d' into NewLink 2026-03-31 19:03:52 +02:00
Riccardo Elitropi 73739a2931 EgtMachKernel :
- in PocketingNT aggiunta gestione lucidature.
2026-03-31 18:55:32 +02:00
Riccardo Elitropi 690c53a5dc Merge commit 'f9964a2f3c6501ef5005acdc764dae9b2c4b9775' into NewLink 2026-03-30 15:28:25 +02:00
Dario Sassi f9964a2f3c EgtMachKernel 3.1c8 :
- piccola miglioria in simulatori per log di errori.
2026-03-30 08:04:59 +02:00
Riccardo Elitropi 39b5434c22 EgtMachKernel (NewLink) :
- correzione per disposizioni con Path(s) esistenti.
2026-03-27 18:41:45 +01:00
Riccardo Elitropi 00881757a7 Merge commit '4be087a16d33702218b4ca5437824081e4d3431c' into NewLink 2026-03-26 09:26:41 +01:00
Dario Sassi 4be087a16d EgtMachKernel :
- corretta anteprima WaterJetting (poteva sbagliare disegno ingresso/uscita con geometria senza vettore estrusione).
2026-03-25 19:56:04 +01:00
Dario Sassi b6ef052c50 EgtMachKernel 3.1c7 :
- esportata VerifyOutstroke con angoli da vettore di double
- resa più robusta GetCalcAngles che restituisce due soli assi rotanti (ora i primi due)
- nelle GetCalcAngles ora si applicano gli assi bloccati impostati tramite SetBlockedRotAxis
- consentiti fino a 4 assi rotanti nelle catene cinematiche dei centri di lavoro.
2026-03-25 16:42:53 +01:00
Riccardo Elitropi 1ec2188326 EgtMachKernel (NewLink) :
- aggiunta gestione ZMax.
2026-03-23 17:03:52 +01:00
Riccardo Elitropi 58fe1d1f8f Merge commit '8fed51ca793ba0784e08a787aa8ec157b303df27' into NewLink 2026-03-20 11:23:14 +01:00
Dario Sassi 8fed51ca79 EgtMachKernel :
- aggiunta scrittura nota "EXTR" in Px di CL per SawRoughing e SawFinishing.
2026-03-20 10:40:18 +01:00
Riccardo Elitropi 708fe02b9b EgtMachKernel (NewLink) :
- correzione a funzione SpecialLink e aggiunto parametro a funzione GetDoubleToolData.
2026-03-19 09:52:01 +01:00
Riccardo Elitropi b418e2d3ef Merge commit '0ba49c41eb98e295baa2bc6994a94469cddd3df5' into NewLink 2026-03-18 16:19:59 +01:00
Riccardo Elitropi 0ba49c41eb EgtMachKernel 3.1c6 :
- in MachMgr aggiunte funzioni per ottenere vTDir, vCDir e vADir da entità CamData.
2026-03-18 15:58:43 +01:00
Riccardo Elitropi 4925ab462c EgtMachKernel (NewLink) :
- in SimulatorSP e SimulatorMP aggiunta gestione lavorazioni in doppio per OnPathStart.
2026-03-18 11:06:14 +01:00
Riccardo Elitropi 1f09c33e46 Merge commit 'f0eccf0efc72b360902087e14f3a940497891101' into NewLink 2026-03-18 08:16:11 +01:00
Dario Sassi f0eccf0efc EgtMachKernel :
- in waterjetting portate info di Start, End, Extr e Elev anche in gruppi P1, P2, ... di Preview.
2026-03-16 12:33:11 +01:00
Dario Sassi 6040a7c43d EgtMachKernel :
- colore preview Waterjet Cambiato in TEAL.
2026-03-15 18:27:24 +01:00
Riccardo Elitropi 984f206d56 EgtMachKernel (NewLink) :
- primo commit per codice NewLink.
2026-03-13 17:28:21 +01:00
Riccardo Elitropi 1ba62546b0 EgtMachKernel 3.1c5 :
- in Operation corretta assegnazione entità/camData con Info per funzione AdjustOneStartEndMovement.
2026-03-12 18:20:36 +01:00
Riccardo Elitropi d7712e133e EgtMachKernel 3.1c4 :
- in Drilling in doppio aggiunto flag 105 per movimenti in parallelo.
2026-03-09 11:49:15 +01:00
Riccardo Elitropi 6d6da429e4 EgtMachKernel 3.1c3 :
- in PocketingNT aggiunte info di Extr, Elev, Start ed End al gruppo del percorso.
2026-03-06 12:18:31 +01:00
Riccardo Elitropi aace2ff81d EgtMachKernel :
- in MachiningToolPreview migliorata la visualizzazione delle teste.
2026-03-05 09:52:54 +01:00
Dario Sassi 616026d74e EgtMachKernel :
- piccola miglioria a MachiningToolPreview.
2026-03-04 17:49:59 +01:00
Riccardo Elitropi 00c97b0503 EgtMachKernel 3.1c2 :
- cambio di versione.
2026-03-04 16:05:36 +01:00
Riccardo Elitropi 9a749e0f20 EgtMachKernel :
- in PocketingNT semplificazione e pulizia codice.
2026-03-04 14:59:40 +01:00
Dario Sassi b88c276bb0 EgtMachKernel :
- aggiunta in interfaccia funzione ChangePreviewMachiningToolShow.
2026-03-03 18:33:50 +01:00
Riccardo Elitropi 3b2b185fd1 EgtMachKernel 3.1c1 :
- aggiunta nuova gestione della Preview Utensile (merge ramo Preview).
2026-03-03 17:15:43 +01:00
Riccardo Elitropi ed58f649f3 Merge commit '5801b85a31cd6ba0ca8330acbce443d5ad45e45a' 2026-03-03 17:13:21 +01:00
Riccardo Elitropi e8e8a209b1 EgtMachKernel :
- in PocketingNT piccola correzione.
2026-03-02 16:20:55 +01:00
48 changed files with 3495 additions and 1263 deletions
+2
View File
@@ -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))
+2
View File
@@ -89,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 ;
+76 -37
View File
@@ -27,6 +27,7 @@
#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"
@@ -753,8 +754,8 @@ Drilling::Update( bool bPostApply)
// 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 sDblHead ; int nDblExit ;
bool bOk = GetDoubleToolData( sDblTool, sDblHead, nDblExit) &&
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) ;
@@ -867,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
@@ -880,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 ;
}
}
@@ -3331,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)
@@ -3574,30 +3622,12 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
return false ;
}
// parametri per foro in doppio
bool bDouble = ( GetDoubleType( m_Params.m_sUserNotes) != 0) ;
int nDouble = GetDoubleType( m_Params.m_sUserNotes) ;
bool bDouble = ( nDouble != 0) ;
bool bDoubleParallel = false ;
if ( bDouble)
bDoubleParallel = VerifyParallelDrilling( nDouble, hole) ;
double dDoubleLastStep = GetDoubleLastStep() ;
bool dDoubleParallel = false ;
if ( bDouble) {
// nel caso di lavorazione in doppio con flag nel file .ini abilitato, prima della risalita finale, risalgo dell'ultimo step compiuto
// se il piano di mirror presenta una normale circa parallela alla direzione del foro ( da BTL 1 grado di tolleranza)
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
if ( pMch != nullptr) {
string sMachIni = pMch->GetMachineDir() + "\\" + pMch->GetMachineName() + ".ini" ;
const char* SEC_MACH = "Customizations" ;
const char* KEY_DRILLING_DOUBLE = "DrillingDoubleNT" ;
int nDrillingDouble = GetPrivateProfileInt( SEC_MACH, KEY_DRILLING_DOUBLE, 0, sMachIni.c_str()) ;
if ( nDrillingDouble == 1) {
int nDouble = GetDoubleType( m_Params.m_sUserNotes) ;
Vector3d vtNorm = V_INVALID ;
switch ( nDouble) {
case 1 : vtNorm = X_AX ; break ;
case 2 : vtNorm = Y_AX ; break ;
case 3 : vtNorm = Z_AX ; break ;
}
dDoubleParallel = ( vtNorm.IsValid() && hole.vtDir * vtNorm > cos( 1. * DEGTORAD)) ;
}
}
}
// ciclo di affondamento a step
const double MIN_STEP = 1 ;
const double APPR_STEP = 1 ;
@@ -3648,8 +3678,9 @@ 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 ( dDoubleParallel && i == nStep) {
if ( AddLinearMove( ptP3, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
if ( bDoubleParallel && i == nStep) {
SetFlag( 105) ; // movimento in doppio parallelo
if ( AddLinearMove( ptP3, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
return false ;
}
else {
@@ -3679,8 +3710,9 @@ 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 ( dDoubleParallel && i == nStep) {
if ( AddLinearMove( ptP4, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
if ( bDoubleParallel && i == nStep) {
SetFlag( 105) ; // movimento in doppio parallelo
if ( AddLinearMove( ptP4, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
return false ;
}
else {
@@ -3709,8 +3741,9 @@ 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 ( dDoubleParallel && i == nStep) {
if ( AddLinearMove( ptP5, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
if ( bDoubleParallel && i == nStep) {
SetFlag( 105) ; // movimento in doppio parallelo
if ( AddLinearMove( ptP5, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
return false ;
}
else {
@@ -3724,17 +3757,23 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
// 6 -> ritorno all'approccio del foro
SetFeed( GetEndFeed()) ;
SetFlag( 104) ; // risalita sopra il foro
if ( dDoubleParallel) {
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( 2. * dLastStep, dCurrLen) * hole.vtDir, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
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_DBP) == GDB_ID_NULL)
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 ;
+1
View File
@@ -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) ;
BIN
View File
Binary file not shown.
+6
View File
@@ -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" />
@@ -480,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>
+18
View File
@@ -785,6 +785,24 @@
<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">
+1 -1
View File
@@ -730,7 +730,7 @@ FiveAxisMilling::Update( bool bPostApply)
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ;
double dSingConeAng = 0.1 ;
double dSingConeAng = SING_CONE_ANG_DFLT ;
GetValInNotes( m_Params.m_sUserNotes, UN_SINGCONEANG, dSingConeAng) ;
if ( ! CalculateAxesValues( sHint, false, dSingConeAng)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
+8 -3
View File
@@ -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 ;
}
+25
View File
@@ -140,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
@@ -148,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
@@ -174,3 +190,12 @@ const double MIN_ZDIR_VERT_CHSAW = 0.7072 ;
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 ;
//----------------------------------------------------------------------------
// Compensazione Raggio Utensile in Macchina
enum {
TOOL_COMPENSATION_PROGRAM = 0, // Compensazione Utensile da Programma
TOOL_COMPENSATION_LENGTH = 1, // Compensazione Lunghezza Utensile in Macchina
TOOL_COMPENSATION_RADIUS = 2, // Compensazione Raggio Utensile in Macchina
TOOL_COMPENSATION_LENGHT_AND_RADIUS = 3 // Compensazione Lunghezza e Raggio Utensile in Macchina
} ;
+5 -1
View File
@@ -304,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 ;
@@ -327,6 +328,9 @@ class MachMgr : public IMachMgr
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 ;
@@ -374,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 ;
@@ -482,7 +487,6 @@ class MachMgr : public IMachMgr
bool GetCalcMaxDeltaR2OnFirst( void) const ;
bool GetCalcPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ;
bool VerifyAngleOutstroke( int nInd, double dAng) const ;
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const ;
bool ExistProtectedAreas( void) const ;
// Operations
bool GetOperationNewName( std::string& sName) const ;
+55 -1
View File
@@ -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.
//
//
//
@@ -147,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
View File
@@ -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
+14 -2
View File
@@ -775,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 ;
}
//----------------------------------------------------------------------------
@@ -784,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) ;
}
+18 -2
View File
@@ -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
@@ -1342,7 +1358,7 @@ MachMgr::GetMachiningStartAxes( bool bSkipClimb, DBLVECTOR& vAxVal) const
if ( pMch == nullptr)
return false ;
// recupero i valori
return pMch->GetInitialAxesValues( bSkipClimb, vAxVal) ;
return pMch->GetInitialAxesValues( bSkipClimb, true, vAxVal) ;
}
//----------------------------------------------------------------------------
@@ -1358,5 +1374,5 @@ MachMgr::GetMachiningEndAxes( bool bSkipRise, DBLVECTOR& vAxVal) const
if ( pMch == nullptr)
return false ;
// recupero i valori
return pMch->GetFinalAxesValues( bSkipRise, vAxVal) ;
return pMch->GetFinalAxesValues( bSkipRise, true, vAxVal) ;
}
+1
View File
@@ -66,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 ;
}
+8 -3
View File
@@ -168,9 +168,9 @@ 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,
@@ -281,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 ;
@@ -346,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
+219 -76
View File
@@ -660,7 +660,7 @@ Machine::CalculateKinematicChain( void)
// 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
@@ -742,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 ;
}
@@ -864,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 ;
@@ -893,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 ;
@@ -967,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,
@@ -1003,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) ;
@@ -1032,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) ;
}
@@ -1043,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 ;
}
//----------------------------------------------------------------------------
@@ -1291,6 +1334,110 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
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,
@@ -1372,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]) ;
@@ -1399,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]) ;
@@ -1590,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]) ;
@@ -1598,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]) ;
@@ -1738,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)
@@ -1754,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) ;
@@ -1766,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)
@@ -1787,7 +1934,7 @@ 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() ;
@@ -1810,7 +1957,7 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng
}
}
// 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() ;
@@ -2245,13 +2392,9 @@ Machine::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vecto
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 ;
+54 -24
View File
@@ -296,28 +296,34 @@ 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) ;
@@ -329,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 ;
@@ -350,28 +362,34 @@ 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) ;
@@ -383,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 ;
@@ -404,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 ||
@@ -418,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
@@ -431,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 ||
@@ -445,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
+174 -54
View File
@@ -17,6 +17,7 @@
#include "MachMgr.h"
#include "Machining.h"
#include "OperUserNotesConst.h"
#include "ToolUserNotesConst.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
@@ -25,6 +26,8 @@
using namespace std ;
#define DEBUG 0
const string KEY_AXIS_GROUP = "PreviewAxisGroup" ;
const string KEY_ROT_AXIS_VAL = "PreviewRotAxisVal" ; // salvata per ogni gruppo di Preview
@@ -45,10 +48,12 @@ Machining::Machining( void)
m_nLookFlag = MCH_LOOK_TAB_HEAD ;
m_nPreviewHeadId = GDB_ID_NULL ;
m_nPreviewHeadIdDBL = GDB_ID_NULL ;
m_nPreviewExitId = GDB_ID_NULL ;
m_nPreviewExitIdDBL = GDB_ID_NULL ;
m_nPreviewToolTip = GDB_ID_NULL ;
m_nPreviewToolTipDBL = GDB_ID_NULL ;
m_vPreviewAxisIds = {} ;
m_vPreviewAxisIdsBBL = {} ;
m_vPreviewAxisIdsDBL = {} ;
}
//----------------------------------------------------------------------------
@@ -57,10 +62,12 @@ Machining::~Machining( void)
m_nLookFlag = MCH_LOOK_NONE ;
m_nPreviewHeadId = GDB_ID_NULL ;
m_nPreviewHeadIdDBL = GDB_ID_NULL ;
m_nPreviewExitId = GDB_ID_NULL ;
m_nPreviewExitIdDBL = GDB_ID_NULL ;
m_nPreviewToolTip = GDB_ID_NULL ;
m_nPreviewToolTipDBL = GDB_ID_NULL ;
m_vPreviewAxisIds.clear() ;
m_vPreviewAxisIdsBBL.clear() ;
m_vPreviewAxisIdsDBL.clear() ;
}
//----------------------------------------------------------------------------
@@ -163,17 +170,20 @@ Machining::MyChangeToolPreviewShow( int nLookFlag, bool bDouble)
// se non esiste il gruppo di Preview, errore
int nCurrStdId = GDB_ID_NULL ;
int nCurrHeadId = GDB_ID_NULL ;
int nCurrExitId = GDB_ID_NULL ;
if ( ! bDouble) {
nCurrStdId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST) ;
if ( nCurrStdId == GDB_ID_NULL || m_nPreviewHeadId == GDB_ID_NULL)
return false ;
nCurrHeadId = m_nPreviewHeadId ;
nCurrExitId = m_nPreviewExitId ;
}
else {
nCurrStdId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST_DBL) ;
if ( nCurrStdId == GDB_ID_NULL || m_nPreviewHeadIdDBL == GDB_ID_NULL)
return false ;
nCurrHeadId = m_nPreviewHeadIdDBL ;
nCurrExitId = m_nPreviewExitIdDBL ;
}
// recupero la macchina corrente
@@ -196,8 +206,14 @@ Machining::MyChangeToolPreviewShow( int nLookFlag, bool bDouble)
int nIter = 0 ;
// se devo visualizzare solamente il gruppo della testa corrente
if ( nLookFlag == MCH_LOOK_TAB_TOOL) {
// la testa diventa visibile
// la testa diventa visibile ( solamente il gruppo dell'uscita corrente)
m_pGeomDB->SetStatus( nCurrHeadId, GDB_ST_ON) ;
int nHeadChildId = m_pGeomDB->GetFirstGroupInGroup( nCurrHeadId) ;
while ( nHeadChildId != GDB_ID_NULL) {
if ( nHeadChildId != nCurrExitId)
m_pGeomDB->SetStatus( nHeadChildId, GDB_ST_OFF) ;
nHeadChildId = m_pGeomDB->GetNext( nHeadChildId) ;
}
// tutti i gruppi che contengono la testa diventano visibili fino a "ST", l'unico loro
// figlio visibile deve essere quello che contiene la testa corrente
int nCurrId = nCurrHeadId ;
@@ -247,10 +263,17 @@ Machining::MyChangeToolPreviewShow( int nLookFlag, bool bDouble)
}
}
else {
// visualizzo tutti i gruppi in coda
for ( auto Iter = dqHierarchy.begin() ; Iter != dqHierarchy.end() ; ++ Iter) {
if ( m_pGeomDB->GetGdbType( *Iter) == GDB_TY_GROUP)
m_pGeomDB->SetStatus( *Iter, GDB_ST_ON) ;
}
// visualizzo tutti i sottogruppi della testa
int nHeadChild = m_pGeomDB->GetFirstGroupInGroup( nCurrHeadId) ;
while ( nHeadChild != GDB_ID_NULL) {
m_pGeomDB->SetStatus( nHeadChild, GDB_ST_ON) ;
nHeadChild = m_pGeomDB->GetNextGroup( nHeadChild) ;
}
}
++ nIter ;
}
@@ -302,14 +325,16 @@ Machining::MyPrepareToolPreview( bool bDouble)
return false ;
// se necessario, imposto l'utensile corrente
string sTool, sHead ;
string sTool, sTcPos, sHead ;
double dTLen ;
int nExitDBLId ;
if ( ! bDouble) {
sTool = GetToolName() ;
sHead = GetHeadName() ;
dTLen = GetToolData().m_dLen ;
}
else {
if ( ! GetDoubleToolData( sTool, sHead, nExitDBLId))
if ( ! GetDoubleToolData( sTool, sTcPos, sHead, nExitDBLId, dTLen))
return false ;
}
@@ -323,6 +348,19 @@ Machining::MyPrepareToolPreview( bool bDouble)
for ( const string& sSetHead : vSetHead)
vSetHeadIds.push_back( pMch->GetHeadId( sSetHead)) ;
// se presenti altre teste che non compaiono nell'headset le memorizzo
int nHeadParentId = m_pGeomDB->GetParentId( nHeadId) ;
INTVECTOR vOtherHeadIds ;
if ( nHeadParentId != GDB_ID_NULL) {
int nChildId = m_pGeomDB->GetFirstGroupInGroup( nHeadParentId) ;
while ( nChildId != GDB_ID_NULL) {
if ( nChildId != nHeadId && pMch->IsHeadGroup( nChildId) &&
find( vSetHeadIds.begin(), vSetHeadIds.end(), nChildId) == vSetHeadIds.end())
vOtherHeadIds.push_back( nChildId) ;
nChildId = m_pGeomDB->GetNextGroup( nChildId) ;
}
}
// recupero la tavola corrente
int nCurrTab = pMch->GetCurrTable() ;
@@ -364,7 +402,7 @@ Machining::MyPrepareToolPreview( bool bDouble)
if ( ! bDouble)
m_vPreviewAxisIds.push_back( nNewTabRotAxisId) ;
else
m_vPreviewAxisIdsBBL.push_back( nNewTabRotAxisId) ;
m_vPreviewAxisIdsDBL.push_back( nNewTabRotAxisId) ;
// aggiungo il versore invertito
int nChildId = m_pGeomDB->GetFirstInGroup( nParentId) ;
while ( nChildId != GDB_ID_NULL) {
@@ -463,7 +501,7 @@ Machining::MyPrepareToolPreview( bool bDouble)
if ( ! bDouble)
m_vPreviewAxisIds.push_back( nNewParentId) ;
else
m_vPreviewAxisIdsBBL.push_back( nNewParentId) ;
m_vPreviewAxisIdsDBL.push_back( nNewParentId) ;
// memorizzo la sua posizione iniziale
double dAxisPos = 0. ;
bOk = bOk && pMch->GetAxisPos( sParentName, dAxisPos) &&
@@ -471,7 +509,7 @@ Machining::MyPrepareToolPreview( bool bDouble)
}
// scorro i suoi figli
int nChildId = m_pGeomDB->GetFirstInGroup( nParentId) ;
while ( bOk && nChildId != GDB_ID_NULL) {
while ( bOk && nChildId != GDB_ID_NULL) {
// se vettore ausiliario lo inserisco solo se asse padre rotativo
if ( m_pGeomDB->GetGdbType( nChildId) == GDB_TY_GEO) {
if ( bRotary) {
@@ -488,13 +526,18 @@ Machining::MyPrepareToolPreview( bool bDouble)
if ( nChildId == nHeadId) {
if ( ! bDouble) {
m_nPreviewHeadId = m_pGeomDB->CopyGlob( nHeadId, GDB_ID_NULL, nNewParentId) ;
bOk = ( m_nPreviewHeadId == GDB_ID_NULL) ;
bOk = ( m_nPreviewHeadId != GDB_ID_NULL) ;
}
else {
m_nPreviewHeadIdDBL = m_pGeomDB->CopyGlob( nHeadId, GDB_ID_NULL, nNewParentId) ;
bOk = ( m_nPreviewHeadIdDBL == GDB_ID_NULL) ;
bOk = ( m_nPreviewHeadIdDBL != GDB_ID_NULL) ;
}
}
// se altra testa non presente nell'HeadSet la inserisco
else if ( find( vOtherHeadIds.begin(), vOtherHeadIds.end(), nChildId) != vOtherHeadIds.end()) {
int nOtherHeadId = m_pGeomDB->CopyGlob( nChildId, GDB_ID_NULL, nNewParentId) ;
bOk = ( nOtherHeadId != GDB_ID_NULL) ;
}
else {
// se asse successivo nella catena cinematica, sarà il nuovo gruppo padre
auto NextIter = Iter ; ++ NextIter ;
@@ -531,15 +574,19 @@ Machining::MyPrepareToolPreview( bool bDouble)
bOk = bOk && m_pGeomDB->GetName( nExitGrpId, sExitGrpName) ;
int nFrId = GDB_ID_NULL ;
if ( bOk) {
if ( ! bDouble)
if ( ! bDouble) {
nFrId = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadId, "_" + sExitGrpName) ;
else
m_nPreviewExitId = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadId, sExitGrpName) ;
}
else {
nFrId = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadIdDBL, "_" + sExitGrpName) ;
m_nPreviewExitIdDBL = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadIdDBL, sExitGrpName) ;
}
}
bOk = bOk && ( nFrId != GDB_ID_NULL) ;
const IGeoFrame3d* frExit = ( bOk ? GetGeoFrame3d( m_pGeomDB->GetGeoObj( nFrId)) : nullptr) ;
bOk = bOk && ( frExit != nullptr) ;
Point3d ptToolTip = ( bOk ? ( frExit->GetFrame()).Orig() - GetToolData().m_dLen * ( frExit->GetFrame()).VersZ() : P_INVALID) ;
Point3d ptToolTip = ( bOk ? ( frExit->GetFrame()).Orig() - dTLen * ( frExit->GetFrame()).VersZ() : P_INVALID) ;
bOk = bOk && ptToolTip.IsValid() ;
if ( bOk) {
PtrOwner<IGeoPoint3d> ptGToolTip( CreateGeoPoint3d()) ;
@@ -561,7 +608,7 @@ Machining::MyPrepareToolPreview( bool bDouble)
//----------------------------------------------------------------------------
bool
Machining::PrepareToolPreview()
Machining::PrepareToolPreview( void)
{
// verifico validità gestori DB geometrico e CAM
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
@@ -580,6 +627,7 @@ Machining::PrepareToolPreview()
return false ;
m_pGeomDB->SetName( nStId, MCH_ST) ;
m_pGeomDB->SetLevel( nStId, GDB_LV_TEMP) ;
m_nLookFlag = MCH_LOOK_TAB_TOOL ;
}
// altrimenti lo svuoto
else
@@ -610,7 +658,7 @@ Machining::PrepareToolPreview()
m_nPreviewToolTip = GDB_ID_NULL ;
m_nPreviewToolTipDBL = GDB_ID_NULL ;
m_vPreviewAxisIds.clear() ;
m_vPreviewAxisIdsBBL.clear() ;
m_vPreviewAxisIdsDBL.clear() ;
// preparo l'anteprima per il gruppo ST
bool bOk = true ;
@@ -621,15 +669,15 @@ Machining::PrepareToolPreview()
if ( ! EqualNoCase( sTool, GetToolName()))
bOk = ( m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr())) ;
// creo la preview
bOk = bOk && MyPrepareToolPreview( false) && MyChangeToolPreviewShow( MCH_LOOK_TAB_TOOL, false) ;
bOk = bOk && MyPrepareToolPreview( false) && MyChangeToolPreviewShow( m_nLookFlag, false) ;
}
if ( bOk && nStdIdDBL != GDB_ID_NULL) {
// imposto l'utensile per la lavorazione in doppio
string sTool, sHead ; int nDblExit ;
bOk = ( GetDoubleToolData( sTool, sHead, nDblExit)) ;
string sTool, sTcPos, sHead ; int nDblExit ;
bOk = ( GetDoubleToolData( sTool, sTcPos, sHead, nDblExit)) ;
if ( bOk) {
bool bOkToolSet = ( m_pMchMgr->SetCalcTool( sTool, sHead, nDblExit)) ;
bOk = bOkToolSet && MyPrepareToolPreview( true) && MyChangeToolPreviewShow( MCH_LOOK_TAB_TOOL, true) ;
bOk = bOkToolSet && MyPrepareToolPreview( true) && MyChangeToolPreviewShow( m_nLookFlag, true) ;
if ( bOkToolSet)
bOk = ( m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr())) && bOk ;
}
@@ -647,20 +695,26 @@ Machining::RemoveToolPreview( void)
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
#if DEBUG
return true ;
#endif
// recupero i gruppi per l'anteprima utensile
int nStId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST) ;
int nStIdDBL = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST_DBL) ;
// li svuoto
// svuoto il gruppo dell'utensile principale
m_pGeomDB->EmptyGroup( nStId) ;
m_pGeomDB->EmptyGroup( nStIdDBL) ;
// rimuovo il gruppo dell'utensile secondario ( non lo svuoto, in quanto potrei ricalcolare la stessa lavorazione
// come singola, ritrovandomi un gruppo per il DBL in ToolPreview())
m_pGeomDB->Erase( nStIdDBL) ;
// reset delle variabili membro
m_nPreviewHeadId = GDB_ID_NULL ;
m_nPreviewHeadIdDBL = GDB_ID_NULL ;
m_nPreviewExitId = GDB_ID_NULL ;
m_nPreviewExitIdDBL = GDB_ID_NULL ;
m_nPreviewToolTip = GDB_ID_NULL ;
m_nPreviewToolTipDBL = GDB_ID_NULL ;
m_vPreviewAxisIds.clear() ;
m_vPreviewAxisIdsBBL.clear() ;
m_nLookFlag = MCH_LOOK_NONE ;
m_vPreviewAxisIdsDBL.clear() ;
return true ;
}
@@ -675,7 +729,7 @@ Machining::GetToolPreviewStepCount( void) const
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
if ( nClId == GDB_ID_NULL)
return 0 ;
// determino il numero di entità di tutti i sottogruppi, escludendo CLIMB e RISE
// determino il numero di entità di tutti i sottogruppi, escludendo CLIMB, RISE ed HOME
int nCount = 0 ;
int nPxId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
while ( nPxId != GDB_ID_NULL) {
@@ -727,8 +781,10 @@ Machining::GetToolPreviewNext( int nEntId, int nParentId, int nStId) const
// se prima entità, eventuale attivazione uscite di gruppo a forare
if ( nEntId == GDB_ID_NULL && m_pGeomDB->ExistsInfo( nNewParentId, KEY_DRACEX)) {
INTVECTOR vActExit ;
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit))
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit)) {
ActivateDrillingUnit( m_nPreviewHeadId, vActExit) ;
MyShowMultiDrillingTool( vActExit) ;
}
}
return nNewId ;
}
@@ -737,8 +793,10 @@ Machining::GetToolPreviewNext( int nEntId, int nParentId, int nStId) const
// eventuale attivazione uscite di gruppo a forare
if ( m_pGeomDB->ExistsInfo( nNewParentId, KEY_DRACEX)) {
INTVECTOR vActExit ;
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit))
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit)) {
ActivateDrillingUnit( m_nPreviewHeadId, vActExit) ;
MyShowMultiDrillingTool( vActExit) ;
}
}
// recupero la prima entità del successivo gruppo
nNewId = m_pGeomDB->GetFirstInGroup( nNewParentId) ;
@@ -770,8 +828,10 @@ Machining::GetToolPreviewPrev( int nEntId, int nParentId, int nStId) const
// eventuale attivazione uscite di gruppo a forare
if ( m_pGeomDB->ExistsInfo( nNewParentId, KEY_DRACEX)) {
INTVECTOR vActExit ;
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit))
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit)) {
ActivateDrillingUnit( m_nPreviewHeadId, vActExit) ;
MyShowMultiDrillingTool( vActExit) ;
}
}
// recupero l'ultima entità del precedente gruppo
nNewId = m_pGeomDB->GetLastInGroup( nNewParentId) ;
@@ -810,8 +870,8 @@ Machining::MyToolPreview( int nEntId, bool bDouble) const
if ( ! bDouble)
m_pMchMgr->GetAllCurrAxesNames( vAxNames) ;
else {
string sDBLTool, sDBLHead ; int nDBLExit ;
bool bOk = ( GetDoubleToolData( sDBLTool, sDBLHead, nDBLExit) && m_pMchMgr->SetCalcTool( sDBLTool, sDBLHead, nDBLExit)) ;
string sDBLTool, sDBLTcPos, sDBLHead ; int nDBLExit ;
bool bOk = ( GetDoubleToolData( sDBLTool, sDBLTcPos, sDBLHead, nDBLExit) && m_pMchMgr->SetCalcTool( sDBLTool, sDBLHead, nDBLExit)) ;
if ( bOk)
m_pMchMgr->GetAllCurrAxesNames( vAxNames) ;
m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()) ;
@@ -829,7 +889,7 @@ Machining::MyToolPreview( int nEntId, bool bDouble) const
}
// scorro gli assi dentro al gruppo "ST" ( considero solo quelli rotativi)
const INTVECTOR& vCurrPreviewAxisIds = ( ! bDouble ? m_vPreviewAxisIds : m_vPreviewAxisIdsBBL) ;
const INTVECTOR& vCurrPreviewAxisIds = ( ! bDouble ? m_vPreviewAxisIds : m_vPreviewAxisIdsDBL) ;
for ( auto Iter = vCurrPreviewAxisIds.begin() ; Iter != vCurrPreviewAxisIds.end() ; ++ Iter) {
// recupero l'Id dell'asse corrente
int nAxisId = *Iter ;
@@ -985,7 +1045,7 @@ Machining::ToolPreview( int nEntId, int nStep) const
//----------------------------------------------------------------------------
int
Machining::GetDoubleType( const string& sUserNotes)
Machining::GetDoubleType( const string& sUserNotes) const
{
int nDouble ;
if ( ! GetValInNotes( sUserNotes, UN_DOUBLE, nDouble) ||
@@ -997,7 +1057,15 @@ Machining::GetDoubleType( const string& sUserNotes)
//----------------------------------------------------------------------------
bool
Machining::GetDoubleToolData( string& sDblTool, string& sDblHead, int& nDblExit) const
Machining::GetDoubleToolData( string& sDblTool, string& sDblTcPos, string& sDblHead, int& nDblExit) const
{
double dDummy ;
return GetDoubleToolData( sDblTool, sDblTcPos, sDblHead, nDblExit, dDummy) ;
}
//----------------------------------------------------------------------------
bool
Machining::GetDoubleToolData( string& sDblTool, string& sDblTcPos, string& sDblHead, int& nDblExit, double& dDblLen) const
{
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
return false ;
@@ -1006,13 +1074,13 @@ Machining::GetDoubleToolData( string& sDblTool, string& sDblHead, int& nDblExit)
if ( pTMgr == nullptr)
return false ;
// recupero dati utensile in doppio
if ( ! GetValInNotes( GetToolData().m_sUserNotes, "DOUBLE", sDblTool))
if ( ! GetValInNotes( GetToolData().m_sUserNotes, TUN_DOUBLE, sDblTool))
return false ;
string sDblTcPos ;
const ToolData* pTdata = pTMgr->GetTool( sDblTool) ;
if ( pTdata == nullptr)
return false ;
dDblLen = pTdata->m_dLen ;
if ( ! m_pMchMgr->GetCurrSetupMgr().GetToolData( sDblTool, sDblTcPos, sDblHead, nDblExit)) {
const ToolData* pTdata = pTMgr->GetTool( sDblTool) ;
if ( pTdata == nullptr)
return false ;
sDblHead = pTdata->m_sHead ;
nDblExit = pTdata->m_nExit ;
}
@@ -1021,7 +1089,32 @@ Machining::GetDoubleToolData( string& sDblTool, string& sDblHead, int& nDblExit)
//----------------------------------------------------------------------------
bool
Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes)
Machining::CalcMirrorPlaneByDouble( int nDouble, const string& sUserNotes, Point3d& ptOn, Vector3d& vtNorm) const
{
// verifico parametro per lavorazione in doppio
if ( nDouble != 1 && nDouble != 2 && nDouble != 3)
return false ;
// determino posizione del piano di mirroring mediante centro del Box del grezzo
BBox3d b3Raw ;
if ( ! GetCurrRawsGlobBox( b3Raw) || ! b3Raw.GetCenter( ptOn))
return false ;
switch ( nDouble) {
case 1 : vtNorm = X_AX ; break ;
case 2 : vtNorm = Y_AX ; break ;
case 3 : vtNorm = Z_AX ; break ;
}
// se presente nota utente con posizione del piano, allora dal punto più basso salgo di tale valore per individuare la quota
double dPlanePos ;
if ( GetValInNotes( sUserNotes, UN_MIRRORAX, dPlanePos))
ptOn = b3Raw.GetMin() + dPlanePos * vtNorm ;
return true ;
}
//----------------------------------------------------------------------------
bool
Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes) const
{
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
return false ;
@@ -1071,20 +1164,10 @@ Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes)
nPathId = m_pGeomDB->GetNextName( nPathId, MCH_PATH + "*") ;
}
// determino posizione del piano di mirroring
BBox3d b3Raw ;
Point3d ptOn ;
if ( ! GetCurrRawsGlobBox( b3Raw) || ! b3Raw.GetCenter( ptOn))
// calcolo il piano di Mirroring
Point3d ptOn ; Vector3d vtNorm ;
if ( ! CalcMirrorPlaneByDouble( nDouble, sUserNotes, ptOn, vtNorm))
return false ;
Vector3d vtNorm ;
switch ( nDouble) {
case 1 : vtNorm = X_AX ; break ;
case 2 : vtNorm = Y_AX ; break ;
case 3 : vtNorm = Z_AX ; break ;
}
double dPlanePos ;
if ( GetValInNotes( sUserNotes, UN_MIRRORAX, dPlanePos))
ptOn = b3Raw.GetMin() + dPlanePos * vtNorm ;
// eseguo mirroring rispetto a piano opportuno
nPathId = m_pGeomDB->GetFirstNameInGroup( nDblId, MCH_PATH + "*") ;
@@ -1092,15 +1175,15 @@ Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes)
int nEntId = m_pGeomDB->GetFirstInGroup( nPathId) ;
while ( nEntId != GDB_ID_NULL) {
string sName ; m_pGeomDB->GetName( nEntId, sName) ;
// nel caso di fuorature in doppio, il movimento deve essere sincronizzato
if ( sName == MCH_CL_DBP) {
// nel caso di forature in doppio, il movimento deve essere sincronizzato
if ( sName == MCH_CL_PARALLEL_DBL) {
INTVECTOR vSyncEntId ;
do {
vSyncEntId.push_back( nEntId) ;
nEntId = m_pGeomDB->GetNext( nEntId) ;
sName.clear() ;
m_pGeomDB->GetName( nEntId, sName) ;
} while ( sName == MCH_CL_DBP) ;
} while ( sName == MCH_CL_PARALLEL_DBL) ;
Vector3d vtRef ;
bool bOk = true ;
for ( int i = 0 ; bOk && i < ssize( vSyncEntId) ; ++ i) {
@@ -1146,6 +1229,43 @@ Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes)
return true ;
}
//----------------------------------------------------------------------------
bool
Machining::MyShowMultiDrillingTool( const INTVECTOR& vActExit) const
{
// verifico validità del Flag
if ( m_nLookFlag != MCH_LOOK_NONE && m_nLookFlag != MCH_LOOK_TAB_TOOL && m_nLookFlag != MCH_LOOK_TAB_HEAD)
return false ;
// se non ho visibilità solo utensile, non faccio nulla
if ( m_nLookFlag != MCH_LOOK_TAB_TOOL)
return false ;
// verifico che il gruppo di preview della testa sia valido
if ( m_nPreviewHeadId == GDB_ID_NULL)
return false ;
// recupero i nomi delle uscite da visualizzare nella preview
STRVECTOR vsExit ; vsExit.resize( vActExit.size()) ;
for ( int i = 0 ; i < ssize( vActExit) ; ++ i)
vsExit[i] = MCH_EXIT + ToString( vActExit[i]) ;
// rendo visibili solo i gruppi nella preview inerenti
int nChildHeadId = m_pGeomDB->GetFirstInGroup( m_nPreviewHeadId) ;
while ( nChildHeadId != GDB_ID_NULL) {
// recupero il nome del gruppo corrente
string sName ;
m_pGeomDB->GetName( nChildHeadId, sName) ;
// verifico se attivare o meno il gruppo corrente
bool bStatusOn = ( find_if( vsExit.begin(), vsExit.end(), [&]( const string& sExitName) {
return EqualNoCase( sExitName, sName) ; }) != vsExit.end()) ;
m_pGeomDB->SetStatus( nChildHeadId, bStatusOn ? GDB_ST_ON : GDB_ST_OFF) ;
// passo al gruppo successivo
nChildHeadId = m_pGeomDB->GetNextGroup( nChildHeadId) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Machining::ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const
+11 -6
View File
@@ -26,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 ;
@@ -61,9 +62,10 @@ class Machining : public Operation
~Machining( void) ;
bool SpecialApply( std::string& sErr) ;
bool PostApply( std::string& sErr) ;
int GetDoubleType( const std::string& sUserNotes) ;
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblHead, int& nDblExit) const ;
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ;
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 :
@@ -72,17 +74,20 @@ class Machining : public Operation
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 testa di Preview
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 della testa di Preview
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_vPreviewAxisIdsBBL ; // indici degli assi di Preview
INTVECTOR m_vPreviewAxisIdsDBL ; // indici degli assi di Preview
} ;
//----------------------------------------------------------------------------
+38 -13
View File
@@ -910,8 +910,8 @@ Milling::Update( bool bPostApply)
// 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 sDblHead ; int nDblExit ;
bool bOk = GetDoubleToolData( sDblTool, sDblHead, nDblExit) &&
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) ;
@@ -2037,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 ;
@@ -4025,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
@@ -4050,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) {
@@ -6501,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 ;
}
+5
View File
@@ -25,6 +25,8 @@ 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" ;
@@ -50,6 +52,8 @@ 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" ;
static const std::string UN_TOOL_COMPENSATION = "ToolCompensation" ;
// Solo per Sawing
static const std::string UN_DOWNSE = "DownSE" ;
@@ -71,6 +75,7 @@ static const std::string UN_ANGLETOL = "AngleTol" ;
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" ;
+783 -276
View File
File diff suppressed because it is too large Load Diff
+28 -16
View File
@@ -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 :
@@ -54,8 +54,8 @@ class Operation : public IUserObj
virtual bool UpdateStatus( int nModif) = 0 ;
public :
bool GetInitialAxesValues( bool bSkipClimb, DBLVECTOR& vAxVal) const ;
bool GetFinalAxesValues( bool bSkipRise, DBLVECTOR& vAxVal) const ;
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 ;
@@ -63,6 +63,7 @@ class Operation : public IUserObj
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 ; }
@@ -125,9 +126,9 @@ class Operation : public IUserObj
bool AreAllPathsOk( void) const ;
bool GetToolpathsStatus( int& nCnt, int& nEmpty) const ;
int GetFirstFullToolpath( bool bMain = true) const ;
int GetNextFullToolpath( int nClPathId) const ;
int GetNextFullToolpath( int nClPathId, bool bMain = true) const ;
int GetLastFullToolpath( bool bMain = true) const ;
int GetPrevFullToolpath( int nClPathId) 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 ;
@@ -180,8 +181,8 @@ class Operation : public IUserObj
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
std::string ExtractHint( const std::string& sNotes) const ;
bool SetBlockedRotAxis( const std::string& sBlockedAxis, 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 CalculateAxesValues( const std::string& sHint, bool bSolChExact = false, double dSingConeAng = SING_CONE_ANG_DFLT) ;
bool CalculateDoubleAxesValues( const std::string& sHint, bool bSolChExact = false, double dSingConeAng = SING_CONE_ANG_DFLT) ;
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
bool RemoveClimbRiseHome( bool bMain = true) ;
double GetDeltaSafeZ( const Vector3d& vtTool) const ;
@@ -208,9 +209,9 @@ class Operation : public IUserObj
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 ApplyHintToPrevAxRot( const std::string& sHint, const Machine* pMch, DBLVECTOR& vAxRotPrec) ;
bool CalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome,
@@ -239,16 +240,26 @@ class Operation : public IUserObj
bool AdjustStartEndMovementsStd( bool bVerifyPreviousLink) ;
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 bMain = true) ;
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 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 bMain = true) ;
bool AddHome( void) ;
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 ;
@@ -267,7 +278,8 @@ 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 :
+1
View File
@@ -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
+10 -2
View File
@@ -781,8 +781,8 @@ Pocketing::Update( bool bPostApply)
// 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 sDblHead ; int nDblExit ;
bool bOk = GetDoubleToolData( sDblTool, sDblHead, nDblExit) &&
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) ;
@@ -5165,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) {
+18 -2
View File
@@ -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 ;
+1388 -512
View File
File diff suppressed because it is too large Load Diff
+20 -10
View File
@@ -30,9 +30,11 @@ struct PathInfoPO {
bool bOptTrap ; // flag per casi ottimizzati a trapezio ( per Spiral)
bool bOptCirle ; // flag per casi ottimizzati a Spirale ( per Spiral)
bool bIsZigZagOneWayBorder ; // curve di bordo dei lati chiusi ( per ZigZag e OneWay)
bool bToolCompensation ; // curva di bordo per compensazione utensile
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
@@ -129,12 +131,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) ;
const Vector3d& vtTool, bool bHolePocketing, const Point3d& ptHoleDest, bool bToolCompensation, bool bInVsOut, ICurveComposite* pCrvGlide) ;
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) ;
@@ -148,23 +153,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,
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& ptStart, const Point3d& ptP1, const Vector3d& vtTool,
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) 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,
@@ -174,7 +176,15 @@ 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) ;
bool AddTangentLinesForToolCompensation( ICurveComposite* pCompoPath, const Vector3d& vtTool, const ISurfFlatRegion* pSfrLimit) const ;
bool AssignPropsToCamDataForToolCompensation( int nId, bool bLineIn, bool bLineOut, bool bToolAtLeft) ;
// debug
void DebugDrawSfr( const ISurfFlatRegion* pSfr, bool bUniform, int nlayer = GDB_ID_ROOT) ;
void DebugDrawLoop( const ICurveComposite* pCrvCompo, int nLayer, bool bUniform) ;
+16 -2
View File
@@ -398,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) ;
@@ -424,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 ;
@@ -963,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
View File
@@ -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) ;
+12
View File
@@ -1124,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) ;
@@ -1320,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 ;
@@ -1431,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) ;
@@ -1627,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 ;
+9 -9
View File
@@ -1158,6 +1158,9 @@ SawRoughing::CalculateToolPath( int nAuxId, int nPvId, int nClId)
SetPathId( nPxId) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// Determino eventuali pareti verticali ( sono in senso decrescente di X)
DBLVECTOR vdVr ;
DBLVECTOR vdVrDelta ;
@@ -1446,6 +1449,9 @@ SawRoughing::CalculateCurvedToolPath( int nAuxId, int nClId)
SetPathId( nPxId) ;
SetToolDir( vtTool) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// Ciclo sugli intervalli tra le posizioni particolari per generare le passate
int nCount = 0 ;
for ( size_t j = 0 ; j < vdPp.size() ; ++ j) {
@@ -1488,15 +1494,9 @@ SawRoughing::CalculateCurvedToolPath( int nAuxId, int nClId)
}
else
pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ;
// esecuzione del taglio
if ( m_Params.m_nStepType != SAWROU_ST_ZIGZAG) {
//if ( ! CalculateOneWayCut( ptStart, ptEnd, vtGdDir, vtTool, vtCorr, dElev, bFirst, bLast))
// return false ;
}
else {
if ( ! CalculateCurvedZigZagCut( pCut, vtTool, dElev, bFirst, bLast, nCount))
return false ;
}
// esecuzione del taglio (per ora solo ZigZag)
if ( ! CalculateCurvedZigZagCut( pCut, vtTool, dElev, bFirst, bLast, nCount))
return false ;
}
}
+27 -1
View File
@@ -1953,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 ;
@@ -2133,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()) ;
@@ -2576,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 ;
@@ -3358,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 ;
+29 -9
View File
@@ -960,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) ;
@@ -990,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 ;
@@ -1961,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 ;
@@ -1968,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
@@ -2150,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) {
@@ -2185,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 ;
+1 -1
View File
@@ -104,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) ;
+41 -18
View File
@@ -97,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 ;
@@ -207,9 +208,6 @@ SimulatorSP::Start( bool bFirst)
// Verifico attrezzaggio
if ( ! VerifySetup())
bOk = false ;
// Recupero il materiale associato alla macchina
string sMachIni = m_pMachine->GetMachineDir() + "\\" + m_pMachine->GetMachineName() + ".ini" ;
m_sMachineMaterial = GetPrivateProfileStringUtf8( GENERAL_SEC.c_str(), MATERIAL_KEY.c_str(), "", sMachIni.c_str()) ;
}
// Reset utensile, interpolazione e assi correnti
@@ -907,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) ;
@@ -937,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 ;
@@ -1685,10 +1690,10 @@ SimulatorSP::EnableToolTipTrace( bool 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 ;
}
@@ -1708,17 +1713,22 @@ 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_sMachineMaterial != "Additive" ? m_dTLen : 0) * 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 int TRACE_MAX_LINE = 1000 ;
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) ;
@@ -2018,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 ;
@@ -2025,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
@@ -2229,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) {
@@ -2258,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 ;
+2 -2
View File
@@ -103,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) ;
@@ -147,7 +147,6 @@ class SimulatorSP : public ISimulator
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
Machine* m_pMachine ; // puntatore alla macchina
std::string m_sMachineMaterial ; // nome del materiale associato alla macchina
PerformanceCounter* m_pPerfCnt ; // timer per calcolo FPS
int m_nStatus ; // stato interno del simulatore (creato, inizializzato, pronto al movimento)
double m_dStep ; // lunghezza di riferimento per la velocità di simulazione
@@ -177,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
+60 -42
View File
@@ -1794,12 +1794,17 @@ SurfFinishing::ProcessCrvCompo( int nPathId, int nPvId, int nClId)
return false ;
}
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// Imposto dati comuni
SetPathId( nPxId) ;
SetToolDir( vtTool) ;
Vector3d vtAux ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
vtAux.Normalize() ;
SetAuxDir( vtAux) ;
// assegno il vettore estrusione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// Eseguo la lavorazione a seconda del tipo
double dElev = dDepth ;
@@ -2039,12 +2044,16 @@ SurfFinishing::ProcessSfr( int nPathId, int nPvId, int nClId)
m_pGeomDB->SetMaterial( nSfrF, LIME) ;
#endif
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// Imposto dati comuni
SetPathId( nPxId) ;
SetToolDir( vtTool) ;
Vector3d vtAux ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
vtAux.Normalize() ;
SetAuxDir( vtAux) ;
// assegno il vettore estrusione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// inserisco le superfici di supporto tra le superfici locali
for ( SurfLocal& SurfLocSupp : vSrfLocSupp)
@@ -2093,7 +2102,7 @@ SurfFinishing::ProcessSfr( int nPathId, int nPvId, int nClId)
//----------------------------------------------------------------------------
bool
SurfFinishing::SimplifyCurve( ICurveComposite* pCompo, double dMergeLinTol, double dMergeAndTolDeg,
SurfFinishing::SimplifyCurve( ICurveComposite* pCompo, const Frame3d& frLocXY, double dMergeLinTol, double dMergeAndTolDeg,
double dSmallDefLinTol, double dSmallDefAngTolDeg,
double dArcApproxLinTol, double dArcApproxAngTolDeg) const
{
@@ -2101,35 +2110,38 @@ SurfFinishing::SimplifyCurve( ICurveComposite* pCompo, double dMergeLinTol, doub
if ( pCompo == nullptr || ! pCompo->IsValid())
return false ;
// ricavo il punto iniziale e finale
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
// eseguo le modifiche su una copia della curva originale
PtrOwner<ICurveComposite> pCompoCL( CloneCurveComposite( pCompo)) ;
if ( IsNull( pCompoCL))
// eseguo le modifiche su una copia della curva originale in locale al frame XY
PtrOwner<ICurveComposite> pCompoLoc( CloneCurveComposite( pCompo)) ;
if ( IsNull( pCompoLoc))
return false ;
pCompoLoc->ToLoc( frLocXY) ;
// ricavo il punto iniziale e finale
Point3d ptStart ; pCompoLoc->GetStartPoint( ptStart) ;
Point3d ptEnd ; pCompoLoc->GetEndPoint( ptEnd) ;
// merge per uniformità
bool bOk = pCompoCL->MergeCurves( dMergeLinTol, dMergeAndTolDeg, false) ;
bool bOk = pCompoLoc->MergeCurves( dMergeLinTol, dMergeAndTolDeg, false) ;
// rimozione Spikes o Curve Z
bOk = bOk && pCompoCL->RemoveSmallDefects( dSmallDefLinTol, dSmallDefAngTolDeg, true) ;
bOk = bOk && pCompoLoc->RemoveSmallDefects( dSmallDefLinTol, dSmallDefAngTolDeg, true) ;
// interpolazione mediante linee ed archi
PolyArc PA ;
bOk = bOk && pCompoCL->ApproxWithArcsEx( dArcApproxLinTol, dArcApproxAngTolDeg, LIN_FEA_STD, PA) &&
pCompoCL->Clear() && pCompoCL->FromPolyArc( PA) ;
bOk = bOk && pCompoLoc->ApproxWithArcsEx( dArcApproxLinTol, dArcApproxAngTolDeg, LIN_FEA_STD, PA) &&
pCompoLoc->Clear() && pCompoLoc->FromPolyArc( PA) ;
// controllo aggiuntivo sui punti iniziali e finali che siano gli stessi
Point3d ptNewStart, ptNewEnd ;
bOk = bOk && pCompoCL->GetStartPoint( ptNewStart) && pCompoCL->GetEndPoint( ptNewEnd) &&
bOk = bOk && pCompoLoc->GetStartPoint( ptNewStart) && pCompoLoc->GetEndPoint( ptNewEnd) &&
AreSamePointApprox( ptNewStart, ptStart) && AreSamePointApprox( ptNewEnd, ptEnd) ;
// controllo che non si siano create auto-intersezioni
SelfIntersCurve SIC( *pCompoCL) ;
SelfIntersCurve SIC( *pCompoLoc) ;
bOk = bOk && ( SIC.GetCrossIntersCount() == 0) ;
// se tutto bene, sostiuisco la curva originale con la modificata
if ( bOk)
pCompo->CopyFrom( pCompoCL) ;
if ( bOk) {
pCompoLoc->ToGlob( frLocXY) ;
pCompo->CopyFrom( pCompoLoc) ;
}
return true ;
}
@@ -2266,8 +2278,8 @@ SurfFinishing::AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, cons
// calcolo lo ZigZag
ICRVCOMPOPOVECTOR vpCrvs ;
if ( ! CalcPocketing( pSfrCnt, m_TParams.m_dDiam / 2., 0., m_Params.m_dSideStep, m_Params.m_dSideAngle, 5.,
POCKET_ZIGZAG, false, false, false, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
m_Params.m_dLiTang, GetLeadInType(), vpCrvs)) {
POCKET_ZIGZAG, false, false, false, true, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
GetLeadInType(), m_Params.m_dLiTang, 0., GetLeadOutType(), m_Params.m_dLoTang, false, 0., 0., false, vpCrvs)) {
m_pMchMgr->SetLastError( 3125, "Error in SurfFinishing : CalcPocketing failed") ;
return false ;
}
@@ -2294,8 +2306,8 @@ SurfFinishing::AddOneWay( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, cons
// calcolo OneWay
ICRVCOMPOPOVECTOR vpCrvs ;
if ( ! CalcPocketing( pSfrCnt, m_TParams.m_dDiam / 2., 0., m_Params.m_dSideStep, m_Params.m_dSideAngle, 5.,
POCKET_ONEWAY, false, false, false, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
m_Params.m_dLiTang, GetLeadInType(), vpCrvs)) {
POCKET_ONEWAY, false, false, false, true, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
GetLeadInType(), m_Params.m_dLiTang, 0., GetLeadOutType(), m_Params.m_dLoTang, false, 0., 0., false, vpCrvs)) {
m_pMchMgr->SetLastError( 3125, "Error in SurfFinishing : CalcPocketing failed") ;
return false ;
}
@@ -2322,8 +2334,8 @@ SurfFinishing::AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, cons
int nType = ( bInVsOut ? POCKET_SPIRALIN : POCKET_SPIRALOUT) ;
ICRVCOMPOPOVECTOR vpCrvs ;
if ( ! CalcPocketing( pSfrCnt, m_TParams.m_dDiam / 2., 0., m_Params.m_dSideStep, m_Params.m_dSideAngle, 5.,
nType, false, false, false, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
m_Params.m_dLiTang, GetLeadInType(), vpCrvs)) {
nType, false, false, false, true, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
GetLeadInType(), m_Params.m_dLiTang, 0., GetLeadOutType(), m_Params.m_dLoTang, false, 0., 0., false, vpCrvs)) {
m_pMchMgr->SetLastError( 3125, "Error in SurfFinishing : CalcPocketing failed") ;
return false ;
}
@@ -2502,6 +2514,11 @@ SurfFinishing::CalcZConstSilCrv( ICAvParSilhouettesSurfTm* pCavParSilh, const SU
if ( pSfrClass == nullptr || ! pSfrClass->IsValid())
return false ;
// definisco un frame implicito rispetto alla superficie di classificazione
Frame3d frLocXY ;
Point3d ptC ; pSfrClass->GetCentroid( ptC) ;
frLocXY.Set( ptC, pSfrClass->GetNormVersor()) ;
// NB. Essendo una finitura a Z costante, devo controllare che i piani di finitura non facciano
// overlap con facce delle TriMesh selezionate con normale simile a vtTool
set<double> setZAmbiguos ;
@@ -2530,32 +2547,32 @@ SurfFinishing::CalcZConstSilCrv( ICAvParSilhouettesSurfTm* pCavParSilh, const SU
if ( ! pCavParSilh->GetSilhouette( dZLoc, vPL))
return false ;
// classifico le PolyLine in base alla regione
POLYLINEVECTOR vPL_InsideSfr ;
POLYLINEVECTOR vPLInsideSfr ;
for ( auto& PL : vPL) {
// porto la PolyLine a contatto con la regione
PL.Translate( - dZLoc * pSfrClass->GetNormVersor()) ;
// converto in curva composita
PtrOwner<ICurveComposite> pCrv_PL( CreateCurveComposite()) ;
if ( IsNull( pCrv_PL) || ! pCrv_PL->FromPolyLine( PL))
PtrOwner<ICurveComposite> pCrvPL( CreateCurveComposite()) ;
if ( IsNull( pCrvPL) || ! pCrvPL->FromPolyLine( PL))
return false ;
// classifico la curva con la superficie
CRVCVECTOR ccClass ;
if ( ! pSfrClass->GetCurveClassification( *pCrv_PL, EPS_SMALL, ccClass))
if ( ! pSfrClass->GetCurveClassification( *pCrvPL, EPS_SMALL, ccClass))
return false ;
// tengo tutti i tratti non esterni alla superficie
for ( int i = 0 ; i < int( ccClass.size()) ; ++ i) {
if ( ccClass[i].nClass != CRVC_OUT) {
PtrOwner<ICurveComposite> pCrvCompoPartIn( ConvertCurveToComposite( pCrv_PL->CopyParamRange( ccClass[i].dParS, ccClass[i].dParE))) ;
PtrOwner<ICurveComposite> pCrvCompoPartIn( ConvertCurveToComposite( pCrvPL->CopyParamRange( ccClass[i].dParS, ccClass[i].dParE))) ;
if ( ! IsNull( pCrvCompoPartIn) && pCrvCompoPartIn->IsValid()) {
vPL_InsideSfr.emplace_back( PolyLine()) ;
vPLInsideSfr.emplace_back( PolyLine()) ;
// riporto la curva alla quota giusta
pCrvCompoPartIn->Translate( dZLoc * pSfrClass->GetNormVersor()) ;
pCrvCompoPartIn->ApproxWithLines( 0, 0, ICurve::APL_SPECIAL, vPL_InsideSfr.back()) ;
pCrvCompoPartIn->ApproxWithLines( 0, 0, ICurve::APL_SPECIAL, vPLInsideSfr.back()) ;
}
}
}
}
swap( vPL, vPL_InsideSfr) ;
swap( vPL, vPLInsideSfr) ;
for ( auto& PL : vPL) {
// recupero la curva dalla silhouette
PtrOwner<ICurveComposite> pSilCrv( CreateCurveComposite()) ;
@@ -2574,7 +2591,7 @@ SurfFinishing::CalcZConstSilCrv( ICAvParSilhouettesSurfTm* pCavParSilh, const SU
pTempCrv->MergeCurves( SILH_ARC_TOL / 2., ANG_TOL_STD_DEG))
pSilCrv.Set( pTempCrv) ;
}
SimplifyCurve( pSilCrv) ;
SimplifyCurve( pSilCrv, frLocXY) ;
vCrvCompo.back().emplace_back( Release( pSilCrv)) ;
}
// controllo validità delle curve
@@ -4761,8 +4778,9 @@ SurfFinishing::GetOffsetCurvesFromPencilProjection( const ICRVCOMPOPOVECTOR& vCr
// lavoro a ZigZag
ICRVCOMPOPOVECTOR vCrvZigZag ;
if ( ! CalcPocketing( pSfrChunk, m_TParams.m_dDiam / 2., 0., m_Params.m_dSideStep, m_Params.m_dSideAngle,
5., POCKET_SUB_ZIGZAG, false, false, m_Params.m_bInvert, true, false,
false, P_INVALID, nullptr, true, INFINITO, INFINITO, GetLeadInType(), vCrvZigZag))
5., POCKET_SUB_ZIGZAG, false, false, m_Params.m_bInvert, true, true, false,
false, P_INVALID, nullptr, true, INFINITO, GetLeadInType(), m_Params.m_dLiTang, 0.,
GetLeadOutType(), m_Params.m_dLoTang, false, 0., 0., false, vCrvZigZag))
return false ;
// inserisco le curve ricavate
for ( auto& pCompo : vCrvZigZag) {
@@ -5459,8 +5477,8 @@ SurfFinishing::CalcOptimalZigZagCurves( const ISurfFlatRegion* pSfrLoc, const Fr
// eseguo il calcolo della lavorazione ZigZag
ICRVCOMPOPOVECTOR vpCrvs ;
if ( ! CalcPocketing( pSfrChunk, m_TParams.m_dDiam / 2., 0., m_Params.m_dSideStep, m_Params.m_dSideAngle, 5.,
nSubType, false, false, false, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
m_Params.m_dLiTang, GetLeadInType(), vpCrvs)) {
nSubType, false, false, false, true, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
GetLeadInType(), m_Params.m_dLiTang, 0., GetLeadOutType(), m_Params.m_dLoTang, false, 0., 0., false, vpCrvs)) {
m_pMchMgr->SetLastError( 3125, "Error in SurfFinishing : CalcPocketing failed") ;
return false ;
}
@@ -5806,7 +5824,7 @@ SurfFinishing::CalcOptimalZConstCurves( const ISurfFlatRegion* pSfrLoc, const SU
PtrOwner<ICurveComposite> pNewCrvCompo( CreateCurveComposite()) ;
if ( IsNull( pNewCrvCompo) || ! pNewCrvCompo->FromPolyLine( PL))
continue ;
SimplifyCurve( pNewCrvCompo) ;
SimplifyCurve( pNewCrvCompo, frSfr) ;
vvCrvCompo[i].emplace_back( Release( pNewCrvCompo)) ;
// memorizzo come primo TempParam la distanza della superficie ( per coerenza)
vvCrvCompo[i].back()->SetTempParam( dSfrDist, 0) ;
+1 -1
View File
@@ -115,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 ;
+234 -104
View File
@@ -124,6 +124,7 @@ static string KEY_SUBSTEP = "SUBSTEP" ;
#include "/EgtDev/Include/EgtPerfCounter.h"
#include "/EgtDev/Include/EGkExtText.h"
string sPathSrfBool = "C:\\Temp\\" ;
int nGrpDebugFeed = GDB_ID_NULL, nLayDebugFeed = GDB_ID_NULL ;
#endif
const double STEP_TOL = 10. * EPS_SMALL ;
@@ -420,6 +421,11 @@ SurfRoughing::SetParam( int nType, double dVal)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dOffsL = dVal ;
return true ;
case MPA_OVERL :
if ( ! AreSameLenValue( dVal, m_Params.m_dOverlap))
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dOverlap = dVal ;
return true ;
case MPA_DEPTH: {
string sVal = ToString( dVal) ;
if ( sVal != m_Params.m_sDepth)
@@ -836,6 +842,9 @@ SurfRoughing::GetParam( int nType, double& dVal) const
case MPA_STARTPOS :
dVal = m_Params.m_dStartPos ;
return true ;
case MPA_OVERL :
dVal = m_Params.m_dOverlap ;
return true ;
case MPA_STEP :
dVal = m_Params.m_dStep ;
return true ;
@@ -1228,7 +1237,7 @@ SurfRoughing::Chain( int nGrpDestId)
}
// scorro le regioni piane ricavate dalle curve
int nGroupName = -1 ;
int nGroupName = 0 ;
PtrOwner<ISurfFlatRegion> pSfrCurr( SfrByC.GetSurf()) ;
while ( ! IsNull( pSfrCurr) && pSfrCurr->IsValid()) {
// la normale del Chunk deve essere coerente con l'estrusione ricavata
@@ -1537,6 +1546,12 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
return false ;
}
// verifico se presente parametro di Overlap
if ( m_Params.m_dOverlap > 10. * EPS_SMALL) {
if ( ! pSfrSgro->Offset( m_Params.m_dOverlap, ICurve::OFF_EXTEND) || ! pSfrSgro->IsValid())
return false ;
}
// inizializzo la classe di intersezione tra grezzo e piani paralleli ( quelli di lavoro)
// traslo leggermente il grezzo per gestire il primo e l'ultimo Step
pStmRaw->Translate( - vtTool * 5 * EPS_SMALL) ;
@@ -2084,6 +2099,10 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
// Imposto dati comuni
SetPathId( nPxId) ;
SetToolDir( vtTool) ;
Vector3d vtAux ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
vtAux.Normalize() ;
SetAuxDir( vtAux) ;
// se richiesto ordine per ZChunk, aggiusto le geometrie inserite nel gruppo
if ( m_bOrderZ)
@@ -2440,71 +2459,83 @@ SurfRoughing::GetToolCollisionRegion( const ISurfFlatRegion* pSfrSgro, double& d
// recupero il Box della ventosa
BBox3d bFxtBox ;
if ( m_pGeomDB->GetGlobalBBox( nFxtId, bFxtBox) && ! bFxtBox.IsEmpty()) {
// espando il Box per evitare la collisione con l'utensile
bFxtBox.Expand( SAFE_TOL) ;
#if ENABLE_DEBUG_SFR_COLLISION
ICurveComposite* _pCompoFxt = CreateCurveComposite() ;
_pCompoFxt->AddPoint( bFxtBox.GetMin()) ;
_pCompoFxt->AddLine( bFxtBox.GetMin() + X_AX * bFxtBox.GetDimX()) ;
_pCompoFxt->AddLine( bFxtBox.GetMax() - Z_AX * bFxtBox.GetDimZ()) ;
_pCompoFxt->AddLine( bFxtBox.GetMin() + Y_AX * bFxtBox.GetDimY()) ;
_pCompoFxt->Close() ;
_pCompoFxt->SetExtrusion( Z_AX) ;
_pCompoFxt->SetThickness( bFxtBox.GetDimZ()) ;
int nFxtId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, _pCompoFxt) ;
m_pGeomDB->SetMaterial( nFxtId, YELLOW) ;
#endif
// recupero la TriMesh del Box
PtrOwner<ICurveComposite> pCompoFxt( CreateCurveComposite()) ;
if ( IsNull( pCompoFxt))
return false ;
pCompoFxt->AddPoint( bFxtBox.GetMin()) ;
pCompoFxt->AddLine( bFxtBox.GetMin() + X_AX * bFxtBox.GetDimX()) ;
pCompoFxt->AddLine( bFxtBox.GetMax() - Z_AX * bFxtBox.GetDimZ()) ;
pCompoFxt->AddLine( bFxtBox.GetMin() + Y_AX * bFxtBox.GetDimY()) ;
pCompoFxt->Close() ;
CICURVEPVECTOR vpCrvs ;
vpCrvs.emplace_back( pCompoFxt) ;
PtrOwner<ISurfTriMesh> pStmCollFxt( GetSurfTriMeshByRegionExtrusion( vpCrvs, Z_AX * bFxtBox.GetDimZ())) ;
if ( IsNull( pStmCollFxt) || ! pStmCollFxt->IsValid() || pStmCollFxt->GetTriangleCount() == 0)
return false ;
// recupero la sua proiezione nel piano di sgrossatura come regione piana
Plane3d plProj ;
if ( ! plProj.Set( frLoc.Orig() - dDepth * frLoc.VersZ(), frLoc.VersZ()))
return false ;
POLYLINEVECTOR vPL ;
if ( ! pStmCollFxt->GetSilhouette( plProj, EPS_SMALL, vPL)) // proiezione di 6 triangoli, veloce
return false ;
// se completamente dietro al piano, non influenza la sgrossatura attuale
if ( vPL.empty())
continue ;
SurfFlatRegionByContours SfrByC ;
for ( const PolyLine& PL : vPL) {
PtrOwner<ICurveComposite> pCompoLoop( CreateCurveComposite()) ;
if ( IsNull( pCompoLoop) || ! pCompoLoop->FromPolyLine( PL) ||
! SfrByC.AddCurve( Release( pCompoLoop)))
return false ;
}
PtrOwner<ISurfFlatRegion> pSfrFxtColl( SfrByC.GetSurf()) ;
if ( IsNull( pSfrFxtColl) || ! pSfrFxtColl->IsValid())
return false ;
if ( AreOppositeVectorApprox( pSfrFxtColl->GetNormVersor(), frLoc.VersZ()))
pSfrFxtColl->Invert() ;
// aggiorno la regione di collissione per l'utensile
if ( ! pSfrColl->IsValid()) {
if ( ! pSfrColl->CopyFrom( pSfrFxtColl))
return false ;
// se sgrossatura orientata come come Z_AX
if ( AreSameVectorApprox( pSfrSgro->GetNormVersor(), Z_AX)) {
// controllo se limitare la Depth della tavola
double dTabDist = abs( ( ptCen - bFxtBox.GetMax()) * pSfrSgro->GetNormVersor()) ;
if ( dDepth > dTabDist - DIST_TABLE) {
dDepth = dTabDist - DIST_TABLE ;
string sWarn = "Warning in SurfRoughing : Depth reduced at " + ToString( dDepth, 3) ;
m_pMchMgr->SetWarning( 3057, sWarn) ;
}
}
else {
if ( ! pSfrColl->Add( *pSfrFxtColl))
// espando il Box per evitare la collisione con l'utensile
bFxtBox.Expand( SAFE_TOL) ;
#if ENABLE_DEBUG_SFR_COLLISION
ICurveComposite* _pCompoFxt = CreateCurveComposite() ;
_pCompoFxt->AddPoint( bFxtBox.GetMin()) ;
_pCompoFxt->AddLine( bFxtBox.GetMin() + X_AX * bFxtBox.GetDimX()) ;
_pCompoFxt->AddLine( bFxtBox.GetMax() - Z_AX * bFxtBox.GetDimZ()) ;
_pCompoFxt->AddLine( bFxtBox.GetMin() + Y_AX * bFxtBox.GetDimY()) ;
_pCompoFxt->Close() ;
_pCompoFxt->SetExtrusion( Z_AX) ;
_pCompoFxt->SetThickness( bFxtBox.GetDimZ()) ;
int nFxtId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, _pCompoFxt) ;
m_pGeomDB->SetMaterial( nFxtId, YELLOW) ;
#endif
// recupero la TriMesh del Box
PtrOwner<ICurveComposite> pCompoFxt( CreateCurveComposite()) ;
if ( IsNull( pCompoFxt))
return false ;
pCompoFxt->AddPoint( bFxtBox.GetMin()) ;
pCompoFxt->AddLine( bFxtBox.GetMin() + X_AX * bFxtBox.GetDimX()) ;
pCompoFxt->AddLine( bFxtBox.GetMax() - Z_AX * bFxtBox.GetDimZ()) ;
pCompoFxt->AddLine( bFxtBox.GetMin() + Y_AX * bFxtBox.GetDimY()) ;
pCompoFxt->Close() ;
CICURVEPVECTOR vpCrvs ;
vpCrvs.emplace_back( pCompoFxt) ;
PtrOwner<ISurfTriMesh> pStmCollFxt( GetSurfTriMeshByRegionExtrusion( vpCrvs, Z_AX * bFxtBox.GetDimZ())) ;
if ( IsNull( pStmCollFxt) || ! pStmCollFxt->IsValid() || pStmCollFxt->GetTriangleCount() == 0)
return false ;
// recupero la sua proiezione nel piano di sgrossatura come regione piana
Plane3d plProj ;
if ( ! plProj.Set( frLoc.Orig() - dDepth * frLoc.VersZ(), frLoc.VersZ()))
return false ;
POLYLINEVECTOR vPL ;
if ( ! pStmCollFxt->GetSilhouette( plProj, EPS_SMALL, vPL)) // proiezione di 6 triangoli, veloce
return false ;
// se completamente dietro al piano, non influenza la sgrossatura attuale
if ( vPL.empty())
continue ;
SurfFlatRegionByContours SfrByC ;
for ( const PolyLine& PL : vPL) {
PtrOwner<ICurveComposite> pCompoLoop( CreateCurveComposite()) ;
if ( IsNull( pCompoLoop) || ! pCompoLoop->FromPolyLine( PL) ||
! SfrByC.AddCurve( Release( pCompoLoop)))
return false ;
}
PtrOwner<ISurfFlatRegion> pSfrFxtColl( SfrByC.GetSurf()) ;
if ( IsNull( pSfrFxtColl) || ! pSfrFxtColl->IsValid())
return false ;
if ( AreOppositeVectorApprox( pSfrFxtColl->GetNormVersor(), frLoc.VersZ()))
pSfrFxtColl->Invert() ;
// aggiorno la regione di collissione per l'utensile
if ( ! pSfrColl->IsValid()) {
if ( ! pSfrColl->CopyFrom( pSfrFxtColl))
return false ;
}
else {
if ( ! pSfrColl->Add( *pSfrFxtColl))
return false ;
}
#if ENABLE_DEBUG_SFR_COLLISION
ISurfFlatRegion* _pSfrFxt = CreateSurfFlatRegion() ;
_pSfrFxt->CopyFrom( pSfrFxtColl) ;
int _nSfrFxtId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, _pSfrFxt) ;
m_pGeomDB->SetMaterial( _nSfrFxtId, Color( 255, 255, 0, 50)) ;
#endif
}
#if ENABLE_DEBUG_SFR_COLLISION
ISurfFlatRegion* _pSfrFxt = CreateSurfFlatRegion() ;
_pSfrFxt->CopyFrom( pSfrFxtColl) ;
int _nSfrFxtId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, _pSfrFxt) ;
m_pGeomDB->SetMaterial( _nSfrFxtId, Color( 255, 255, 0, 50)) ;
#endif
}
}
@@ -2576,6 +2607,9 @@ SurfRoughing::GetToolCollisionRegion( const ISurfFlatRegion* pSfrSgro, double& d
}
}
}
// se non ho una superficie di Blocco, allora non devo fare nulla
if ( IsNull( pSfrBlock) || ! pSfrBlock->IsValid())
return true ;
// determino la superficie di collisione
pSfrColl->Clear() ;
@@ -2939,6 +2973,9 @@ SurfRoughing::CalcPaths( const INTINTVECTOR& vPocket, STEPINFOSRVECTOR& vStepInf
// del percorso successivo)
Point3d ptEndLastPath = P_INVALID ;
// determino se Conventional Milling o Climb Milling per curve singole
bool bConventionalMilling = ( m_Params.m_nSubType == POCKET_ONEWAY || m_Params.m_nSubType == POCKET_CONFORMAL_ONEWAY) ;
// scorro gli indici delle superfici
int nInd = 0 ;
for ( auto& vId : vPocket) {
@@ -3006,8 +3043,9 @@ SurfRoughing::CalcPaths( const INTINTVECTOR& vPocket, STEPINFOSRVECTOR& vStepInf
ICRVCOMPOPOVECTOR vCrvPaths ;
if ( ! CalcPocketing( vStepInfo[nInd].pSfrPock, m_TParams.m_dDiam / 2, 0., m_Params.m_dSideStep,
m_Params.m_dSideAngle, 5., vStepInfo[nInd].nSubType, true, true, vStepInfo[nInd].bInverted,
false, true, true, ptEndLastPath, vStepInfo[nInd].pSfrLimit, false, m_Params.m_dSideStep,
m_Params.m_dLiTang, GetLeadInType(), vCrvPaths)) {
false, bConventionalMilling, true, true, ptEndLastPath, vStepInfo[nInd].pSfrLimit, false, m_Params.m_dSideStep,
GetLeadInType(), m_Params.m_dLiTang, m_Params.m_dLiElev, GetLeadOutType(), m_Params.m_dLoTang,
false, 0., 0., false, vCrvPaths)) {
if ( vStepInfo[nInd].bIsExtraStep) {
string sWarn = "Warning in SurfRoughing : CalcPocketing failed with substep (" + ToString( vStepInfo[nInd].dDepth, 1) + ")" ;
m_pMchMgr->SetWarning( 3055, sWarn) ;
@@ -3118,13 +3156,13 @@ SurfRoughing::GetLinkFromPaths( STEPINFOSRVECTOR& vStepInfo, int i, int j, const
// recupero anche il suo punto iniziale, ovvero il punto finale del Link
int nLinkType = -1 ;
Point3d ptEnd ;
if ( j < int( vStepInfo[i].vPaths.size()) - 1) {
if ( j < ssize( vStepInfo[i].vPaths) - 1) {
nLinkType = PLANAR ;
vStepInfo[i].vPaths[j+1].pCrvPath->GetStartPoint( ptEnd) ;
}
else {
// --- se non esiste lo Step i+1 errore
if ( i + 1 >= int( vStepInfo.size()))
if ( i + 1 >= ssize( vStepInfo))
return false ;
vStepInfo[i+1].vPaths.front().pCrvPath->GetStartPoint( ptEnd) ;
nLinkType = ( ( ptEnd - ptStart) * vtTool < - 50 * EPS_SMALL ? DOWN : ABOVE) ;
@@ -3172,7 +3210,7 @@ SurfRoughing::GetLinkFromPaths( STEPINFOSRVECTOR& vStepInfo, int i, int j, const
return false ;
// nel caso stessi ordinando per ZChunk, devo controllare di essere fuori dalla limite
// anche per lo Step i+1
// NB. Nel caso stessi ordinando per piani, vuol dire che ho già svuotato tutti il piano i-esimo
// NB. Nel caso stessi ordinando per piani, vuol dire che ho già svuotato tutto il piano i-esimo
// Se Safe, allora definisco il collegamento
if ( bSafe) {
pCrvLink->AddPoint( ptStart) ;
@@ -3396,9 +3434,6 @@ SurfRoughing::OrderZChunkSteps( STEPDATAMATRIX& vvDataSteps, STEPDATAMATRIX& vIn
// se non ho Steps non faccio nulla
if ( vvDataSteps.empty())
return true ;
// se ho solo una riga di Steps, non posso ordinare per Z, l'ordine è già corretto
if ( int( vvDataSteps.size()) == 1)
return true ;
// ordino le righe della matrice ( i piani) per Z decrescente ( Z è negativa rispetto al piano { ORIG, Z_AX})
sort( vvDataSteps.begin(), vvDataSteps.end(), []( const STEPDATAVECTOR& vSDA, const STEPDATAVECTOR& vSDB) {
@@ -3762,6 +3797,11 @@ SurfRoughing::AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool,
STEPINFOSRVECTOR vStepInfo ;
if ( ! CalcPaths( vPocket, vStepInfo))
return false ;
#if ENABLE_DEBUG_FEEDS
nGrpDebugFeed = m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, GLOB_FRM) ;
nLayDebugFeed = m_pGeomDB->AddGroup( GDB_ID_NULL, nGrpDebugFeed, GLOB_FRM) ;
m_pGeomDB->SetName( nGrpDebugFeed, "Feed") ;
#endif
// recupero distanze di sicurezza
double dSafeZ = GetSafeZ() ;
@@ -3772,13 +3812,18 @@ SurfRoughing::AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool,
// punto finale del percorso precedente al corrente
Point3d ptEnd = P_INVALID ;
// recupero parametro di Feed minima
double dMinFeed = GetFeed() / FEED_MAX_REDUCE ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MINFEED, dMinFeed))
dMinFeed = Clamp( dMinFeed, GetFeed() / FEED_MAX_REDUCE, GetFeed()) ;
// scorro il vettore dei piani di pocketing
for ( int i = 0 ; i < int( vStepInfo.size()) ; ++ i) {
for ( int i = 0 ; i < ssize( vStepInfo) ; ++ i) {
// riferimento alle informazioni relative allo step i-esimo
StepInfoSR& currStep = vStepInfo[i] ;
// scorro i percorsi calcolati per il piano di pocketing i-esimo
for ( int j = 0 ; j < int( currStep.vPaths.size()) ; ++ j) {
for ( int j = 0 ; j < ssize( currStep.vPaths) ; ++ j) {
// riferimento alle informazioni relative al percorso j-esimo del piano di pocketing i-esimo
PathInfoSR& currPath = currStep.vPaths[j] ;
@@ -3855,17 +3900,18 @@ SurfRoughing::AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool,
ICurveLine* pLine = GetCurveLine( pCurve) ;
Point3d ptP3 = pLine->GetEnd() ;
Vector3d vtMove ; pLine->GetStartDir( vtMove) ;
SetFeed( Clamp( dCoeffFeed * GetFeed(), dMinFeed, GetFeed())) ;
#if ENABLE_DEBUG_FEEDS
DrawFeed( pLine, dCoeffFeed * GetRightFeed( vtMove, vtTool)) ;
DrawFeed( pCurve->Clone(), dCoeffFeed * GetFeed(), nLayDebugFeed) ;
#endif
SetFeed( dCoeffFeed * GetRightFeed( vtMove, vtTool)) ;
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
return false ;
}
else if ( pCurve->GetType() == CRV_ARC) {
ICurveArc* pArc = GetCurveArc( pCurve) ;
SetFeed( Clamp( dCoeffFeed * GetFeed(), dMinFeed, GetFeed())) ;
#if ENABLE_DEBUG_FEEDS
DrawFeed( pArc, dCoeffFeed * GetFeed()) ;
DrawFeed( pCurve->Clone(), dCoeffFeed * GetFeed(), nLayDebugFeed) ;
#endif
SetFeed( dCoeffFeed * GetFeed()) ;
if ( AddCurveMove( pArc, bSplitArcs) == GDB_ID_NULL)
@@ -3878,7 +3924,7 @@ SurfRoughing::AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool,
pCurve->GetEndPoint( ptEnd) ;
Vector3d vtEnd ; pCurve->GetEndDir( vtEnd) ;
// se sono l'ultima entità globale del percorso
if ( i == int( vStepInfo.size()) - 1 && j == int( currStep.vPaths.size()) - 1) {
if ( i == ssize( vStepInfo) - 1 && j == ssize( currStep.vPaths) - 1) {
// aggiungo LeadOut
Point3d ptP1 ;
SetFeed( GetEndFeed()) ;
@@ -3905,6 +3951,9 @@ SurfRoughing::AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool,
}
// imposto EndFeed e aggiungo il Link
SetFeed( GetEndFeed()) ;
#if ENABLE_DEBUG_FEEDS
DrawFeed( pCrvLink->Clone(), GetEndFeed(), nLayDebugFeed) ;
#endif
AddCurveMove( pCrvLink, bSplitArcs) ;
}
}
@@ -4097,6 +4146,12 @@ SurfRoughing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
PtrOwner<ICurveArc> pArc( CreateCurveArc()) ;
if ( IsNull( pArc) || ! pArc->Set( ptCen, vtN, dRad, - vtCen, dAngCen, dDeltaN))
return false ;
// dovendo creare l'elica, sono nel materiale, quindi regolo la Feed
Vector3d vtTanHelix ; pArc->GetStartDir( vtTanHelix) ;
SetFeed( GetRightStartFeed( vtTanHelix, vtN)) ;
#if ENABLE_DEBUG_FEEDS
DrawFeed( pArc->Clone(), GetRightStartFeed( vtTanHelix, vtN), nLayDebugFeed) ;
#endif
// emetto l'elica (con eventuale spezzatura)
return ( AddCurveMove( pArc, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
}
@@ -4112,14 +4167,30 @@ SurfRoughing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
double dStep = - dDeltaN / nStep ;
Point3d ptPa = ptP1 + vtStart * 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
Point3d ptPb = ptP1 - vtStart * 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
Vector3d vtTanZigZag = ( ptPa - vtN * 0.25 * dStep) - ptP1 ;
SetFeed( GetRightStartFeed( vtTanZigZag, vtN)) ;
// verifico se fattibile
if ( bSkipControl || VerifyLeadInZigZag( pSfr, ptStart, ptPa, ptPb)) {
for ( int i = 1 ; i <= nStep ; ++ i) {
#if ENABLE_DEBUG_FEEDS
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
Point3d ptCurr ; GetCurrPos( ptCurr) ; pLine->Set( ptCurr, ptPa - vtN * ( i - 0.75) * dStep) ;
DrawFeed( pLine->Clone(), GetRightStartFeed( vtTanZigZag, vtN), nLayDebugFeed) ;
#endif
if ( AddLinearMove( ptPa - vtN * ( i - 0.75) * dStep, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
return false ;
#if ENABLE_DEBUG_FEEDS
GetCurrPos( ptCurr) ; pLine->Set( ptCurr, ptPb - vtN * ( i - 0.25) * dStep) ;
DrawFeed( pLine->Clone(), GetRightStartFeed( vtTanZigZag, vtN), nLayDebugFeed) ;
#endif
if ( AddLinearMove( ptPb - vtN * ( i - 0.25) * dStep, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
return false ;
}
#if ENABLE_DEBUG_FEEDS
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
Point3d ptCurr ; GetCurrPos( ptCurr) ; pLine->Set( ptCurr, ptStart) ;
DrawFeed( pLine->Clone(), GetRightStartFeed( vtTanZigZag, vtN), nLayDebugFeed) ;
#endif
return ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
}
// altrimenti diretto
@@ -4154,6 +4225,14 @@ SurfRoughing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
double dNini = ( ptP1 - ORIG) * vtN ;
double dNfin = ( ptStart - ORIG) * vtN ;
AdjustCurveSlope( pCrv, dNini, dNfin) ;
// assegno le Feed
Point3d ptS ; pCrv->GetStartPoint( ptS) ;
Point3d ptE ; pCrv->GetEndPoint( ptE) ;
Vector3d vtFeedMove = ptE - ptS ;
SetFeed( GetRightStartFeed( vtFeedMove, vtN)) ;
#if ENABLE_DEBUG_FEEDS
DrawFeed( pCrv->Clone(), GetRightStartFeed( vtFeedMove, vtN), nLayDebugFeed) ;
#endif
// emetto (con eventuale spezzatura)
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
}
@@ -4166,6 +4245,17 @@ SurfRoughing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
Point3d ptCurr = ptP1 ;
GetCurrPos( ptCurr) ;
if ( ! AreSamePointApprox( ptCurr, ptStart)) {
Vector3d vtMove = ptStart - ptCurr ; vtMove.Normalize() ;
double dElev = 0. ;
bool bInMaterial = true ;
if ( GetElevation( m_nPhase, ptCurr, ptStart, vtN, GetRadiusForStartEndElevation(), m_TParams.m_dLen, vtN, dElev) && dElev < 10. * EPS_SMALL)
bInMaterial = false ;
// Feed di Testa
SetFeed( bInMaterial ? GetTipFeed() : GetStartFeed()) ;
#if ENABLE_DEBUG_FEEDS
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ; pLine->Set( ptCurr, ptStart) ;
DrawFeed( pLine->Clone(), bInMaterial ? GetTipFeed() : GetStartFeed(), nLayDebugFeed) ;
#endif
if ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
return false ;
}
@@ -4244,6 +4334,24 @@ SurfRoughing::GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) cons
return min( GetFeed(), GetTipFeed() / abs( dCosMove)) ;
}
//------------------------------------------------------------------
double
SurfRoughing::GetRightStartFeed( const Vector3d& vtMove, const Vector3d& vtTool) const
{
// Determino i versori
Vector3d vtM = vtMove ;
vtM.Normalize() ;
Vector3d vtT = vtTool ;
vtT.Normalize() ;
// Angolo tra movimento e versore utensile
double dCosMove = vtM * vtT ;
// Se l'utensile non ha movimento significativo di punta, si restituisce la feed standard
if ( dCosMove > - COS_ORTO_ANG_SMALL)
return GetStartFeed() ;
// Altrimenti non si deve superare la massima velocità di punta prevista
return min( GetStartFeed(), GetTipFeed() / abs( dCosMove)) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughing::ResetCurveAllTempProp( ICurve* pCurve) const
@@ -4269,52 +4377,60 @@ SurfRoughing::ResetCurveAllTempProp( ICurve* pCurve) const
//----------------------------------------------------------------------------
bool
SurfRoughing::SimplifyCurve( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvCheck) const
SurfRoughing::SimplifyCurve( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvCheck, const Frame3d& frLocXY) const
{
// controllo dei parametri
if ( pCompo == nullptr || ! pCompo->IsValid())
return false ;
// ricavo il punto iniziale e finale
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
// eseguo le modifiche su una copia della curva originale
PtrOwner<ICurveComposite> pCompoCL( CloneCurveComposite( pCompo)) ;
if ( IsNull( pCompoCL))
// eseguo le modifiche su una copia della curva originale in locale al frameXY
PtrOwner<ICurveComposite> pCompoLoc( CloneCurveComposite( pCompo)) ;
if ( IsNull( pCompoLoc))
return false ;
pCompoLoc->ToLoc( frLocXY) ;
// ricavo il punto iniziale e finale
Point3d ptStart ; pCompoLoc->GetStartPoint( ptStart) ;
Point3d ptEnd ; pCompoLoc->GetEndPoint( ptEnd) ;
// merge per uniformità
bool bOk = pCompoCL->MergeCurves( 200 * EPS_SMALL, 200 * EPS_ANG_SMALL, false) ;
bool bOk = pCompoLoc->MergeCurves( 200. * EPS_SMALL, 200. * EPS_ANG_SMALL, false) ;
// rimozione Spikes o Curve Z
bOk = bOk && pCompoCL->RemoveSmallDefects( 150 * EPS_SMALL, 2 * ANG_TOL_STD_DEG, true) ;
bOk = bOk && pCompoLoc->RemoveSmallDefects( 150. * EPS_SMALL, 2. * ANG_TOL_STD_DEG, true) ;
// interpolazione mediante linee ed archi
PolyArc PA ;
bOk = bOk && pCompoCL->ApproxWithArcsEx( 50 * EPS_SMALL, ANG_TOL_STD_DEG, LIN_FEA_STD, PA) &&
pCompoCL->Clear() && pCompoCL->FromPolyArc( PA) ;
bOk = bOk && pCompoLoc->ApproxWithArcsEx( 50. * EPS_SMALL, ANG_TOL_STD_DEG, LIN_FEA_STD, PA) &&
pCompoLoc->Clear() && pCompoLoc->FromPolyArc( PA) ;
// controllo aggiuntivo sui punti iniziali e finali che siano gli stessi
Point3d ptNewStart, ptNewEnd ;
bOk = bOk && pCompoCL->GetStartPoint( ptNewStart) && pCompoCL->GetEndPoint( ptNewEnd) &&
bOk = bOk && pCompoLoc->GetStartPoint( ptNewStart) && pCompoLoc->GetEndPoint( ptNewEnd) &&
AreSamePointApprox( ptNewStart, ptStart) && AreSamePointApprox( ptNewEnd, ptEnd) ;
// controllo che non si siano create auto-intersezioni
SelfIntersCurve SIC( *pCompoCL) ;
SelfIntersCurve SIC( *pCompoLoc) ;
bOk = bOk && ( SIC.GetCrossIntersCount() == 0) ;
// controllo che non si siano create intersezioni con le altre curve in punti interni
for ( int i = 0 ; i < int( vCrvCheck.size()) && bOk ; ++ i) {
IntersCurveCurve ICC( *vCrvCheck[i], *pCompoCL) ;
for ( int j = 0 ; j < int( ICC.GetIntersCount()) && bOk ; ++ j) {
IntCrvCrvInfo aInfo ;
bOk = bOk && ICC.GetIntCrvCrvInfo( j, aInfo) ;
bOk = bOk && ( AreSamePointApprox( ptStart, aInfo.IciA[0].ptI) ||
AreSamePointApprox( ptEnd, aInfo.IciA[0].ptI)) ;
for ( int i = 0 ; i < ssize( vCrvCheck) && bOk ; ++ i) {
PtrOwner<ICurveComposite> pCrvCheckLocXY( CloneCurveComposite( vCrvCheck[i])) ;
bOk = bOk && ( ! IsNull( pCrvCheckLocXY)) && pCrvCheckLocXY->IsValid() ;
if ( bOk) {
pCrvCheckLocXY->ToLoc( frLocXY) ;
IntersCurveCurve ICC( *pCrvCheckLocXY, *pCompoLoc) ;
for ( int j = 0 ; j < ICC.GetIntersCount() && bOk ; ++ j) {
IntCrvCrvInfo aInfo ;
bOk = ICC.GetIntCrvCrvInfo( j, aInfo) ;
bOk = bOk && ( AreSamePointApprox( ptStart, aInfo.IciA[0].ptI) ||
AreSamePointApprox( ptEnd, aInfo.IciA[0].ptI)) ;
}
}
}
// se tutto bene, sostiuisco la curva originale con la modificata
if ( bOk)
pCompo->CopyFrom( pCompoCL) ;
if ( bOk) {
pCompoLoc->ToGlob( frLocXY) ;
pCompo->CopyFrom( pCompoLoc) ;
}
return true ;
}
@@ -4333,12 +4449,17 @@ SurfRoughing::SimplyfySfr( ISurfFlatRegion* pSfr) const
return false ;
ICRVCOMPOPOVECTOR vCrvEmpty ;
// recupero il frame localeXY della regione piana
Frame3d frLoc ;
Point3d ptC ; pSfr->GetCentroid( ptC) ;
frLoc.Set( ptC, pSfr->GetNormVersor()) ;
// scorro tutti i loops di tutte le parti
for ( int nC = 0 ; nC < pSfr->GetChunkCount() ; ++ nC) {
for ( int nL = 0 ; nL < pSfr->GetLoopCount( nC) ; ++ nL) {
// recupero la curva di Loop e la semplifico
PtrOwner<ICurveComposite> pCompoLoop( ConvertCurveToComposite( pSfr->GetLoop( nC, nL))) ;
if ( IsNull( pCompoLoop) || ! SimplifyCurve( pCompoLoop, vCrvEmpty))
if ( IsNull( pCompoLoop) || ! SimplifyCurve( pCompoLoop, vCrvEmpty, frLoc))
return false ;
// inserisco le curve nella nuova regione (il primo loop di ogni parte è esterno)
if ( nL == 0) {
@@ -4446,6 +4567,11 @@ SurfRoughing::CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler
if ( IsNull( pSfrRegular))
return false ;
// recupero il frame locale XY della superficie
Frame3d frLoc ;
Point3d ptC ; pSfr->GetCentroid( ptC) ;
frLoc.Set( ptC, pSfr->GetNormVersor()) ;
// scorro tutti i chunk della superficie
for ( int nC = 0 ; nC < pSfr->GetChunkCount() ; ++ nC) {
// creo una superficie di test
@@ -4476,7 +4602,7 @@ SurfRoughing::CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler
// se tratto aperto e non coincidente con tutta la curva
if ( vpCrvs[i]->GetTempProp( 0) == TEMP_PROP_OPEN_EDGE && int( vpCrvs.size()) != 1) {
// semplifico il loop per avere curve più uniformi
SimplifyCurve( vpCrvs[i], vCrvClose) ;
SimplifyCurve( vpCrvs[i], vCrvClose, frLoc) ;
// riporto le proprietà
vpCrvs[i]->SetTempProp( TEMP_PROP_OPEN_EDGE) ;
for ( int j = 0 ; j < vpCrvs[i]->GetCurveCount() ; ++ j)
@@ -4865,15 +4991,19 @@ SurfRoughing::DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bUniform, Color C
//----------------------------------------------------------------------------
void
SurfRoughing::DrawFeed( const ICurve* pCrv, double dFeed) const
SurfRoughing::DrawFeed( const ICurve* pCrv, double dFeed, int nLay) const
{
if ( pCrv == nullptr)
return ;
double dMinFeed = GetFeed() * GetSideStep() / m_TParams.m_dDiam ;
// recupero parametro di Feed minima
double dMinFeed = GetFeed() / FEED_MAX_REDUCE ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MINFEED, dMinFeed))
dMinFeed = Clamp( dMinFeed, GetFeed() / FEED_MAX_REDUCE, GetFeed()) ;
double myAngle = 120 * ( ( ( dFeed - dMinFeed) / ( GetFeed() - dMinFeed))) ;
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pCrv->Clone()) ;
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nLay, pCrv->Clone()) ;
m_pGeomDB->SetMaterial( nInd, GetColorFromHSV( HSV( myAngle, 1., 1.))) ;
return ;
return ;
}
+3 -2
View File
@@ -215,6 +215,7 @@ class SurfRoughing : public Machining
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,
@@ -222,7 +223,7 @@ 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 Point3d& ptDest, const ISurfFlatRegion* pSfrCheck, const Vector3d& vtTool,
bool& bSafe) const ;
@@ -270,7 +271,7 @@ class SurfRoughing : public Machining
/* debug functions */
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf, Color Col, bool bAlphaCoverage, std::string sName) const ;
void DrawFeed( const ICurve* pCrv, double dFeed) const ;
void DrawFeed( const ICurve* pCrv, double dFeed, int nLay) const ;
void DrawNormalShaderSurfTm( const ISurfTriMesh* pStm, std::string sName) const ;
/* end debug functions */
+17 -3
View File
@@ -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
View File
@@ -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 ;
+22
View File
@@ -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" ;
+19 -17
View File
@@ -1740,10 +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 ;
}
@@ -1783,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
@@ -1804,7 +1814,7 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
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
@@ -1822,7 +1832,7 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
m_pGeomDB->SetMaterial( nRRId, INVISIBLE) ;
// regione per attacco
PtrOwner<ISurfFlatRegion> pSfrLI( GenerateLeadInPreview( pCompo, bClosed)) ;
PtrOwner<ISurfFlatRegion> pSfrLI( GenerateLeadInPreview( pCompo, vtTool, bClosed)) ;
if ( IsNull( pSfrLI))
return false ;
if ( pSfrLI->IsValid()) {
@@ -1832,7 +1842,6 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
if ( IsNull( pCrvLI))
return false ;
int nCLIId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrvLI)) ;
// int nCLIId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfrLI)) ;
if ( nCLIId == GDB_ID_NULL)
return false ;
// assegno nome e colore
@@ -1854,7 +1863,7 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
}
// regione per uscita
PtrOwner<ISurfFlatRegion> pSfrLO( GenerateLeadOutPreview( pCompo)) ;
PtrOwner<ISurfFlatRegion> pSfrLO( GenerateLeadOutPreview( pCompo, vtTool)) ;
if ( IsNull( pSfrLO))
return false ;
if ( pSfrLO->IsValid()) {
@@ -2015,7 +2024,7 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
//----------------------------------------------------------------------------
ISurfFlatRegion*
WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo, bool bClosed)
WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo, const Vector3d& vtN, bool bClosed)
{
// Creo la superficie
PtrOwner<ISurfFlatRegion> pSfr( CreateSurfFlatRegion()) ;
@@ -2028,8 +2037,6 @@ WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo, bool bClosed
// 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() ;
@@ -2082,7 +2089,7 @@ WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo, bool bClosed
//----------------------------------------------------------------------------
ISurfFlatRegion*
WaterJetting::GenerateLeadOutPreview( const ICurveComposite* pCompo)
WaterJetting::GenerateLeadOutPreview( const ICurveComposite* pCompo, const Vector3d& vtN)
{
// Creo la regione
PtrOwner<ISurfFlatRegion> pSfr( CreateSurfFlatRegion()) ;
@@ -2112,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) {
@@ -2320,9 +2325,6 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
// 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) ;
@@ -2404,7 +2406,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
// anello
bool bLoopOk = true ;
PtrOwner<ICurve> pCrvA( GetArc2PVN( ptPe, ptPs, vtEnd, vtN)) ;
PtrOwner<ICurve> pCrvA( GetArc2PVN( ptPe, ptPs, vtEnd, vtTool)) ;
if ( ! IsNull( pCrvA) && pCrvA->GetType() == CRV_ARC) {
// verifico che l'anello non interferisca con la curva di lavoro
IntersCurveCurve intAC( *pCrvA, *pCompo) ;
+3 -3
View File
@@ -82,9 +82,9 @@ class WaterJetting : public Machining
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, bool bClosed) ;
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) ;