Compare commits

..

54 Commits

Author SHA1 Message Date
Daniele Bariletti d949864643 Merge branch 'master' into 5AxTrimming 2026-06-09 12:32:25 +02:00
Daniele Bariletti 94cf212333 EgtMachKernel :
- spostata funzione per il calcolo IntersLineCyl
- rimosso codice di debug.
2026-06-09 12:31:59 +02:00
Riccardo Elitropi bcfa3326b8 EgtMachKernel 3.1f1 :
- piccola correzione messaggio di errore in PocketingNT.
2026-06-09 10:20:54 +02:00
Riccardo Elitropi 38ceb12df8 EgtMachKernel 3.1e7 :
- in PocketingNT aggiunto controllo aggiuntivo per Silhouette del grezzo
- in PocketingNT aggiunto parametro da note utenti StartPoint.
2026-06-09 09:50:08 +02:00
Daniele Bariletti 8b8ad9af44 EgtMachKernel :
- aggiunta gestione per angoli interni smooth.
2026-06-05 12:07:38 +02:00
Riccardo Elitropi 1874f6b1f8 EgtMachKernel :
- in finiture migliorati i controlli per tipologia Optimal.
2026-05-29 16:49:28 +02:00
Riccardo Elitropi 981563b682 EgtMachKernel :
- in PocketingNT aggiunto LeadOut a scivolo per percorsi in ToolCompensation
- in PocketingNT aggiunto piccolo arco di raccordo per ingressi ai percorsi in ToolCompensation
- in PocketingNT correzioni varie.
2026-05-29 13:28:02 +02:00
Dario Sassi c848b82235 EgtMachKereel :
- ulteriori migliorie per correzione raggio fresa in macchina/CNC.
2026-05-28 22:52:57 +02:00
Dario Sassi b3366241a2 EgtMachKernel :
- messa a punto offset di Milling per correzione raggio fresa in macchina.
2026-05-27 19:28:59 +02:00
Riccardo Elitropi 31a701a0e3 EgtMachKernel :
- in Finitura di superficie rimozione parametro Offset radiale per considerazione sulla curva di bordo.
2026-05-27 17:31:06 +02:00
Riccardo Elitropi 040be553ad EgtMachKernel :
- aggiunta gestione Spiral  in Correzione utensile per Milling
- aggiunta gestione Tab e Oscillation in correzione utensile per Milling.
2026-05-27 13:37:34 +02:00
Riccardo Elitropi a747e7ecfb Merge commit 'dfa0069a0b402c0a45ddcc56b75056e8f0050962' 2026-05-26 17:01:04 +02:00
Riccardo Elitropi dfa0069a0b EgtMachKernel (MillingToolComp) :
- prima versione per Tool Compensation in lavorazioni Milling.
2026-05-26 17:00:31 +02:00
Riccardo Elitropi f089cd1e1c EgtMachKernel (MillingToolComp) :
- aggiunta gestione per OneWay a più step e semplificazione del codice.
2026-05-26 16:11:09 +02:00
Riccardo Elitropi 1ebce72c1d EgtMachKernel (MillingToolComp) :
- piccola correzione.
2026-05-26 11:18:06 +02:00
Riccardo Elitropi b87cbbfb5b EgtMachKernel (MillingToolComp) :
- aggiunta gestione per Milling ZigZag a singolo step e multi step.
2026-05-26 10:14:36 +02:00
Riccardo Elitropi c1b5f41d0d EgtMachKernel (MillingToolComp) :
- prima versione di prova per Tool Compensation per Milling.
2026-05-25 17:18:54 +02:00
Dario Sassi a91525108c EgtMachKernel 3.1e5 :
- modifiche a svuotature per correzioni raggio fresa in macchina
- preparazione di fresature per correzioni raggio fresa in macchina.
2026-05-25 07:37:58 +02:00
Dario Sassi f2b8f25fbd EgtMachKernel :
- corretto calcolo elevazione per percorso di lavorazione Mortasatura.
2026-05-22 20:18:38 +02:00
Dario Sassi 77b0363152 EgtMachKernel :
- annullato flag di DEBUG_PRV.
2026-05-22 09:24:45 +02:00
Dario Sassi 5bd8468d10 EgtMacheKernel :
- correzione recupero riferimento uscita per visualizzazione Preview Utensile/Testa.
2026-05-22 09:16:54 +02:00
Riccardo Elitropi ae5a7b8064 EgtMachKernel :
- In finiture aggiunte considerazioni per invesione utensile, migliorate e corrette finiture Optimal
- in PocketingNT aggiunta gestione di isole aperte all'interno del grezzo.
2026-05-21 12:01:27 +02:00
Riccardo Elitropi d0bbc52253 EgtMachKernel 3.1e4 :
- in SurfFinishing migliorate e corrette le lavorazione ZLevel.
2026-05-19 10:29:54 +02:00
Dario Sassi b1e7534b28 EgtMachKernel :
- quando si scelgono gli angoli del robot se inizio si accetta di passare anche da direzione singolare (movimento in aria).
2026-05-17 19:28:09 +02:00
Dario Sassi db30954eb3 EgtMachKernel :
- aggiunto ricalcolo RawOutline dopo rotazione dello stesso attorno ad asse diverso da Z.
2026-05-15 18:33:27 +02:00
Dario Sassi 8c59084a99 EgtMachKernel :
- aggiunta la funzione AddRawPart per definire un nuovo grezzo a partire da una curva con spessore o da una superficie.
2026-05-15 11:41:50 +02:00
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
42 changed files with 4821 additions and 1564 deletions
+14
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))
@@ -585,11 +587,23 @@ CamData::CamData( void)
bool
CamData::SetMoveType( int nMove)
{
if ( nMove < 0 || nMove > 3)
return false ;
m_nMove = nMove ;
ResetObjGraphics() ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetCorrType( int nCorr)
{
if ( nCorr != 0 && nCorr != 41 && nCorr != 42 && nCorr != 140 && nCorr != 141 && nCorr != 142)
return false ;
m_nCorre = nCorr ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetToolDir( const Vector3d& vtDir)
+4 -1
View File
@@ -46,6 +46,7 @@ class CamData : public IUserObj
public :
CamData( void) ;
bool SetMoveType( int nMove) ;
bool SetCorrType( int nCorr) ;
bool SetToolDir( const Vector3d& vtDir) ;
bool SetCorrDir( const Vector3d& vtDir) ;
bool SetAuxDir( const Vector3d& vtDir) ;
@@ -78,6 +79,8 @@ class CamData : public IUserObj
{ return ( m_nMove == 0 || m_nMove == 1) ; }
bool IsArc( void) const
{ return ( m_nMove == 2 || m_nMove == 3) ; }
int GetCorrType( void) const
{ return m_nCorre ; }
const Vector3d& GetToolDir( void) const
{ return m_vtTool ; }
const Vector3d& GetCorrDir( void) const
@@ -144,7 +147,7 @@ class CamData : public IUserObj
int m_nOwnerId ;
IGeomDB* m_pGeomDB ;
int m_nMove ; // tipo movimento (0=rapido, 1=lineare, 2=arco CW, 3=arco CCW)
int m_nCorre ; // tipo correzione (0, 41, 42, 141, 142, 40)
int m_nCorre ; // tipo correzione (0, 41, 42, 140, 141, 142)
bool m_bToolShow ; // flag per forzare la visualizzazione della direzione utensile in ogni caso
Vector3d m_vtTool ; // versore fresa
Vector3d m_vtCorr ; // versore correzione
+62 -32
View File
@@ -3336,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)
@@ -3579,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() && abs( hole.vtDir * vtNorm) > cos( 1. * DEGTORAD)) ;
}
}
}
// ciclo di affondamento a step
const double MIN_STEP = 1 ;
const double APPR_STEP = 1 ;
@@ -3653,9 +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 ( bDoubleParallel && i == nStep) {
SetFlag( 105) ; // movimento in doppio parallelo
if ( AddLinearMove( ptP3, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
if ( AddLinearMove( ptP3, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
return false ;
}
else {
@@ -3685,9 +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 ( bDoubleParallel && i == nStep) {
SetFlag( 105) ; // movimento in doppio parallelo
if ( AddLinearMove( ptP4, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
if ( AddLinearMove( ptP4, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
return false ;
}
else {
@@ -3716,9 +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 ( bDoubleParallel && i == nStep) {
SetFlag( 105) ; // movimento in doppio parallelo
if ( AddLinearMove( ptP5, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
if ( AddLinearMove( ptP5, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
return false ;
}
else {
@@ -3732,15 +3757,20 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
// 6 -> ritorno all'approccio del foro
SetFeed( GetEndFeed()) ;
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
+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_COMP_PROGRAM = 0, // Compensazione Utensile da Programma
TOOL_COMP_LENGTH = 1, // Compensazione Lunghezza Utensile in Macchina
TOOL_COMP_RADIUS = 2, // Compensazione Raggio Utensile in Macchina
TOOL_COMP_LEN_AND_RAD = 3 // Compensazione Lunghezza e Raggio Utensile in Macchina
} ;
+5 -3
View File
@@ -123,6 +123,7 @@ class MachMgr : public IMachMgr
bool IsRawPart( int nId) const override
{ return VerifyRawPart( nId) ; }
int AddRawPart( const Point3d& ptOrig, double dLen, double dWidth, double dHeight, Color cCol) override ;
int AddRawPart( int nCrvSrfId, double dOverMat, Color cCol) override ;
int AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color cCol) override ;
bool ModifyRawPart( int nRawId, const Point3d& ptOrig, double dLen, double dWidth, double dHeight, Color cCol) override ;
bool ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dHeight, Color cCol) override ;
@@ -328,9 +329,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& vTDir) const override ;
bool GetClEntCDir( int nEntId, Vector3d& vCDir) const override ;
bool GetClEntADir( int nEntId, Vector3d& vADir) 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 ;
@@ -537,6 +538,7 @@ class MachMgr : public IMachMgr
int AddRawPart( int nSurfUpId, int nSurfDownId, double dHeight, Color cCol) ;
bool SetRawPartCenter( int nRawId) ;
bool ResetRawPartCenter( int nRawId) ;
bool UpdateRawOutline( int nRawId) ;
// Parts
bool SwapParts( bool bToRawPart) ;
bool SwapRawPartParts( int nRawId, bool bToRawPart) ;
+11 -11
View File
@@ -150,10 +150,10 @@ MachMgr::GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntTDir( int nEntId, Vector3d& vTDir) const
MachMgr::GetClEntTDir( int nEntId, Vector3d& vtTDir) const
{
// default
vTDir = V_NULL ;
vtTDir = V_NULL ;
// verifico validità GeomBD
if ( m_pGeomDB == nullptr)
return false ;
@@ -161,17 +161,17 @@ MachMgr::GetClEntTDir( int nEntId, Vector3d& vTDir) const
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero vTDir
vTDir = pCamData->GetToolDir() ;
// recupero TDir
vtTDir = pCamData->GetToolDir() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntCDir( int nEntId, Vector3d& vCDir) const
MachMgr::GetClEntCDir( int nEntId, Vector3d& vtCDir) const
{
// default
vCDir = V_NULL ;
vtCDir = V_NULL ;
// verifico validità GeomDB
if ( m_pGeomDB == nullptr)
return false ;
@@ -179,17 +179,17 @@ MachMgr::GetClEntCDir( int nEntId, Vector3d& vCDir) const
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero vCDir
vCDir = pCamData->GetCorrDir() ;
// recupero CDir
vtCDir = pCamData->GetCorrDir() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntADir( int nEntId, Vector3d& vADir) const
MachMgr::GetClEntADir( int nEntId, Vector3d& vtADir) const
{
// default
vADir = V_NULL ;
vtADir = V_NULL ;
// verifico validità GeomDB
if ( m_pGeomDB == nullptr)
return false ;
@@ -198,6 +198,6 @@ MachMgr::GetClEntADir( int nEntId, Vector3d& vADir) const
if ( pCamData == nullptr)
return false ;
// recupero ADir
vADir = pCamData->GetAuxDir() ;
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
+206 -98
View File
@@ -29,6 +29,7 @@
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStmFromCurves.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkCAvSilhouetteSurfTm.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EXeConst.h"
@@ -167,6 +168,88 @@ MachMgr::ModifyRawPart( int nRawId, const Point3d& ptOrig, double dLen, double d
return bOk ;
}
//----------------------------------------------------------------------------
int
MachMgr::AddRawPart( int nCrvSrfId, double dOverMat, Color cCol)
{
// verifico il gruppo dei grezzi nella macchinata corrente
if ( GetCurrRawGroupId() == GDB_ID_NULL)
return GDB_ID_NULL ;
// recupero il tipo di oggetto per definire il grezzo
int nGtype = m_pGeomDB->GetGeoType( nCrvSrfId) ;
// costruzione del grezzo
int nRawId = GDB_ID_NULL ;
// se grezzo da superficie (per ora senza possibilità di offset)
if ( ( nGtype & GEO_SURF) != 0) {
// inserisco il grezzo
nRawId = AddRawPart( nCrvSrfId, cCol) ;
}
// se altrimenti grezzo da contorno
else if ( ( nGtype & GEO_CURVE) != 0) {
// recupero la curva
const ICurve* pCrv = GetCurve( m_pGeomDB->GetGeoObj( nCrvSrfId)) ;
if ( pCrv == nullptr)
return GDB_ID_NULL ;
// copio la curva in una composita
PtrOwner<ICurveComposite> pMyCrv( ConvertCurveToComposite( pCrv->Clone())) ;
if ( IsNull( pMyCrv))
return GDB_ID_NULL ;
// se non è chiusa, la chiudo
pMyCrv->Close() ;
// recupero l'estrusione e lo spessore
Vector3d vtExtr ;
if ( ! pMyCrv->GetExtrusion( vtExtr) || vtExtr.IsSmall())
vtExtr = Z_AX ;
double dThick = 0 ;
pMyCrv->GetThickness( dThick) ;
if ( abs( dThick) + 2 * dOverMat < 10 *EPS_SMALL)
dThick = 1 ;
// la oriento in senso CCW
Plane3d plPlane ;
double dArea ;
if ( ! pMyCrv->GetArea( plPlane, dArea))
return GDB_ID_NULL ;
if ( plPlane.GetVersN() * vtExtr * dArea < 0)
pMyCrv->Invert() ;
// ne eseguo l'offset
OffsetCurve OffsCrv ;
OffsCrv.Make( pMyCrv, dOverMat, ICurve::OFF_EXTEND) ;
PtrOwner<ICurve> pOffsCrv( OffsCrv.GetLongerCurve()) ;
if ( IsNull( pOffsCrv))
return GDB_ID_NULL ;
// aggiusto per sovramateriale lungo estrusione
pMyCrv->Translate( vtExtr * -copysign( dOverMat, dThick)) ;
// creo il solido
double dH = dThick + 2 * copysign( dOverMat, dThick) ;
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshByExtrusion( pOffsCrv, vtExtr * dH, true, 50 * EPS_SMALL)) ;
if ( IsNull( pStm))
return false ;
// lo inserisco nel DB geometrico
int nSrfId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, m_pGeomDB->GetParentId( nCrvSrfId), Release( pStm)) ;
if ( nSrfId == GDB_ID_NULL)
return GDB_ID_NULL ;
// inserisco il grezzo
nRawId = AddRawPart( nSrfId, cCol) ;
// cancello la superficie
m_pGeomDB->Erase( nSrfId) ;
}
// verifico costruzione grezzo
if ( nRawId == GDB_ID_NULL)
return GDB_ID_NULL ;
// se definita tavola, aggiusto posizione del grezzo
Point3d ptTabRef ;
if ( GetTableRef( 1, ptTabRef)) {
// recupero box del solido
int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
BBox3d b3RawSolid ;
// lo porto nell'angolo in basso a sinistra della tavola
if ( m_pGeomDB->GetGlobalBBox( nRawSolidId, b3RawSolid))
m_pGeomDB->TranslateGlob( nRawId, ptTabRef - b3RawSolid.GetMin()) ;
}
return nRawId ;
}
//----------------------------------------------------------------------------
int
MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color cCol)
@@ -187,6 +270,9 @@ MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color
if ( ( nGtype & GEO_SURF) != 0) {
// inserisco il grezzo
nRawId = AddRawPart( nCrvSrfId, cCol) ;
// se inserimento riuscito, nascondo la superficie originale
if ( nRawId != GDB_ID_NULL)
m_pGeomDB->SetStatus( nCrvSrfId, GDB_ST_OFF) ;
// annullo il sovra-materiale
dOverMat = 0 ;
// calcolo il punto di inserimento nel grezzo
@@ -421,109 +507,12 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
// calcolo il punto centro del solido
bOk = bOk && SetRawPartCenter( nRawId) ;
// calcolo la curva di contorno
if ( bOk) {
// creo la curva
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( IsNull( pCrvCompo))
return GDB_ID_NULL ;
// recupero la superficie trimesh
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return GDB_ID_NULL ;
// recupero l'ingombro della superficie in locale
BBox3d b3Srf ;
pStm->GetLocalBBox( b3Srf) ;
// ne calcolo la silhouette secondo Z+
bool bSilh = false ;
const int NUM_TRIA_LIM = 500 ;
if ( pStm->GetTriangleCount() < NUM_TRIA_LIM) {
POLYLINEVECTOR vPL ;
if ( pStm->GetSilhouette( Z_AX, 10.0, vPL) && ! vPL.empty()) {
// cerco il contorno esterno
int nInd = - 1 ;
double dMaxArea = 0 ;
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
double dArea ;
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
if ( dArea < 0)
vPL[i].Invert() ;
dMaxArea = abs( dArea) ;
nInd = i ;
}
}
// ne deduco la curva
PtrOwner<ICurveComposite> pCrvSilh( CreateCurveComposite()) ;
if ( nInd >= 0 && pCrvSilh->FromPolyLine( vPL[nInd])) {
pCrvSilh->SetExtrusion( Z_AX) ;
Plane3d plProj ;
plProj.Set( b3Srf.GetMin(), Z_AX) ;
pCrvCompo.Set( GetCurveComposite( ProjectCurveOnPlane( *pCrvSilh, plProj))) ;
if ( ! IsNull( pCrvCompo)) {
pCrvCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ;
bSilh = true ;
}
}
}
}
else {
PtrOwner<ICAvParSilhouettesSurfTm> pCavParSilh( CreateCAvParSilhouettesSurfTm()) ;
if ( ! IsNull( pCavParSilh)) {
Frame3d frSrf( b3Srf.GetMin()) ;
const double SILH_TOL = 1.0 ;
POLYLINEVECTOR vPL ;
if ( pCavParSilh->SetData( { pStm}, frSrf, SILH_TOL) &&
pCavParSilh->GetSilhouette( 0, vPL)) {
// cerco il contorno esterno
int nInd = - 1 ;
double dMaxArea = 0 ;
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
double dArea ;
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
if ( dArea < 0)
vPL[i].Invert() ;
dMaxArea = abs( dArea) ;
nInd = i ;
}
}
// ne deduco la curva
if ( nInd >= 0 && pCrvCompo->FromPolyLine( vPL[nInd])) {
pCrvCompo->SetExtrusion( Z_AX) ;
bSilh = true ;
}
}
}
}
// non riuscita, la calcolo come contorno del box
if ( ! bSilh) {
Point3d ptMin ;
double dDimX, dDimY, dDimZ ;
b3Srf.GetMinDim( ptMin, dDimX, dDimY, dDimZ) ;
PolyLine PL ;
PL.AddUPoint( 0, ptMin) ;
PL.AddUPoint( 1, ptMin + Vector3d( dDimX, 0,0)) ;
PL.AddUPoint( 2, ptMin + Vector3d( dDimX, dDimY,0)) ;
PL.AddUPoint( 3, ptMin + Vector3d( 0, dDimY,0)) ;
PL.AddUPoint( 4, ptMin) ;
if ( pCrvCompo->FromPolyLine( PL))
pCrvCompo->SetExtrusion( Z_AX) ;
else
bOk = false ;
}
// inserisco la curva composita nel DB
int nCrvId = ( bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pCrvCompo)) : GDB_ID_NULL) ;
bOk = bOk && ( nCrvId != GDB_ID_NULL) ;
// assegno il nome alla curva
bOk = bOk && m_pGeomDB->SetName( nCrvId, MACH_RAW_OUTLINE) ;
// assegno il colore alla curva
bOk = bOk && m_pGeomDB->SetMaterial( nCrvId, cCol) ;
}
bOk = bOk && UpdateRawOutline( nRawId) ;
// se qualcosa è andato storto, cancello tutto
if ( ! bOk) {
m_pGeomDB->Erase( nRawId) ;
return GDB_ID_NULL ;
}
// nascondo la superficie originale
m_pGeomDB->SetStatus( nSurfId, GDB_ST_OFF) ;
// tutto ok
return nRawId ;
}
@@ -918,6 +907,9 @@ MachMgr::RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg)
LOG_ERROR( GetEMkLogger(), "Error on RotateRawPart") ;
return false ;
}
// se rotazione non è attorno a Z, aggiorno la curva di outline
if ( abs( dAngRotDeg) > EPS_ANG_ZERO && ! vtAx.IsZ())
UpdateRawOutline( nRawId) ;
return true ;
}
@@ -1056,6 +1048,122 @@ MachMgr::GetRawPartBBox( int nRawId, BBox3d& b3Raw)
return m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::UpdateRawOutline( int nRawId)
{
// cerco il solido del grezzo
int nSolId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
if ( nSolId == GDB_ID_NULL)
return false ;
// creo la curva
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( IsNull( pCrvCompo))
return false ;
// recupero la superficie trimesh in globale
SurfLocal pStmG( m_pGeomDB, nSolId, GLOB_FRM) ;
const ISurfTriMesh* pStm = GetSurfTriMesh( pStmG) ;
if ( pStm == nullptr)
return false ;
// recupero l'ingombro della superficie
BBox3d b3Srf ;
pStm->GetLocalBBox( b3Srf) ;
// ne calcolo la silhouette secondo Z+ globale
bool bSilh = false ;
const int NUM_TRIA_LIM = 500 ;
if ( pStm->GetTriangleCount() < NUM_TRIA_LIM) {
POLYLINEVECTOR vPL ;
if ( pStm->GetSilhouette( Z_AX, 10.0, vPL) && ! vPL.empty()) {
// cerco il contorno esterno
int nInd = - 1 ;
double dMaxArea = 0 ;
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
double dArea ;
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
if ( dArea < 0)
vPL[i].Invert() ;
dMaxArea = abs( dArea) ;
nInd = i ;
}
}
// ne deduco la curva
PtrOwner<ICurveComposite> pCrvSilh( CreateCurveComposite()) ;
if ( nInd >= 0 && pCrvSilh->FromPolyLine( vPL[nInd])) {
pCrvSilh->SetExtrusion( Z_AX) ;
Plane3d plProj ;
plProj.Set( b3Srf.GetMin(), Z_AX) ;
pCrvCompo.Set( GetCurveComposite( ProjectCurveOnPlane( *pCrvSilh, plProj))) ;
if ( ! IsNull( pCrvCompo)) {
pCrvCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ;
bSilh = true ;
}
}
}
}
else {
PtrOwner<ICAvParSilhouettesSurfTm> pCavParSilh( CreateCAvParSilhouettesSurfTm()) ;
if ( ! IsNull( pCavParSilh)) {
Frame3d frSrf( b3Srf.GetMin()) ;
const double SILH_TOL = 1.0 ;
POLYLINEVECTOR vPL ;
if ( pCavParSilh->SetData( { pStm}, frSrf, SILH_TOL) &&
pCavParSilh->GetSilhouette( 0, vPL)) {
// cerco il contorno esterno
int nInd = - 1 ;
double dMaxArea = 0 ;
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
double dArea ;
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
if ( dArea < 0)
vPL[i].Invert() ;
dMaxArea = abs( dArea) ;
nInd = i ;
}
}
// ne deduco la curva
if ( nInd >= 0 && pCrvCompo->FromPolyLine( vPL[nInd])) {
pCrvCompo->SetExtrusion( Z_AX) ;
bSilh = true ;
}
}
}
}
// non riuscita, la calcolo come contorno del box
if ( ! bSilh) {
Point3d ptMin ;
double dDimX, dDimY, dDimZ ;
b3Srf.GetMinDim( ptMin, dDimX, dDimY, dDimZ) ;
PolyLine PL ;
PL.AddUPoint( 0, ptMin) ;
PL.AddUPoint( 1, ptMin + Vector3d( dDimX, 0,0)) ;
PL.AddUPoint( 2, ptMin + Vector3d( dDimX, dDimY,0)) ;
PL.AddUPoint( 3, ptMin + Vector3d( 0, dDimY,0)) ;
PL.AddUPoint( 4, ptMin) ;
if ( pCrvCompo->FromPolyLine( PL))
pCrvCompo->SetExtrusion( Z_AX) ;
else
return false ;
}
// rimuovo eventuale vecchia curva
int nOtlId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_OUTLINE) ;
m_pGeomDB->Erase( nOtlId) ;
// inserisco la curva composita nel DB
Frame3d frRaw ;
m_pGeomDB->GetGroupGlobFrame( nRawId, frRaw) ;
pCrvCompo->ToLoc( frRaw) ;
int nCrvId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pCrvCompo)) ;
if ( nCrvId == GDB_ID_NULL)
return false ;
// assegno il nome alla curva
m_pGeomDB->SetName( nCrvId, MACH_RAW_OUTLINE) ;
// assegno il colore alla curva
Color cCol ;
if ( m_pGeomDB->GetMaterial( nSolId, cCol))
m_pGeomDB->SetMaterial( nCrvId, cCol) ;
return true ;
}
//---------------------------------------------------------------------------
static bool
AssociateSurfs( IGeomDB* pGeomDB, int nSurfUpId, int nSurfDownId, vector<pair<int,int>>& vRawSurfs)
+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 ;
}
+5 -1
View File
@@ -168,7 +168,9 @@ class Machine
const Frame3d& GetCurrLinAxesFrame( void) const
{ return m_frLinAx ; }
int GetCurrKinematicChainType( void) const
{ return m_nCalcChainType ; }
{ 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,
@@ -348,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
@@ -382,6 +385,7 @@ class Machine
static int LuaEmtRemoveClimb( lua_State* L) ;
static int LuaEmtAddRise( lua_State* L) ;
static int LuaEmtRemoveRise( lua_State* L) ;
static int LuaEmtAdjustConcavePartsInPath( lua_State* L) ;
static int LuaEmtGetMoveType( lua_State* L) ;
static int LuaEmtGetAxesPos( lua_State* L) ;
static int LuaEmtGetBackAuxDir( lua_State* L) ;
+33 -25
View File
@@ -1384,6 +1384,15 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
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) ;
@@ -1404,22 +1413,25 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
dAngC2 = dAngC1 + ( dAngC1 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT) ;
// verifiche dei limiti di corsa
nStat = 2 ;
// se non riesco ad aggiustare, elimino
if ( ! AdjustAngleInStroke( RotAx1.stroke, dAngA2) ||
! AdjustAngleInStroke( RotAx2.stroke, dAngB2) ||
! AdjustAngleInStroke( RotAx3.stroke, dAngC2))
-- nStat ;
// 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 ;
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 ;
}
}
}
@@ -1873,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)
@@ -1889,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) ;
@@ -1901,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)
@@ -2380,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 ;
+1
View File
@@ -128,6 +128,7 @@ Machine::LuaInit( const string& sMachineName)
m_LuaMgr.RegisterFunction( "EmtGetInitialAxesPos", Machine::LuaEmtGetInitialAxesPos) ;
m_LuaMgr.RegisterFunction( "EmtGetFinalAxesPos", Machine::LuaEmtGetFinalAxesPos) ;
m_LuaMgr.RegisterFunction( "EmtGetCurrAxesHomePos", Machine::LuaEmtGetCurrAxesHomePos) ;
m_LuaMgr.RegisterFunction( "EmtAdjustConcavePartsInPath", Machine::LuaEmtAdjustConcavePartsInPath) ;
// registro le funzioni di lettura entità CL per lua
m_LuaMgr.RegisterFunction( "EmtGetMoveType", Machine::LuaEmtGetMoveType) ;
m_LuaMgr.RegisterFunction( "EmtGetAxesPos", Machine::LuaEmtGetAxesPos) ;
+271 -25
View File
@@ -19,12 +19,16 @@
#include "Operation.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkIntersLineCylinder.h"
#include "/EgtDev/Include/EGkGeomDB.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/ENkPolynomialRoots.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
@@ -153,6 +157,41 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
int
AddLinearMove( const Point3d& ptIni, const Point3d& ptFin, IGeomDB* pGeomDB , int nPathId, const Vector3d& vtTool,
const Vector3d& vtCorr, const Vector3d& vtAux, double dFeed, int nFlag, int nFlag2, bool bToolShow, int nRefId = GDB_ID_NULL)
{
// creo oggetto linea per DB geometrico
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
bool bOk = ! IsNull( pLine) ;
// assegno gli estremi della linea
bOk = bOk && pLine->Set( ptIni, ptFin) ;
// inserisco l'oggetto nel DB geometrico
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pLine)) : GDB_ID_NULL) ;
bOk = bOk && ( nId != GDB_ID_NULL) ;
if ( bOk && nRefId != GDB_ID_NULL)
pGeomDB->RelocateGlob( nId, nRefId, GDB_AFTER) ;
// creo oggetto dati Cam
PtrOwner<CamData> pCam( new( nothrow) CamData) ;
bOk = bOk && ! IsNull( pCam) ;
if ( bOk) {
// assegno valori
pCam->SetMoveType( 1) ;
pCam->SetToolDir( vtTool) ;
pCam->SetCorrDir( vtCorr) ;
pCam->SetAuxDir( vtAux) ;
pCam->SetEndPoint( ptFin) ;
pCam->SetFeed( dFeed) ;
pCam->SetFlag( nFlag) ;
pCam->SetFlag2( nFlag2) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico
pGeomDB->SetUserObj( nId, Release( pCam)) ;
}
return nId ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtAddLinearMove( lua_State* L)
@@ -185,31 +224,8 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ;
// creo oggetto linea per DB geometrico
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
bool bOk = ! IsNull( pLine) ;
// assegno gli estremi della linea
bOk = bOk && pLine->Set( ptIni, ptFin) ;
// inserisco l'oggetto nel DB geometrico
int nId = ( bOk ? m_pMchLua->m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pLine)) : GDB_ID_NULL) ;
bOk = bOk && ( nId != GDB_ID_NULL) ;
// creo oggetto dati Cam
PtrOwner<CamData> pCam( new( nothrow) CamData) ;
bOk = bOk && ! IsNull( pCam) ;
if ( bOk) {
// assegno valori
pCam->SetMoveType( 1) ;
pCam->SetToolDir( vtTool) ;
pCam->SetCorrDir( vtCorr) ;
pCam->SetAuxDir( vtAux) ;
pCam->SetEndPoint( ptFin) ;
pCam->SetFeed( dFeed) ;
pCam->SetFlag( nFlag) ;
pCam->SetFlag2( nFlag2) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
}
int nId = AddLinearMove( ptIni, ptFin, m_pMchLua->m_pGeomDB, nPathId, vtTool, vtCorr, vtAux, dFeed, nFlag, nFlag2, bToolShow) ;
bool bOk = nId != GDB_ID_NULL ;
// assegno risultato
if ( bOk)
LuaSetParam( L, nId) ;
@@ -317,6 +333,9 @@ Machine::LuaEmtAddClimb( lua_State* L)
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)
@@ -343,6 +362,9 @@ Machine::LuaEmtRemoveClimb( lua_State* L)
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)
@@ -377,6 +399,9 @@ Machine::LuaEmtAddRise( lua_State* L)
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)
@@ -403,6 +428,9 @@ Machine::LuaEmtRemoveRise( lua_State* L)
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)
@@ -569,3 +597,221 @@ Machine::LuaEmtGetBackAuxDir( lua_State* L)
return 1 ;
}
struct Cyl {
Cyl( void): frCyl( GLOB_FRM), dH( 0.), dRad( 0.) {;} ;
Cyl( const Frame3d& _frCyl, double _dH, double _dRad, double _dLinTol) :
frCyl( _frCyl), dH( _dH), dRad( _dRad) { ;}
Cyl( const Point3d& _ptBase, const Vector3d& vtZ, double _dH, double _dRad, double _dLinTol) :
dH( _dH), dRad( _dRad){
frCyl.Set( _ptBase, vtZ); }
public :
Frame3d frCyl ;
public:
double dH ;
double dRad ;
};
typedef vector<Cyl> OFFSETCYLVECT ;
//----------------------------------------------------------------------------
bool
IsPointInsideCylinder( const Point3d& ptTest, const Cyl& offCyl)
{
Point3d ptTestLoc = ptTest ; ptTestLoc.ToLoc( offCyl.frCyl) ;
if ( ptTestLoc.z > offCyl.dH || ptTestLoc.z < 0)
return false ;
double dDist = ptTestLoc.x * ptTestLoc.x + ptTestLoc.y * ptTestLoc.y ;
double dRadSq = offCyl.dRad * offCyl.dRad ;
if ( dDist > dRadSq)
return false ;
return true ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtAdjustConcavePartsInPath( lua_State* L)
{
bool bOk = true ;
// 3 parametri : nPathId, nAuxPathId, dRad
int nPathId ;
LuaCheckParam( L, 1, nPathId)
int nAuxPathId ;
LuaCheckParam( L, 2, nAuxPathId)
double dRad ;
LuaCheckParam( L, 3, dRad)
LuaClearStack( L) ;
IGeomDB* pGeomDB = m_pMchLua->m_pGeomDB ;
int nId = pGeomDB->GetFirstInGroup( nPathId) ;
int nIdCrvAux = pGeomDB->GetFirstInGroup( nAuxPathId) ;
const ICurve* pCrvAux = GetCurve( pGeomDB->GetGeoObj(nIdCrvAux)) ;
const double dLinTol = 5 * EPS_SMALL ;
while ( nId != GDB_ID_NULL) {
if ( pGeomDB->GetGeoType( nId) == CRV_LINE) {
int nFlag = 0 ; pGeomDB->GetInfo( nId, "Flg2", nFlag) ;
if ( nFlag == 1) {
// scorro i prossimi finchè trovo la fine della zona concava
INTINTVECTOR vLines ;
while ( nFlag == 1 && nId != GDB_ID_NULL) {
nId = pGeomDB->GetNext( nId) ;
if ( nId != GDB_ID_NULL && pGeomDB->GetGeoType( nId) == CRV_LINE) {
int nDerivedFromId = GDB_ID_NULL ;
if ( pGeomDB->GetInfo( nId, "DerivFrom", nDerivedFromId)) {
pGeomDB->GetInfo( nId, "Flg2", nFlag) ;
vLines.emplace_back( nId, nDerivedFromId) ;
}
}
}
OFFSETCYLVECT vCyl ;
// creo un cilindro della dimensione del raggio
for ( int i = 0 ; i < ssize( vLines) ; ++i) {
const IGeoVector3d* pGV = GetGeoVector3d( pGeomDB->GetGeoObj( vLines[i].second)) ;
if ( pGV == nullptr)
return false ;
Point3d ptBase = pGV->GetBase() ;
double dPar = 0 ;
if ( ! pCrvAux->GetParamAtPoint( ptBase, dPar))
return false ;
dPar = round( dPar) ;
if ( dPar > 0) {
Point3d ptStart, ptEnd ;
Vector3d vtHeight ;
pCrvAux->GetPointD1D2( dPar, ICurve::FROM_MINUS, ptEnd, &vtHeight) ;
pCrvAux->GetPointD1D2( dPar - 1, ICurve::FROM_MINUS, ptStart) ;
vtHeight = ptEnd - ptStart ;
double dHeight = vtHeight.Len() ;
// questa altezza dovrebbe coincidere con quella precedentemente calcolata come direzione della linea
vtHeight.Normalize() ;
vCyl.emplace_back( ptStart, vtHeight, dHeight, dRad, dLinTol) ;
}
}
// controllo l'end di ogni linea per verificare se sta nel cilindro definito da uno degli altri tratti
// controllo tutto i punti
bool bErasedSomePart = false ;
bool bErasedPrev = false ;
INTINTVECTOR vInters ;
for ( int i = 0 ; i < ssize( vLines) ; ++i) {
Point3d ptStart, ptEnd ;
const ICurveLine* pCL = GetCurveLine( pGeomDB->GetGeoObj( vLines[i].first)) ;
if ( pCL == nullptr)
return false ;
pCL->GetEndPoint( ptEnd) ;
pCL->GetStartPoint( ptStart) ;
// se stanno in uno dei cilindri degli altri tratti della zona concava
for ( int j = 0 ; j < ssize( vLines) ; ++j) {
if ( i == j)
continue ;
bool bToErase = IsPointInsideCylinder( ptEnd, vCyl[j]) ;
if ( bErasedPrev && ! bToErase)
bToErase = bToErase || IsPointInsideCylinder( ptStart, vCyl[j]) ;
if ( bToErase) {
bErasedSomePart = true ;
bErasedPrev = true ;
vInters.emplace_back(vLines[i].first,i) ;
vInters.emplace_back(vLines[i+1].first,i+1) ;
++i ;
break ;
}
else
bErasedPrev = false ;
}
}
if ( bErasedSomePart) {
// calcolo le intersezioni effettive del primo e ultimo tratto cancellati con i cilindri che li hanno cancellati
// controllo che effettivamente tutti i tratti cancellati siano consecutivi
for ( int i = 1 ; i < ssize( vInters) ; ++i) {
if ( vInters[i].first != vInters[i-1].first + 1)
return false ;
}
for ( int i = 0 ; i < ssize( vInters) ; ++i) {
// cancello i tratti intermedi
if ( i > 0 && i < ssize( vInters) - 1) {
pGeomDB->Erase( vInters[i].first) ;
continue ;
}
// per il primo e ultimo controllo le intersezioni con tutti i cilindri
ICurveLine* pCL = GetCurveLine( pGeomDB->GetGeoObj( vInters[i].first)) ;
Point3d ptStart = pCL->GetStart() ;
Vector3d vtStart ; pCL->GetStartDir( vtStart) ;
double dLen ; pCL->GetLength( dLen) ;
double dUTrim = ( i == 0 ? INFINITO : 0) ;
Point3d ptTrim = P_INVALID ;
for ( int j = 0 ; j < ssize( vCyl) ; ++j) {
if ( vInters[i].second == j)
continue ;
Point3d ptInt1 = P_INVALID, ptInt2 = P_INVALID ;
double dU1, dU2 ;
Vector3d vtN1, vtN2 ;
if ( IntersLineCyl( ptStart, vtStart * dLen, vCyl[j].frCyl, vCyl[j].dH, vCyl[j].dRad, dU1, ptInt1, vtN1, dU2, ptInt2, vtN2)) {
bool bUpdate = ( i == 0 ? dU1 < dUTrim : dU1 > dUTrim) ;
bUpdate = bUpdate && ptInt1.IsValid() && dU1 > 0 && dU1 < 1 ;
bUpdate = bUpdate && vtN1 * vtStart < 0 ;
if ( bUpdate) {
dUTrim = dU1 ;
ptTrim = ptInt1 ;
}
bUpdate = ( i == 0 ? dU2 < dUTrim : dU2 > dUTrim) ;
bUpdate = bUpdate && ptInt2.IsValid() && dU2 > 0 && dU2 < 1 ;
bUpdate = bUpdate && vtN2 * vtStart > 0 ;
if ( bUpdate) {
dUTrim = dU2 ;
ptTrim = ptInt2 ;
}
}
}
if ( ptTrim.IsValid()) {
if ( i == 0) {
pCL->ModifyEnd( ptTrim) ;
double dNewLen ; pCL->GetLength( dNewLen) ;
if ( dNewLen < 0.1) {
int nPrev = pGeomDB->GetPrev( vInters[0].first) ;
pGeomDB->Erase( vInters[0].first) ;
vInters[0].first = nPrev ;
ICurveLine* pCLPrev = GetCurveLine( pGeomDB->GetGeoObj( nPrev)) ;
pCLPrev->ModifyEnd( ptTrim) ;
}
CamData* camData = GetCamData( pGeomDB->GetUserObj( vInters[0].first)) ;
camData->SetEndPoint( ptTrim) ;
}
else {
pCL->ModifyStart( ptTrim) ;
double dNewLen ; pCL->GetLength( dNewLen) ;
if ( dNewLen < 0.1) {
int nNext = pGeomDB->GetNext( vInters[i].first) ;
pGeomDB->Erase( vInters[i].first) ;
vInters[i].first = nNext ;
ICurveLine* pCLNext = GetCurveLine( pGeomDB->GetGeoObj( nNext)) ;
pCLNext->ModifyStart( ptTrim) ;
}
}
}
}
// giunto questi due punti
ICurveLine* pCLprev = GetCurveLine( pGeomDB->GetGeoObj( vInters[0].first)) ;
Point3d ptIni = pCLprev->GetEnd() ;
ICurveLine* pCLnext = GetCurveLine( pGeomDB->GetGeoObj( vInters.back().first)) ;
Point3d ptFin = pCLnext->GetStart() ;
const CamData* camDataPrev = GetCamData( pGeomDB->GetUserObj( vInters[0].first)) ;
const CamData* camDataNext = GetCamData( pGeomDB->GetUserObj( vInters.back().first)) ;
Vector3d vtTool = Media( camDataPrev->GetToolDir(), camDataNext->GetToolDir()) ;
Vector3d vtCorr = Media( camDataPrev->GetCorrDir(), camDataNext->GetCorrDir()) ;
Vector3d vtAux = Media( camDataPrev->GetAuxDir(), camDataNext->GetAuxDir()) ;
double dFeed = camDataPrev->GetFeed() ;
int nFlag = camDataPrev->GetFlag() ;
int nFlag2 = camDataPrev->GetFlag2() ;
bool bToolShow = camDataPrev->GetToolShow() ;
AddLinearMove( ptIni, ptFin, pGeomDB, nPathId, vtTool, vtCorr, vtAux, dFeed, nFlag, nFlag2, bToolShow, vInters[0].first) ;
}
nId = vLines.back().first ;
}
}
nId = m_pMchLua->m_pGeomDB->GetNext( nId) ;
}
LuaSetParam( L, bOk) ;
return 1 ;
}
+85 -65
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,10 +26,9 @@
using namespace std ;
#define DEBUG 0
#define DEBUG_PRV 0
const string KEY_AXIS_GROUP = "PreviewAxisGroup" ;
const string KEY_ROT_AXIS_VAL = "PreviewRotAxisVal" ; // salvata per ogni gruppo di Preview
const string KEY_PRV_ROTAXIS_VAL = "PreviewRotAxisVal" ; // salvata per ogni gruppo di Preview
// struttura per informazioni sugli assi
struct PreviewAxisInfo {
@@ -325,13 +325,15 @@ Machining::MyPrepareToolPreview( bool bDouble)
// se necessario, imposto l'utensile corrente
string sTool, sTcPos, sHead ;
double dTLen ;
int nExitDBLId ;
if ( ! bDouble) {
sTool = GetToolName() ;
sHead = GetHeadName() ;
dTLen = GetToolData().m_dLen ;
}
else {
if ( ! GetDoubleToolData( sTool, sTcPos, sHead, nExitDBLId))
if ( ! GetDoubleToolData( sTool, sTcPos, sHead, nExitDBLId, dTLen))
return false ;
}
@@ -392,7 +394,7 @@ Machining::MyPrepareToolPreview( bool bDouble)
m_pGeomDB->SetName( nNewTabRotAxisId, sName) ;
double dAxisPos = 0. ;
bOk = bOk && pMch->GetAxisPos( sName, dAxisPos) &&
m_pGeomDB->SetInfo( nNewTabRotAxisId, KEY_ROT_AXIS_VAL, dAxisPos) ;
m_pGeomDB->SetInfo( nNewTabRotAxisId, KEY_PRV_ROTAXIS_VAL, dAxisPos) ;
if ( ! bOk)
return false ;
nCurrHierarchyId = nNewTabRotAxisId ;
@@ -502,7 +504,7 @@ Machining::MyPrepareToolPreview( bool bDouble)
// memorizzo la sua posizione iniziale
double dAxisPos = 0. ;
bOk = bOk && pMch->GetAxisPos( sParentName, dAxisPos) &&
m_pGeomDB->SetInfo( nNewParentId, KEY_ROT_AXIS_VAL, dAxisPos) ;
m_pGeomDB->SetInfo( nNewParentId, KEY_PRV_ROTAXIS_VAL, dAxisPos) ;
}
// scorro i suoi figli
int nChildId = m_pGeomDB->GetFirstInGroup( nParentId) ;
@@ -566,41 +568,33 @@ Machining::MyPrepareToolPreview( bool bDouble)
// recupero il punto Tip dell'utensile e lo inserisco dentro al gruppo testa corrente
int nExitGrpId = ( ! bDouble ? pMch->GetCurrExit() : pMch->GetExitId( sHead, nExitDBLId)) ;
bool bOk = ( nExitGrpId != GDB_ID_NULL) ;
if ( nExitGrpId == GDB_ID_NULL)
return false ;
string sExitGrpName ;
bOk = bOk && m_pGeomDB->GetName( nExitGrpId, sExitGrpName) ;
int nFrId = GDB_ID_NULL ;
if ( bOk) {
if ( ! bDouble) {
nFrId = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadId, "_" + sExitGrpName) ;
m_nPreviewExitId = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadId, sExitGrpName) ;
}
else {
nFrId = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadIdDBL, "_" + sExitGrpName) ;
m_nPreviewExitIdDBL = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadIdDBL, sExitGrpName) ;
}
if ( ! m_pGeomDB->GetName( nExitGrpId, sExitGrpName))
return false ;
if ( ! bDouble)
m_nPreviewExitId = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadId, sExitGrpName) ;
else
m_nPreviewExitIdDBL = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadIdDBL, sExitGrpName) ;
// determino le coordinate del Tip in locale
const Frame3d* pfrExit = m_pGeomDB->GetGroupFrame( nExitGrpId) ;
if ( pfrExit == nullptr)
return false ;
Point3d ptToolTip = pfrExit->Orig() - dTLen * pfrExit->VersZ() ;
// creo l'oggetto punto nel DBG
PtrOwner<IGeoPoint3d> ptGToolTip( CreateGeoPoint3d()) ;
if ( IsNull( ptGToolTip) || ! ptGToolTip->Set( ptToolTip))
return false ;
if ( ! bDouble) {
m_nPreviewToolTip = m_pGeomDB->AddGeoObj( GDB_ID_NULL, m_nPreviewHeadId, Release( ptGToolTip)) ;
return ( m_nPreviewToolTip != GDB_ID_NULL) ;
}
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) ;
bOk = bOk && ptToolTip.IsValid() ;
if ( bOk) {
PtrOwner<IGeoPoint3d> ptGToolTip( CreateGeoPoint3d()) ;
bOk = ( ! IsNull( ptGToolTip) && ptGToolTip->Set( ptToolTip)) ;
if ( bOk) {
if ( ! bDouble) {
m_nPreviewToolTip = m_pGeomDB->AddGeoObj( GDB_ID_NULL, m_nPreviewHeadId, Release( ptGToolTip)) ;
bOk = bOk && ( m_nPreviewToolTip != GDB_ID_NULL) ;
}
else {
m_nPreviewToolTipDBL = m_pGeomDB->AddGeoObj( GDB_ID_NULL, m_nPreviewHeadIdDBL, Release( ptGToolTip)) ;
bOk = bOk && ( m_nPreviewToolTipDBL != GDB_ID_NULL) ;
}
}
else {
m_nPreviewToolTipDBL = m_pGeomDB->AddGeoObj( GDB_ID_NULL, m_nPreviewHeadIdDBL, Release( ptGToolTip)) ;
return ( m_nPreviewToolTipDBL != GDB_ID_NULL) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
@@ -692,15 +686,17 @@ Machining::RemoveToolPreview( void)
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
#if DEBUG
#if DEBUG_PRV
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 ;
@@ -896,7 +892,7 @@ Machining::MyToolPreview( int nEntId, bool bDouble) const
return false ;
// recupero il valore corrente dell'asse
double dCurrAxisVal = 0. ;
m_pGeomDB->GetInfo( nAxisId, KEY_ROT_AXIS_VAL, dCurrAxisVal) ;
m_pGeomDB->GetInfo( nAxisId, KEY_PRV_ROTAXIS_VAL, dCurrAxisVal) ;
// recupero il valore dell'asse
bool bFound = false ;
double dAxisVal = 0 ;
@@ -917,7 +913,7 @@ Machining::MyToolPreview( int nEntId, bool bDouble) const
Vector3d vtDir = pGV->GetVector() ;
vtDir.Normalize() ;
m_pGeomDB->RotateGroup( nAxisId, ptPos, vtDir, ( dAxisVal - dCurrAxisVal)) ;
m_pGeomDB->SetInfo( nAxisId, KEY_ROT_AXIS_VAL, dAxisVal) ;
m_pGeomDB->SetInfo( nAxisId, KEY_PRV_ROTAXIS_VAL, dAxisVal) ;
}
// recupero la posizione del tip dell'utensile per movimento assi lineari
@@ -1040,7 +1036,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) ||
@@ -1053,6 +1049,14 @@ Machining::GetDoubleType( const string& sUserNotes)
//----------------------------------------------------------------------------
bool
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 ;
@@ -1061,12 +1065,13 @@ Machining::GetDoubleToolData( string& sDblTool, string& sDblTcPos, string& sDblH
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 ;
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 ;
}
@@ -1075,7 +1080,32 @@ Machining::GetDoubleToolData( string& sDblTool, string& sDblTcPos, string& sDblH
//----------------------------------------------------------------------------
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 ;
@@ -1125,20 +1155,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 + "*") ;
@@ -1146,15 +1166,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) {
+5 -3
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& sDblTcPos, std::string& sDblHead, int& nDblExit) const override ;
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 :
+1033 -259
View File
File diff suppressed because it is too large Load Diff
+13 -2
View File
@@ -81,6 +81,7 @@ class Milling : public Machining
double m_dRampLen ;
double m_dTopLen ;
} ;
enum ToolCorrEntity { TOOL_CORR_PATH = 0, TOOL_CORR_IN = 1, TOOL_CORR_OUT = 2 } ;
private :
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
@@ -115,7 +116,7 @@ class Milling : public Machining
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool,
double dSafeZ, double dSawEndElev, double dEndElev, double dAppr, bool bAddExtract = false) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) const ;
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
const Vector3d& vtTool, double dStElev, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs) ;
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool,
@@ -136,8 +137,11 @@ class Milling : public Machining
bool GetPointBelowRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) ;
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) const ;
bool CalcOffset( ICurveComposite* pCompo, double dSignOffs) const ;
bool CalcAndSetCorrAuxDir( const Vector3d& vtCorr) ;
bool AdjustAllCorrAuxDirToSide( int nId, bool bCcwRot) ;
bool CalcOffset( ICurveComposite* pCompo, double dSignOffs, double dExtraOffs = 0) const ;
bool TrimExtendCurveToClosedStm( ICurveComposite* pCompo, int nCstmId, bool bInvert) ;
int GetCorrType( int nToolCompEntity, bool bInvert) const ;
private :
double GetSpeed() const
@@ -171,6 +175,10 @@ class Milling : public Machining
m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
double GetLeadInOutToler( void) const
{ return ( m_bTHoldFloating ? LIO_ELEV_FLOAT : LIO_ELEV_TOL) ; }
inline double GetToolCompMinRadOffset() const
{ return 100. * EPS_SMALL ; }
inline double GetToolCompPerpLen() const
{ return 2.0 ; }
friend class LeadIOStatus ;
private :
@@ -194,6 +202,9 @@ class Milling : public Machining
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
double m_dCurrOscillLen ; // lunghezza corrente lungo il percorso per l'oscillazione
double m_dCurrTabsLen ; // lunghezza corrente lungo il percorso per tabs
bool m_bToolComp ; // correzione raggio utensile abilitata dai dati
Vector3d m_vtLieCorr ; // versore correzione da applicare a fine attacco
Vector3d m_vtLieAux ; // versore ausiliario da applicare a fine attacco
bool m_bStartOutRaw ; // flag forzatura inizio fuori dal grezzo
bool m_bEndOutRaw ; // flag forzatura fine fuori dal grezzo
Vector3d m_vtStartDir ; // direzione iniziale del percorso in elaborazione
+19 -31
View File
@@ -1250,7 +1250,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
return false ;
dLen += dStartAddLen ;
}
if (dEndAddLen > EPS_SMALL) {
if ( dEndAddLen > EPS_SMALL) {
if ( ! pCompo->ExtendEndByLen( dEndAddLen))
return false ;
dLen += dEndAddLen ;
@@ -1330,7 +1330,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
// calcolo l'elevazione massima
double dElev ;
if ( CalcPathElevation( pCompo, vtTool, dDepth, GetRadiusForStartEndElevation(), m_TParams.m_dThick, dElev)) {
if ( CalcPathElevation( pCompo, vtTool, vtAux, dDepth, GetRadiusForStartEndElevation(), m_TParams.m_dThick, dElev)) {
if ( dElev < EPS_SMALL && AreSameVectorApprox( vtExtr, Z_AX)) {
BBox3d b3Crv ;
pCompo->GetLocalBBox( b3Crv) ;
@@ -1350,7 +1350,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
double dCosAng = min( abs( vtTg * vtExtr), cos( 30 * DEGTORAD)) ;
double dAddEnc = m_TParams.m_dDiam / 2 * dCosAng / dSinAng ;
// affondamento speciale da note utente (!!! da trasformare in parametro come gli altri !!!)
// affondamento speciale da note utente
int nPlunge = 0 ;
GetValInNotes( m_Params.m_sUserNotes, UN_PLUNGE, nPlunge) ;
@@ -1437,12 +1437,12 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
//----------------------------------------------------------------------------
bool
Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dThick,
double& dElev) const
Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtAux,
double dDepth, double dRad, double dThick, double& dElev) const
{
dElev = 0 ;
int nMaxInd = pCompo->GetCurveCount() - 1 ;
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
const double DELTA_ELEV_RAD = 20.0 ;
for ( int i = 0 ; i < pCompo->GetCurveCount() ; ++ i) {
// curva corrente
const ICurve* pCrvC = pCompo->GetCurve( i) ;
// calcolo elevazione
@@ -1451,17 +1451,16 @@ Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtT
pCrvC->GetStartPoint( ptStart) ;
pCrvC->GetMidPoint( ptMid) ;
pCrvC->GetEndPoint( ptEnd) ;
Vector3d vtStartPerp, vtEndPerp ;
pCrvC->GetStartDir( vtStartPerp) ;
vtStartPerp *= -dRad ;
pCrvC->GetEndDir( vtEndPerp) ;
vtEndPerp *= dRad ;
Vector3d vtTg ; pCrvC->GetMidDir( vtTg) ;
Vector3d vtOrtho = vtTool ^ vtTg ;
vtOrtho.Normalize() ;
vtOrtho *= dThick ;
Vector3d vtStart, vtEnd ;
pCrvC->GetStartDir( vtStart) ;
pCrvC->GetEndDir( vtEnd) ;
ptStart += -dRad * vtStart + 0.5 * dThick * vtAux ;
ptMid += 0.5 * dThick * vtAux ;
ptEnd += dRad * vtEnd + 0.5 * dThick * vtAux ;
Vector3d vtOrtho = vtAux ;
vtOrtho *= 0.5 * dThick + DELTA_ELEV_RAD ;
Vector3d vtDepth = -vtTool * dDepth ;
// linea centro utensile
// in centro utensile
if ( GetElevation( m_nPhase, ptStart + vtDepth, ptMid + vtDepth, ptEnd + vtDepth, vtTool, dCurrElev)) {
if ( dCurrElev > dElev)
dElev = dCurrElev ;
@@ -1479,19 +1478,8 @@ Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtT
m_pMchMgr->SetLastError( 2505, "Error in Mortising : Entity GetElevation") ;
return false ;
}
// da una parte
if ( GetElevation( m_nPhase, ptStart + vtStartPerp + vtDepth, ptMid + vtDepth,
ptEnd + vtEndPerp + vtDepth, vtTool, dCurrElev)) {
if ( dCurrElev > dElev)
dElev = dCurrElev ;
}
else {
m_pMchMgr->SetLastError( 2505, "Error in Mortising : Entity GetElevation") ;
return false ;
}
// dall'altra parte
if ( GetElevation( m_nPhase, ptStart + vtStartPerp + vtDepth, ptMid + vtDepth,
ptEnd + vtEndPerp + vtDepth, vtTool, dCurrElev)) {
// sotto centro utensile
if ( GetElevation( m_nPhase, ptStart + vtDepth - vtOrtho, ptMid + vtDepth - vtOrtho, ptEnd + vtDepth - vtOrtho, vtTool, dCurrElev)) {
if ( dCurrElev > dElev)
dElev = dCurrElev ;
}
@@ -1535,7 +1523,7 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
return false ;
}
// se alrimenti affondamenti ripetuti da inizio a fine con ritorno basso
// se altrimenti affondamenti ripetuti da inizio a fine con ritorno basso
else if ( nPlunge == MORTISE_PLUNGE_START_TO_END) {
// distanza e vettore spostamento laterale
Vector3d vtDir = ptEnd - ptStart ;
+1 -1
View File
@@ -78,7 +78,7 @@ class Mortising : public Machining
bool Chain( int nGrpDestId) ;
bool CalcSurfAuxView( int nAuxId, int nAuxViewId) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dThick, double& dElev) const ;
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtAux, double dDepth, double dRad, double dThick, double& dElev) const ;
bool GenerateMortisingPv( int nPathId, const ICurveComposite* pCompo) ;
bool GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep, int nPlunge) ;
bool GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep,
+7
View File
@@ -26,6 +26,7 @@ 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" ;
@@ -51,6 +52,9 @@ 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" ;
static const std::string UN_START_PNT = "StartPoint" ;
// Solo per Sawing
static const std::string UN_DOWNSE = "DownSE" ;
@@ -67,11 +71,14 @@ static const std::string UN_STEPNUMBER = "StepNumber" ;
static const std::string UN_BITANGANG = "BiTangAng" ;
static const std::string UN_OPTIMALTYPE = "OptimalType" ;
static const std::string UN_ANGLETOL = "AngleTol" ;
static const std::string UN_THETA = "Theta" ;
static const std::string UN_PHI = "Phi" ;
// Solo per SurfRoughing
static const std::string UN_PLANEZ = "PlaneZ" ;
static const std::string UN_ORDER = "Order" ;
static const std::string UN_SUPP_RAD_OFFS = "SuppRadOffs" ;
// come per PocketingNT, viene usato il parametro UN_MINFEED
// Solo per Waterjetting
static const std::string UN_START = "START" ;
+133 -100
View File
@@ -1917,6 +1917,7 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact, double dS
// calcolo il valore degli assi macchina di tutti i movimenti
bool bOk = true ;
if ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_MCENT) {
m_pGeomDB->SetInfo( nClId, KEY_KINTYPE, KIN_CHAIN_MCENT) ;
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
while ( nClPathId != GDB_ID_NULL) {
if ( ! CalculateClPathMcentAxesValues( nClPathId, dAngDeltaMinForHome, vAxRotHome, vAxRotPrec))
@@ -1925,6 +1926,7 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact, double dS
}
}
else if ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_ROBOT) {
m_pGeomDB->SetInfo( nClId, KEY_KINTYPE, KIN_CHAIN_ROBOT) ;
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
while ( nClPathId != GDB_ID_NULL) {
if ( ! CalculateClPathRobotAxesValues( nClPathId, dAngDeltaMinForHome, vAxRotHome, vAxRotPrec))
@@ -1932,8 +1934,10 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact, double dS
nClPathId = m_pGeomDB->GetNextGroup( nClPathId) ;
}
}
else
else {
m_pGeomDB->SetInfo( nClId, KEY_KINTYPE, KIN_CHAIN_NONE) ;
bOk = false ;
}
return bOk ;
}
@@ -2210,8 +2214,8 @@ Operation::MyCalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinF
double dCoeff = double( i) / nNumStep ;
Point3d ptCurr = Media( ptPrec, ptP, dCoeff) ;
DBLVECTOR vAng( vAxRot.size()) ;
for ( int i = 0 ; i < int( vAxRot.size()) ; ++ i)
vAng[i] = vAxRotPrec[i] * ( 1 - dCoeff) + vAxRot[i] * dCoeff ;
for ( int j = 0 ; j < ssize( vAxRot) ; ++ j)
vAng[j] = vAxRotPrec[j] * ( 1 - dCoeff) + vAxRot[j] * dCoeff ;
int nStat = 0 ;
bool bPaOk = pMachine->VerifyProtectedAreas( ptCurr.x, ptCurr.y, ptCurr.z, vAng, nStat) ;
if ( ! bPaOk || nStat != 0) {
@@ -2236,8 +2240,8 @@ Operation::MyCalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinF
ptMid.Rotate( ptCen, vtN, - dAngCen / 2) ;
// determino i valori degli assi al punto medio
DBLVECTOR vAngMid( vAxRot.size()) ;
for ( size_t i = 0 ; i < vAxRot.size() ; ++ i)
vAngMid[i] = ( vAxRotPrec[i] + vAxRot[i]) / 2 ;
for ( int j = 0 ; j < ssize( vAxRot) ; ++ j)
vAngMid[j] = ( vAxRotPrec[j] + vAxRot[j]) / 2 ;
double dXmid, dYmid, dZmid ;
bool bLmidOk = m_pMchMgr->GetCalcPositions( ptMid, vAngMid, dXmid, dYmid, dZmid) ;
if ( ! bLmidOk) {
@@ -2249,8 +2253,8 @@ Operation::MyCalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinF
Point3d ptEnd = ptP - dDeltaN * vtN ;
// determino i valori degli assi al punto finale
DBLVECTOR vAngEnd( vAxRot.size()) ;
for ( size_t i = 0 ; i < vAxRot.size() ; ++ i)
vAngEnd[i] = vAxRot[i] ;
for ( int j = 0 ; j < ssize( vAxRot) ; ++ j)
vAngEnd[j] = vAxRot[j] ;
double dXend, dYend, dZend ;
bool bLendOk = m_pMchMgr->GetCalcPositions( ptEnd, vAngEnd, dXend, dYend, dZend) ;
if ( ! bLendOk) {
@@ -2308,8 +2312,8 @@ Operation::MyCalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinF
double dCoeff = double( i) / NUM_VERIF_STEP ;
Point3d ptCurr = ptCen + vtCurr + vtN * dDeltaN * dCoeff ;
DBLVECTOR vAng( vAxRot.size()) ;
for ( size_t i = 0 ; i < vAxRot.size() ; ++ i)
vAng[i] = vAxRotPrec[i] * ( 1 - dCoeff) + vAxRot[i] * dCoeff ;
for ( int j = 0 ; j < ssize( vAxRot) ; ++ j)
vAng[j] = vAxRotPrec[j] * ( 1 - dCoeff) + vAxRot[j] * dCoeff ;
int nStat ;
bool bOsOk = m_pMchMgr->VerifyOutstroke( ptCurr.x, ptCurr.y, ptCurr.z, vAng, false, nStat) ;
if ( ! bOsOk || nStat != 0) {
@@ -2354,34 +2358,43 @@ Operation::CalculateMcentRotAxesValues( bool bFirst, const Vector3d& vtTool, con
double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec, DBLVECTOR& vAxRot)
{
// macchina
Machine* pMachine = m_pMchMgr->GetCurrMachine() ;
if ( pMachine == nullptr)
return false ;
// continuità su assi rotanti nei movimenti successivi al primo per tutte le lavorazioni, tranne disposizioni
bool bRotContOnNext = ( GetType() != OPER_DISP) ;
// massima variazione secondo asse rotante per continuità
const double dMaxDeltaR2 = 30 ;
// imposto primo asse precedente (per caso con 3 rotanti liberi)
pMachine->SetPrevAngA( ( ! vAxRotPrec.empty() ? vAxRotPrec[0] : NAN)) ;
// calcolo degli assi rotanti della macchina
int nRStat ;
DBLVECTOR vAng1, vAng2 ;
bool bROk = m_pMchMgr->GetCalcAngles( vtTool, vtAux, nRStat, vAng1, vAng2) ;
bool bROk = pMachine->GetAngles( vtTool, vtAux, nRStat, vAng1, vAng2) ;
pMachine->SetPrevAngA( NAN) ;
if ( ! bROk || nRStat == 0)
return false ;
if ( abs( nRStat) == 1) {
// se primo movimento
if ( bFirst) {
// porto gli angoli ai valori più vicini ai precedenti con offset di uno o più giri
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
if ( pMachine->IsKinematicRotAxisBlocked( i))
continue ;
pMachine->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
pMachine->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
}
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente, limitandolo alla corsa
if ( nRStat < 0 && vAng1.size() >= 1) {
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
// ignoro gli assi bloccati
if ( m_pMchMgr->IsKinematicRotAxisBlocked( i))
if ( pMachine->IsKinematicRotAxisBlocked( i))
continue ;
// assegno il precedente ed esco
vAng1[i] = vAxRotPrec[i] ;
m_pMchMgr->LimitAngleToStroke( i, vAng1[i]) ;
pMachine->LimitAngleToStroke( i, vAng1[i]) ;
break ;
}
}
@@ -2389,19 +2402,19 @@ Operation::CalculateMcentRotAxesValues( bool bFirst, const Vector3d& vtTool, con
// per movimenti successivi
else {
// scelgo gli angoli più vicini, per continuità non applico offset per stare nelle corse
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
if ( bRotContOnNext)
vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ;
else
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
pMachine->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
pMachine->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
}
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente
if ( nRStat < 0 && vAng1.size() >= 1) {
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
// ignoro gli assi bloccati
if ( m_pMchMgr->IsKinematicRotAxisBlocked( i))
if ( pMachine->IsKinematicRotAxisBlocked( i))
continue ;
// assegno il precedente ed esco
vAng1[i] = vAxRotPrec[i] ;
@@ -2416,23 +2429,23 @@ Operation::CalculateMcentRotAxesValues( bool bFirst, const Vector3d& vtTool, con
// se primo movimento
if ( bFirst) {
// porto gli angoli ai valori più vicini ai precedenti con offset di uno o più giri
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
pMachine->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ;
pMachine->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
pMachine->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ;
if ( abs( vAng2[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
pMachine->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
}
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente, limitandolo alla corsa
if ( nRStat < 0 && vAng1.size() >= 1) {
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
// ignoro gli assi bloccati
if ( m_pMchMgr->IsKinematicRotAxisBlocked( i))
if ( pMachine->IsKinematicRotAxisBlocked( i))
continue ;
// assegno il precedente ed esco
vAng1[i] = vAxRotPrec[i] ;
m_pMchMgr->LimitAngleToStroke( i, vAng1[i]) ;
pMachine->LimitAngleToStroke( i, vAng1[i]) ;
vAng2[i] = vAng1[i] ;
break ;
}
@@ -2440,25 +2453,25 @@ Operation::CalculateMcentRotAxesValues( bool bFirst, const Vector3d& vtTool, con
}
else {
// scelgo gli angoli più vicini, per continuità non applico offset per stare nelle corse
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
if ( bRotContOnNext)
vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ;
else
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
pMachine->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
pMachine->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
if ( bRotContOnNext)
vAng2[i] = AngleNearAngle( vAng2[i], vAxRotPrec[i]) ;
else
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ;
pMachine->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ;
if ( abs( vAng2[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
pMachine->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
}
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente
if ( nRStat < 0 && vAng1.size() >= 1) {
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
// ignoro gli assi bloccati
if ( m_pMchMgr->IsKinematicRotAxisBlocked( i))
if ( pMachine->IsKinematicRotAxisBlocked( i))
continue ;
// assegno il precedente ed esco
vAng1[i] = vAxRotPrec[i] ;
@@ -2467,32 +2480,33 @@ Operation::CalculateMcentRotAxesValues( bool bFirst, const Vector3d& vtTool, con
}
}
// verifico che le soluzioni siano nelle corse
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
if ( ! m_pMchMgr->VerifyAngleOutstroke( i, vAng1[i]))
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
if ( ! pMachine->VerifyAngleOutstroke( i, vAng1[i]))
bAng1 = false ;
if ( ! m_pMchMgr->VerifyAngleOutstroke( i, vAng2[i]))
if ( ! pMachine->VerifyAngleOutstroke( i, vAng2[i]))
bAng2 = false ;
}
}
// scelgo la soluzione più vicina alla precedente
double dDelta1 = 0 ;
double dDelta2 = 0 ;
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
// ignoro gli assi bloccati
if ( m_pMchMgr->IsKinematicRotAxisBlocked( i))
if ( pMachine->IsKinematicRotAxisBlocked( i))
continue ;
// calcolo i delta asse con eventuale peso
bool bFirst = ( i == 0) ;
dDelta1 += abs( vAng1[i] - vAxRotPrec[i]) * ( bFirst ? m_pMchMgr->GetCalcRot1W() : 1) ;
dDelta2 += abs( vAng2[i] - vAxRotPrec[i]) * ( bFirst ? m_pMchMgr->GetCalcRot1W() : 1) ;
dDelta1 += abs( vAng1[i] - vAxRotPrec[i]) * ( bFirst ? pMachine->GetCurrRot1W() : 1) ;
dDelta2 += abs( vAng2[i] - vAxRotPrec[i]) * ( bFirst ? pMachine->GetCurrRot1W() : 1) ;
}
if ( bAng2 && ( dDelta2 < dDelta1 - EPS_ANG_SMALL || ! bAng1))
if ( bAng2 && ( dDelta2 < dDelta1 - 10 * EPS_ANG_SMALL || ! bAng1))
swap( vAng1, vAng2) ;
// se imposto limite su variazione di secondo asse rotante
if ( ( m_pMchMgr->GetCalcMaxDeltaR2OnFirst() || ! bFirst) && dMaxDeltaR2 > EPS_ANG_SMALL && vAng1.size() >= 2) {
double dR2Diff1 = vAng1[1] - vAxRotPrec[1] ;
double dR2Diff2 = vAng2[1] - vAxRotPrec[1] ;
if ( abs( dR2Diff1) > abs( dR2Diff2) && abs( dR2Diff1) > dMaxDeltaR2)
if ( ( pMachine->GetCurrCalcMaxDeltaR2OnFirst() || ! bFirst) && dMaxDeltaR2 > EPS_ANG_SMALL && vAng1.size() >= 2) {
double dR2Diff1 = abs( vAng1[1] - vAxRotPrec[1]) ;
double dR2Diff2 = abs( vAng2[1] - vAxRotPrec[1]) ;
if ( dR2Diff1 > dR2Diff2 + 10 * EPS_ANG_SMALL &&
dR2Diff1 > dMaxDeltaR2 && ( dR2Diff2 < dMaxDeltaR2 || dR2Diff2 < dR2Diff1 - dMaxDeltaR2))
swap( vAng1, vAng2) ;
}
}
@@ -2862,7 +2876,6 @@ Operation::CalculateRobotAxesValues( bool bFirst, const Point3d& ptP, const Vect
if ( abs( vAng2[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
pMachine->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
}
bFirst = false ;
}
// altrimenti movimenti successivi
else {
@@ -2911,10 +2924,10 @@ Operation::CalculateRobotAxesValues( bool bFirst, const Point3d& ptP, const Vect
// se esiste solo la prima
if ( vAng2.empty())
vAxVal = vAng1 ;
// evito passaggio per lo zero di R5 (per evitare passaggio attraverso direzione singolare)
else if ( vAng1[4] * vAxRotPrec[4] >= 0 && vAng2[4] * vAxRotPrec[4] < 0)
// se non è inizio, evito passaggio per lo zero di R5 (per evitare passaggio attraverso direzione singolare)
else if ( ! bFirst && vAng1[4] * vAxRotPrec[4] >= 0 && vAng2[4] * vAxRotPrec[4] < 0)
vAxVal = vAng1 ;
else if ( vAng1[4] * vAxRotPrec[4] < 0 && vAng2[4] * vAxRotPrec[4] >= 0)
else if ( ! bFirst && vAng1[4] * vAxRotPrec[4] < 0 && vAng2[4] * vAxRotPrec[4] >= 0)
vAxVal = vAng2 ;
// minimizzo rotazione polso
else if ( abs( vAng1[3] - vAxRotPrec[3]) < abs( vAng2[3] - vAxRotPrec[3]) + 10 * EPS_ANG_SMALL)
@@ -3407,7 +3420,8 @@ Operation::AdjustStartEndMovementsStd( bool bVerifyPreviousLink)
//----------------------------------------------------------------------------
bool
Operation::MoveHeadFromHomeToMach( bool bCurrMain, const string& sToolName, const string& sHeadName, int nExitNbr, int nStartZMax)
Operation::MoveHeadFromHomeToMach( bool bCurrMain, const string& sToolName, const string& sHeadName, int nExitNbr, int nStartZMax,
int nOtherLinkType)
{
// verifico gestore delle lavorazioni e operazione
if ( m_pMchMgr == nullptr)
@@ -3422,7 +3436,7 @@ Operation::MoveHeadFromHomeToMach( bool bCurrMain, const string& sToolName, cons
if ( ! AdjustOneStartEndMovement( GetFirstFullToolpath( bCurrMain), GDB_ID_NULL, nullptr, vAxVal, 0, true))
return false ;
// eseguo collegamento speciale
if ( ! ManageSpecialLink( nullptr, GDB_ID_NULL, false, this, GDB_ID_NULL, bCurrMain, nStartZMax))
if ( ! ManageSpecialLink( nullptr, GDB_ID_NULL, false, this, GDB_ID_NULL, bCurrMain, nStartZMax, nOtherLinkType))
return false ;
// riporto l'utensile corrente come originale
@@ -3437,7 +3451,7 @@ bool
Operation::MoveHeadFromMachToMach( Operation* pPrevOpe,
bool bPrevMain, const string& sPrevToolName, const string& sPrevHeadName, int nPrevExitNbr,
bool bCurrMain, const string& sCurrToolName, const string& sCurrHeadName, int nCurrExitNbr,
bool bToolChangeNeeded, int nStartZMax)
bool bToolChangeNeeded, int nStartZMax, int nOtherLinkType, int nOtherLinkType1)
{
// verifico gestore delle lavorazioni e operazione precedente
if ( m_pMchMgr == nullptr || pPrevOpe == nullptr)
@@ -3463,7 +3477,7 @@ Operation::MoveHeadFromMachToMach( Operation* pPrevOpe,
if ( ! AdjustOneStartEndMovement( GetFirstFullToolpath( bCurrMain), GDB_ID_NULL, pPrevOpe, vAxVal, dPrevOffsX, false))
return false ;
// gestione collegamento speciale
if ( ! ManageSpecialLink( pPrevOpe, GDB_ID_NULL, bPrevMain, this, GDB_ID_NULL, bCurrMain, nStartZMax))
if ( ! ManageSpecialLink( pPrevOpe, GDB_ID_NULL, bPrevMain, this, GDB_ID_NULL, bCurrMain, nStartZMax, nOtherLinkType))
return false ;
}
@@ -3471,12 +3485,12 @@ Operation::MoveHeadFromMachToMach( Operation* pPrevOpe,
else {
// imposto la lavorazione precedente come corrente ed effettuo collegamento
m_pMchMgr->SetCurrMachining( pPrevOpe->GetOwner()) ;
if ( ! MoveHeadFromMachToHome( pPrevOpe, bPrevMain, sPrevToolName, sPrevHeadName, nPrevExitNbr, nStartZMax))
if ( ! MoveHeadFromMachToHome( pPrevOpe, bPrevMain, sPrevToolName, sPrevHeadName, nPrevExitNbr, nStartZMax, nOtherLinkType))
return false ;
// ripristino la lavorazione corrente ed effettuo collegamento
m_pMchMgr->SetCurrMachining( GetOwner()) ;
if ( ! MoveHeadFromHomeToMach( bCurrMain, sCurrToolName, sCurrHeadName, nCurrExitNbr, nStartZMax))
if ( ! MoveHeadFromHomeToMach( bCurrMain, sCurrToolName, sCurrHeadName, nCurrExitNbr, nStartZMax, nOtherLinkType1))
return false ;
}
@@ -3490,7 +3504,7 @@ Operation::MoveHeadFromMachToMach( Operation* pPrevOpe,
//----------------------------------------------------------------------------
bool
Operation::MoveHeadFromMachToHome( Operation* pPrevOpe, bool bPrevMain, const string& sPrevToolName, const string& sPrevHeadName, int nPrevExitNbr,
int nStartZMax)
int nStartZMax, int nOtherLinkType)
{
// verifico gestore delle lavorazioni e operazione precedente
if ( m_pMchMgr == nullptr || pPrevOpe == nullptr)
@@ -3506,7 +3520,7 @@ Operation::MoveHeadFromMachToHome( Operation* pPrevOpe, bool bPrevMain, const st
return false ;
}
// eventuale rilascio utensile speciale di lavorazione precedente
if ( ! pPrevOpe->ManageSpecialLink( pPrevOpe, GDB_ID_NULL, bPrevMain, nullptr, GDB_ID_NULL, false, nStartZMax))
if ( ! pPrevOpe->ManageSpecialLink( pPrevOpe, GDB_ID_NULL, bPrevMain, nullptr, GDB_ID_NULL, false, nStartZMax, nOtherLinkType))
return false ;
// riporto l'utensile corrente come originale
@@ -3554,10 +3568,10 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
if ( sPrevTool.empty() || NeedPrevHome()) {
// -->! la lavorazione corrente è per forza in doppio !<--
// Dalla sua posizione di Home porto la Testa Main sul percorso Main corrente
if ( ! MoveHeadFromHomeToMach( true, GetToolName(), GetHeadName(), GetExitNbr(), nStartZMax))
if ( ! MoveHeadFromHomeToMach( true, GetToolName(), GetHeadName(), GetExitNbr(), nStartZMax, LINK_HOME_TO_MACH))
return false ;
// Dalla sua posizione di Home porto da Testa Double sul percorso Double corrente
if ( ! MoveHeadFromHomeToMach( false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, nStartZMax))
if ( ! MoveHeadFromHomeToMach( false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, nStartZMax, LINK_HOME_TO_MACH))
return false ;
}
else {
@@ -3568,10 +3582,11 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
if ( ! ToolChangeNeeded( *pPrevOpe, true, *this, true) && nStartZMax == 0) {
// Come prima cosa sposto la testa Main della prima lavorazione sul percorso Main della lavorazione corrente
if ( ! MoveHeadFromMachToMach( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr,
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax))
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax,
LINK_HOME_TO_MACH, LINK_NULL))
return false ;
// Successivamente porto la testa Double dalla sua Home alla lavorazione corrente ( in doppio) sul percorso
if ( ! MoveHeadFromHomeToMach( false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, nStartZMax))
if ( ! MoveHeadFromHomeToMach( false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, nStartZMax, LINK_MACH_TO_MACH))
return false ;
}
// -->! 2) Verifico se l'unico utensile della lavorazione precedente ( in quanto singola) è compatibile
@@ -3579,10 +3594,11 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
else if ( ! ToolChangeNeeded( *pPrevOpe, true, *this, false) && nStartZMax == 0) {
// Come prima cosa sposto la testa Main della lavorazione precedente sul percorso Double della lavorazione corrente
if ( ! MoveHeadFromMachToMach( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr,
false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, false, nStartZMax))
false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, false, nStartZMax,
LINK_HOME_TO_MACH, LINK_NULL))
return false ;
// Successivamente porto la testa Main dalla sua Home alla lavorazione corrente ( in doppio) sul percorso
if ( ! MoveHeadFromHomeToMach( true, GetToolName(), GetHeadName(), GetExitNbr(), nStartZMax))
if ( ! MoveHeadFromHomeToMach( true, GetToolName(), GetHeadName(), GetExitNbr(), nStartZMax, LINK_MACH_TO_MACH))
return false ;
}
// -->! 3) In questo caso l'unico utensile della lavorazione precedente ( in quanto singola) non è compatibile
@@ -3590,10 +3606,11 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
else {
// Porto la Testa Main sul percorso Main corrente
if ( ! MoveHeadFromMachToMach( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr,
true, GetToolName(), GetHeadName(), GetExitNbr(), true, nStartZMax))
true, GetToolName(), GetHeadName(), GetExitNbr(), true, nStartZMax,
LINK_NULL, LINK_HOME_TO_MACH))
return false ;
// Dalla sua posizione di Home porto da Testa Double sul percorso Double corrente
if ( ! MoveHeadFromHomeToMach( false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, nStartZMax))
if ( ! MoveHeadFromHomeToMach( false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, nStartZMax, LINK_HOME_TO_MACH))
return false ;
}
}
@@ -3603,33 +3620,36 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
// con l'Utensile presente sul percorso Main della lavorazione corrente ( in quanto singola) !<--
if ( ! ToolChangeNeeded( *pPrevOpe, true, *this, true) && nStartZMax == 0) {
// Come prima cosa sposto la testa Double della lavorazione precedente ( in doppio) in Home
if ( ! MoveHeadFromMachToHome( pPrevOpe, false, sPrevDblTool, sPrevDblHead, nPrevDblExitNbr, nStartZMax))
if ( ! MoveHeadFromMachToHome( pPrevOpe, false, sPrevDblTool, sPrevDblHead, nPrevDblExitNbr, nStartZMax, LINK_MACH_TO_MACH))
return false ;
// Sposto al testa Main della lavorazione precedente sul percorso Main corrente
if ( ! MoveHeadFromMachToMach( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr,
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax))
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax,
LINK_MACH_TO_HOME, LINK_NULL))
return false ;
}
// -->! 2) Verifico se l'utensile secondario della lavorazione precedente ( in doppio) è compatibile
// con l'Utensile presente sul percorso Double della lavorazione corrente ( in quanto singola) !<--
else if ( ! ToolChangeNeeded( *pPrevOpe, false, *this, true) && nStartZMax == 0) {
// Come prima cosa sposto la testa Main della lavorazione precedente ( in doppio) in Home
if ( ! MoveHeadFromMachToHome( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr, nStartZMax))
if ( ! MoveHeadFromMachToHome( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr, nStartZMax, LINK_MACH_TO_MACH))
return false ;
// Sposto al testa Double della lavorazione precedente sul percorso corrente
if ( ! MoveHeadFromMachToMach( pPrevOpe, false, sPrevDblTool, sPrevDblHead, nPrevDblExitNbr,
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax))
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax,
LINK_MACH_TO_HOME, LINK_NULL))
return false ;
}
// -->! 3) In questo caso l'unico utensile della lavorazione corrente ( in quanto singola) non è compatibile
// con nessun utensile della lavorazione precedente ( in doppio) !<--
else {
// Come prima cosa sposto la testa Double della lavorazione precedente ( in doppio) in Home
if ( ! MoveHeadFromMachToHome( pPrevOpe, false, sPrevDblTool, sPrevDblHead, nPrevDblExitNbr, nStartZMax))
if ( ! MoveHeadFromMachToHome( pPrevOpe, false, sPrevDblTool, sPrevDblHead, nPrevDblExitNbr, nStartZMax, LINK_MACH_TO_HOME))
return false ;
// Sposto la testa Main della lavorazione precedente sul percorso corrente
if ( ! MoveHeadFromMachToMach( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr,
true, GetToolName(), GetHeadName(), GetExitNbr(), true, nStartZMax))
true, GetToolName(), GetHeadName(), GetExitNbr(), true, nStartZMax,
LINK_MACH_TO_HOME, LINK_NULL))
return false ;
}
}
@@ -3639,22 +3659,26 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
if ( ! ToolChangeNeeded( *pPrevOpe, true, *this, true) && ! ToolChangeNeeded( *pPrevOpe, false, *this, false) && nStartZMax == 0) {
// Porto la testa Main dalla lavorazione precedente alla lavorazione corrente
if ( ! MoveHeadFromMachToMach( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr,
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax))
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax,
LINK_MACH_TO_MACH, LINK_NULL))
return false ;
// Porto la testa double delle lavorazione precedente alla lavorazine corrente
if ( ! MoveHeadFromMachToMach( pPrevOpe, false, sPrevDblTool, sPrevDblHead, nPrevDblExitNbr,
false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, false, nStartZMax))
false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, false, nStartZMax,
LINK_MACH_TO_MACH, LINK_NULL))
return false ;
}
// -->! 2) Per tutto il resto porto sempre in Home per sicurezza passando da una lavorazione all'altra !<--
else {
// Porto la testa Main dalla lavorazione precedente alla lavorazione corrente
if ( ! MoveHeadFromMachToMach( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr,
true, GetToolName(), GetHeadName(), GetExitNbr(), true, nStartZMax))
true, GetToolName(), GetHeadName(), GetExitNbr(), true, nStartZMax,
LINK_MACH_TO_HOME, LINK_HOME_TO_MACH))
return false ;
// Porto la testa Double delle lavorazione precedente alla lavorazine corrente
if ( ! MoveHeadFromMachToMach( pPrevOpe, false, sPrevDblTool, sPrevDblHead, nPrevDblExitNbr,
false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, true, nStartZMax))
false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, true, nStartZMax,
LINK_MACH_TO_HOME, LINK_HOME_TO_MACH))
return false ;
}
}
@@ -3673,7 +3697,7 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
DBLVECTOR vAxVal ;
bOk = bOk && GetClPathFinalAxesValues( nPrevCLPathId, false, vAxVal) ;
bOk = bOk && AdjustOneStartEndMovement( nCLPathId, nPrevCLPathId, nullptr, vAxVal, 0, false) ;
bOk = bOk && ManageSpecialLink( this, nPrevCLPathId, true, this, nCLPathId, true, nStartZMax) ;
bOk = bOk && ManageSpecialLink( this, nPrevCLPathId, true, this, nCLPathId, true, nStartZMax, LINK_NULL) ;
// passo al successivo
nPrevCLPathId = nCLPathId ;
nCLPathId = GetNextFullToolpath( nCLPathId) ;
@@ -3705,13 +3729,13 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
// Utensile Main
bOk = bOk && GetClPathFinalAxesValues( nPrevCLPathId, false, vAxVal) ;
bOk = bOk && AdjustOneStartEndMovement( nCLPathId, nPrevCLPathId, nullptr, vAxVal, 0, false) ;
bOk = bOk && ManageSpecialLink( this, nPrevCLPathId, true, this, nCLPathId, true, nStartZMax) ;
bOk = bOk && ManageSpecialLink( this, nPrevCLPathId, true, this, nCLPathId, true, nStartZMax, LINK_MACH_TO_HOME) ;
// Utensile Double
DBLVECTOR vAxDblVal ;
bOk = bOk && m_pMchMgr->SetCalcTool( sCurrDblTool, sCurrDblHead, nCurrDblExitNbr) ;
bOk = bOk && GetClPathFinalAxesValues( nPrevDBLPathId, false, vAxDblVal) ;
bOk = bOk && AdjustOneStartEndMovement( nDBLPathId, nPrevDBLPathId, nullptr, vAxDblVal, 0, false) ;
bOk = bOk && ManageSpecialLink( this, nPrevDBLPathId, false, this, nDBLPathId, false, nStartZMax) ;
bOk = bOk && ManageSpecialLink( this, nPrevDBLPathId, false, this, nDBLPathId, false, nStartZMax, LINK_MACH_TO_HOME) ;
bOk = bOk && m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()) ;
// passo al successivo
nPrevCLPathId = nCLPathId ;
@@ -3724,12 +3748,12 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
// per utensile Main
DBLVECTOR vAxVal ;
bOk = bOk && AddRise( vAxVal) ;
bOk = bOk && ManageSpecialLink( this, GDB_ID_NULL, true, nullptr, GDB_ID_NULL, true, 0) ;
bOk = bOk && ManageSpecialLink( this, GDB_ID_NULL, true, nullptr, GDB_ID_NULL, true, 0, LINK_NULL) ;
// per utensile Double
DBLVECTOR vAxDblVal ;
bOk = bOk && m_pMchMgr->SetCalcTool( sCurrDblTool, sCurrDblHead, nCurrDblExitNbr) ;
bOk = bOk && AddRise( vAxDblVal, NAN, GDB_ID_NULL, false) ;
bOk = bOk && ManageSpecialLink( this, GDB_ID_NULL, false, nullptr, GDB_ID_NULL, false, 0) ;
bOk = bOk && ManageSpecialLink( this, GDB_ID_NULL, false, nullptr, GDB_ID_NULL, false, 0, LINK_NULL) ;
bOk = bOk && m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()) ;
// -->! se ultima operazione o la successiva lo richiede, vado in Home !<--
int nNextOpId = m_pMchMgr->GetNextActiveOperation( m_nOwnerId) ;
@@ -3896,7 +3920,7 @@ Operation::AdjustStartEndMovementsNew( void)
//----------------------------------------------------------------------------
bool
Operation::ManageSpecialLink( Operation* pPrevOpe, int nPrevClPathId, bool bPrevMain, Operation* pNextOpe, int nNextClPathId, bool bNextMain,
int nStartZmax)
int nStartZmax, int nOtherLinkType)
{
// controlli
if ( pPrevOpe == nullptr && pNextOpe == nullptr)
@@ -3939,7 +3963,7 @@ Operation::ManageSpecialLink( Operation* pPrevOpe, int nPrevClPathId, bool bPrev
return false ;
// chiamo funzione script OnSpecialRapidMove per avere posizioni di movimento
bool bOk = SpecialLink( vNeatAxSta, vNeatAxEnd, nLinkType, pPrevOpe, bPrevMain, pNextOpe, bNextMain, nStartZmax) ;
bool bOk = SpecialLink( vNeatAxSta, vNeatAxEnd, nLinkType, pPrevOpe, bPrevMain, pNextOpe, bNextMain, nStartZmax, nOtherLinkType) ;
// in caso di errore eseguo inserimento con segnalazione di errore
if ( ! bOk) {
@@ -4943,6 +4967,10 @@ Operation::AddRobotClimb( int nEntId, double dDeltaZ)
int nNewEntId = m_pGeomDB->Copy( nEntId, GDB_ID_NULL, nEntId, GDB_BEFORE) ;
if ( nNewEntId == GDB_ID_NULL)
return false ;
// aggiorno il CamData
pCdEnt = GetCamData( m_pGeomDB->GetUserObj( nNewEntId)) ;
if ( pCdEnt == nullptr)
return false ;
// modifico quella originale (è la prima del percorso)
m_pGeomDB->SetName( nNewEntId, MCH_CL_CLIMB) ;
m_pGeomDB->RemoveInfo( nNewEntId, KEY_CL_DOUBLE) ;
@@ -4954,7 +4982,7 @@ Operation::AddRobotClimb( int nEntId, double dDeltaZ)
double dStep = dNewDeltaZ / nStep ;
for ( int i = 1 ; i < nStep ; ++ i) {
// copio l'entità
int nNewId = m_pGeomDB->Copy( nEntId, GDB_ID_NULL, nEntId, GDB_AFTER) ;
int nNewId = m_pGeomDB->Copy( nNewEntId, GDB_ID_NULL, nNewEntId, GDB_AFTER) ;
if ( nNewId == GDB_ID_NULL)
return false ;
// calcolo la posizione sopra il punto a Zmax
@@ -5297,7 +5325,7 @@ Operation::GetUserNotesZmax( void) const
string sUserNotes ;
if ( m_pMchMgr != nullptr && m_pMchMgr->GetMachiningParam( MPA_USERNOTES, sUserNotes)) {
int nVal ;
if ( FromString( ExtractInfo( sUserNotes, "StartZmax="), nVal))
if ( GetValInNotes( sUserNotes, UN_STARTZMAX, nVal))
return nVal ;
}
return 0 ;
@@ -5926,23 +5954,24 @@ Operation::SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
bool
Operation::SpecialLink( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nLinkType,
const Operation* pPrevOpe, bool bPrevMain, const Operation* pNextOpe, bool bNextMain,
int nStartZMax)
int nStartZMax, int nOtherLinkType)
{
// recupero la macchina corrente
Machine* pMch = ( m_pMchMgr != nullptr ? m_pMchMgr->GetCurrMachine() : nullptr) ;
if ( pMch == nullptr)
return false ;
// costanti
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_PREVMCHID = ".PREVMCHID" ; // IN (int) identificativo lavorazione precedente
static const string EVAR_PREVPHASE = ".PREVPHASE" ; // IN (int) indice fase della lavorazione precedente
static const string EVAR_PREVMAIN = ".PREVMAIN" ; // IN (bool) flag lavorazione principale o double precedente
static const string EVAR_NEXTMCHID = ".NEXTMCHID" ; // IN (int) identificativo lavorazione successiva
static const string EVAR_NEXTPHASE = ".NEXTPHASE" ; // IN (int) indice fase della lavorazione successiva
static const string EVAR_NEXTMAIN = ".NEXTMAIN" ; // IN (bool) flag lavorazione principale o double successiva
static const string EVAR_STARTZMAX = ".STARTZMAX" ; // IN (int) identificativo StartZMax
static const string EVAR_LINKTYPE = ".LINKTYPE" ; // IN (int) codice tipo collegamento (1=Inizio, 2=Fine, 3=FinePrec+InizioSucc)
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_PREVMCHID = ".PREVMCHID" ; // IN (int) identificativo lavorazione precedente
static const string EVAR_PREVPHASE = ".PREVPHASE" ; // IN (int) indice fase della lavorazione precedente
static const string EVAR_PREVMAIN = ".PREVMAIN" ; // IN (bool) flag lavorazione principale o double precedente
static const string EVAR_NEXTMCHID = ".NEXTMCHID" ; // IN (int) identificativo lavorazione successiva
static const string EVAR_NEXTPHASE = ".NEXTPHASE" ; // IN (int) indice fase della lavorazione successiva
static const string EVAR_NEXTMAIN = ".NEXTMAIN" ; // IN (bool) flag lavorazione principale o double successiva
static const string EVAR_STARTZMAX = ".STARTZMAX" ; // IN (int) identificativo StartZMax
static const string EVAR_LINKTYPE = ".LINKTYPE" ; // IN (int) codice tipo collegamento (1=Inizio, 2=Fine, 3=FinePrec+InizioSucc)
static const string EVAR_OTHERLINKTYPE = ".OTHERLINKTYPE" ; // IN (int) codice tipo collegamento per altra lavorazione (0=Non Presente, 1=Inizio, 2=Fine, 3=FinePrec+InizioSucc)
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string ON_SPECIAL_LINK = "OnSpecialLink" ;
// se la funzione non è definita, esco
@@ -5967,14 +5996,18 @@ Operation::SpecialLink( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_EXIT, nExitNbr) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TCPOS, sTcPos) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PREVMCHID, ( pPrevOpe != nullptr ? pPrevOpe->GetOwner() : GDB_ID_NULL)) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PREVMAIN, ( bPrevMain ? MCH_CL : MCH_DBL)) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PREVMAIN, ( pPrevOpe != nullptr ? ( bPrevMain ? MCH_CL : MCH_DBL) : MCH_HOME)) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PREVPHASE, ( pPrevOpe != nullptr ? pPrevOpe->m_nPhase : 0)) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_NEXTMCHID, ( pNextOpe != nullptr ? pNextOpe->GetOwner() : GDB_ID_NULL)) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_NEXTPHASE, ( pNextOpe != nullptr ? pNextOpe->m_nPhase : 0)) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_NEXTMAIN, ( bNextMain ? MCH_CL : MCH_DBL)) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_NEXTMAIN, ( pNextOpe != nullptr ? ( bNextMain ? MCH_CL : MCH_DBL) : MCH_HOME)) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTZMAX, nStartZMax) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_PHASE, m_nPhase) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_LINKTYPE, nLinkType) ;
if ( nOtherLinkType == LINK_NULL)
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR + EVAR_OTHERLINKTYPE) ;
else
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OTHERLINKTYPE, nOtherLinkType) ;
// valore degli assi
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
int nNumAxes = ssize( vAxStart) ;
+12 -7
View File
@@ -181,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 ;
@@ -240,16 +240,17 @@ 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 MoveHeadFromHomeToMach( bool bMain, const std::string& sToolName, const std::string& sHeadName, int nExitNbr, int nStartZMax) ;
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) ;
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 nStartZMax, int nOtherLinkType) ;
bool ManageDoubleOperNew( Operation* pPrevOpe) ;
bool ManageSpecialLink( Operation* pPrevOpe, int nPrevClPathId, bool bPrevMain, Operation* pNextOpe, int nNextClPathId, bool bNextMain,
int nStartZMax) ;
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) ;
@@ -278,7 +279,7 @@ class Operation : public IUserObj
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, bool bPrevMain, const Operation* pNextOpe, bool bNextMain,
int nStartZMax) ;
int nStartZMax, int nOtherLinkType = LINK_NULL) ;
bool SpecialPrevMachiningOffset( const Operation* pPrevOpe, double& dOffsetX) ;
protected :
@@ -324,12 +325,16 @@ class Operation : public IUserObj
int AddLinearMove( const Point3d& ptP, const std::string& sName) ;
int AddLinearMove( const Point3d& ptP, bool bSplit) ;
int AddLinearMove( const Point3d& ptP, bool bSplit, const std::string& sName) ;
int AddLinearMove( const Point3d& ptP, bool bSplit, int nCorrType, const std::string* sName = nullptr, const Color* pColor = nullptr) ;
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN) ;
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, const std::string& sName) ;
int AddArcMove ( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, int nCorrType,
const std::string* psName = nullptr, const Color* pColor = nullptr) ;
int AddCurveMove( const ICurve* pCrv) ;
int AddCurveMove( const ICurve* pCrv, const std::string& sName) ;
int AddCurveMove( const ICurve* pCrv, bool bSplit) ;
int AddCurveMove( const ICurve* pCrv, bool bSplit, const std::string& sName) ;
int AddCurveMove( const ICurve* pCrv, bool bSplit, int nCorrType, const std::string* psName = nullptr, const Color* pColor = nullptr) ;
bool ResetMoveData( void) ;
protected :
+56
View File
@@ -348,6 +348,25 @@ Operation::AddLinearMove( const Point3d& ptP, bool bSplit, const string& sName)
return nFirstId ;
}
//----------------------------------------------------------------------------
int
Operation::AddLinearMove( const Point3d& ptP, bool bSplit, int nCorrType, const string* psName, const Color* pColor)
{
int nFirstId = AddLinearMove( ptP, bSplit) ;
int nId = nFirstId ;
while ( nId != GDB_ID_NULL) {
if ( psName != nullptr)
m_pGeomDB->SetName( nId, *psName) ;
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
if ( pCamData == nullptr || ! pCamData->SetCorrType( nCorrType))
return GDB_ID_NULL ;
if ( pColor != nullptr)
m_pGeomDB->SetMaterial( nId, *pColor) ;
nId = m_pGeomDB->GetNext( nId) ;
}
return nFirstId ;
}
//----------------------------------------------------------------------------
int
Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN)
@@ -422,6 +441,24 @@ Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen,
return nId ;
}
//----------------------------------------------------------------------------
int
Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, int nCorrType,
const string* psName, const Color* pColor)
{
int nId = AddArcMove( ptP, ptCen, dAngCen, vtN) ;
if ( nId != GDB_ID_NULL) {
if ( psName != nullptr)
m_pGeomDB->SetName( nId, *psName) ;
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
if ( pCamData == nullptr || ! pCamData->SetCorrType( nCorrType))
return GDB_ID_NULL ;
if ( pColor != nullptr)
m_pGeomDB->SetMaterial( nId, *pColor) ;
}
return nId ;
}
//----------------------------------------------------------------------------
int
Operation::AddCurveMove( const ICurve* pCrv)
@@ -530,6 +567,25 @@ Operation::AddCurveMove( const ICurve* pCrv, bool bSplit, const string& sName)
return nFirstId ;
}
//----------------------------------------------------------------------------
int
Operation::AddCurveMove( const ICurve* pCrv, bool bSplit, int nCorrType, const string* psName, const Color* pColor)
{
int nFirstId = AddCurveMove( pCrv, bSplit) ;
int nId = nFirstId ;
while ( nId != GDB_ID_NULL) {
if ( psName != nullptr)
m_pGeomDB->SetName( nId, *psName) ;
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
if ( pCamData == nullptr || ! pCamData->SetCorrType( nCorrType))
return GDB_ID_NULL ;
if ( pColor != nullptr)
m_pGeomDB->SetMaterial( nId, *pColor) ;
nId = m_pGeomDB->GetNext( nId) ;
}
return nFirstId ;
}
//----------------------------------------------------------------------------
bool
Operation::ResetMoveData( void)
+1
View File
@@ -174,6 +174,7 @@ static const std::string GVAR_MASK = ".MASK" ; // (int) mask asso
static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento
static const std::string GVAR_FLAG2 = ".FLAG2" ; // (int) secondo flag associato ad ogni movimento
static const std::string GVAR_INDEX = ".IDX" ; // (int) indice associato ad ogni movimento
static const std::string GVAR_CORR = ".CORR" ; // (int) tipo di correzione (0=no,41=sn,42=dx,140=out,141=in_sn,142=in_dx)
static const std::string GVAR_TDIR = ".TDIR" ; // (Vector3d) versore utensile nel riferimento pezzo
static const std::string GVAR_CDIR = ".CDIR" ; // (Vector3d) versore correzione nel riferimento pezzo
static const std::string GVAR_ADIR = ".ADIR" ; // (Vector3d) versore ausiliario nel riferimento pezzo
+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 ;
+1878 -419
View File
File diff suppressed because it is too large Load Diff
+29 -9
View File
@@ -21,6 +21,7 @@
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
#include "/EgtDev/Include/EGkCAvSilhouetteSurfTm.h"
// struttura informazioni sui singoli percorsi
struct PathInfoPO {
@@ -30,9 +31,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
@@ -107,15 +110,17 @@ class PocketingNT : public Machining
bool GetCurves( const SelData& Id, const ISurfTriMesh* pStmRaw, const ISurfTriMesh* pStmTrim, ICURVEPLIST& lstPC) ;
bool SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen = nullptr) ;
bool SetSfrLoopsAllTempProp( int nSfrId, ISurfFlatRegion* pSfr) ;
bool ResetCurveAllTempProp( ICurve* pCurve) ;
bool ResetCurveAllTempProp( ICurve* pCurve, bool bClose = true) ;
bool Chain( int nGrpDestId) ;
ISurfTriMesh* GetRaw( void) ;
ISurfTriMesh* GetStmTrim( void) ;
ISurfTriMesh* GetExtrusionStm( const ISurfFlatRegion* pSfr, const Vector3d& vtExtr) ;
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) ;
ISurfFlatRegion* GetSfrRawProjection( const ISurfTriMesh* pStmRaw, const ISurfFlatRegion* pSfr, const Vector3d& vtTool) ;
ISurfFlatRegion* GetSfrRawProjection( const ISurfTriMesh* pStmRaw, const ISurfFlatRegion* pSfr, const Vector3d& vtTool,
const Frame3d& frAtTop, ICAvParSilhouettesSurfTm** ppCavParSil = nullptr) ;
Point3d GetStartPointByUser( const ISurfFlatRegion* pSfr) const ;
Point3d GetStartPointsByHead( const STEPINFOPOVECTOR& vStepInfo) const ;
Point3d GetStartPointsFromSteps( const STEPINFOPOVECTOR& vStepInfo, int nCrvType) const ;
Point3d GetStartPointsBySteps( const STEPINFOPOVECTOR& vStepInfo, int nCrvType) const ;
bool ChooseRawPart( const ISurfFlatRegion* pSfrChunk, ISurfTriMesh* pStm) const ;
bool ManageOpenEdges( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmPart) ;
bool GetHomogeneousParts( const ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) const ;
@@ -129,12 +134,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) ;
const Vector3d& vtTool, bool bHolePocketing, const Point3d& ptHoleDest, bool bToolComp, 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) ;
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,16 +156,16 @@ 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 ;
@@ -171,7 +179,19 @@ 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,
bool bWithEndGuide) const ;
bool AssignPropsToCamDataForToolCompensation( int nId, bool bLineIn, bool bLineOut, bool bToolAtLeft) ;
bool CalcLinkByStartUserPoint( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrLimit, const Point3d& ptStart,
const Point3d& ptEnd, ICurveComposite* pCompoLink) const ;
// debug
void DebugDrawSfr( const ISurfFlatRegion* pSfr, bool bUniform, int nlayer = GDB_ID_ROOT) ;
void DebugDrawLoop( const ICurveComposite* pCrvCompo, int nLayer, bool bUniform) ;
+26 -6
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 ;
@@ -501,7 +508,8 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
case 1 : // linea
if ( ! OnLinear( nEntId, nEntInd, nMove, AxesEnd,
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext))
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(),
pCamData->GetCorrType(), nMoveNext, AxesNext))
return false ;
break ;
case 2 : // arco CW
@@ -511,7 +519,8 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
if ( ! OnArc( nEntId, nEntInd, nMove, AxesEnd,
pCamData->GetAxesCen(), ptMid, pCamData->GetAxesRad(), pCamData->GetAxesAngCen(),
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext))
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(),
pCamData->GetCorrType(), nMoveNext, AxesNext))
return false ;
break ;
}
@@ -963,18 +972,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
@@ -1091,7 +1107,7 @@ Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd
bool
Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext)
double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext)
{
// cancello variabili estranee
ResetArcData() ;
@@ -1123,6 +1139,8 @@ Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEn
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
// assegno il valore dell'indice
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
// assegno il tipo di correzione
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_CORR, nCorr) ;
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
if ( nMoveNext != -1) {
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
@@ -1148,7 +1166,7 @@ bool
Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext)
double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext)
{
// assegno Id e indice entità di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ;
@@ -1190,6 +1208,8 @@ Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
// assegno il valore dell'indice
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
// assegno il tipo di correzione
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_CORR, nCorr) ;
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
if ( nMoveNext != -1) {
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
+3 -3
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) ;
@@ -65,11 +65,11 @@ class Processor
int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ;
bool OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ;
double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext) ;
bool OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ;
double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext) ;
bool ResetArcData( void) ;
protected :
+7 -6
View File
@@ -208,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
@@ -1722,12 +1719,16 @@ SimulatorSP::TraceToolTipMove( int nMoveType)
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) ;
-1
View File
@@ -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
+616 -370
View File
File diff suppressed because it is too large Load Diff
+10 -3
View File
@@ -21,6 +21,7 @@
#include "GeoConst.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
@@ -177,8 +178,11 @@ class SurfFinishing : public Machining
double dFrontTriaTolerAng, double& dMaxFrontTriaRad) const ;
bool CalcOptimalZConstCurves( const ISurfFlatRegion* pSfrLoc, const SURFLOCALVECTOR& vSrfLoc,
const Frame3d& frSurf, const Vector3d& vtTool, double dAngDegSplit,
double dAngDegTol, double dDepth, ICAvToolSurfTm* pCAvTlStm, VECTORPATHS& vPaths, ISurfFlatRegion* pSfrProj) const ;
bool CalcOptimalZigZagCurves( const ISurfFlatRegion* pSfrLoc, const Frame3d& frSurf,
double dAngDegTol, double dDepth, ICAvToolSurfTm* pCAvTlStm, VECTORPATHS& vPaths,
ISurfFlatRegion* pSfrToolColl) const ;
bool CalcOptimalZigZagSfrByZConstCrv( const ISurfFlatRegion* pSfrLoc, const CISURFTMPVECTOR& vpStm, const Vector3d& vtToolLoc,
double dExtraCollOffs, ICurveComposite* pCompoSil, ISurfFlatRegion* pSfrZigZag) const ;
bool CalcOptimalZigZagCurves( ISURFFRPOVECTOR& vSfrZigZagProj, const Frame3d& frSurf,
const Vector3d& vtTool, double dDepth, ICAvToolSurfTm* pCAvTlStm, VECTORPATHS& vPaths) const ;
bool GetOptimalSfr( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfrLoc, const Vector3d& vtTool,
double dDepth, double dElev, ISurfFlatRegion* pSfrSpiral, ISurfFlatRegion* pSfrZConst) const ;
@@ -213,6 +217,9 @@ class SurfFinishing : public Machining
bool MarchingSquares( const VECTORCOLLISIONSFR& vPntM, int nType, double dOffsTol, int nStepX, int nStepY, double dClippingAngle,
double dLimInfClippingAng, double dLimSupClippingAng, const Vector3d& vtAxL, const Vector3d& vtMoveL, ICAvToolSurfTm* pCAvTlStm,
ICRVCOMPOPOVECTOR& vCrvCompo) const ;
bool AreSameSfrChunkEpsilon( const ISurfFlatRegion* pSfrChunkA, const ISurfFlatRegion* pSfrChunkB, double dMaxDist) const ;
bool CalcOptimalZigZagRegion( const ISurfFlatRegion* pSfrCntLoc, const ISurfFlatRegion* pSfrZLevelColl, const SURFLOCALVECTOR& vSrfLoc,
const Frame3d& frSurf, const Vector3d& vtTool, double dDepth, double dSplitAngDeg, ISURFFRPOVECTOR& vpSfrZigZagProj) const ;
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
double GetRadiusForStartEndElevation( void) const ;
@@ -235,7 +242,7 @@ class SurfFinishing : public Machining
int GetLeadOutType( void) const ;
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
SurfFinishingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
double m_dTHoldBase ; // posizione base del porta-utensile
+171 -75
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 ;
@@ -2458,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
}
}
@@ -2594,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() ;
@@ -2957,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) {
@@ -3024,9 +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,
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., vCrvPaths)) {
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) ;
@@ -3137,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) ;
@@ -3191,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) ;
@@ -3778,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() ;
@@ -3788,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] ;
@@ -3871,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)
@@ -3894,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()) ;
@@ -3921,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) ;
}
}
@@ -4113,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) ;
}
@@ -4128,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
@@ -4170,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) ;
}
@@ -4182,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 ;
}
@@ -4260,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
@@ -4899,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 ;
}
+2 -1
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,
@@ -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 */
+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" ;