Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e1c69e207d | |||
| 67b34008c5 | |||
| 1bb839e9f4 | |||
| 083f896d50 | |||
| 83c83fb5f0 | |||
| b577dfe86b | |||
| 624bc499a2 | |||
| 79e1e9fefd | |||
| dcb3e6984f | |||
| 0722c496ac | |||
| 04a252418c | |||
| 7dd75bc14b | |||
| 3a6da43acc | |||
| dd45642748 | |||
| 97e95741b9 | |||
| 73739a2931 | |||
| 690c53a5dc | |||
| f9964a2f3c | |||
| 39b5434c22 | |||
| 00881757a7 | |||
| 4be087a16d | |||
| b6ef052c50 | |||
| 1ec2188326 | |||
| 58fe1d1f8f | |||
| 8fed51ca79 | |||
| 708fe02b9b | |||
| b418e2d3ef | |||
| 0ba49c41eb | |||
| 4925ab462c | |||
| 1f09c33e46 | |||
| f0eccf0efc | |||
| 6040a7c43d | |||
| 984f206d56 | |||
| 1ba62546b0 | |||
| d7712e133e | |||
| 6d6da429e4 | |||
| aace2ff81d | |||
| 616026d74e | |||
| 00c97b0503 | |||
| 9a749e0f20 | |||
| b88c276bb0 | |||
| 3b2b185fd1 | |||
| ed58f649f3 | |||
| e8e8a209b1 |
@@ -89,6 +89,8 @@ class Disposition : public Operation
|
||||
const std::string& GetHeadName( void) const override ;
|
||||
int GetExitNbr( void) const override ;
|
||||
const std::string& GetToolTcPos( void) const override ;
|
||||
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const override
|
||||
{ return false ; }
|
||||
int GetSolCh( void) const override
|
||||
{ return 0 ; }
|
||||
bool NeedPrevHome( void) const override ;
|
||||
|
||||
+16
-7
@@ -27,6 +27,7 @@
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkChainCurves.h"
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
#include "/EgtDev/Include/EGnStringKeyVal.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
@@ -753,8 +754,8 @@ Drilling::Update( bool bPostApply)
|
||||
// elimino le entità CLIMB, RISE e HOME della lavorazione in doppio
|
||||
RemoveClimbRiseHome( false) ;
|
||||
// recupero i dati della testa in doppio e la imposto
|
||||
string sDblTool ; string sDblHead ; int nDblExit ;
|
||||
bool bOk = GetDoubleToolData( sDblTool, sDblHead, nDblExit) &&
|
||||
string sDblTool ; string sDblTcPos ; string sDblHead ; int nDblExit ;
|
||||
bool bOk = GetDoubleToolData( sDblTool, sDblTcPos, sDblHead, nDblExit) &&
|
||||
m_pMchMgr->SetCalcTool( sDblTool, sDblHead, nDblExit) ;
|
||||
// imposto eventuale asse bloccato da lavorazione
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis, true) ;
|
||||
@@ -867,7 +868,11 @@ Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
// eseguo la lavorazione richiesta
|
||||
switch ( nDrillType) {
|
||||
case DRILL_TYPE_STD :
|
||||
{ // elaboro i singoli fori
|
||||
{ // se vtAux impostato come parametro di lavorazione nelle UserNotes
|
||||
Vector3d vtAux ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
|
||||
vtAux.Normalize() ;
|
||||
// elaboro i singoli fori
|
||||
for ( int i = 0 ; i < int( m_vId.size()) ; ++ i) {
|
||||
const auto& vId = m_vId[i] ;
|
||||
// se richiesto preview
|
||||
@@ -880,7 +885,7 @@ Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
}
|
||||
// se richiesta lavorazione
|
||||
if ( nClId != GDB_ID_NULL) {
|
||||
if ( ! GenerateHoleCl( i, vId, MCH_PATH, nClId))
|
||||
if ( ! GenerateHoleCl( i, vId, MCH_PATH, nClId, 0, vtAux))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -3574,7 +3579,7 @@ 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) ;
|
||||
bool bDouble = ( GetDoubleType( m_Params.m_sUserNotes) != 0) ;
|
||||
double dDoubleLastStep = GetDoubleLastStep() ;
|
||||
bool dDoubleParallel = false ;
|
||||
if ( bDouble) {
|
||||
@@ -3594,7 +3599,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
case 2 : vtNorm = Y_AX ; break ;
|
||||
case 3 : vtNorm = Z_AX ; break ;
|
||||
}
|
||||
dDoubleParallel = ( vtNorm.IsValid() && hole.vtDir * vtNorm > cos( 1. * DEGTORAD)) ;
|
||||
dDoubleParallel = ( vtNorm.IsValid() && abs( hole.vtDir * vtNorm) > cos( 1. * DEGTORAD)) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3649,6 +3654,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
if ( bHoleEnd)
|
||||
ptP3 -= hole.vtDir * dAddLen ;
|
||||
if ( dDoubleParallel && i == nStep) {
|
||||
SetFlag( 105) ; // movimento in doppio parallelo
|
||||
if ( AddLinearMove( ptP3, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
@@ -3680,6 +3686,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
if ( bHoleEnd)
|
||||
ptP4 -= hole.vtDir * dAddLen ;
|
||||
if ( dDoubleParallel && i == nStep) {
|
||||
SetFlag( 105) ; // movimento in doppio parallelo
|
||||
if ( AddLinearMove( ptP4, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
@@ -3710,6 +3717,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
if ( bHoleEnd)
|
||||
ptP5 -= hole.vtDir * dAddLen ;
|
||||
if ( dDoubleParallel && i == nStep) {
|
||||
SetFlag( 105) ; // movimento in doppio parallelo
|
||||
if ( AddLinearMove( ptP5, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
@@ -3724,8 +3732,8 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
|
||||
// 6 -> ritorno all'approccio del foro
|
||||
SetFeed( GetEndFeed()) ;
|
||||
SetFlag( 104) ; // risalita sopra il foro
|
||||
if ( dDoubleParallel) {
|
||||
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)
|
||||
@@ -3735,6 +3743,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
if ( AddLinearMove( ptEnd - dLastStep * hole.vtDir, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
SetFlag( 104) ; // risalita sopra il foro
|
||||
if ( AddLinearMove( ptP1, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
|
||||
Binary file not shown.
@@ -304,6 +304,7 @@ class MachMgr : public IMachMgr
|
||||
bool RemoveMachiningPreview( void) override ;
|
||||
bool MachiningApply( bool bRecalc, bool bPostApply = true) override ;
|
||||
bool MachiningUpdate( bool bPostApply = true) override ;
|
||||
bool ChangePreviewMachiningToolShow( int nLookFlag) override ;
|
||||
bool PreparePreviewMachiningTool( void) const override ;
|
||||
bool RemovePreviewMachiningTool( void) const override ;
|
||||
int GetPreviewMachiningToolStepCount( void) const override ;
|
||||
@@ -327,6 +328,9 @@ class MachMgr : public IMachMgr
|
||||
bool GetClEntAxesStatus( int nEntId, int& nStatus) const override ;
|
||||
bool GetClEntAxesMask( int nEntId, int& nMask) const override ;
|
||||
bool GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const override ;
|
||||
bool GetClEntTDir( int nEntId, Vector3d& vTDir) const override ;
|
||||
bool GetClEntCDir( int nEntId, Vector3d& vCDir) const override ;
|
||||
bool GetClEntADir( int nEntId, Vector3d& vADir) const override ;
|
||||
// Simulation
|
||||
bool SimInit( void) override ;
|
||||
bool SimStart( bool bFirst) override ;
|
||||
@@ -374,6 +378,7 @@ class MachMgr : public IMachMgr
|
||||
bool GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const override ;
|
||||
bool LimitAngleToStroke( int nInd, double& dAng) const override ;
|
||||
bool VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) const override ;
|
||||
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const override ;
|
||||
std::string GetOutstrokeInfo( bool bMM = true) const override ;
|
||||
// Machine
|
||||
int GetBaseId( const std::string& sBase) const override ;
|
||||
@@ -482,7 +487,6 @@ class MachMgr : public IMachMgr
|
||||
bool GetCalcMaxDeltaR2OnFirst( void) const ;
|
||||
bool GetCalcPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ;
|
||||
bool VerifyAngleOutstroke( int nInd, double dAng) const ;
|
||||
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const ;
|
||||
bool ExistProtectedAreas( void) const ;
|
||||
// Operations
|
||||
bool GetOperationNewName( std::string& sName) const ;
|
||||
|
||||
+55
-1
@@ -2,7 +2,7 @@
|
||||
// EgalTech 2019-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachMgrClEntities.cpp Data : 27.10.23 Versione : 2.5j4
|
||||
// Contenuto : Implementazione interrogazione entità CL della classe MachMgr.
|
||||
// Contenuto : Implementazione interrogazione entità CL della classe MachMgr.
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -147,3 +147,57 @@ MachMgr::GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const
|
||||
vAxes = pCamData->GetAxesVal() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntTDir( int nEntId, Vector3d& vTDir) const
|
||||
{
|
||||
// default
|
||||
vTDir = V_NULL ;
|
||||
// verifico validità GeomBD
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero l'oggetto CamData
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero vTDir
|
||||
vTDir = pCamData->GetToolDir() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntCDir( int nEntId, Vector3d& vCDir) const
|
||||
{
|
||||
// default
|
||||
vCDir = V_NULL ;
|
||||
// verifico validità GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero l'oggetto CamData
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero vCDir
|
||||
vCDir = pCamData->GetCorrDir() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntADir( int nEntId, Vector3d& vADir) const
|
||||
{
|
||||
// default
|
||||
vADir = V_NULL ;
|
||||
// verifico validità GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero l'oggetto CamData
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero ADir
|
||||
vADir = pCamData->GetAuxDir() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
+14
-2
@@ -775,8 +775,19 @@ bool
|
||||
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetAngles( vtDirT, vtDirA, nStat, dAngA1, dAngB1, dAngA2, dAngB2) : false) ;
|
||||
nStat = 0 ; dAngA1 = 0 ; dAngB1 = 0 ; dAngA2 = 0 ; dAngB2 = 0 ;
|
||||
DBLVECTOR vAng1, vAng2 ;
|
||||
if ( ! GetCalcAngles( vtDirT, vtDirA, nStat, vAng1, vAng2))
|
||||
return false ;
|
||||
if ( vAng1.size() >= 1) {
|
||||
dAngA1 = vAng1[0] ;
|
||||
dAngA2 = vAng2[0] ;
|
||||
if ( vAng1.size() >= 2) {
|
||||
dAngB1 = vAng1[1] ;
|
||||
dAngB2 = vAng2[1] ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -784,6 +795,7 @@ bool
|
||||
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const
|
||||
{
|
||||
const_cast<MachMgr*>(this)->ApplyRotAxisBlock() ;
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetAngles( vtDirT, vtDirA, nStat, vAng1, vAng2) : false) ;
|
||||
}
|
||||
|
||||
+18
-2
@@ -1106,6 +1106,22 @@ MachMgr::MachiningUpdate( bool bPostApply)
|
||||
return pMch->Update( bPostApply) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ChangePreviewMachiningToolShow( int nLookFlag)
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
if ( nCurrMchId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// ne recupero il gestore
|
||||
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// eseguo
|
||||
return pMch->ChangeToolPreviewShow( nLookFlag) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::PreparePreviewMachiningTool( void) const
|
||||
@@ -1342,7 +1358,7 @@ MachMgr::GetMachiningStartAxes( bool bSkipClimb, DBLVECTOR& vAxVal) const
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// recupero i valori
|
||||
return pMch->GetInitialAxesValues( bSkipClimb, vAxVal) ;
|
||||
return pMch->GetInitialAxesValues( bSkipClimb, true, vAxVal) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1358,5 +1374,5 @@ MachMgr::GetMachiningEndAxes( bool bSkipRise, DBLVECTOR& vAxVal) const
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// recupero i valori
|
||||
return pMch->GetFinalAxesValues( bSkipRise, vAxVal) ;
|
||||
return pMch->GetFinalAxesValues( bSkipRise, true, vAxVal) ;
|
||||
}
|
||||
|
||||
@@ -169,8 +169,6 @@ class Machine
|
||||
{ return m_frLinAx ; }
|
||||
int GetCurrKinematicChainType( void) const
|
||||
{ return m_nCalcChainType ; }
|
||||
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ;
|
||||
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
|
||||
bool GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
@@ -281,6 +279,10 @@ class Machine
|
||||
const Vector3d& vtDirH, const Vector3d& vtDirI,
|
||||
int nNumRotAx, const KinAxis& RotAx1, const KinAxis& RotAx2,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ;
|
||||
bool GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
const Vector3d& vtDirH, const Vector3d& vtDirI,
|
||||
const KinAxis& RotAx1, const KinAxis& RotAx2, const KinAxis& RotAx3,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngC1, double& dAngA2, double& dAngB2, double& dAngC2) const ;
|
||||
bool GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const ;
|
||||
bool GetBackDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const ;
|
||||
bool GetSccDir( int nSolCh, const Vector3d& vtDirA, Vector3d& vtDirScc) const ;
|
||||
|
||||
+202
-67
@@ -660,7 +660,7 @@ Machine::CalculateKinematicChain( void)
|
||||
|
||||
// verifiche sugli assi lineari :
|
||||
// aggiusto gli indici di ordine sulla sua catena cinematica (1-based)
|
||||
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( m_vCalcLinAx) ; ++ i) {
|
||||
if ( m_vCalcLinAx[i].bHead)
|
||||
m_vCalcLinAx[i].nInd += m_nHeadLinAxes + m_nHeadRotAxes + 1 ;
|
||||
else
|
||||
@@ -742,9 +742,36 @@ Machine::CalculateKinematicChain( void)
|
||||
}
|
||||
}
|
||||
}
|
||||
// se più di 3
|
||||
// se 4 va bene ( due dovranno poi avere valore assegnato)
|
||||
else if ( m_vCalcRotAx.size() == 4) {
|
||||
int n2ndHeadRotAx = - 1 ;
|
||||
// se tutti e quattro di testa, devo invertire il primo con il quarto e il secondo con il terzo
|
||||
if ( m_vCalcRotAx[0].bHead && m_vCalcRotAx[1].bHead && m_vCalcRotAx[2].bHead && m_vCalcRotAx[3].bHead) {
|
||||
swap( m_vCalcRotAx[0], m_vCalcRotAx[3]) ;
|
||||
swap( m_vCalcRotAx[1], m_vCalcRotAx[2]) ;
|
||||
n2ndHeadRotAx = 1 ;
|
||||
}
|
||||
// se altrimenti ultimi tre di testa, devo invertire il secondo con il quarto
|
||||
else if ( m_vCalcRotAx[1].bHead && m_vCalcRotAx[2].bHead && m_vCalcRotAx[3].bHead) {
|
||||
swap( m_vCalcRotAx[1], m_vCalcRotAx[3]) ;
|
||||
n2ndHeadRotAx = 2 ;
|
||||
}
|
||||
// se altrimenti ultimi due di testa, devo invertirne l'ordine
|
||||
else if ( m_vCalcRotAx[2].bHead && m_vCalcRotAx[3].bHead) {
|
||||
swap( m_vCalcRotAx[2], m_vCalcRotAx[3]) ;
|
||||
n2ndHeadRotAx = 3 ;
|
||||
}
|
||||
// impongo limiti di corsa sul secondo asse rotante di testa
|
||||
if ( n2ndHeadRotAx > 0) {
|
||||
Head* pHead = GetHead( m_nCalcHeadId) ;
|
||||
if ( pHead != nullptr) {
|
||||
m_vCalcRotAx[n2ndHeadRotAx].stroke.Min = max( m_vCalcRotAx[n2ndHeadRotAx].stroke.Min, pHead->GetRot2Stroke().Min) ;
|
||||
m_vCalcRotAx[n2ndHeadRotAx].stroke.Max = min( m_vCalcRotAx[n2ndHeadRotAx].stroke.Max, pHead->GetRot2Stroke().Max) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// altrimenti più di 4 non ancora gestito, quindi errore
|
||||
else {
|
||||
// altrimenti non ancora gestito, quindi errore
|
||||
LOG_ERROR( GetEMkLogger(), "Rotary Axes not manageable")
|
||||
return false ;
|
||||
}
|
||||
@@ -864,7 +891,7 @@ Machine::BlockKinematicRotAxis( int nId, double dVal)
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// cerco l'asse rotante di calcolo con questo identificativo
|
||||
for ( size_t i = 0 ; i < m_vCalcRotAx.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( m_vCalcRotAx) ; ++ i) {
|
||||
if ( m_vCalcRotAx[i].nGrpId == nId) {
|
||||
if ( dVal < m_vCalcRotAx[i].stroke.Min || dVal > m_vCalcRotAx[i].stroke.Max) {
|
||||
m_vCalcRotAx[i].bFixed = false ;
|
||||
@@ -893,7 +920,7 @@ Machine::FreeKinematicRotAxis( int nId)
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// cerco l'asse rotante di calcolo con questo identificativo
|
||||
for ( size_t i = 0 ; i < m_vCalcRotAx.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( m_vCalcRotAx) ; ++ i) {
|
||||
if ( m_vCalcRotAx[i].nGrpId == nId) {
|
||||
m_vCalcRotAx[i].bFixed = false ;
|
||||
return true ;
|
||||
@@ -967,31 +994,6 @@ Machine::SetSolCh( int nScc, bool bExact)
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const
|
||||
{
|
||||
// assegno dati
|
||||
Vector3d vtDirH = m_vtCalcDir ;
|
||||
Vector3d vtDirI = m_vtCalcADir ;
|
||||
int nNumRotAx = 0 ;
|
||||
KinAxis RotAx1 ;
|
||||
if ( m_vCalcRotAx.size() >= 1) {
|
||||
++ nNumRotAx ;
|
||||
RotAx1 = m_vCalcRotAx[0] ;
|
||||
}
|
||||
KinAxis RotAx2 ;
|
||||
if ( m_vCalcRotAx.size() >= 2) {
|
||||
++ nNumRotAx ;
|
||||
RotAx2 = m_vCalcRotAx[1] ;
|
||||
}
|
||||
|
||||
// eseguo calcolo
|
||||
return GetMyAngles( vtDirT, vtDirA, vtDirH, vtDirI, nNumRotAx, RotAx1, RotAx2,
|
||||
nStat, dAngA1, dAngB1, dAngA2, dAngB2) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
@@ -1003,19 +1005,19 @@ Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
Vector3d vtDirH = m_vtCalcDir ;
|
||||
Vector3d vtDirI = m_vtCalcADir ;
|
||||
int nNumRotAx = 0 ;
|
||||
KinAxis RotAx[2] ;
|
||||
KinAxis RotAx[3] ;
|
||||
INTVECTOR vBloHeAx ;
|
||||
for ( size_t i = 0 ; i < m_vCalcRotAx.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( m_vCalcRotAx) ; ++ i) {
|
||||
// se asse libero
|
||||
if ( ! m_vCalcRotAx[i].bFixed) {
|
||||
// verifico di non superare il limite
|
||||
if ( nNumRotAx >= 2)
|
||||
if ( nNumRotAx >= 3)
|
||||
return false ;
|
||||
// assegno l'asse
|
||||
RotAx[nNumRotAx] = m_vCalcRotAx[i] ;
|
||||
// se asse di testa, lo aggiorno con precedenti bloccati di testa (applicati in ordine contrario)
|
||||
if ( RotAx[nNumRotAx].bHead) {
|
||||
for ( size_t k = vBloHeAx.size() ; k >= 1 ; -- k) {
|
||||
for ( int k = ssize( vBloHeAx) ; k >= 1 ; -- k) {
|
||||
int nA = vBloHeAx[k-1] ;
|
||||
RotAx[nNumRotAx].ptPos.Rotate( m_vCalcRotAx[nA].ptPos, m_vCalcRotAx[nA].vtDir, m_vCalcRotAx[nA].dFixVal) ;
|
||||
RotAx[nNumRotAx].vtDir.Rotate( m_vCalcRotAx[nA].vtDir, m_vCalcRotAx[nA].dFixVal) ;
|
||||
@@ -1032,7 +1034,7 @@ Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
vtDirTm.Rotate( m_vCalcRotAx[i].vtDir, m_vCalcRotAx[i].dFixVal) ;
|
||||
vtDirAm.Rotate( m_vCalcRotAx[i].vtDir, m_vCalcRotAx[i].dFixVal) ;
|
||||
// aggiorno eventuali assi già inseriti (sicuramente di tavola)
|
||||
for ( size_t j = 0 ; int( j) < nNumRotAx ; ++ j) {
|
||||
for ( int j = 0 ; j < nNumRotAx ; ++ j) {
|
||||
RotAx[j].ptPos.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, m_vCalcRotAx[i].dFixVal) ;
|
||||
RotAx[j].vtDir.Rotate( m_vCalcRotAx[i].vtDir, m_vCalcRotAx[i].dFixVal) ;
|
||||
}
|
||||
@@ -1043,42 +1045,83 @@ Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
vBloHeAx.push_back( int( i)) ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// aggiorno direzioni utensile e ausiliaria su testa con eventuali assi bloccati di testa (applico in ordine contrario)
|
||||
for ( size_t k = vBloHeAx.size() ; k >= 1 ; -- k) {
|
||||
for ( int k = ssize( vBloHeAx) ; k >= 1 ; -- k) {
|
||||
int nA = vBloHeAx[k-1] ;
|
||||
vtDirH.Rotate( m_vCalcRotAx[nA].vtDir, m_vCalcRotAx[nA].dFixVal) ;
|
||||
vtDirI.Rotate( m_vCalcRotAx[nA].vtDir, m_vCalcRotAx[nA].dFixVal) ;
|
||||
}
|
||||
|
||||
// eseguo calcolo
|
||||
double dAngA1, dAngB1, dAngA2, dAngB2 ;
|
||||
if ( ! GetMyAngles( vtDirTm, vtDirAm, vtDirH, vtDirI, nNumRotAx, RotAx[0], RotAx[1],
|
||||
nStat, dAngA1, dAngB1, dAngA2, dAngB2))
|
||||
return false ;
|
||||
// assegno gli angoli
|
||||
int nRotAxInd = 1 ;
|
||||
for ( size_t i = 0 ; i < m_vCalcRotAx.size() ; ++i) {
|
||||
if ( m_vCalcRotAx[i].bFixed) {
|
||||
vAng1.push_back( m_vCalcRotAx[i].dFixVal) ;
|
||||
vAng2.push_back( m_vCalcRotAx[i].dFixVal) ;
|
||||
}
|
||||
else {
|
||||
if ( nRotAxInd == 1) {
|
||||
vAng1.push_back( dAngA1) ;
|
||||
vAng2.push_back( dAngA2) ;
|
||||
// fino a due assi rotanti liberi
|
||||
if ( nNumRotAx <= 2) {
|
||||
// eseguo calcolo
|
||||
double dAngA1, dAngB1, dAngA2, dAngB2 ;
|
||||
if ( ! GetMyAngles( vtDirTm, vtDirAm, vtDirH, vtDirI, nNumRotAx, RotAx[0], RotAx[1],
|
||||
nStat, dAngA1, dAngB1, dAngA2, dAngB2))
|
||||
return false ;
|
||||
// assegno gli angoli
|
||||
int nRotAxInd = 1 ;
|
||||
for ( int i = 0 ; i < ssize( m_vCalcRotAx) ; ++i) {
|
||||
if ( m_vCalcRotAx[i].bFixed) {
|
||||
vAng1.push_back( m_vCalcRotAx[i].dFixVal) ;
|
||||
vAng2.push_back( m_vCalcRotAx[i].dFixVal) ;
|
||||
}
|
||||
else if ( nRotAxInd == 2) {
|
||||
vAng1.push_back( dAngB1) ;
|
||||
vAng2.push_back( dAngB2) ;
|
||||
else {
|
||||
if ( nRotAxInd == 1) {
|
||||
vAng1.push_back( dAngA1) ;
|
||||
vAng2.push_back( dAngA2) ;
|
||||
}
|
||||
else if ( nRotAxInd == 2) {
|
||||
vAng1.push_back( dAngB1) ;
|
||||
vAng2.push_back( dAngB2) ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
++ nRotAxInd ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
++ nRotAxInd ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
// altrimenti tre assi rotanti liberi
|
||||
else {
|
||||
// verifico siano del tipo XYX (primo e terzo paralleli, secondo ortogonale a questi)
|
||||
if ( ! AreSameOrOppositeVectorApprox( RotAx[0].vtDir, RotAx[2].vtDir) ||
|
||||
! AreOrthoApprox( RotAx[0].vtDir, RotAx[1].vtDir))
|
||||
return false ;
|
||||
// eseguo calcolo
|
||||
double dAngA1, dAngB1, dAngC1, dAngA2, dAngB2, dAngC2 ;
|
||||
if ( ! GetMyAngles( vtDirTm, vtDirAm, vtDirH, vtDirI, RotAx[0], RotAx[1], RotAx[2],
|
||||
nStat, dAngA1, dAngB1, dAngC1, dAngA2, dAngB2, dAngC2))
|
||||
return false ;
|
||||
// assegno gli angoli
|
||||
int nRotAxInd = 1 ;
|
||||
for ( int i = 0 ; i < ssize( m_vCalcRotAx) ; ++i) {
|
||||
if ( m_vCalcRotAx[i].bFixed) {
|
||||
vAng1.push_back( m_vCalcRotAx[i].dFixVal) ;
|
||||
vAng2.push_back( m_vCalcRotAx[i].dFixVal) ;
|
||||
}
|
||||
else {
|
||||
if ( nRotAxInd == 1) {
|
||||
vAng1.push_back( dAngA1) ;
|
||||
vAng2.push_back( dAngA2) ;
|
||||
}
|
||||
else if ( nRotAxInd == 2) {
|
||||
vAng1.push_back( dAngB1) ;
|
||||
vAng2.push_back( dAngB2) ;
|
||||
}
|
||||
else if ( nRotAxInd == 3) {
|
||||
vAng1.push_back( dAngC1) ;
|
||||
vAng2.push_back( dAngC2) ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
++ nRotAxInd ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1291,6 +1334,98 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
const Vector3d& vtDirH, const Vector3d& vtDirI,
|
||||
const KinAxis& RotAx1, const KinAxis& RotAx2, const KinAxis& RotAx3,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngC1, double& dAngA2, double& dAngB2, double& dAngC2) const
|
||||
{
|
||||
// annullo tutti gli angoli
|
||||
nStat = 0 ; dAngA1 = 0 ; dAngB1 = 0 ; dAngC1 = 0 ; dAngA2 = 0 ; dAngB2 = 0 ; dAngC2 = 0 ;
|
||||
|
||||
// direzione fresa normalizzata
|
||||
Vector3d vtDirTn = vtDirT ;
|
||||
if ( ! vtDirTn.Normalize())
|
||||
return false ;
|
||||
// direzione ausiliaria normalizzata
|
||||
Vector3d vtDirAn = vtDirA ;
|
||||
if ( ! vtDirAn.Normalize())
|
||||
return false ;
|
||||
|
||||
// riferimento fresa su testa a riposo
|
||||
Frame3d frTzero ;
|
||||
frTzero.Set( ORIG, vtDirH, vtDirI) ;
|
||||
// riferimento fresa richiesto
|
||||
Frame3d frTool ;
|
||||
frTool.Set( ORIG, vtDirTn, vtDirAn) ;
|
||||
// riferimento intrinseco primi due assi rotanti
|
||||
Frame3d frWrist ;
|
||||
frWrist.Set( ORIG, RotAx1.vtDir, RotAx2.vtDir ^ RotAx1.vtDir) ;
|
||||
|
||||
// direzione terzo asse rotante con testa a riposo
|
||||
Vector3d vtCzero = GetToLoc( RotAx3.vtDir, frTzero) ;
|
||||
// direzione richiesta terzo asse rotante
|
||||
Vector3d vtCen = GetToGlob( vtCzero, frTool) ;
|
||||
|
||||
// calcolo primi due assi rotanti
|
||||
Vector3d vtCenL = GetToLoc( vtCen, frWrist) ;
|
||||
vtCenL.ToSpherical( nullptr, &dAngB1, &dAngA1) ;
|
||||
if ( dAngA1 > ANG_STRAIGHT)
|
||||
dAngA1 -= ANG_FULL ;
|
||||
if ( dAngA1 > ANG_RIGHT) {
|
||||
dAngA1 -= ANG_STRAIGHT ;
|
||||
dAngB1 = -dAngB1 ;
|
||||
}
|
||||
else if ( dAngA1 < -ANG_RIGHT) {
|
||||
dAngA1 += ANG_STRAIGHT ;
|
||||
dAngB1 = -dAngB1 ;
|
||||
}
|
||||
dAngA2 = dAngA1 + ( dAngA1 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT) ;
|
||||
dAngB2 = -dAngB1 ;
|
||||
|
||||
// calcolo il terzo asse rotante del polso
|
||||
Vector3d vtR3 = RotAx3.vtDir ;
|
||||
vtR3.Rotate( RotAx2.vtDir, dAngB1) ;
|
||||
vtR3.Rotate( RotAx1.vtDir, dAngA1) ;
|
||||
Vector3d vtTool = vtDirH ;
|
||||
vtTool.Rotate( RotAx2.vtDir, dAngB1) ;
|
||||
vtTool.Rotate( RotAx1.vtDir, dAngA1) ;
|
||||
bool bDetC1 ;
|
||||
if ( ! vtTool.GetRotation( vtDirTn, vtR3, EPS_SMALL, dAngC1, bDetC1) || ! bDetC1) {
|
||||
Vector3d vtAux = vtDirI ;
|
||||
vtAux.Rotate( RotAx2.vtDir, dAngB1) ;
|
||||
vtAux.Rotate( RotAx1.vtDir, dAngA1) ;
|
||||
if ( ! vtAux.GetRotation( vtDirAn, vtR3, EPS_SMALL, dAngC1, bDetC1) || ! bDetC1) {
|
||||
LOG_ERROR( GetEMkLogger(), "Error : R3 not calculable (machine)")
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
dAngC2 = dAngC1 + ( dAngC1 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT) ;
|
||||
|
||||
// verifiche dei limiti di corsa
|
||||
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 ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
@@ -1372,7 +1507,7 @@ Machine::GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& v
|
||||
vtNew = vtDir ;
|
||||
|
||||
// ciclo sugli assi di testa dall'ultimo (prima assi di tavola, poi di testa)
|
||||
for ( size_t i = m_vCalcRotAx.size() ; i >= 1 ; -- i) {
|
||||
for ( int i = ssize( m_vCalcRotAx) ; i >= 1 ; -- i) {
|
||||
// se asse di testa
|
||||
if ( m_vCalcRotAx[i-1].bHead)
|
||||
vtNew.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
|
||||
@@ -1399,7 +1534,7 @@ Machine::GetBackDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3
|
||||
vtNew = vtDir ;
|
||||
|
||||
// ciclo sugli assi dall'ultimo (prima assi di tavola, poi di testa)
|
||||
for ( size_t i = m_vCalcRotAx.size() ; i >= 1 ; -- i) {
|
||||
for ( int i = ssize( m_vCalcRotAx) ; i >= 1 ; -- i) {
|
||||
// se asse di testa
|
||||
if ( m_vCalcRotAx[i-1].bHead)
|
||||
vtNew.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
|
||||
@@ -1590,7 +1725,7 @@ Machine::GetPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Ve
|
||||
vtDir = vtPart ;
|
||||
|
||||
// ciclo sugli assi dal primo (solo assi di tavola)
|
||||
for ( size_t i = 1 ; i <= m_vCalcRotAx.size() ; ++ i) {
|
||||
for ( int i = 1 ; i <= ssize( m_vCalcRotAx) ; ++ i) {
|
||||
// se asse di tavola
|
||||
if ( ! m_vCalcRotAx[i-1].bHead)
|
||||
vtDir.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
|
||||
@@ -1598,7 +1733,7 @@ Machine::GetPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Ve
|
||||
|
||||
// eseguo rotazione inversa eventuale asse rotante speciale di testa
|
||||
if ( m_nHeadSpecRotAxis != -1) {
|
||||
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
|
||||
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= ssize( m_vCalcRotAx))
|
||||
return false ;
|
||||
int i = m_nHeadSpecRotAxis ;
|
||||
vtDir.Rotate( m_vCalcRotAx[i].vtDir, -vAng[i]) ;
|
||||
@@ -1787,7 +1922,7 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng
|
||||
m_OutstrokeInfo.Clear() ;
|
||||
// verifica degli assi lineari
|
||||
DBLVECTOR vLin( 3) ; vLin[0] = dX ; vLin[1] = dY ; vLin[2] = dZ ;
|
||||
for ( size_t i = 0 ; i < m_vCalcLinAx.size() && i < vLin.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( m_vCalcLinAx) && i < ssize( vLin) ; ++ i) {
|
||||
if ( vLin[i] < m_vCalcLinAx[i].stroke.Min) {
|
||||
if ( nStat == 0) {
|
||||
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcLinAx[i].nGrpId)->GetName() ;
|
||||
@@ -1810,7 +1945,7 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng
|
||||
}
|
||||
}
|
||||
// verifica degli assi rotanti
|
||||
for ( size_t i = 0 ; i < m_vCalcRotAx.size() && i < vAng.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize(m_vCalcRotAx) && i < ssize( vAng) ; ++ i) {
|
||||
if ( vAng[i] < m_vCalcRotAx[i].stroke.Min) {
|
||||
if ( nStat == 0) {
|
||||
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcRotAx[i].nGrpId)->GetName() ;
|
||||
|
||||
+42
-24
@@ -296,19 +296,22 @@ Machine::LuaEmtAddArcMove( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtAddClimb( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : nMachId, vAxVal, nMask, nFlag, nFlag2 [, sInfo]
|
||||
// 5 o 6 o 7 parametri : nMachId [, sMain], vAxVal, nMask, nFlag, nFlag2 [, sInfo]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
string sMain = MCH_CL ;
|
||||
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
DBLVECTOR vAxVal ;
|
||||
LuaCheckParam( L, 2, vAxVal)
|
||||
LuaCheckParam( L, 2 + nOffs, vAxVal)
|
||||
int nMask ;
|
||||
LuaCheckParam( L, 3, nMask)
|
||||
LuaCheckParam( L, 3 + nOffs, nMask)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 4, nFlag)
|
||||
LuaCheckParam( L, 4 + nOffs, nFlag)
|
||||
int nFlag2 ;
|
||||
LuaCheckParam( L, 5, nFlag2)
|
||||
LuaCheckParam( L, 5 + nOffs, nFlag2)
|
||||
string sInfo = "" ;
|
||||
LuaGetParam( L, 6, sInfo) ;
|
||||
LuaGetParam( L, 6 + nOffs, sInfo) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -317,7 +320,7 @@ Machine::LuaEmtAddClimb( lua_State* L)
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// imposto la discesa (primo movimento del primo percorso della lavorazione)
|
||||
bool bOk = ( pOper != nullptr && pOper->AddSpecialClimb( vAxVal, ( nMask >= 0), GDB_ID_NULL, nFlag, nFlag2, nMask, sInfo, false)) ;
|
||||
bool bOk = ( pOper != nullptr && pOper->AddSpecialClimb( vAxVal, ( nMask >= 0), GDB_ID_NULL, bMain, nFlag, nFlag2, nMask, sInfo, false)) ;
|
||||
if ( ! bOk)
|
||||
return luaL_error( L, " Error in EmtAddClimb") ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
@@ -329,9 +332,12 @@ Machine::LuaEmtAddClimb( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtRemoveClimb( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nMachId
|
||||
// 1 o 2 parametri : nMachId [, sMain]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
string sMain = MCH_CL ;
|
||||
LuaGetParam( L, 2, sMain) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -340,7 +346,7 @@ Machine::LuaEmtRemoveClimb( lua_State* L)
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// elimino le discese (primi movimenti "CLIMB" del primo percorso della lavorazione)
|
||||
bool bOk = ( pOper != nullptr && pOper->RemoveClimb()) ;
|
||||
bool bOk = ( pOper != nullptr && pOper->RemoveClimb( GDB_ID_NULL, bMain)) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
|
||||
return 1 ;
|
||||
@@ -350,19 +356,22 @@ Machine::LuaEmtRemoveClimb( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtAddRise( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : nMachId, vAxVal, nMask, nFlag, nFlag2 [, sInfo]
|
||||
// 5 o 6 o 7 parametri : nMachId [, sMain], vAxVal, nMask, nFlag, nFlag2 [, sInfo]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
string sMain = MCH_CL ;
|
||||
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
DBLVECTOR vAxVal ;
|
||||
LuaCheckParam( L, 2, vAxVal)
|
||||
LuaCheckParam( L, 2 + nOffs, vAxVal)
|
||||
int nMask ;
|
||||
LuaCheckParam( L, 3, nMask)
|
||||
LuaCheckParam( L, 3 + nOffs, nMask)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 4, nFlag)
|
||||
LuaCheckParam( L, 4 + nOffs, nFlag)
|
||||
int nFlag2 ;
|
||||
LuaCheckParam( L, 5, nFlag2)
|
||||
LuaCheckParam( L, 5 + nOffs, nFlag2)
|
||||
string sInfo = "" ;
|
||||
LuaGetParam( L, 6, sInfo) ;
|
||||
LuaGetParam( L, 6 + nOffs, sInfo) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -371,7 +380,7 @@ Machine::LuaEmtAddRise( lua_State* L)
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// aggiungo la risalita (ultimo movimento dell'ultimo percorso della lavorazione)
|
||||
bool bOk = ( pOper != nullptr && pOper->AddSpecialRise( vAxVal, ( nMask >= 0), GDB_ID_NULL, nFlag, nFlag2, nMask, sInfo)) ;
|
||||
bool bOk = ( pOper != nullptr && pOper->AddSpecialRise( vAxVal, ( nMask >= 0), GDB_ID_NULL, bMain, nFlag, nFlag2, nMask, sInfo)) ;
|
||||
if ( ! bOk)
|
||||
return luaL_error( L, " Error in EmtAddRise") ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
@@ -383,9 +392,12 @@ Machine::LuaEmtAddRise( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtRemoveRise( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nMachId
|
||||
// 1 o 2 parametri : nMachId [, bMain]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
string sMain = MCH_CL ;
|
||||
LuaGetParam( L, 2, sMain) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -394,7 +406,7 @@ Machine::LuaEmtRemoveRise( lua_State* L)
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// elimino le risalite (ultimi movimenti "RISE" dell'ultimo percorso della lavorazione)
|
||||
bool bOk = ( pOper != nullptr && pOper->RemoveRise()) ;
|
||||
bool bOk = ( pOper != nullptr && pOper->RemoveRise( GDB_ID_NULL, bMain)) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
|
||||
return 1 ;
|
||||
@@ -404,11 +416,14 @@ Machine::LuaEmtRemoveRise( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtGetInitialAxesPos( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nMachId [, bSkipClimb]
|
||||
// 1 o 2 o 3 parametri : nMachId [, sMain] [, bSkipClimb]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
string sMain = MCH_CL ;
|
||||
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
bool bSkipClimb = true ;
|
||||
LuaGetParam( L, 2, bSkipClimb) ;
|
||||
LuaGetParam( L, 2 + nOffs, bSkipClimb) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -418,7 +433,7 @@ Machine::LuaEmtGetInitialAxesPos( lua_State* L)
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// acquisico il valore iniziale degli assi macchina
|
||||
DBLVECTOR vAxesVal ;
|
||||
bool bOk = ( pOper != nullptr && pOper->GetInitialAxesValues( bSkipClimb, vAxesVal)) ;
|
||||
bool bOk = ( pOper != nullptr && pOper->GetInitialAxesValues( bSkipClimb, bMain, vAxesVal)) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vAxesVal) ;
|
||||
else
|
||||
@@ -431,11 +446,14 @@ Machine::LuaEmtGetInitialAxesPos( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtGetFinalAxesPos( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nMachId [, bSkipRise]
|
||||
// 1 o 2 o 3 parametri : nMachId [, sMain] [, bSkipRise]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
bool bSkipRise = true ;
|
||||
LuaGetParam( L, 2, bSkipRise) ;
|
||||
string sMain = MCH_CL ;
|
||||
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
LuaGetParam( L, 2 + nOffs, bSkipRise) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -445,7 +463,7 @@ Machine::LuaEmtGetFinalAxesPos( lua_State* L)
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// acquisico il valore finale degli assi macchina
|
||||
DBLVECTOR vAxesVal ;
|
||||
bool bOk = ( pOper != nullptr && pOper->GetFinalAxesValues( bSkipRise, vAxesVal)) ;
|
||||
bool bOk = ( pOper != nullptr && pOper->GetFinalAxesValues( bSkipRise, bMain, vAxesVal)) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vAxesVal) ;
|
||||
else
|
||||
|
||||
+120
-29
@@ -25,6 +25,8 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
#define DEBUG 0
|
||||
|
||||
const string KEY_AXIS_GROUP = "PreviewAxisGroup" ;
|
||||
const string KEY_ROT_AXIS_VAL = "PreviewRotAxisVal" ; // salvata per ogni gruppo di Preview
|
||||
|
||||
@@ -45,10 +47,12 @@ Machining::Machining( void)
|
||||
m_nLookFlag = MCH_LOOK_TAB_HEAD ;
|
||||
m_nPreviewHeadId = GDB_ID_NULL ;
|
||||
m_nPreviewHeadIdDBL = GDB_ID_NULL ;
|
||||
m_nPreviewExitId = GDB_ID_NULL ;
|
||||
m_nPreviewExitIdDBL = GDB_ID_NULL ;
|
||||
m_nPreviewToolTip = GDB_ID_NULL ;
|
||||
m_nPreviewToolTipDBL = GDB_ID_NULL ;
|
||||
m_vPreviewAxisIds = {} ;
|
||||
m_vPreviewAxisIdsBBL = {} ;
|
||||
m_vPreviewAxisIdsDBL = {} ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -57,10 +61,12 @@ Machining::~Machining( void)
|
||||
m_nLookFlag = MCH_LOOK_NONE ;
|
||||
m_nPreviewHeadId = GDB_ID_NULL ;
|
||||
m_nPreviewHeadIdDBL = GDB_ID_NULL ;
|
||||
m_nPreviewExitId = GDB_ID_NULL ;
|
||||
m_nPreviewExitIdDBL = GDB_ID_NULL ;
|
||||
m_nPreviewToolTip = GDB_ID_NULL ;
|
||||
m_nPreviewToolTipDBL = GDB_ID_NULL ;
|
||||
m_vPreviewAxisIds.clear() ;
|
||||
m_vPreviewAxisIdsBBL.clear() ;
|
||||
m_vPreviewAxisIdsDBL.clear() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -163,17 +169,20 @@ Machining::MyChangeToolPreviewShow( int nLookFlag, bool bDouble)
|
||||
// se non esiste il gruppo di Preview, errore
|
||||
int nCurrStdId = GDB_ID_NULL ;
|
||||
int nCurrHeadId = GDB_ID_NULL ;
|
||||
int nCurrExitId = GDB_ID_NULL ;
|
||||
if ( ! bDouble) {
|
||||
nCurrStdId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST) ;
|
||||
if ( nCurrStdId == GDB_ID_NULL || m_nPreviewHeadId == GDB_ID_NULL)
|
||||
return false ;
|
||||
nCurrHeadId = m_nPreviewHeadId ;
|
||||
nCurrExitId = m_nPreviewExitId ;
|
||||
}
|
||||
else {
|
||||
nCurrStdId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST_DBL) ;
|
||||
if ( nCurrStdId == GDB_ID_NULL || m_nPreviewHeadIdDBL == GDB_ID_NULL)
|
||||
return false ;
|
||||
nCurrHeadId = m_nPreviewHeadIdDBL ;
|
||||
nCurrExitId = m_nPreviewExitIdDBL ;
|
||||
}
|
||||
|
||||
// recupero la macchina corrente
|
||||
@@ -196,8 +205,14 @@ Machining::MyChangeToolPreviewShow( int nLookFlag, bool bDouble)
|
||||
int nIter = 0 ;
|
||||
// se devo visualizzare solamente il gruppo della testa corrente
|
||||
if ( nLookFlag == MCH_LOOK_TAB_TOOL) {
|
||||
// la testa diventa visibile
|
||||
// la testa diventa visibile ( solamente il gruppo dell'uscita corrente)
|
||||
m_pGeomDB->SetStatus( nCurrHeadId, GDB_ST_ON) ;
|
||||
int nHeadChildId = m_pGeomDB->GetFirstGroupInGroup( nCurrHeadId) ;
|
||||
while ( nHeadChildId != GDB_ID_NULL) {
|
||||
if ( nHeadChildId != nCurrExitId)
|
||||
m_pGeomDB->SetStatus( nHeadChildId, GDB_ST_OFF) ;
|
||||
nHeadChildId = m_pGeomDB->GetNext( nHeadChildId) ;
|
||||
}
|
||||
// tutti i gruppi che contengono la testa diventano visibili fino a "ST", l'unico loro
|
||||
// figlio visibile deve essere quello che contiene la testa corrente
|
||||
int nCurrId = nCurrHeadId ;
|
||||
@@ -247,10 +262,17 @@ Machining::MyChangeToolPreviewShow( int nLookFlag, bool bDouble)
|
||||
}
|
||||
}
|
||||
else {
|
||||
// visualizzo tutti i gruppi in coda
|
||||
for ( auto Iter = dqHierarchy.begin() ; Iter != dqHierarchy.end() ; ++ Iter) {
|
||||
if ( m_pGeomDB->GetGdbType( *Iter) == GDB_TY_GROUP)
|
||||
m_pGeomDB->SetStatus( *Iter, GDB_ST_ON) ;
|
||||
}
|
||||
// visualizzo tutti i sottogruppi della testa
|
||||
int nHeadChild = m_pGeomDB->GetFirstGroupInGroup( nCurrHeadId) ;
|
||||
while ( nHeadChild != GDB_ID_NULL) {
|
||||
m_pGeomDB->SetStatus( nHeadChild, GDB_ST_ON) ;
|
||||
nHeadChild = m_pGeomDB->GetNextGroup( nHeadChild) ;
|
||||
}
|
||||
}
|
||||
++ nIter ;
|
||||
}
|
||||
@@ -302,14 +324,14 @@ Machining::MyPrepareToolPreview( bool bDouble)
|
||||
return false ;
|
||||
|
||||
// se necessario, imposto l'utensile corrente
|
||||
string sTool, sHead ;
|
||||
string sTool, sTcPos, sHead ;
|
||||
int nExitDBLId ;
|
||||
if ( ! bDouble) {
|
||||
sTool = GetToolName() ;
|
||||
sHead = GetHeadName() ;
|
||||
}
|
||||
else {
|
||||
if ( ! GetDoubleToolData( sTool, sHead, nExitDBLId))
|
||||
if ( ! GetDoubleToolData( sTool, sTcPos, sHead, nExitDBLId))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -323,6 +345,19 @@ Machining::MyPrepareToolPreview( bool bDouble)
|
||||
for ( const string& sSetHead : vSetHead)
|
||||
vSetHeadIds.push_back( pMch->GetHeadId( sSetHead)) ;
|
||||
|
||||
// se presenti altre teste che non compaiono nell'headset le memorizzo
|
||||
int nHeadParentId = m_pGeomDB->GetParentId( nHeadId) ;
|
||||
INTVECTOR vOtherHeadIds ;
|
||||
if ( nHeadParentId != GDB_ID_NULL) {
|
||||
int nChildId = m_pGeomDB->GetFirstGroupInGroup( nHeadParentId) ;
|
||||
while ( nChildId != GDB_ID_NULL) {
|
||||
if ( nChildId != nHeadId && pMch->IsHeadGroup( nChildId) &&
|
||||
find( vSetHeadIds.begin(), vSetHeadIds.end(), nChildId) == vSetHeadIds.end())
|
||||
vOtherHeadIds.push_back( nChildId) ;
|
||||
nChildId = m_pGeomDB->GetNextGroup( nChildId) ;
|
||||
}
|
||||
}
|
||||
|
||||
// recupero la tavola corrente
|
||||
int nCurrTab = pMch->GetCurrTable() ;
|
||||
|
||||
@@ -364,7 +399,7 @@ Machining::MyPrepareToolPreview( bool bDouble)
|
||||
if ( ! bDouble)
|
||||
m_vPreviewAxisIds.push_back( nNewTabRotAxisId) ;
|
||||
else
|
||||
m_vPreviewAxisIdsBBL.push_back( nNewTabRotAxisId) ;
|
||||
m_vPreviewAxisIdsDBL.push_back( nNewTabRotAxisId) ;
|
||||
// aggiungo il versore invertito
|
||||
int nChildId = m_pGeomDB->GetFirstInGroup( nParentId) ;
|
||||
while ( nChildId != GDB_ID_NULL) {
|
||||
@@ -463,7 +498,7 @@ Machining::MyPrepareToolPreview( bool bDouble)
|
||||
if ( ! bDouble)
|
||||
m_vPreviewAxisIds.push_back( nNewParentId) ;
|
||||
else
|
||||
m_vPreviewAxisIdsBBL.push_back( nNewParentId) ;
|
||||
m_vPreviewAxisIdsDBL.push_back( nNewParentId) ;
|
||||
// memorizzo la sua posizione iniziale
|
||||
double dAxisPos = 0. ;
|
||||
bOk = bOk && pMch->GetAxisPos( sParentName, dAxisPos) &&
|
||||
@@ -471,7 +506,7 @@ Machining::MyPrepareToolPreview( bool bDouble)
|
||||
}
|
||||
// scorro i suoi figli
|
||||
int nChildId = m_pGeomDB->GetFirstInGroup( nParentId) ;
|
||||
while ( bOk && nChildId != GDB_ID_NULL) {
|
||||
while ( bOk && nChildId != GDB_ID_NULL) {
|
||||
// se vettore ausiliario lo inserisco solo se asse padre rotativo
|
||||
if ( m_pGeomDB->GetGdbType( nChildId) == GDB_TY_GEO) {
|
||||
if ( bRotary) {
|
||||
@@ -488,13 +523,18 @@ Machining::MyPrepareToolPreview( bool bDouble)
|
||||
if ( nChildId == nHeadId) {
|
||||
if ( ! bDouble) {
|
||||
m_nPreviewHeadId = m_pGeomDB->CopyGlob( nHeadId, GDB_ID_NULL, nNewParentId) ;
|
||||
bOk = ( m_nPreviewHeadId == GDB_ID_NULL) ;
|
||||
bOk = ( m_nPreviewHeadId != GDB_ID_NULL) ;
|
||||
}
|
||||
else {
|
||||
m_nPreviewHeadIdDBL = m_pGeomDB->CopyGlob( nHeadId, GDB_ID_NULL, nNewParentId) ;
|
||||
bOk = ( m_nPreviewHeadIdDBL == GDB_ID_NULL) ;
|
||||
bOk = ( m_nPreviewHeadIdDBL != GDB_ID_NULL) ;
|
||||
}
|
||||
}
|
||||
// se altra testa non presente nell'HeadSet la inserisco
|
||||
else if ( find( vOtherHeadIds.begin(), vOtherHeadIds.end(), nChildId) != vOtherHeadIds.end()) {
|
||||
int nOtherHeadId = m_pGeomDB->CopyGlob( nChildId, GDB_ID_NULL, nNewParentId) ;
|
||||
bOk = ( nOtherHeadId != GDB_ID_NULL) ;
|
||||
}
|
||||
else {
|
||||
// se asse successivo nella catena cinematica, sarà il nuovo gruppo padre
|
||||
auto NextIter = Iter ; ++ NextIter ;
|
||||
@@ -531,10 +571,14 @@ Machining::MyPrepareToolPreview( bool bDouble)
|
||||
bOk = bOk && m_pGeomDB->GetName( nExitGrpId, sExitGrpName) ;
|
||||
int nFrId = GDB_ID_NULL ;
|
||||
if ( bOk) {
|
||||
if ( ! bDouble)
|
||||
if ( ! bDouble) {
|
||||
nFrId = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadId, "_" + sExitGrpName) ;
|
||||
else
|
||||
m_nPreviewExitId = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadId, sExitGrpName) ;
|
||||
}
|
||||
else {
|
||||
nFrId = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadIdDBL, "_" + sExitGrpName) ;
|
||||
m_nPreviewExitIdDBL = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadIdDBL, sExitGrpName) ;
|
||||
}
|
||||
}
|
||||
bOk = bOk && ( nFrId != GDB_ID_NULL) ;
|
||||
const IGeoFrame3d* frExit = ( bOk ? GetGeoFrame3d( m_pGeomDB->GetGeoObj( nFrId)) : nullptr) ;
|
||||
@@ -561,7 +605,7 @@ Machining::MyPrepareToolPreview( bool bDouble)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machining::PrepareToolPreview()
|
||||
Machining::PrepareToolPreview( void)
|
||||
{
|
||||
// verifico validità gestori DB geometrico e CAM
|
||||
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
|
||||
@@ -580,6 +624,7 @@ Machining::PrepareToolPreview()
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nStId, MCH_ST) ;
|
||||
m_pGeomDB->SetLevel( nStId, GDB_LV_TEMP) ;
|
||||
m_nLookFlag = MCH_LOOK_TAB_TOOL ;
|
||||
}
|
||||
// altrimenti lo svuoto
|
||||
else
|
||||
@@ -610,7 +655,7 @@ Machining::PrepareToolPreview()
|
||||
m_nPreviewToolTip = GDB_ID_NULL ;
|
||||
m_nPreviewToolTipDBL = GDB_ID_NULL ;
|
||||
m_vPreviewAxisIds.clear() ;
|
||||
m_vPreviewAxisIdsBBL.clear() ;
|
||||
m_vPreviewAxisIdsDBL.clear() ;
|
||||
|
||||
// preparo l'anteprima per il gruppo ST
|
||||
bool bOk = true ;
|
||||
@@ -621,15 +666,15 @@ Machining::PrepareToolPreview()
|
||||
if ( ! EqualNoCase( sTool, GetToolName()))
|
||||
bOk = ( m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr())) ;
|
||||
// creo la preview
|
||||
bOk = bOk && MyPrepareToolPreview( false) && MyChangeToolPreviewShow( MCH_LOOK_TAB_TOOL, false) ;
|
||||
bOk = bOk && MyPrepareToolPreview( false) && MyChangeToolPreviewShow( m_nLookFlag, false) ;
|
||||
}
|
||||
if ( bOk && nStdIdDBL != GDB_ID_NULL) {
|
||||
// imposto l'utensile per la lavorazione in doppio
|
||||
string sTool, sHead ; int nDblExit ;
|
||||
bOk = ( GetDoubleToolData( sTool, sHead, nDblExit)) ;
|
||||
string sTool, sTcPos, sHead ; int nDblExit ;
|
||||
bOk = ( GetDoubleToolData( sTool, sTcPos, sHead, nDblExit)) ;
|
||||
if ( bOk) {
|
||||
bool bOkToolSet = ( m_pMchMgr->SetCalcTool( sTool, sHead, nDblExit)) ;
|
||||
bOk = bOkToolSet && MyPrepareToolPreview( true) && MyChangeToolPreviewShow( MCH_LOOK_TAB_TOOL, true) ;
|
||||
bOk = bOkToolSet && MyPrepareToolPreview( true) && MyChangeToolPreviewShow( m_nLookFlag, true) ;
|
||||
if ( bOkToolSet)
|
||||
bOk = ( m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr())) && bOk ;
|
||||
}
|
||||
@@ -647,6 +692,9 @@ Machining::RemoveToolPreview( void)
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
#if DEBUG
|
||||
return true ;
|
||||
#endif
|
||||
// recupero i gruppi per l'anteprima utensile
|
||||
int nStId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST) ;
|
||||
int nStIdDBL = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST_DBL) ;
|
||||
@@ -656,11 +704,12 @@ Machining::RemoveToolPreview( void)
|
||||
// reset delle variabili membro
|
||||
m_nPreviewHeadId = GDB_ID_NULL ;
|
||||
m_nPreviewHeadIdDBL = GDB_ID_NULL ;
|
||||
m_nPreviewExitId = GDB_ID_NULL ;
|
||||
m_nPreviewExitIdDBL = GDB_ID_NULL ;
|
||||
m_nPreviewToolTip = GDB_ID_NULL ;
|
||||
m_nPreviewToolTipDBL = GDB_ID_NULL ;
|
||||
m_vPreviewAxisIds.clear() ;
|
||||
m_vPreviewAxisIdsBBL.clear() ;
|
||||
m_nLookFlag = MCH_LOOK_NONE ;
|
||||
m_vPreviewAxisIdsDBL.clear() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -675,7 +724,7 @@ Machining::GetToolPreviewStepCount( void) const
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
|
||||
if ( nClId == GDB_ID_NULL)
|
||||
return 0 ;
|
||||
// determino il numero di entità di tutti i sottogruppi, escludendo CLIMB e RISE
|
||||
// determino il numero di entità di tutti i sottogruppi, escludendo CLIMB, RISE ed HOME
|
||||
int nCount = 0 ;
|
||||
int nPxId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
|
||||
while ( nPxId != GDB_ID_NULL) {
|
||||
@@ -727,8 +776,10 @@ Machining::GetToolPreviewNext( int nEntId, int nParentId, int nStId) const
|
||||
// se prima entità, eventuale attivazione uscite di gruppo a forare
|
||||
if ( nEntId == GDB_ID_NULL && m_pGeomDB->ExistsInfo( nNewParentId, KEY_DRACEX)) {
|
||||
INTVECTOR vActExit ;
|
||||
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit))
|
||||
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit)) {
|
||||
ActivateDrillingUnit( m_nPreviewHeadId, vActExit) ;
|
||||
MyShowMultiDrillingTool( vActExit) ;
|
||||
}
|
||||
}
|
||||
return nNewId ;
|
||||
}
|
||||
@@ -737,8 +788,10 @@ Machining::GetToolPreviewNext( int nEntId, int nParentId, int nStId) const
|
||||
// eventuale attivazione uscite di gruppo a forare
|
||||
if ( m_pGeomDB->ExistsInfo( nNewParentId, KEY_DRACEX)) {
|
||||
INTVECTOR vActExit ;
|
||||
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit))
|
||||
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit)) {
|
||||
ActivateDrillingUnit( m_nPreviewHeadId, vActExit) ;
|
||||
MyShowMultiDrillingTool( vActExit) ;
|
||||
}
|
||||
}
|
||||
// recupero la prima entità del successivo gruppo
|
||||
nNewId = m_pGeomDB->GetFirstInGroup( nNewParentId) ;
|
||||
@@ -770,8 +823,10 @@ Machining::GetToolPreviewPrev( int nEntId, int nParentId, int nStId) const
|
||||
// eventuale attivazione uscite di gruppo a forare
|
||||
if ( m_pGeomDB->ExistsInfo( nNewParentId, KEY_DRACEX)) {
|
||||
INTVECTOR vActExit ;
|
||||
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit))
|
||||
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit)) {
|
||||
ActivateDrillingUnit( m_nPreviewHeadId, vActExit) ;
|
||||
MyShowMultiDrillingTool( vActExit) ;
|
||||
}
|
||||
}
|
||||
// recupero l'ultima entità del precedente gruppo
|
||||
nNewId = m_pGeomDB->GetLastInGroup( nNewParentId) ;
|
||||
@@ -810,8 +865,8 @@ Machining::MyToolPreview( int nEntId, bool bDouble) const
|
||||
if ( ! bDouble)
|
||||
m_pMchMgr->GetAllCurrAxesNames( vAxNames) ;
|
||||
else {
|
||||
string sDBLTool, sDBLHead ; int nDBLExit ;
|
||||
bool bOk = ( GetDoubleToolData( sDBLTool, sDBLHead, nDBLExit) && m_pMchMgr->SetCalcTool( sDBLTool, sDBLHead, nDBLExit)) ;
|
||||
string sDBLTool, sDBLTcPos, sDBLHead ; int nDBLExit ;
|
||||
bool bOk = ( GetDoubleToolData( sDBLTool, sDBLTcPos, sDBLHead, nDBLExit) && m_pMchMgr->SetCalcTool( sDBLTool, sDBLHead, nDBLExit)) ;
|
||||
if ( bOk)
|
||||
m_pMchMgr->GetAllCurrAxesNames( vAxNames) ;
|
||||
m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()) ;
|
||||
@@ -829,7 +884,7 @@ Machining::MyToolPreview( int nEntId, bool bDouble) const
|
||||
}
|
||||
|
||||
// scorro gli assi dentro al gruppo "ST" ( considero solo quelli rotativi)
|
||||
const INTVECTOR& vCurrPreviewAxisIds = ( ! bDouble ? m_vPreviewAxisIds : m_vPreviewAxisIdsBBL) ;
|
||||
const INTVECTOR& vCurrPreviewAxisIds = ( ! bDouble ? m_vPreviewAxisIds : m_vPreviewAxisIdsDBL) ;
|
||||
for ( auto Iter = vCurrPreviewAxisIds.begin() ; Iter != vCurrPreviewAxisIds.end() ; ++ Iter) {
|
||||
// recupero l'Id dell'asse corrente
|
||||
int nAxisId = *Iter ;
|
||||
@@ -997,7 +1052,7 @@ Machining::GetDoubleType( const string& sUserNotes)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machining::GetDoubleToolData( string& sDblTool, string& sDblHead, int& nDblExit) const
|
||||
Machining::GetDoubleToolData( string& sDblTool, string& sDblTcPos, string& sDblHead, int& nDblExit) const
|
||||
{
|
||||
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
|
||||
return false ;
|
||||
@@ -1008,7 +1063,6 @@ Machining::GetDoubleToolData( string& sDblTool, string& sDblHead, int& nDblExit)
|
||||
// recupero dati utensile in doppio
|
||||
if ( ! GetValInNotes( GetToolData().m_sUserNotes, "DOUBLE", sDblTool))
|
||||
return false ;
|
||||
string sDblTcPos ;
|
||||
if ( ! m_pMchMgr->GetCurrSetupMgr().GetToolData( sDblTool, sDblTcPos, sDblHead, nDblExit)) {
|
||||
const ToolData* pTdata = pTMgr->GetTool( sDblTool) ;
|
||||
if ( pTdata == nullptr)
|
||||
@@ -1146,6 +1200,43 @@ Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machining::MyShowMultiDrillingTool( const INTVECTOR& vActExit) const
|
||||
{
|
||||
// verifico validità del Flag
|
||||
if ( m_nLookFlag != MCH_LOOK_NONE && m_nLookFlag != MCH_LOOK_TAB_TOOL && m_nLookFlag != MCH_LOOK_TAB_HEAD)
|
||||
return false ;
|
||||
// se non ho visibilità solo utensile, non faccio nulla
|
||||
if ( m_nLookFlag != MCH_LOOK_TAB_TOOL)
|
||||
return false ;
|
||||
|
||||
// verifico che il gruppo di preview della testa sia valido
|
||||
if ( m_nPreviewHeadId == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
// recupero i nomi delle uscite da visualizzare nella preview
|
||||
STRVECTOR vsExit ; vsExit.resize( vActExit.size()) ;
|
||||
for ( int i = 0 ; i < ssize( vActExit) ; ++ i)
|
||||
vsExit[i] = MCH_EXIT + ToString( vActExit[i]) ;
|
||||
|
||||
// rendo visibili solo i gruppi nella preview inerenti
|
||||
int nChildHeadId = m_pGeomDB->GetFirstInGroup( m_nPreviewHeadId) ;
|
||||
while ( nChildHeadId != GDB_ID_NULL) {
|
||||
// recupero il nome del gruppo corrente
|
||||
string sName ;
|
||||
m_pGeomDB->GetName( nChildHeadId, sName) ;
|
||||
// verifico se attivare o meno il gruppo corrente
|
||||
bool bStatusOn = ( find_if( vsExit.begin(), vsExit.end(), [&]( const string& sExitName) {
|
||||
return EqualNoCase( sExitName, sName) ; }) != vsExit.end()) ;
|
||||
m_pGeomDB->SetStatus( nChildHeadId, bStatusOn ? GDB_ST_ON : GDB_ST_OFF) ;
|
||||
// passo al gruppo successivo
|
||||
nChildHeadId = m_pGeomDB->GetNextGroup( nChildHeadId) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machining::ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const
|
||||
|
||||
+7
-4
@@ -62,7 +62,7 @@ class Machining : public Operation
|
||||
bool SpecialApply( std::string& sErr) ;
|
||||
bool PostApply( std::string& sErr) ;
|
||||
int GetDoubleType( const std::string& sUserNotes) ;
|
||||
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblHead, int& nDblExit) const ;
|
||||
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const override ;
|
||||
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ;
|
||||
bool ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const ;
|
||||
|
||||
@@ -72,17 +72,20 @@ class Machining : public Operation
|
||||
bool MyPrepareToolPreview( bool bDouble) ;
|
||||
bool MyChangeToolPreviewShow( int nLookFlag, bool bDouble) ;
|
||||
bool MyToolPreview( int nEntId, bool bDouble) const ;
|
||||
bool MyShowMultiDrillingTool( const INTVECTOR& vActExit) const ;
|
||||
|
||||
private :
|
||||
int m_nLookFlag ; // flag di Visualizzazione per Preview
|
||||
// lavorazione singola
|
||||
int m_nPreviewHeadId ; // Id del gruppo testa di Preview
|
||||
int m_nPreviewHeadId ; // Id del gruppo della testa di Preview
|
||||
int m_nPreviewExitId ; // Id del gruppo dell'uscita di Preview
|
||||
int m_nPreviewToolTip ; // Id del gruppo contenente il punto ToolTip
|
||||
INTVECTOR m_vPreviewAxisIds ; // indici degli assi di Preview
|
||||
// lavorazione in doppio
|
||||
int m_nPreviewHeadIdDBL ; // Id della testa di Preview
|
||||
int m_nPreviewHeadIdDBL ; // Id del gruppo della testa di Preview
|
||||
int m_nPreviewExitIdDBL ; // Id del gruppo dell'uscita di Preview
|
||||
int m_nPreviewToolTipDBL ; // Id del gruppo contenente il punto di ToolTip
|
||||
INTVECTOR m_vPreviewAxisIdsBBL ; // indici degli assi di Preview
|
||||
INTVECTOR m_vPreviewAxisIdsDBL ; // indici degli assi di Preview
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+23
-4
@@ -910,8 +910,8 @@ Milling::Update( bool bPostApply)
|
||||
// elimino le entità CLIMB, RISE e HOME della lavorazione in doppio
|
||||
RemoveClimbRiseHome( false) ;
|
||||
// recupero i dati della testa in doppio e la imposto
|
||||
string sDblTool ; string sDblHead ; int nDblExit ;
|
||||
bool bOk = GetDoubleToolData( sDblTool, sDblHead, nDblExit) &&
|
||||
string sDblTool ; string sTcPos; string sDblHead ; int nDblExit ;
|
||||
bool bOk = GetDoubleToolData( sDblTool, sTcPos, sDblHead, nDblExit) &&
|
||||
m_pMchMgr->SetCalcTool( sDblTool, sDblHead, nDblExit) ;
|
||||
// imposto eventuale asse bloccato da lavorazione
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis, true) ;
|
||||
@@ -2037,6 +2037,15 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sPathName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, GREEN) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
|
||||
|
||||
// creo l'anteprima del percorso
|
||||
if ( ! GenerateMillingPv( nPxId, pCompo, dRbDist, dDepth))
|
||||
return false ;
|
||||
@@ -6512,14 +6521,24 @@ Milling::CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bI
|
||||
if ( m_bAggrBottom)
|
||||
return true ;
|
||||
// se impostato uso direttamente da lavorazione, imposto anche come versore aux
|
||||
if ( m_Params.m_nSolCh == MCH_SCC_ADIR_NEAR || m_Params.m_nSolCh == MCH_SCC_ADIR_FAR)
|
||||
if ( m_Params.m_nSolCh == MCH_SCC_ADIR_NEAR || m_Params.m_nSolCh == MCH_SCC_ADIR_FAR) {
|
||||
SetAuxDir( vtCorr) ;
|
||||
return true ;
|
||||
}
|
||||
// se standard o nullo o suo opposto
|
||||
if ( m_Params.m_nSolCh == MCH_SCC_STD || m_Params.m_nSolCh == MCH_SCC_NONE || m_Params.m_nSolCh == MCH_SCC_OPPOSITE) {
|
||||
// verifico se richiesto dalla testa
|
||||
if ( m_nHeadSolCh == MCH_SCC_ADIR_NEAR || m_nHeadSolCh == MCH_SCC_ADIR_FAR)
|
||||
if ( m_nHeadSolCh == MCH_SCC_ADIR_NEAR || m_nHeadSolCh == MCH_SCC_ADIR_FAR) {
|
||||
SetAuxDir( vtCorr) ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// reset o assegnamento da parametro di lavorazione nelle UserNotes
|
||||
Vector3d vtAux ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
|
||||
vtAux.Normalize() ;
|
||||
SetAuxDir( vtAux) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ static const std::string UN_LINTOL = "LinTol" ;
|
||||
static const std::string UN_DOUBLE = "DOUBLE" ;
|
||||
static const std::string UN_MIRRORAX = "MirrorAx" ;
|
||||
static const std::string UN_DELTAZ = "DeltaZ" ;
|
||||
static const std::string UN_VTAUXDIR = "VtAuxDir" ;
|
||||
|
||||
// Solo per Drilling
|
||||
static const std::string UN_LASTSTEP = "LastStep" ;
|
||||
|
||||
+692
-219
File diff suppressed because it is too large
Load Diff
+25
-14
@@ -45,7 +45,7 @@ class Operation : public IUserObj
|
||||
{ m_nPhase = nPhase ; return true ; }
|
||||
virtual int GetPhase( void) const
|
||||
{ return m_nPhase ; }
|
||||
virtual bool RemoveHome( void) ;
|
||||
virtual bool RemoveHome( bool bMain = true) ;
|
||||
std::string GetName( void) const ;
|
||||
|
||||
public :
|
||||
@@ -54,8 +54,8 @@ class Operation : public IUserObj
|
||||
virtual bool UpdateStatus( int nModif) = 0 ;
|
||||
|
||||
public :
|
||||
bool GetInitialAxesValues( bool bSkipClimb, DBLVECTOR& vAxVal) const ;
|
||||
bool GetFinalAxesValues( bool bSkipRise, DBLVECTOR& vAxVal) const ;
|
||||
bool GetInitialAxesValues( bool bSkipClimb, bool bMain, DBLVECTOR& vAxVal) const ;
|
||||
bool GetFinalAxesValues( bool bSkipRise, bool bMain, DBLVECTOR& vAxVal) const ;
|
||||
|
||||
protected :
|
||||
virtual const std::string& GetToolName( void) const = 0 ;
|
||||
@@ -63,6 +63,7 @@ class Operation : public IUserObj
|
||||
virtual int GetExitNbr( void) const = 0 ;
|
||||
virtual int GetSolCh( void) const = 0 ;
|
||||
virtual const std::string& GetToolTcPos( void) const = 0 ;
|
||||
virtual bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const = 0 ;
|
||||
virtual bool NeedPrevHome( void) const = 0 ;
|
||||
virtual bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
|
||||
{ return true ; }
|
||||
@@ -125,9 +126,9 @@ class Operation : public IUserObj
|
||||
bool AreAllPathsOk( void) const ;
|
||||
bool GetToolpathsStatus( int& nCnt, int& nEmpty) const ;
|
||||
int GetFirstFullToolpath( bool bMain = true) const ;
|
||||
int GetNextFullToolpath( int nClPathId) const ;
|
||||
int GetNextFullToolpath( int nClPathId, bool bMain = true) const ;
|
||||
int GetLastFullToolpath( bool bMain = true) const ;
|
||||
int GetPrevFullToolpath( int nClPathId) const ;
|
||||
int GetPrevFullToolpath( int nClPathId, bool bMain = true) const ;
|
||||
bool UpdateFollowingOperationsStatus( int nModif) ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
@@ -208,9 +209,9 @@ class Operation : public IUserObj
|
||||
bool GetClPathInitialToolDir( int nClPathId, bool bSkipClimb, Vector3d& vtTool) const ;
|
||||
bool GetFinalToolDir( bool bSkipRise, Vector3d& vtTool) const ;
|
||||
bool GetClPathFinalToolDir( int nClPathId, bool bSkipRise, Vector3d& vtTool) const ;
|
||||
const CamData* GetInitialCamData( bool bSkipClimb) const ;
|
||||
const CamData* GetInitialCamData( bool bSkipClimb, bool bMain = true) const ;
|
||||
const CamData* GetClPathInitialCamData( int nClPathId, bool bSkipClimb) const ;
|
||||
const CamData* GetFinalCamData( bool bSkipRise) const ;
|
||||
const CamData* GetFinalCamData( bool bSkipRise, bool bMain = true) const ;
|
||||
const CamData* GetClPathFinalCamData( int nClPathId, bool bSkipRise) const ;
|
||||
bool ApplyHintToPrevAxRot( const std::string& sHint, const Machine* pMch, DBLVECTOR& vAxRotPrec) ;
|
||||
bool CalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome,
|
||||
@@ -239,16 +240,25 @@ class Operation : public IUserObj
|
||||
bool AdjustStartEndMovementsStd( bool bVerifyPreviousLink) ;
|
||||
bool AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOpe, const DBLVECTOR& vAxPrev, double dPrevOffsX, bool bMaxZ) ;
|
||||
bool AdjustStartEndMovementsNew( void) ;
|
||||
bool ManageSpecialLink( Operation* pPrevOpe, int nPrevClPathId, Operation* pNextOpe, int nNextClPathId) ;
|
||||
bool ToolChangeNeeded( const Operation& Ope1, const Operation& Ope2) const ;
|
||||
bool AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL,
|
||||
bool MoveHeadFromHomeToMach( bool bMain, const std::string& sToolName, const std::string& sHeadName, int nExitNbr, int nStartZMax) ;
|
||||
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 MoveHeadFromMachToHome( Operation* pPrevOpe, bool bCurrMain, const std::string& sCurrToolName, const std::string& sCurrHeadName, int nCurrExitNbr,
|
||||
int nStartZMax) ;
|
||||
bool ManageDoubleOperNew( Operation* pPrevOpe) ;
|
||||
bool ManageSpecialLink( Operation* pPrevOpe, int nPrevClPathId, bool bPrevMain, Operation* pNextOpe, int nNextClPathId, bool bNextMain,
|
||||
int nStartZMax) ;
|
||||
bool ToolChangeNeeded( const Operation& Ope1, bool bMain1, const Operation& Ope2, bool bMain2) const ;
|
||||
bool AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, bool bMain = true,
|
||||
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "", bool bFirst = true) ;
|
||||
bool RemoveClimb( int nClPathId = GDB_ID_NULL, bool bMain = true) ;
|
||||
bool AddRise( DBLVECTOR& vAxVal, double dDelta = NAN, int nClPathId = GDB_ID_NULL, int nToMinMaxZ = 0) ;
|
||||
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL,
|
||||
bool AddRise( DBLVECTOR& vAxVal, double dDelta = NAN, int nClPathId = GDB_ID_NULL, bool bMain = true, int nToMinMaxZ = 0) ;
|
||||
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, bool bMain = true,
|
||||
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "") ;
|
||||
bool RemoveRise( int nClPathId = GDB_ID_NULL, bool bMain = true) ;
|
||||
bool AddHome( void) ;
|
||||
bool AddHome( bool bMain = true) ;
|
||||
bool AddRobotClimb( int nEntId, double dDeltaZ = NAN) ;
|
||||
bool CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const Vector3d& vtA, double dDeltaZ,
|
||||
DBLVECTOR& vAx, double* pdNewDeltaZ = nullptr) const ;
|
||||
@@ -267,7 +277,8 @@ class Operation : public IUserObj
|
||||
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
|
||||
bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, DBLVECTOR& vAxNew, bool& bModif) ;
|
||||
bool SpecialLink( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nLinkType,
|
||||
const Operation* pPrevOpe, const Operation* pNextOpe) ;
|
||||
const Operation* pPrevOpe, bool bPrevMain, const Operation* pNextOpe, bool bNextMain,
|
||||
int nStartZMax) ;
|
||||
bool SpecialPrevMachiningOffset( const Operation* pPrevOpe, double& dOffsetX) ;
|
||||
|
||||
protected :
|
||||
|
||||
@@ -88,6 +88,7 @@ static const std::string GVAR_MAXMIN = ".MAXMIN" ; // (double/s) minimo di
|
||||
static const std::string GVAR_MAXMAX = ".MAXMAX" ; // (double/s) massimo di ingombro degli assi della lavorazione
|
||||
static const std::string GVAR_PATHID = ".PATHID" ; // (int) identificativo percorso di lavorazione
|
||||
static const std::string GVAR_PATHIND = ".PATHIND" ; // (int) indice percorso di lavorazione
|
||||
static const std::string GVAR_DBLPATHID = ".DBLPATHID" ; // (int) identificativo eventuale percorso di lavorazione in doppio
|
||||
static const std::string GVAR_START = ".START" ; // (Point3d) punto iniziale del percorso originale
|
||||
static const std::string GVAR_END = ".END" ; // (Point3d) punto finale del percorso originale
|
||||
static const std::string GVAR_EXTR = ".EXTR" ; // (Vector3d) versore estrusione
|
||||
|
||||
+10
-2
@@ -781,8 +781,8 @@ Pocketing::Update( bool bPostApply)
|
||||
// elimino le entità CLIMB, RISE e HOME della lavorazione in doppio
|
||||
RemoveClimbRiseHome( false) ;
|
||||
// recupero i dati della testa in doppio e la imposto
|
||||
string sDblTool ; string sDblHead ; int nDblExit ;
|
||||
bool bOk = GetDoubleToolData( sDblTool, sDblHead, nDblExit) &&
|
||||
string sDblTool ; string sDblTcPos ; string sDblHead ; int nDblExit ;
|
||||
bool bOk = GetDoubleToolData( sDblTool, sDblTcPos, sDblHead, nDblExit) &&
|
||||
m_pMchMgr->SetCalcTool( sDblTool, sDblHead, nDblExit) ;
|
||||
// imposto eventuale asse bloccato da lavorazione
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis, true) ;
|
||||
@@ -5165,6 +5165,14 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
|
||||
SetFlag( 0) ;
|
||||
}
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
// se impostato come parametro di lavorazione nelle UserNotes
|
||||
Vector3d vtAux ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
|
||||
vtAux.Normalize() ;
|
||||
SetAuxDir( vtAux) ;
|
||||
}
|
||||
// se sopra attacco c'è spazio per sicurezza o approccio
|
||||
double dSafeDist = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
|
||||
if ( ! bBottomOutStart && dElev + max( dSafeDist, dAppr) > 10 * EPS_SMALL) {
|
||||
|
||||
+200
-378
@@ -122,8 +122,10 @@ static double TOOL_RAD_PTSTART = 20. ;
|
||||
#define DEBUG_SAFETY_LINK 0 // Debug raccordi tra percorsi di lavorazioni differenti
|
||||
#define DEBUG_FEED 0 // Debug per Feed
|
||||
#define DEBUG_START_POINT 0 // Debug per scelta del punto iniziale
|
||||
#define DEBUG_PATH_CL 0 // Debug per valori memorizzati nel percorso del CL
|
||||
#define DEBUG 0 // Debug
|
||||
#if DEBUG_STM_TOPOLOGY || DEBUG_OPEN_EDGE_EXTENSION || DEBUG_OPEN_EDGE_IN_RAW || DEBUG_SFR_STEPS || DEBUG_SFR_RAW || DEBUG_GLIDE || DEBUG_SAFETY_LINK || DEBUG_FEED || DEBUG_START_POINT || DEBUG
|
||||
#if DEBUG_STM_TOPOLOGY || DEBUG_OPEN_EDGE_EXTENSION || DEBUG_OPEN_EDGE_IN_RAW || DEBUG_SFR_STEPS || DEBUG_SFR_RAW || DEBUG_GLIDE || \
|
||||
DEBUG_SAFETY_LINK || DEBUG_FEED || DEBUG_START_POINT || DEBUG_PATH_CL || DEBUG
|
||||
#include "EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "EgtDev/Include/EGkFrame3d.h"
|
||||
@@ -856,8 +858,8 @@ PocketingNT::Update( bool bPostApply)
|
||||
// elimino le entità CLIMB, RISE e HOME della lavorazione in doppio
|
||||
RemoveClimbRiseHome( false) ;
|
||||
// recupero i dati della testa in doppio e la imposto
|
||||
string sDblTool ; string sDblHead ; int nDblExit ;
|
||||
bool bOk = GetDoubleToolData( sDblTool, sDblHead, nDblExit) &&
|
||||
string sDblTool ; string sDblTcPos ; string sDblHead ; int nDblExit ;
|
||||
bool bOk = GetDoubleToolData( sDblTool, sDblTcPos, sDblHead, nDblExit) &&
|
||||
m_pMchMgr->SetCalcTool( sDblTool, sDblHead, nDblExit) ;
|
||||
// imposto eventuale asse bloccato da lavorazione
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis, true) ;
|
||||
@@ -1794,11 +1796,6 @@ PocketingNT::ResetCurveAllTempProp( ICurve* pCurve)
|
||||
bool
|
||||
PocketingNT::Chain( int nGrpDestId)
|
||||
{
|
||||
// vettore puntatori alle curve
|
||||
ICURVEPOVECTOR vpCrvs ;
|
||||
vpCrvs.reserve( m_vId.size()) ;
|
||||
// vettore selettori delle curve originali
|
||||
SELVECTOR vInds ;
|
||||
// flag per imposizione lati chiusi
|
||||
m_bAllClose = GetForcedClosed() ;
|
||||
|
||||
@@ -1812,8 +1809,21 @@ PocketingNT::Chain( int nGrpDestId)
|
||||
// recupero la superficie di Trim in globale [nullptr se non presente]
|
||||
PtrOwner<ISurfTriMesh> pStmTrim( GetStmTrim()) ;
|
||||
|
||||
// struct per informazioni da salvare sul gruppo Aux come su chiave KEY_IDS
|
||||
struct InfoCrvSel {
|
||||
Point3d ptOnCrv ; // per determinare a quale curva si riferisce nella regione piana
|
||||
bool bFound ; // per ottimizzare la ricerca
|
||||
SELVECTOR vIds ; // SELVECTOR originario
|
||||
InfoCrvSel( const Point3d& ptOC, const SELVECTOR& vI)
|
||||
: ptOnCrv( ptOC), bFound( false), vIds( vI) {} ;
|
||||
} ;
|
||||
vector<InfoCrvSel> vInfoCrvSel ;
|
||||
|
||||
// vettore puntatori e selettori alle curve
|
||||
ICURVEPOVECTOR vpCrvs ; vpCrvs.reserve( m_vId.size()) ;
|
||||
SELVECTOR vInds ; vInds.reserve( m_vId.size()) ;
|
||||
// recupero tutte le curve e le porto in globale
|
||||
for ( const auto& Id : m_vId) {
|
||||
for ( const SelData& Id : m_vId) {
|
||||
// prendo le curve
|
||||
ICURVEPLIST lstPC ;
|
||||
if ( ! GetCurves( Id, pStmRaw, pStmTrim, lstPC)) {
|
||||
@@ -1828,10 +1838,10 @@ PocketingNT::Chain( int nGrpDestId)
|
||||
// preparo i dati per il concatenamento
|
||||
bool bFirst = true ;
|
||||
Point3d ptNear = ORIG ;
|
||||
double dToler = 10 * EPS_SMALL ;
|
||||
double dToler = 10. * EPS_SMALL ;
|
||||
ChainCurves chainC ;
|
||||
chainC.Init( true, dToler, int( vpCrvs.size())) ;
|
||||
for ( size_t i = 0 ; i < vpCrvs.size() ; ++ i) {
|
||||
chainC.Init( true, dToler, ssize( vpCrvs)) ;
|
||||
for ( int i = 0 ; i < ssize( vpCrvs) ; ++ i) {
|
||||
// recupero la curva e il suo riferimento
|
||||
ICurve* pCrv = vpCrvs[i] ;
|
||||
if ( pCrv == nullptr)
|
||||
@@ -1842,11 +1852,11 @@ PocketingNT::Chain( int nGrpDestId)
|
||||
if ( ! pCrv->GetStartPoint( ptStart) || ! pCrv->GetStartDir( vtStart) ||
|
||||
! pCrv->GetEndPoint( ptEnd) || ! pCrv->GetEndDir( vtEnd))
|
||||
return false ;
|
||||
if ( ! chainC.AddCurve( int( i + 1), ptStart, vtStart, ptEnd, vtEnd))
|
||||
if ( ! chainC.AddCurve( i + 1, ptStart, vtStart, ptEnd, vtEnd))
|
||||
return false ;
|
||||
// se prima curva, assegno inizio della ricerca
|
||||
if ( bFirst) {
|
||||
ptNear = ptStart + 10 * EPS_SMALL * vtStart ;
|
||||
ptNear = ptStart + 10. * EPS_SMALL * vtStart ;
|
||||
bFirst = false ;
|
||||
}
|
||||
}
|
||||
@@ -1865,7 +1875,7 @@ PocketingNT::Chain( int nGrpDestId)
|
||||
SELVECTOR vId2 ;
|
||||
vId2.reserve( vnId2.size()) ;
|
||||
// recupero le curve semplici e le inserisco nella curva composita
|
||||
for ( size_t i = 0 ; i < vnId2.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vnId2) ; ++ i) {
|
||||
int nId = abs( vnId2[i]) - 1 ;
|
||||
bool bInvert = ( vnId2[i] < 0) ;
|
||||
vId2.emplace_back( vInds[nId]) ;
|
||||
@@ -1925,18 +1935,21 @@ PocketingNT::Chain( int nGrpDestId)
|
||||
vCrvCompo.back()->SetExtrusion( vtExtr) ;
|
||||
// salvo la thickness come seconda temp prop ( la Sfr rimuove la thick delle curve)
|
||||
vCrvCompo.back()->SetTempParam( dThick, 1) ;
|
||||
// salvo le Info della curva corrente
|
||||
Point3d ptStart ; vCrvCompo.back()->GetStartPoint( ptStart) ;
|
||||
vInfoCrvSel.emplace_back( ptStart, vId2) ;
|
||||
}
|
||||
|
||||
// ordino le curve creando una regione piana
|
||||
SurfFlatRegionByContours SfrByC ;
|
||||
for ( int i = 0 ; i < int( vCrvCompo.size()) ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vCrvCompo) ; ++ i) {
|
||||
// memorizzo la Thickness nei TempParams
|
||||
vCrvCompo[i]->SetTempParam( vCrvCompo[i]->GetTempParam( 1), 1) ;
|
||||
SfrByC.AddCurve( Release( vCrvCompo[i])) ;
|
||||
}
|
||||
|
||||
// scorro le regioni piane ricavate dalle curve
|
||||
int nGroupName = -1 ;
|
||||
int nGroupName = 0 ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrCurr( SfrByC.GetSurf()) ;
|
||||
while ( ! IsNull( pSfrCurr) && pSfrCurr->IsValid()) {
|
||||
// per ogni Chunk
|
||||
@@ -1946,17 +1959,40 @@ PocketingNT::Chain( int nGrpDestId)
|
||||
if ( nPathId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPathId, MCH_PATH + ToString( ++ nGroupName)) ;
|
||||
m_pGeomDB->SetInfo( nPathId, KEY_IDS, ToString( nGroupName)) ;
|
||||
// recupero il Chunk corrente
|
||||
PtrOwner<ISurfFlatRegion> pSfrChunk( pSfrCurr->CloneChunk( nC)) ;
|
||||
if ( IsNull( pSfrChunk) || ! pSfrChunk->IsValid())
|
||||
return false ;
|
||||
// recupero la ThickNess e l'Estrusione dal Loop esterno
|
||||
// recupero la Thickness e l'Estrusione dal Loop esterno
|
||||
PtrOwner<ICurveComposite> pCrvInfo( ConvertCurveToComposite( pSfrChunk->GetLoop( 0, 0))) ;
|
||||
if ( IsNull( pCrvInfo) || ! pCrvInfo->IsValid())
|
||||
return false ;
|
||||
double dThick = pCrvInfo->GetTempParam( 1) ;
|
||||
Vector3d vtExtr ; pCrvInfo->GetExtrusion( vtExtr) ;
|
||||
// assegno come proprietà del gruppo le Info di selezione delle entità selezionate originarie
|
||||
string sInfo ;
|
||||
for ( int nInfo = 0 ; nInfo < ssize( vInfoCrvSel) ; ++ nInfo) {
|
||||
if ( ! vInfoCrvSel[nInfo].bFound) {
|
||||
if ( pCrvInfo->IsPointOn( vInfoCrvSel[nInfo].ptOnCrv, 5. * EPS_SMALL)) {
|
||||
sInfo += ToString( vInfoCrvSel[nInfo].vIds) ;
|
||||
vInfoCrvSel[nInfo].bFound = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
for ( int nL = 1 ; nL < pSfrChunk->GetLoopCount( 0) ; ++ nL) {
|
||||
PtrOwner<ICurve> pCrvLoop( pSfrChunk->GetLoop( 0, nL)) ;
|
||||
if ( IsNull( pCrvLoop) || ! pCrvLoop->IsValid())
|
||||
continue ;
|
||||
for ( int nInfo = 0 ; nInfo < ssize( vInfoCrvSel) ; ++ nInfo) {
|
||||
if ( ! vInfoCrvSel[nInfo].bFound) {
|
||||
if ( pCrvLoop->IsPointOn( vInfoCrvSel[nInfo].ptOnCrv, 5. * EPS_SMALL)) {
|
||||
sInfo += ToString( vInfoCrvSel[nInfo].vIds) ;
|
||||
vInfoCrvSel[nInfo].bFound = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_pGeomDB->SetInfo( nPathId, KEY_IDS, sInfo) ;
|
||||
// -------------- Verifico quale part del Grezzo bisogna considerare ----------------
|
||||
if ( ! ChooseRawPart( pSfrChunk, ( pStmTrim == nullptr ? pStmRaw : pStmTrim))) {
|
||||
m_pMchMgr->SetLastError( 2436, "Error in PocketingNT : not valid Raw") ;
|
||||
@@ -1980,7 +2016,7 @@ PocketingNT::Chain( int nGrpDestId)
|
||||
PtrOwner<ICurveComposite> pCrvLoop( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvLoop) ||
|
||||
! pCrvLoop.Set( ConvertCurveToComposite( pSfrChunk->GetLoop( 0, nL))) ||
|
||||
! pCrvLoop->IsValid())
|
||||
! pCrvLoop->IsValid())
|
||||
return false ;
|
||||
// se loop esterno, aggiungo la superfifice al gruppo con le relative informazioni
|
||||
if ( nL == 0) {
|
||||
@@ -2163,7 +2199,7 @@ ISurfFlatRegion*
|
||||
PocketingNT::GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs)
|
||||
{
|
||||
// interseco la superficie alla quota corrente
|
||||
PNTVECTOR vPnt ;
|
||||
PNTVECTOR vPnt ;
|
||||
BIPNTVECTOR vBpt ;
|
||||
TRIA3DVECTOR vTria ;
|
||||
if ( ! IPPStm.GetInters( dDist, vPnt, vBpt, vTria))
|
||||
@@ -2853,8 +2889,8 @@ PocketingNT::ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh* p
|
||||
return false ;
|
||||
// recupero i NUM_POINTS punti
|
||||
bool bIsOnStm = true ;
|
||||
for ( int p = 0 ; p < NUM_POINTS + 1 && bIsOnStm ; ++ p) {
|
||||
double dPar = ( 1. / ( 1. * NUM_POINTS)) * p ;
|
||||
for ( int nP = 0 ; nP < NUM_POINTS + 1 && bIsOnStm ; ++ nP) {
|
||||
double dPar = ( 1. / ( 1. * NUM_POINTS)) * nP ;
|
||||
Point3d ptPar ;
|
||||
if ( ! pCrv->GetPointD1D2( dPar, ICurve::FROM_PLUS, ptPar))
|
||||
return false ;
|
||||
@@ -3735,11 +3771,6 @@ PocketingNT::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// verifico se archi vanno approssimati con segmenti di retta
|
||||
bool bSplitArcs = GetSplitArcs( vtExtr) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
|
||||
|
||||
// determino numero e affondamento degli step
|
||||
int nStep = max( 1, static_cast<int>( ceil( dElev / dOkStep))) ;
|
||||
double dStep = dElev / nStep ;
|
||||
@@ -3803,8 +3834,8 @@ PocketingNT::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
#endif
|
||||
// inserisco le informazioni dello step nel vettore
|
||||
vStepInfo.resize( vStepInfo.size() + 1) ;
|
||||
vStepInfo.back().dDepth = - j * dStep ;
|
||||
vStepInfo.back().dRelativeDepth = - dStep ;
|
||||
vStepInfo.back().dDepth = j * dStep ;
|
||||
vStepInfo.back().dRelativeDepth = dStep ;
|
||||
vStepInfo.back().pSfrPock.Set( Release( pSfrPock)) ;
|
||||
vStepInfo.back().pSfrLimit.Set( CreateSurfFlatRegion()) ;
|
||||
if ( pSfrLimit->IsValid())
|
||||
@@ -3819,8 +3850,33 @@ PocketingNT::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
SetPathId( nPxId) ;
|
||||
SetToolDir( vtTool) ;
|
||||
|
||||
if ( ! AddPocket( vStepInfo, vtTool, dElev, dStep, bSplitArcs))
|
||||
// calcolo le lavorazioni
|
||||
Point3d ptPockStart ; pSfr->GetCentroid( ptPockStart) ;
|
||||
Point3d ptPockEnd = ptPockStart ;
|
||||
if ( ! AddPocket( vStepInfo, vtTool, dStep, bSplitArcs, ptPockStart, ptPockEnd))
|
||||
return false ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
|
||||
// assegno il punto di inizio e fine al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, ptPockStart) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, ptPockEnd) ;
|
||||
#if DEBUG_PATH_CL
|
||||
PtrOwner<IGeoPoint3d> ptS( CreateGeoPoint3d()) ; ptS->Set( ptPockStart) ;
|
||||
int nPtSId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, Release( ptS)) ;
|
||||
m_pGeomDB->SetMaterial( nPtSId, AQUA) ;
|
||||
PtrOwner<IGeoPoint3d> ptE( CreateGeoPoint3d()) ; ptE->Set( ptPockEnd) ;
|
||||
int nPtEId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, Release( ptE)) ;
|
||||
m_pGeomDB->SetMaterial( nPtEId, ORANGE) ;
|
||||
PtrOwner<IGeoVector3d> vtT( CreateGeoVector3d()) ; vtT->Set( vtTool, ptPockEnd) ;
|
||||
int nVtId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, Release( vtT)) ;
|
||||
m_pGeomDB->SetMaterial( nVtId, Color( abs( vtTool.x), abs( vtTool.y), abs( vtTool.z))) ;
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ; pLine->Set( ptPockEnd, ptPockEnd + vtTool * dElev) ;
|
||||
int nLineID = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, Release( pLine)) ;
|
||||
m_pGeomDB->SetMaterial( nLineID, FUCHSIA) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
// incremento numero di svuotature
|
||||
@@ -4303,14 +4359,34 @@ PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo)
|
||||
bool bAdjustFeed = true ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_ADJUSTFEED, bAdjustFeed) ;
|
||||
|
||||
// verifico se percorso di lucidatura
|
||||
bool bAllOffset = false ;
|
||||
bool bPolishing = ( m_TParams.m_nType == TT_MILL_POLISHING) ;
|
||||
if ( bPolishing) {
|
||||
int nType = GetType() ;
|
||||
if ( ( nType == POCKET_SPIRALIN || GetType() == POCKET_SPIRALOUT) && m_Params.m_dEpicyclesRad < EPS_SMALL)
|
||||
bPolishing = false ;
|
||||
if ( bPolishing) {
|
||||
if ( ( nType == POCKET_SPIRALIN || GetType() == POCKET_SPIRALOUT) && m_Params.m_dEpicyclesDist < 100. * EPS_SMALL) {
|
||||
m_pMchMgr->SetLastError( 2413, "Error in Pocketing : Toolpath not computable") ;
|
||||
return false ;
|
||||
}
|
||||
bAllOffset = true ;
|
||||
}
|
||||
}
|
||||
|
||||
// determino il SideStep
|
||||
double dSideStep = ( ! bPolishing ? GetSideStep() : m_Params.m_dSideStep) ;
|
||||
|
||||
// scorro gli indici delle superfici
|
||||
for ( int i = 0 ; i < int( vStepInfo.size()) ; ++ i) {
|
||||
// calcolo i percorsi di Pocketing
|
||||
// calcolo i percorsi di Pocketing ( o di lucidatura se richiesto)
|
||||
ICRVCOMPOPOVECTOR vCrvPaths ;
|
||||
if ( ! CalcPocketing( vStepInfo[i].pSfrPock, m_TParams.m_dDiam / 2, GetOffsR(), GetSideStep(),
|
||||
if ( ! CalcPocketing( vStepInfo[i].pSfrPock, m_TParams.m_dDiam / 2, GetOffsR(), dSideStep,
|
||||
m_Params.m_dSideAngle, m_dOpenMinSafe, m_Params.m_nSubType, true, true, m_Params.m_bInvert,
|
||||
false, true, bAdjustFeed, ptStartRef, vStepInfo[i].pSfrLimit, false, dMaxOptSize,
|
||||
m_Params.m_dLiTang, GetLeadInType(), vCrvPaths)) {
|
||||
false, true, bAdjustFeed, ptStartRef, vStepInfo[i].pSfrLimit, bAllOffset, dMaxOptSize,
|
||||
GetLeadInType(), m_Params.m_dLiTang, m_Params.m_dLiElev, GetLeadOutType(), m_Params.m_dLoTang,
|
||||
bPolishing, m_Params.m_dEpicyclesRad, m_Params.m_dEpicyclesDist, vCrvPaths)) {
|
||||
m_pMchMgr->SetLastError( 3028, "Error in PocketingNT : Error in CalcPocketing") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -4489,7 +4565,8 @@ PocketingNT::ManageSmoothLink( const PathInfoPO& currPath, const PathInfoPO& nex
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dElev, double dStep, bool bSplitArcs)
|
||||
PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dStep, bool bSplitArcs,
|
||||
Point3d& ptPockStart, Point3d& ptPockEnd)
|
||||
{
|
||||
// se non ho superfici da svuotare, non faccio nulla
|
||||
if ( vStepInfo.empty())
|
||||
@@ -4507,11 +4584,16 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
||||
// recupero distanze di sicurezza
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
double dSafeAggrBottZ = GetSafeAggrBottZ() ;
|
||||
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
|
||||
// elevazione sopra al punto attuale
|
||||
// per il primo percorso in assoluto viene calcolato da CalcFirstElevation(), mentre per i percorsi successivi viene
|
||||
// aggiornato a seconda che il percorso corrente sia sullo stesso piano del precedente o al di sotto di esso
|
||||
double dCurrElev = 0. ;
|
||||
// punto finale del percorso precedente al corrente
|
||||
|
||||
// punto finale del percorso per ogni Chunk di lavorazione
|
||||
Point3d ptEnd = P_INVALID ;
|
||||
|
||||
// scorro il vettore dei piani di pocketing
|
||||
@@ -4534,6 +4616,7 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
||||
// coefficiente feed ( riduzione di feed per sezione di taglio superiore al previsto )
|
||||
double dTempParam ; currPath.pCrvPath->GetCurveTempParam( k, dTempParam) ;
|
||||
double dCoeffFeed = min( 1., ( dTempParam > EPS_SMALL ? dTempParam /= 1000 : 1)) ;
|
||||
|
||||
// se prima entità
|
||||
if ( k == 0) {
|
||||
// dati inizio entità
|
||||
@@ -4542,38 +4625,59 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
||||
// flag approccio libero in aria
|
||||
if ( currPath.bOutStart)
|
||||
dCoeffFeed = ( dTempParam > EPS_SMALL ? dTempParam : 1) ;
|
||||
// calcolo ptP1 per LeadIn iniziale
|
||||
// se prima entità in assoluto, memorizzo il punto iniziale
|
||||
bool bAbsFirst = ( i == 0 && j == 0) ;
|
||||
if ( bAbsFirst)
|
||||
ptPockStart = ptStart ;
|
||||
// calcolo ptP1 per LeadIn iniziale ( punto per approccio a seconda del LeadIn)
|
||||
Point3d ptP1 ;
|
||||
if ( ! CalcLeadInStart( ptStart, vtTool, currPath.pCrvGlideIn, ptP1)) {
|
||||
m_pMchMgr->SetLastError( 3013, "Error in PocketingNT : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// determino l'elevazione sull'inizio dell'attacco della prima curva globale
|
||||
bool bAbsFirst = ( i == 0 && j == 0) ;
|
||||
// determino l'elevazione, per il primo percorso verifico anche la posizione della testa e nel caso
|
||||
// aggiungo un eventuale direzione di 'Escape'
|
||||
double dEscapeElev = 0. ;
|
||||
Vector3d vtEscape ;
|
||||
if ( bAbsFirst)
|
||||
CalcFirstElevation( ptStart, ptP1, vtTool, currStep, dSafeZ, dStep, dCurrElev, dEscapeElev, vtEscape) ;
|
||||
bool bEscapeElev = ( dEscapeElev > 10. * EPS_SMALL && vtEscape.Len() > 10. * EPS_SMALL) ;
|
||||
// sposto il focus su PtP1 per approccio, quindi riduco l'elevazione corrente se esso non coicide con ptStart
|
||||
dCurrElev -= ( ptP1 - ptStart) * vtTool ;
|
||||
// se attacco a zigzag o a spirale o a scivolo, l'elevazione va nell'attacco
|
||||
if ( GetLeadInType() != POCKET_LI_NONE) {
|
||||
double dMyLIO_ELEV_TOL = min( LIO_ELEV_TOL, dSafeZ) ;
|
||||
// se prima entità in assoluto
|
||||
// se prima entità in assoluto
|
||||
if ( bAbsFirst) {
|
||||
ptP1 += vtTool * ( dCurrElev + dMyLIO_ELEV_TOL) ;
|
||||
dCurrElev = - min( LIO_ELEV_TOL, dSafeZ) ;
|
||||
// se lucidatura forzo il valore al parametro di elevazione in ingresso
|
||||
if ( m_TParams.m_nType == TT_MILL_POLISHING) {
|
||||
ptP1 += vtTool * max( m_Params.m_dLiElev, dCurrElev + LIO_ELEV_TOL) ;
|
||||
dCurrElev = 0 ;
|
||||
}
|
||||
// altrimenti, muovo ptP1 alla quota dell'elevazione corrente
|
||||
else {
|
||||
ptP1 += vtTool * ( dCurrElev + dMyLIO_ELEV_TOL) ;
|
||||
dCurrElev = - min( LIO_ELEV_TOL, dSafeZ) ;
|
||||
}
|
||||
}
|
||||
// altrimenti...
|
||||
// altrimenti
|
||||
else if ( ! currPath.bOutStart)
|
||||
ptP1 += vtTool * ( - currStep.dRelativeDepth) ;
|
||||
ptP1 += vtTool * ( currStep.dRelativeDepth) ;
|
||||
}
|
||||
// approccio al punto iniziale ( se punti non allineati lungo vtTool)
|
||||
// altrimenti, l'elevazione va nell'attacco anche nel caso in cui ho una direzione di 'Escape'
|
||||
else if ( currPath.bOutStart && bAbsFirst && bEscapeElev) {
|
||||
// muovo ptP1 alla quota dell'elevazione corrente
|
||||
ptP1 += vtTool * dCurrElev ;
|
||||
dCurrElev = - dSafeZ ;
|
||||
}
|
||||
// approccio al punto iniziale. Viene calcolata nel caso di primo percorso in assoluto o nel caso in cui
|
||||
// la direzione di approccio non sia esattamente come vtTool ( quindi di perfetta discesa)
|
||||
double dMySafeZ = ( bAbsFirst ? dSafeZ : 0.) ;
|
||||
Point3d ptMyPos ; GetCurrPos( ptMyPos) ;
|
||||
double dMyElev = ( bAbsFirst ? dCurrElev : ( ptMyPos - ptP1) * vtTool) ;
|
||||
double dMyAppr = ( bAbsFirst ? dAppr : 0.) ;
|
||||
if ( bAbsFirst || ! OrthoCompo( ptMyPos - ptP1, vtTool).IsSmall()) {
|
||||
if ( bAbsFirst && dEscapeElev > 10 * EPS_SMALL && vtEscape.SqLen() > 100 * EPS_SMALL) {
|
||||
if ( bAbsFirst && bEscapeElev) {
|
||||
if ( ! AddApproach( ptP1 + vtEscape * dEscapeElev, vtEscape, dMySafeZ, dSafeAggrBottZ, 0, dMyAppr, bSplitArcs, currPath.bOutStart)) {
|
||||
m_pMchMgr->SetLastError( 3011, "Error in PocketingNT : Approach not computable") ;
|
||||
return false ;
|
||||
@@ -4586,7 +4690,7 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
||||
}
|
||||
}
|
||||
}
|
||||
// aggiungo attacco
|
||||
// aggiungo LeadIn ( se necessario effettuo movimento di riposizionamento verso ptP1)
|
||||
SetFeed( GetStartFeed()) ;
|
||||
Point3d ptCurr ; GetCurrPos( ptCurr) ;
|
||||
if ( ! AreSamePointApprox( ptP1, ptCurr))
|
||||
@@ -4601,6 +4705,7 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
// elaborazioni sulla curva corrente
|
||||
if ( pCurve->GetType() == CRV_LINE) {
|
||||
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
@@ -4621,13 +4726,16 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
||||
if ( AddCurveMove( pCurve, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se ultima entità
|
||||
if ( k == nMaxInd) {
|
||||
// dati fine entità
|
||||
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) {
|
||||
// memorizzo il punto finale della lavorazione
|
||||
ptPockEnd = ptEnd ;
|
||||
// aggiungo LeadOut
|
||||
Point3d ptP1 ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
@@ -4635,12 +4743,13 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
||||
m_pMchMgr->SetLastError( 3014, "Error in PocketingNT : LeadOut not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// calcolo l'elevazione al di sopra del punto corrente
|
||||
// calcolo l'elevazione al di sopra del punto corrente. Esattamente come per la prima elevazione in assoluto potrei
|
||||
// avere una direzione di 'Escape'
|
||||
double dLastElev = 0., dEscapeElev = 0. ;
|
||||
Vector3d vtEscape ;
|
||||
if ( ! CalcLastElevation( ptEnd, ptP1, vtTool, currStep, dSafeZ, dStep, dLastElev, dEscapeElev, vtEscape))
|
||||
return false ;
|
||||
if ( dEscapeElev > 10 * EPS_SMALL && vtEscape.SqLen() > 100 * EPS_SMALL) {
|
||||
if ( dEscapeElev > 10. * EPS_SMALL && vtEscape.Len() > 10. * EPS_SMALL) {
|
||||
AddLinearMove( ptP1 + vtTool * dLastElev) ;
|
||||
if ( ! AddRetract( ptP1 + vtTool * dLastElev, vtEscape, dSafeZ, dSafeAggrBottZ, dEscapeElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 3015, "Error in PocketingNT : Retract not computable") ;
|
||||
@@ -4655,12 +4764,11 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
||||
}
|
||||
}
|
||||
}
|
||||
// se ho un percorso successivo
|
||||
// se invece ultima entità relativa, quindi ho un percorso successivo
|
||||
else {
|
||||
// ricavo il punto che devo raggiungere e controllo la posizione del percorso successivo
|
||||
bool bSamePlane = ( j < int( currStep.vPaths.size()) - 1) ;
|
||||
const PathInfoPO& PathToGo = ( bSamePlane ? currStep.vPaths[j+1] :
|
||||
vStepInfo[i+1].vPaths.front()) ;
|
||||
// ricavo il punto che devo raggiungere
|
||||
bool bSamePlane = ( j < ssize( currStep.vPaths) - 1) ;
|
||||
const PathInfoPO& PathToGo = ( bSamePlane ? currStep.vPaths[j+1] : vStepInfo[i+1].vPaths.front()) ;
|
||||
Point3d ptDest ; Vector3d vtDest ;
|
||||
// se entrata a scivolo ammissibile, allora la destinazione è l'inizio dello scivolo (nel piano)
|
||||
if ( GetLeadInType() == POCKET_LI_GLIDE && ( PathToGo.pCrvGlideIn != nullptr &&
|
||||
@@ -4673,11 +4781,9 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
||||
PathToGo.pCrvPath->GetStartPoint( ptDest) ;
|
||||
PathToGo.pCrvPath->GetStartDir( vtDest) ;
|
||||
}
|
||||
// determino se un collegamento tra i punti proiettati nel piano attuale è ammissibile
|
||||
bool bSafeLimit = false ;
|
||||
bool bSmoothEnd = true ;
|
||||
bool bForceLinear = false ;
|
||||
ManageSmoothLink( currPath, PathToGo, bSamePlane, bSmoothEnd, bForceLinear) ;
|
||||
// determino se possibile aggiungere un collegamento smussato
|
||||
bool bSafeLimit = false, bSmoothEnd = true, bForceLinear = false ;
|
||||
ManageSmoothLink( currPath, PathToGo, bSamePlane, bSmoothEnd, bForceLinear) ; // verifico solo se fattibile
|
||||
PtrOwner<ICurveComposite> pCrvLink( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvLink))
|
||||
return false ;
|
||||
@@ -4686,7 +4792,7 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
||||
pCrvLink->CopyFrom( currPath.pCrvRet) ;
|
||||
bSafeLimit = true ;
|
||||
}
|
||||
// altrimenti cerco raccordo smussato
|
||||
// altrimenti calcolo raccordo smussato
|
||||
else {
|
||||
if ( ! bForceLinear) {
|
||||
if ( ! CheckSafetyLink( ptEnd, vtEnd, ptDest, vtDest, currStep.pSfrLimit, vtTool,
|
||||
@@ -4697,15 +4803,15 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
||||
// determino l'elevazione sul punto corrente e sul punto di destinazione
|
||||
dCurrElev = 0. ;
|
||||
double dNextElev = 0. ;
|
||||
// se il collegamento non rovina il grezzo...
|
||||
// se il collegamento non rovina il grezzo
|
||||
if ( bSafeLimit) {
|
||||
// e sullo stesso piano di pocketing
|
||||
if ( bSamePlane) {
|
||||
// ... ed è sullo stesso piano di svuotatura
|
||||
if ( ( ( m_Params.m_nSubType == POCKET_SUB_SPIRALIN || m_Params.m_nSubType == POCKET_SUB_SPIRALOUT) &&
|
||||
! vStepInfo[i].vPaths[j+1].bOutStart) ||
|
||||
( m_Params.m_nSubType != POCKET_SUB_SPIRALIN && m_Params.m_nSubType != POCKET_SUB_SPIRALOUT &&
|
||||
m_Params.m_nSubType != POCKET_CONFORMAL_ZIGZAG && m_Params.m_nSubType != POCKET_SUB_CONFORMAL_ONEWAY)) {
|
||||
dCurrElev -= currStep.dRelativeDepth ;
|
||||
m_Params.m_nSubType != POCKET_CONFORMAL_ZIGZAG && m_Params.m_nSubType != POCKET_SUB_CONFORMAL_ONEWAY)) {
|
||||
dCurrElev += currStep.dRelativeDepth ;
|
||||
dNextElev = dCurrElev ;
|
||||
}
|
||||
}
|
||||
@@ -4716,13 +4822,12 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
||||
}
|
||||
// se il collegamento rovina il grezzo
|
||||
else {
|
||||
dCurrElev -= currStep.dDepth ;
|
||||
dNextElev -= ( bSamePlane ? currStep.dDepth : vStepInfo[i+1].dDepth) ;
|
||||
dCurrElev += currStep.dDepth ;
|
||||
dNextElev += ( bSamePlane ? currStep.dDepth : vStepInfo[i+1].dDepth) ;
|
||||
}
|
||||
// End Feed
|
||||
SetFeed( GetEndFeed()) ;
|
||||
// per non passare a filo dello step precedente ( quindi nel caso si isole a filo delle stesse)
|
||||
// aggiungo una elevazione extra nel caso di violazione della regione limite
|
||||
SetFeed( GetEndFeed()) ;
|
||||
dCurrElev += ( bSafeLimit ? 0. : EXTRA_ELEV) ;
|
||||
dNextElev += ( bSafeLimit ? 0. : EXTRA_ELEV) ;
|
||||
// se devo salire lungo vtTool da vtEnd, mi alzo
|
||||
@@ -4738,7 +4843,7 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
||||
else
|
||||
AddLinearMove( ptDest + dNextElev * vtTool, bSplitArcs) ;
|
||||
}
|
||||
// aggiorno le elevazioni
|
||||
// aggiorno l'elevazione corrente per il percorso successivo
|
||||
dCurrElev = dNextElev ;
|
||||
}
|
||||
}
|
||||
@@ -4759,22 +4864,22 @@ PocketingNT::CalcFirstElevation( const Point3d& ptStart, const Point3d& ptP1, co
|
||||
{
|
||||
// elevazione per ingresso
|
||||
if ( ! GetElevation( m_nPhase, ptP1 - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dCurrElev))
|
||||
dCurrElev = - currStep.dDepth + 10 * EPS_SMALL ;
|
||||
dCurrElev = currStep.dDepth + 10 * EPS_SMALL ;
|
||||
else
|
||||
dCurrElev = max( dCurrElev, - currStep.dDepth + 10 * EPS_SMALL) ;
|
||||
dCurrElev = max( dCurrElev, currStep.dDepth + 10 * EPS_SMALL) ;
|
||||
dEscapeElev = 0 ;
|
||||
vtEscape = V_NULL ;
|
||||
double dMyEscapeEvel = 0 ;
|
||||
double dMyEscapeElev = 0 ;
|
||||
Vector3d vtMyEscape = vtTool ;
|
||||
vtMyEscape.z = ( m_bAboveHead ? max( vtTool.z, 0.) : min( vtTool.z, 0.)) ;
|
||||
bool bAhUnderRaw = m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab &&
|
||||
GetAhPointUnderRaw( ptP1 + dCurrElev * vtTool, vtTool, 0, GetRadiusForStartEndElevation(),
|
||||
m_TParams.m_dLen, false, dSafeZ, vtMyEscape, dMyEscapeEvel) ;
|
||||
m_TParams.m_dLen, false, dSafeZ, vtMyEscape, dMyEscapeElev) ;
|
||||
bool bUhAboveRaw = ! m_bAboveHead &&
|
||||
GetUhPointAboveRaw( ptP1 + dCurrElev * vtTool, vtTool, 0, GetRadiusForStartEndElevation(),
|
||||
m_TParams.m_dLen, false, dSafeZ, vtMyEscape, dMyEscapeEvel) ;
|
||||
m_TParams.m_dLen, false, dSafeZ, vtMyEscape, dMyEscapeElev) ;
|
||||
if ( bAhUnderRaw || bUhAboveRaw || m_bTiltingTab) {
|
||||
dEscapeElev = dMyEscapeEvel ;
|
||||
dEscapeElev = dMyEscapeElev ;
|
||||
vtEscape = vtMyEscape ;
|
||||
vtEscape.Normalize() ;
|
||||
}
|
||||
@@ -4788,20 +4893,20 @@ PocketingNT::CalcLastElevation( const Point3d& ptEnd, const Point3d& ptP1, const
|
||||
{
|
||||
// elevazione per uscita
|
||||
if ( ! GetElevation( m_nPhase, ptP1, vtTool, GetRadiusForStartEndElevation(), m_TParams.m_dLen, vtTool, dCurrElev))
|
||||
dCurrElev = - currStep.dDepth ;
|
||||
dCurrElev = currStep.dDepth ;
|
||||
dEscapeElev = 0 ;
|
||||
vtEscape = V_NULL ;
|
||||
double dMyEscapeEvel = 0 ;
|
||||
double dMyEscapeElev = 0 ;
|
||||
Vector3d vtMyEscape = vtTool ;
|
||||
vtMyEscape.z = ( m_bAboveHead ? max( vtTool.z, 0.) : min( vtTool.z, 0.)) ;
|
||||
bool bAhUnderRaw = m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab &&
|
||||
GetAhPointUnderRaw( ptP1 + vtTool * dCurrElev, vtTool, 0, GetRadiusForStartEndElevation(),
|
||||
m_TParams.m_dLen, false, dSafeZ, vtMyEscape, dMyEscapeEvel) ;
|
||||
m_TParams.m_dLen, false, dSafeZ, vtMyEscape, dMyEscapeElev) ;
|
||||
bool bUhAboveRaw = ! m_bAboveHead &&
|
||||
GetUhPointAboveRaw( ptP1 + vtTool * dCurrElev, vtTool, 0, GetRadiusForStartEndElevation(),
|
||||
m_TParams.m_dLen, false, dSafeZ, vtMyEscape, dMyEscapeEvel) ;
|
||||
m_TParams.m_dLen, false, dSafeZ, vtMyEscape, dMyEscapeElev) ;
|
||||
if ( bAhUnderRaw || bUhAboveRaw || m_bTiltingTab) {
|
||||
dEscapeElev = dMyEscapeEvel ;
|
||||
dEscapeElev = dMyEscapeElev ;
|
||||
vtEscape = vtMyEscape ;
|
||||
vtEscape.Normalize() ;
|
||||
}
|
||||
@@ -5152,6 +5257,14 @@ PocketingNT::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSa
|
||||
SetFlag( 0) ;
|
||||
}
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
// se impostato come parametro di lavorazione nelle UserNotes
|
||||
Vector3d vtAux ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
|
||||
vtAux.Normalize() ;
|
||||
SetAuxDir( vtAux) ;
|
||||
}
|
||||
// se sopra attacco c'è spazio per sicurezza o approccio
|
||||
double dSafeDist = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
|
||||
if ( ! bBottomOutStart && dElev + max( dSafeDist, dAppr) > 10 * EPS_SMALL) {
|
||||
@@ -5458,7 +5571,10 @@ PocketingNT::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect
|
||||
// recupero le quote per la curva
|
||||
Point3d ptIni ; pCrv->GetStartPoint( ptIni) ;
|
||||
Point3d ptFin ; pCrv->GetEndPoint( ptFin) ;
|
||||
ptFin += vtN * 1.0 ;
|
||||
double dExtraElev = 1.0 ;
|
||||
if ( m_TParams.m_nType == TT_MILL_POLISHING)
|
||||
dExtraElev = max( m_Params.m_dLiElev, 1.0) ;
|
||||
ptFin += vtN * dExtraElev ;
|
||||
double dNini = ( ptIni - ORIG) * vtN ;
|
||||
double dNfin = ( ptFin - ORIG) * vtN ;
|
||||
AdjustCurveSlope( pCrv, dNini, dNfin) ;
|
||||
@@ -5495,300 +5611,6 @@ PocketingNT::GetForcedClosed( void)
|
||||
return ( GetValInNotes( m_Params.m_sUserNotes, UN_OPEN, dOpenLen) && dOpenLen < EPS_ZERO) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PocketingNT::GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOrt)
|
||||
{
|
||||
// recupero il vettore estrusione
|
||||
Vector3d vtExtr = Z_AX ;
|
||||
pCompo->GetExtrusion( vtExtr) ;
|
||||
// verifico se tutti i lati sono aperti
|
||||
bool bAllOpen = true ;
|
||||
const ICurve* pMyCrv = pCompo->GetFirstCurve() ;
|
||||
while ( pMyCrv != nullptr) {
|
||||
if ( pMyCrv->GetTempProp() != 1) {
|
||||
bAllOpen = false ;
|
||||
break ;
|
||||
}
|
||||
pMyCrv = pCompo->GetNextCurve() ;
|
||||
}
|
||||
// richiedo lunghezza superiore a diametro utensile più doppio offset radiale
|
||||
double dRefLen = ( bAllOpen ? 0 : m_TParams.m_dDiam + 2 * GetOffsR() - EPS_SMALL) ;
|
||||
double dMaxLen = dRefLen ;
|
||||
// ciclo sulle singole curve
|
||||
bool bFound = false ;
|
||||
const ICurve* pPrevCrv = pCompo->GetLastCurve() ;
|
||||
double dLenPrev = 0 ;
|
||||
if ( pPrevCrv != nullptr && pPrevCrv->GetTempProp() == 1)
|
||||
pPrevCrv->GetLength( dLenPrev) ;
|
||||
const ICurve* pCrv = pCompo->GetFirstCurve() ;
|
||||
while ( pCrv != nullptr) {
|
||||
// analizzo la curva successiva
|
||||
const ICurve* pNextCrv = pCompo->GetNextCurve() ;
|
||||
bool bNextOk = ( pNextCrv != nullptr) ;
|
||||
if ( ! bNextOk)
|
||||
pNextCrv = pCompo->GetFirstCurve() ;
|
||||
double dLenNext = 0 ;
|
||||
if ( pNextCrv != nullptr && pNextCrv->GetTempProp() == 1)
|
||||
pNextCrv->GetLength( dLenNext) ;
|
||||
// verifico la curva corrente
|
||||
if ( pCrv->GetTempProp() == 1) {
|
||||
// contributo dalle entità adiacenti (se non tutte aperte)
|
||||
double dLenAgg = 0 ;
|
||||
if ( ! bAllOpen) {
|
||||
if ( pPrevCrv != nullptr && pPrevCrv->GetTempProp() == 1) {
|
||||
Vector3d vtPrevEnd ; pPrevCrv->GetEndDir( vtPrevEnd) ;
|
||||
Vector3d vtStart ; pCrv->GetStartDir( vtStart) ;
|
||||
dLenAgg += max( 0.4, vtPrevEnd * vtStart) * dLenPrev ;
|
||||
}
|
||||
if ( pNextCrv != nullptr && pNextCrv->GetTempProp() == 1) {
|
||||
Vector3d vtEnd ; pCrv->GetEndDir( vtEnd) ;
|
||||
Vector3d vtNextStart ; pNextCrv->GetStartDir( vtNextStart) ;
|
||||
dLenAgg += max( 0.4, vtEnd * vtNextStart) * dLenNext ;
|
||||
}
|
||||
}
|
||||
// entità corrente
|
||||
double dLen = 0 ;
|
||||
if ( pCrv->GetLength( dLen)) {
|
||||
const double LEN_TOL = 1 ;
|
||||
// se di lunghezza praticamente uguale
|
||||
if ( bFound && dLen + dLenAgg > dRefLen && abs( dLen + dLenAgg - dMaxLen) < LEN_TOL) {
|
||||
Point3d ptTest ;
|
||||
pCrv->GetMidPoint( ptTest) ;
|
||||
if ( ( m_bAboveHead && ptTest.z > ptMid.z + 100 * EPS_SMALL) ||
|
||||
( ! m_bAboveHead && ptTest.z < ptMid.z - 100 * EPS_SMALL) ||
|
||||
( abs( ptTest.z - ptMid.z) < 100 * EPS_SMALL && ptTest.y < ptMid.y - 100 * EPS_SMALL)) {
|
||||
dMaxLen = max( dMaxLen, dLen + dLenAgg) ;
|
||||
ptMid = ptTest ;
|
||||
// vettore ortogonale verso l'esterno (ruotato -90deg attorno a estrusione)
|
||||
pCrv->GetMidDir( vtMidOrt) ;
|
||||
vtMidOrt.Rotate( vtExtr, 0, -1) ;
|
||||
}
|
||||
}
|
||||
// se più lunga
|
||||
else if ( dLen + dLenAgg > dMaxLen) {
|
||||
dMaxLen = dLen + dLenAgg ;
|
||||
pCrv->GetMidPoint( ptMid) ;
|
||||
// vettore ortogonale verso l'esterno (ruotato -90deg attorno a estrusione)
|
||||
pCrv->GetMidDir( vtMidOrt) ;
|
||||
vtMidOrt.Rotate( vtExtr, 0, -1) ;
|
||||
bFound = true ;
|
||||
}
|
||||
dLenPrev = dLen ;
|
||||
}
|
||||
}
|
||||
else
|
||||
dLenPrev = 0 ;
|
||||
// vado alla successiva
|
||||
pPrevCrv = pCrv ;
|
||||
pCrv = ( bNextOk ? pNextCrv : nullptr) ;
|
||||
}
|
||||
|
||||
return bFound ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PocketingNT::AdjustContourWithOpenEdges( ICurveComposite* pCompo)
|
||||
{
|
||||
// vettore estrusione
|
||||
Vector3d vtExtr ; pCompo->GetExtrusion( vtExtr) ;
|
||||
// calcolo riferimento nel piano della svuotatura
|
||||
Frame3d frPocket ;
|
||||
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
|
||||
frPocket.Set( ptStart, vtExtr) ;
|
||||
// sposto l'inizio a metà del tratto più lungo
|
||||
AdjustContourStart( pCompo) ;
|
||||
// raggio di riferimento per offset
|
||||
double dOutEdge = 0.5 * m_TParams.m_dDiam ;
|
||||
if ( m_Params.m_nSubType == POCKET_SUB_SPIRALIN || m_Params.m_nSubType == POCKET_SUB_ZIGZAG)
|
||||
dOutEdge = max( dOutEdge, m_TParams.m_dDiam - m_Params.m_dSideStep) ;
|
||||
double dRad = dOutEdge + GetOffsR() ;
|
||||
// estraggo parti con proprietà uniforme in un vettore
|
||||
ICURVEPOVECTOR vpCrvs ;
|
||||
int nCurrTempProp ;
|
||||
int nParStart = 0 ;
|
||||
for ( int i = 0 ; i < pCompo->GetCurveCount() ; ++ i) {
|
||||
int nTempProp ;
|
||||
pCompo->GetCurveTempProp( i, nTempProp) ;
|
||||
if ( i == 0) {
|
||||
nCurrTempProp = nTempProp ;
|
||||
nParStart = i ;
|
||||
}
|
||||
else if ( nCurrTempProp != nTempProp) {
|
||||
PtrOwner<ICurve> pCrv( pCompo->CopyParamRange( nParStart, i)) ;
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
pCrv->SetTempProp( nCurrTempProp) ;
|
||||
pCrv->SetExtrusion( vtExtr) ;
|
||||
vpCrvs.emplace_back( Release( pCrv)) ;
|
||||
nCurrTempProp = nTempProp ;
|
||||
nParStart = i ;
|
||||
}
|
||||
}
|
||||
PtrOwner<ICurve> pCrv( pCompo->CopyParamRange( nParStart, pCompo->GetCurveCount())) ;
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
pCrv->SetTempProp( nCurrTempProp) ;
|
||||
pCrv->SetExtrusion( vtExtr) ;
|
||||
vpCrvs.emplace_back( Release( pCrv)) ;
|
||||
// offsetto del raggio le curve aperte
|
||||
for ( int i = 0 ; i < int( vpCrvs.size()) ; ++ i) {
|
||||
if ( vpCrvs[i]->GetTempProp() == 1) {
|
||||
OffsetCurve OffsCrv ;
|
||||
if ( ! OffsCrv.Make( vpCrvs[i], dRad, ICurve::OFF_FILLET) || OffsCrv.GetCurveCount() == 0) {
|
||||
m_pMchMgr->SetLastError( 2412, "Error in PocketingNT : Offset not computable") ;
|
||||
return false ;
|
||||
}
|
||||
vpCrvs[i].Set( OffsCrv.GetLongerCurve()) ;
|
||||
vpCrvs[i]->SetTempProp( 1) ;
|
||||
}
|
||||
}
|
||||
// reinserisco le curve, chiudendo eventuali gap
|
||||
pCompo->Clear() ;
|
||||
pCompo->SetExtrusion( vtExtr) ;
|
||||
bool bOpenCurr = false ;
|
||||
double dDiam = 1.05 * m_TParams.m_dDiam + 2 * GetOffsR() ;
|
||||
for ( int i = 0 ; i < int( vpCrvs.size()) ; ++ i) {
|
||||
// stato curve
|
||||
bool bOpenPrev = bOpenCurr ;
|
||||
bOpenCurr = ( vpCrvs[i]->GetTempProp() != 0) ;
|
||||
// chiudo eventuale gap
|
||||
if ( i > 0) {
|
||||
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
|
||||
Point3d ptStart ; vpCrvs[i]->GetStartPoint( ptStart) ;
|
||||
if ( ! AreSamePointEpsilon( ptEnd, ptStart, 10 * EPS_SMALL)) {
|
||||
// se passo da chiuso ad aperto
|
||||
if ( ! bOpenPrev && bOpenCurr) {
|
||||
// determino la curva ad amo
|
||||
Vector3d vtTg ; pCompo->GetEndDir( vtTg) ;
|
||||
Vector3d vtOrt = vtTg ; vtOrt.Rotate( vtExtr, 0, 1) ;
|
||||
Point3d ptArc = ptEnd + dDiam * vtOrt ;
|
||||
Point3d ptLine = ptArc - 5 * dDiam * vtTg ;
|
||||
PtrOwner<ICurveComposite> pJCrv( CreateCurveComposite()) ;
|
||||
if ( IsNull( pJCrv))
|
||||
return false ;
|
||||
pJCrv->SetExtrusion( vtExtr) ;
|
||||
pJCrv->AddPoint( ptLine) ;
|
||||
pJCrv->AddLine( ptArc, false) ;
|
||||
pJCrv->AddArcTg( ptEnd, false) ;
|
||||
// calcolo l'intersezione nel piano della svuotatura dell'amo con la curva aperta
|
||||
pJCrv->ToLoc( frPocket) ;
|
||||
vpCrvs[i]->ToLoc( frPocket) ;
|
||||
IntersCurveCurve intCC( *pJCrv, *vpCrvs[i]) ;
|
||||
pJCrv->ToGlob( frPocket) ;
|
||||
vpCrvs[i]->ToGlob( frPocket) ;
|
||||
// taglio opportunamente le curve
|
||||
bool bFound = false ;
|
||||
IntCrvCrvInfo aInfo ;
|
||||
if ( intCC.GetIntersCount() > 0) {
|
||||
// cerco la prima intersezione che entra nella curva aperta
|
||||
for ( int j = 0 ; j < intCC.GetIntersCount() ; ++ j) {
|
||||
if ( intCC.GetIntCrvCrvInfo( j, aInfo) && aInfo.IciA[0].nPrevTy == ICCT_OUT) {
|
||||
bFound = true ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( bFound) {
|
||||
pJCrv->TrimEndAtParam( aInfo.IciA[0].dU) ;
|
||||
vpCrvs[i]->TrimStartAtParam( aInfo.IciB[0].dU) ;
|
||||
pCompo->AddCurve( ::Release( pJCrv), true, 10 * EPS_SMALL) ;
|
||||
}
|
||||
else
|
||||
pCompo->AddLine( ptStart) ;
|
||||
}
|
||||
// se passo da aperto a chiuso
|
||||
else if ( bOpenPrev && ! bOpenCurr) {
|
||||
// determino la curva ad amo
|
||||
Vector3d vtTg ; vpCrvs[i]->GetStartDir( vtTg) ;
|
||||
Vector3d vtOrt = vtTg ; vtOrt.Rotate( vtExtr, 0, 1) ;
|
||||
Point3d ptArc = ptStart + dDiam * vtOrt ;
|
||||
Point3d ptLine = ptArc + 5 * dDiam * vtTg ;
|
||||
PtrOwner<ICurveComposite> pJCrv( CreateCurveComposite()) ;
|
||||
if ( IsNull( pJCrv))
|
||||
return false ;
|
||||
pJCrv->SetExtrusion( vtExtr) ;
|
||||
pJCrv->AddPoint( ptLine) ;
|
||||
pJCrv->AddLine( ptArc) ;
|
||||
pJCrv->AddArcTg( ptStart) ;
|
||||
// calcolo l'intersezione nel piano della svuotatura dell'amo con la curva aperta
|
||||
PtrOwner<ICurveComposite> pLCrv( CreateCurveComposite()) ;
|
||||
if ( IsNull( pLCrv))
|
||||
return false ;
|
||||
pLCrv->AddCurve( pCompo->GetLastCurve()->Clone()) ;
|
||||
if ( pCompo->GetCurveCount() >= 2)
|
||||
pLCrv->AddCurve( pCompo->GetPrevCurve()->Clone(), false) ;
|
||||
double dUL = pLCrv->GetCurveCount() ;
|
||||
pJCrv->ToLoc( frPocket) ;
|
||||
pLCrv->ToLoc( frPocket) ;
|
||||
IntersCurveCurve intCC( *pJCrv, *pLCrv) ;
|
||||
pJCrv->ToGlob( frPocket) ;
|
||||
pLCrv->ToGlob( frPocket) ;
|
||||
// taglio opportunamente le curve
|
||||
IntCrvCrvInfo aInfo ;
|
||||
if ( intCC.GetIntCrvCrvInfo( 0, aInfo)) {
|
||||
double dUs, dUe ; pCompo->GetDomain( dUs, dUe) ;
|
||||
pCompo->TrimEndAtParam( dUe - dUL + aInfo.IciB[0].dU) ;
|
||||
pJCrv->TrimStartAtParam( aInfo.IciA[0].dU) ;
|
||||
pCompo->AddCurve( ::Release( pJCrv), true, 10 * EPS_SMALL) ;
|
||||
}
|
||||
else
|
||||
pCompo->AddLine( ptStart) ;
|
||||
}
|
||||
else
|
||||
pCompo->AddLine( ptStart) ;
|
||||
}
|
||||
}
|
||||
// aggiungo la curva
|
||||
pCompo->AddCurve( ::Release( vpCrvs[i]), true, 10 * EPS_SMALL) ;
|
||||
}
|
||||
// non dovrebbe esserci un gap, ma meglio prevenire problemi
|
||||
pCompo->Close() ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PocketingNT::AdjustContourStart( ICurveComposite* pCompo)
|
||||
{
|
||||
// cerco il tratto lineare più lungo che non sia aperto
|
||||
int i = 0 ;
|
||||
int nMax = - 1 ;
|
||||
double dLenMax = 0 ;
|
||||
const ICurve* pCrv = pCompo->GetFirstCurve() ;
|
||||
while ( pCrv != nullptr) {
|
||||
double dLen ;
|
||||
if ( pCrv->GetType() == CRV_LINE && pCrv->GetTempProp() == 0 && pCrv->GetLength( dLen) && dLen > dLenMax) {
|
||||
dLenMax = dLen ;
|
||||
nMax = i ;
|
||||
}
|
||||
++ i ;
|
||||
pCrv = pCompo->GetNextCurve() ;
|
||||
}
|
||||
// se non trovato o troppo corto, cerco il tratto generico più lungo
|
||||
if ( nMax < 0 || dLenMax < 1.25 * m_TParams.m_dDiam) {
|
||||
i = 0 ;
|
||||
pCrv = pCompo->GetFirstCurve() ;
|
||||
while ( pCrv != nullptr) {
|
||||
double dLen ;
|
||||
if ( pCrv->GetType() != CRV_LINE && pCrv->GetTempProp() == 0 && pCrv->GetLength( dLen) && dLen > dLenMax) {
|
||||
dLenMax = dLen ;
|
||||
nMax = i ;
|
||||
}
|
||||
++ i ;
|
||||
pCrv = pCompo->GetNextCurve() ;
|
||||
}
|
||||
}
|
||||
|
||||
// sposto inizio
|
||||
if ( nMax >= 0)
|
||||
pCompo->ChangeStartPoint( nMax + 0.5) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PocketingNT::CheckSafetyLink( const Point3d& ptCurr, const Vector3d& vtCurr,
|
||||
@@ -6150,4 +5972,4 @@ PocketingNT::DebugDrawFeed( const ICurve* pCrv, double dFeed, int nLay)
|
||||
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nLay, pCrv->Clone()) ;
|
||||
m_pGeomDB->SetMaterial( nInd, GetColorFromHSV( HSV( myAngle, 1., 1.))) ;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-4
@@ -133,7 +133,7 @@ class PocketingNT : public Machining
|
||||
bool CalcPaths( STEPINFOPOVECTOR& vStepInfo) ;
|
||||
bool CalcRetCurve( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath,
|
||||
const Vector3d& vtTool, bool bHolePocketing, bool bInVsOut, ICurveComposite* pCrvGlide) ;
|
||||
bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dElev, double dStep, bool bSplitArcs) ;
|
||||
bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dStep, bool bSplitArcs, Point3d& ptPockStart, Point3d& ptPockEnd) ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) ;
|
||||
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
|
||||
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;
|
||||
@@ -162,9 +162,6 @@ class PocketingNT : public Machining
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1) ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
bool GetForcedClosed( void) ;
|
||||
bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ;
|
||||
bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ;
|
||||
bool AdjustContourStart( ICurveComposite* pCompo) ;
|
||||
bool ManageSmoothLink( const PathInfoPO& currPath, const PathInfoPO& nextPath, bool bSamePlane,
|
||||
bool& bSmoothEnd, bool& bForceLinear) ;
|
||||
bool CheckSafetyLink( const Point3d& ptCurr, const Vector3d& vtCurr,
|
||||
|
||||
@@ -1124,6 +1124,9 @@ SawFinishing::CalculateStraightAlongToolPath( int nAuxId, int nClId)
|
||||
SetToolDir( vtTool) ;
|
||||
SetCorrAuxDir( vtCorr) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Classifico i tratti a seconda della pendenza (salita, discesa, verticale, orizzontale)
|
||||
INTVECTOR vnClass ;
|
||||
ClassifySection( pCrv, vnClass) ;
|
||||
@@ -1320,6 +1323,9 @@ SawFinishing::CalculateStraightAcrossToolPath( int nAuxId, int nClId)
|
||||
SetToolDir( vtTool) ;
|
||||
SetCorrAuxDir( vtCorr) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Inizializzo contatore tagli
|
||||
m_nCuts = 0 ;
|
||||
|
||||
@@ -1431,6 +1437,9 @@ SawFinishing::CalculateCurvedAlongToolPath( int nAuxId, int nClId)
|
||||
SetPathId( nPxId) ;
|
||||
SetToolDir( vtTool) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Classifico i tratti a seconda della pendenza (salita, discesa, verticale, orizzontale)
|
||||
INTVECTOR vnClass ;
|
||||
ClassifySection( pCrv, vnClass) ;
|
||||
@@ -1627,6 +1636,9 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
|
||||
SetPathId( nPxId) ;
|
||||
SetToolDir( vtTool) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Inizializzo contatore tagli
|
||||
m_nCuts = 0 ;
|
||||
|
||||
|
||||
+9
-9
@@ -1158,6 +1158,9 @@ SawRoughing::CalculateToolPath( int nAuxId, int nPvId, int nClId)
|
||||
|
||||
SetPathId( nPxId) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Determino eventuali pareti verticali ( sono in senso decrescente di X)
|
||||
DBLVECTOR vdVr ;
|
||||
DBLVECTOR vdVrDelta ;
|
||||
@@ -1446,6 +1449,9 @@ SawRoughing::CalculateCurvedToolPath( int nAuxId, int nClId)
|
||||
SetPathId( nPxId) ;
|
||||
SetToolDir( vtTool) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Ciclo sugli intervalli tra le posizioni particolari per generare le passate
|
||||
int nCount = 0 ;
|
||||
for ( size_t j = 0 ; j < vdPp.size() ; ++ j) {
|
||||
@@ -1488,15 +1494,9 @@ SawRoughing::CalculateCurvedToolPath( int nAuxId, int nClId)
|
||||
}
|
||||
else
|
||||
pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ;
|
||||
// esecuzione del taglio
|
||||
if ( m_Params.m_nStepType != SAWROU_ST_ZIGZAG) {
|
||||
//if ( ! CalculateOneWayCut( ptStart, ptEnd, vtGdDir, vtTool, vtCorr, dElev, bFirst, bLast))
|
||||
// return false ;
|
||||
}
|
||||
else {
|
||||
if ( ! CalculateCurvedZigZagCut( pCut, vtTool, dElev, bFirst, bLast, nCount))
|
||||
return false ;
|
||||
}
|
||||
// esecuzione del taglio (per ora solo ZigZag)
|
||||
if ( ! CalculateCurvedZigZagCut( pCut, vtTool, dElev, bFirst, bLast, nCount))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+27
-1
@@ -1953,6 +1953,14 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso (tenendo conto degli allungamenti in vera lavorazione)
|
||||
Vector3d vtMidDir ; pLine->GetMidDir( vtMidDir) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, pLine->GetStart() - dStartWhiskExt * vtMidDir) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, pLine->GetEnd() + dEndWhiskExt * vtMidDir) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
|
||||
|
||||
// punti notevoli
|
||||
Point3d ptIni = pLine->GetStart() + dElev * vtCorr ;
|
||||
@@ -2133,7 +2141,7 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
m_pGeomDB->SetName( nPxId, sName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Vector3d( 0, 0, 1)) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, pLine->GetStart()) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, pLine->GetEnd()) ;
|
||||
@@ -2576,6 +2584,15 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
// assegno il vettore estrusione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso
|
||||
Point3d ptStart ; pCrv->GetStartPoint( ptStart) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
|
||||
Point3d ptEnd ; pCrv->GetEndPoint( ptEnd) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
|
||||
|
||||
// disabilito eventuale registrazione comandi EXE (riabilitazione automatica)
|
||||
CmdLogOff cmdLogOff ;
|
||||
@@ -3358,6 +3375,15 @@ Sawing::GenerateIntArcPv( const ICurveArc* pArc,
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso
|
||||
Point3d ptStart ; pArc->GetStartPoint( ptStart) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
|
||||
Point3d ptEnd ; pArc->GetEndPoint( ptEnd) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
|
||||
|
||||
// disabilito eventuale registrazione comandi EXE (riabilitazione automatica)
|
||||
CmdLogOff cmdLogOff ;
|
||||
|
||||
+29
-9
@@ -960,6 +960,13 @@ SimulatorMP::FindAndManagePathStart( int& nStatus)
|
||||
// se trovato nuovo CLpath con entità, gestisco inizio percorso di lavoro
|
||||
if ( m_nEntId != GDB_ID_NULL) {
|
||||
++ m_nCLPathInd ;
|
||||
// verifico se Path in doppio
|
||||
int nDBLPathId = GDB_ID_NULL ;
|
||||
int nDBLId = m_pGeomDB->GetFirstNameInGroup( m_nOpId, MCH_DBL) ;
|
||||
if ( nDBLId != GDB_ID_NULL) {
|
||||
string sCLPathName ; m_pGeomDB->GetName( m_nCLPathId, sCLPathName) ;
|
||||
nDBLPathId = m_pGeomDB->GetFirstNameInGroup( nDBLId, sCLPathName) ;
|
||||
}
|
||||
// recupero punti di inizio e fine percorso
|
||||
Point3d ptStart ;
|
||||
m_pGeomDB->GetInfo( m_nCLPathId, KEY_START, ptStart) ;
|
||||
@@ -990,7 +997,7 @@ SimulatorMP::FindAndManagePathStart( int& nStatus)
|
||||
m_nAuxEInd = 0 ;
|
||||
m_nAuxETot = 0 ;
|
||||
// richiamo gestione evento inizio percorso di lavoro
|
||||
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, m_nAuxSTot, ptStart, ptEnd, vtExtr,
|
||||
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, nDBLPathId, m_nAuxSTot, ptStart, ptEnd, vtExtr,
|
||||
ptMin, ptMax, vAxMin, vAxMax, dElev, vActiveExit)) {
|
||||
nStatus = CalcStatusOnError( ERR_NONE) ;
|
||||
return false ;
|
||||
@@ -1961,6 +1968,8 @@ SimulatorMP::OnMachiningEnd( void)
|
||||
{
|
||||
// chiamo la funzione di fine lavorazione
|
||||
bool bOk = CallFunction( ON_SIMUL_MACHINING_END, true) ;
|
||||
// reset eventuale Path in double
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
|
||||
// forzo aggiornamento posizione assi (possono essere stati mossi nello script)
|
||||
UpdateAxesPos() ;
|
||||
return bOk ;
|
||||
@@ -1968,13 +1977,18 @@ SimulatorMP::OnMachiningEnd( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SimulatorMP::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
|
||||
SimulatorMP::OnPathStart( int nClPathId, int nClPathInd, int nDBLPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
|
||||
{
|
||||
// assegno identificativo e indice percorso di lavorazione
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHIND, nClPathInd) ;
|
||||
// assegno identificativo percorso di lavorazione in doppio
|
||||
if ( nDBLPathId == GDB_ID_NULL)
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DBLPATHID, nDBLPathId) ;
|
||||
// assegno numero di dati ausiliari iniziali
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXTOT, nAS) ;
|
||||
// assegno punti iniziale e finale e versore estrusione
|
||||
@@ -2150,9 +2164,9 @@ SimulatorMP::OnMoveStart( const CamData* pCamData, const CamData* pNextCamData,
|
||||
bool bNeg = ( sLink.find( '-') != string::npos) ;
|
||||
string sMainAxis = sLink ; ReplaceString( sMainAxis, "-", "") ;
|
||||
int nInd = 0 ;
|
||||
for ( int i = 0 ; nInd == 0 && i < int( m_AxesName.size()) ; ++ i) {
|
||||
if ( m_AxesName[i] == sMainAxis)
|
||||
nInd = i + 1 ;
|
||||
for ( int j = 0 ; nInd == 0 && j < ssize( m_AxesName) ; ++ j) {
|
||||
if ( m_AxesName[j] == sMainAxis)
|
||||
nInd = j + 1 ;
|
||||
}
|
||||
// se trovato asse principale di riferimento
|
||||
if ( nInd > 0) {
|
||||
@@ -2185,11 +2199,17 @@ SimulatorMP::OnMoveStart( const CamData* pCamData, const CamData* pNextCamData,
|
||||
}
|
||||
}
|
||||
// altrimenti errore
|
||||
else
|
||||
else {
|
||||
bOk = false ;
|
||||
string sErr = " Error in OnMoveStart : Wrong Move AuxAxis " + ToString( i) ;
|
||||
LOG_ERROR( GetEMkLogger(), sErr.c_str())
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
bOk = false ;
|
||||
string sErr = " Error in OnMoveStart : Wrong Name AuxAxis " + ToString( i) ;
|
||||
LOG_ERROR( GetEMkLogger(), sErr.c_str())
|
||||
}
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ class SimulatorMP : public ISimulator
|
||||
bool OnMachiningEnd( void) ;
|
||||
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
|
||||
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nDBLPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
|
||||
bool OnPathEnd( int nAE) ;
|
||||
|
||||
+34
-12
@@ -97,6 +97,7 @@ SimulatorSP::SimulatorSP( void)
|
||||
m_bEnableVm = false ;
|
||||
m_dSafeDist = SAFEDIST_STD ;
|
||||
m_bEnableTrace = false ;
|
||||
m_nTraceGroup = GDB_ID_NULL ;
|
||||
m_nCurrTrace = GDB_ID_NULL ;
|
||||
m_nAxesMask = 0 ;
|
||||
m_bEnabAxes = true ;
|
||||
@@ -907,6 +908,13 @@ SimulatorSP::FindAndManagePathStart( int& nStatus)
|
||||
// se trovato nuovo CLpath con entità, gestisco inizio percorso di lavoro
|
||||
if ( m_nEntId != GDB_ID_NULL) {
|
||||
++ m_nCLPathInd ;
|
||||
// verifico se Path in doppio
|
||||
int nDBLPathId = GDB_ID_NULL ;
|
||||
int nDBLId = m_pGeomDB->GetFirstNameInGroup( m_nOpId, MCH_DBL) ;
|
||||
if ( nDBLId != GDB_ID_NULL) {
|
||||
string sCLPathName ; m_pGeomDB->GetName( m_nCLPathId, sCLPathName) ;
|
||||
nDBLPathId = m_pGeomDB->GetFirstNameInGroup( nDBLId, sCLPathName) ;
|
||||
}
|
||||
// recupero punti di inizio e fine percorso
|
||||
Point3d ptStart ;
|
||||
m_pGeomDB->GetInfo( m_nCLPathId, KEY_START, ptStart) ;
|
||||
@@ -937,7 +945,7 @@ SimulatorSP::FindAndManagePathStart( int& nStatus)
|
||||
m_nAuxEInd = 0 ;
|
||||
m_nAuxETot = 0 ;
|
||||
// richiamo gestione evento inizio percorso di lavoro
|
||||
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, m_nAuxSTot, ptStart, ptEnd, vtExtr,
|
||||
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, nDBLPathId, m_nAuxSTot, ptStart, ptEnd, vtExtr,
|
||||
ptMin, ptMax, vAxMin, vAxMax, dElev, vActiveExit)) {
|
||||
nStatus = CalcStatusOnError( 0) ;
|
||||
return false ;
|
||||
@@ -1685,10 +1693,10 @@ SimulatorSP::EnableToolTipTrace( bool bEnable)
|
||||
;
|
||||
}
|
||||
else {
|
||||
int nTraceCrvId = m_nCurrTrace ;
|
||||
int nTraceCrvId = m_pGeomDB->GetFirstInGroup( m_nTraceGroup) ;
|
||||
while ( nTraceCrvId != GDB_ID_NULL) {
|
||||
m_pGeomDB->SetStatus( nTraceCrvId, GDB_ST_OFF) ;
|
||||
nTraceCrvId = m_pGeomDB->GetPrev( nTraceCrvId) ;
|
||||
nTraceCrvId = m_pGeomDB->GetNext( nTraceCrvId) ;
|
||||
}
|
||||
m_nCurrTrace = GDB_ID_NULL ;
|
||||
}
|
||||
@@ -1708,6 +1716,7 @@ SimulatorSP::TraceToolTipMove( int nMoveType)
|
||||
int nTraceGrpId ;
|
||||
if ( ! m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_TOOLTRACE, nTraceGrpId))
|
||||
return false ;
|
||||
m_nTraceGroup = nTraceGrpId ;
|
||||
// recupero posizione utensile corrente
|
||||
int nExitId = m_pMachine->GetExitId( m_sHead, m_nExit) ;
|
||||
Frame3d frExit ;
|
||||
@@ -2018,6 +2027,8 @@ SimulatorSP::OnMachiningEnd( void)
|
||||
return true ;
|
||||
// chiamo la funzione di fine lavorazione
|
||||
bool bOk = m_pMachine->LuaCallFunction( ON_SIMUL_MACHINING_END) ;
|
||||
// reset eventuale Path in double
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
|
||||
// forzo aggiornamento posizione assi (possono essere stati mossi nello script)
|
||||
UpdateAxesPos() ;
|
||||
return bOk ;
|
||||
@@ -2025,13 +2036,18 @@ SimulatorSP::OnMachiningEnd( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SimulatorSP::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
|
||||
SimulatorSP::OnPathStart( int nClPathId, int nClPathInd, int nDBLPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
|
||||
{
|
||||
// assegno identificativo e indice percorso di lavorazione
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHIND, nClPathInd) ;
|
||||
// assegno identificativo percorso di lavorazione in doppio
|
||||
if ( nDBLPathId == GDB_ID_NULL)
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DBLPATHID, nDBLPathId) ;
|
||||
// assegno numero di dati ausiliari iniziali
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXTOT, nAS) ;
|
||||
// assegno punti iniziale e finale e versore estrusione
|
||||
@@ -2229,9 +2245,9 @@ SimulatorSP::OnMoveStart( const CamData* pCamData, const CamData* pNextCamData,
|
||||
bool bNeg = ( sLink.find( '-') != string::npos) ;
|
||||
string sMainAxis = sLink ; ReplaceString( sMainAxis, "-", "") ;
|
||||
int nInd = 0 ;
|
||||
for ( int i = 0 ; nInd == 0 && i < int( m_AxesName.size()) ; ++ i) {
|
||||
if ( m_AxesName[i] == sMainAxis)
|
||||
nInd = i + 1 ;
|
||||
for ( int j = 0 ; nInd == 0 && j < ssize( m_AxesName) ; ++ j) {
|
||||
if ( m_AxesName[j] == sMainAxis)
|
||||
nInd = j + 1 ;
|
||||
}
|
||||
// se trovato asse principale di riferimento
|
||||
if ( nInd > 0) {
|
||||
@@ -2258,17 +2274,23 @@ SimulatorSP::OnMoveStart( const CamData* pCamData, const CamData* pNextCamData,
|
||||
m_AuxAxesEnd.emplace_back( dEnd) ;
|
||||
m_AuxAxesLink.emplace_back( 0) ;
|
||||
if ( ! m_pMachine->VerifyOutstroke( sName, dEnd)) {
|
||||
nErr = 1 ;
|
||||
nErr = ERR_OUTSTROKE ;
|
||||
bOk = false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// altrimenti errore
|
||||
else
|
||||
else {
|
||||
bOk = false ;
|
||||
string sErr = " Error in OnMoveStart : Wrong Move AuxAxis " + ToString( i) ;
|
||||
LOG_ERROR( GetEMkLogger(), sErr.c_str())
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
bOk = false ;
|
||||
string sErr = " Error in OnMoveStart : Wrong Name AuxAxis " + ToString( i) ;
|
||||
LOG_ERROR( GetEMkLogger(), sErr.c_str())
|
||||
}
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
|
||||
+2
-1
@@ -103,7 +103,7 @@ class SimulatorSP : public ISimulator
|
||||
bool OnMachiningEnd( void) ;
|
||||
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
|
||||
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nDBLPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
|
||||
bool OnPathEnd( int nAE) ;
|
||||
@@ -177,6 +177,7 @@ class SimulatorSP : public ISimulator
|
||||
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
|
||||
INTVECTOR m_nCollMarkId ; // elenco oggetti marcati per visualizzare meglio la collisione rilevata
|
||||
bool m_bEnableTrace ; // flag abilitazione tool tip trace
|
||||
int m_nTraceGroup ; // Id del gruppo in cui si inceriscono le curve di tracciatura
|
||||
int m_nCurrTrace ; // Id della curva composita corrente di trace
|
||||
int m_nAxesMask ; // maschera a bit di abilitazione movimento assi (solo se rapido)
|
||||
bool m_bEnabAxes ; // flag abilitazione movimento assi attivi
|
||||
|
||||
+55
-37
@@ -1794,12 +1794,17 @@ SurfFinishing::ProcessCrvCompo( int nPathId, int nPvId, int nClId)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Imposto dati comuni
|
||||
SetPathId( nPxId) ;
|
||||
SetToolDir( vtTool) ;
|
||||
Vector3d vtAux ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
|
||||
vtAux.Normalize() ;
|
||||
SetAuxDir( vtAux) ;
|
||||
|
||||
|
||||
// assegno il vettore estrusione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Eseguo la lavorazione a seconda del tipo
|
||||
double dElev = dDepth ;
|
||||
@@ -2039,12 +2044,16 @@ SurfFinishing::ProcessSfr( int nPathId, int nPvId, int nClId)
|
||||
m_pGeomDB->SetMaterial( nSfrF, LIME) ;
|
||||
#endif
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Imposto dati comuni
|
||||
SetPathId( nPxId) ;
|
||||
SetToolDir( vtTool) ;
|
||||
Vector3d vtAux ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
|
||||
vtAux.Normalize() ;
|
||||
SetAuxDir( vtAux) ;
|
||||
|
||||
// assegno il vettore estrusione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// inserisco le superfici di supporto tra le superfici locali
|
||||
for ( SurfLocal& SurfLocSupp : vSrfLocSupp)
|
||||
@@ -2093,7 +2102,7 @@ SurfFinishing::ProcessSfr( int nPathId, int nPvId, int nClId)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfFinishing::SimplifyCurve( ICurveComposite* pCompo, double dMergeLinTol, double dMergeAndTolDeg,
|
||||
SurfFinishing::SimplifyCurve( ICurveComposite* pCompo, const Frame3d& frLocXY, double dMergeLinTol, double dMergeAndTolDeg,
|
||||
double dSmallDefLinTol, double dSmallDefAngTolDeg,
|
||||
double dArcApproxLinTol, double dArcApproxAngTolDeg) const
|
||||
{
|
||||
@@ -2101,35 +2110,38 @@ SurfFinishing::SimplifyCurve( ICurveComposite* pCompo, double dMergeLinTol, doub
|
||||
if ( pCompo == nullptr || ! pCompo->IsValid())
|
||||
return false ;
|
||||
|
||||
// ricavo il punto iniziale e finale
|
||||
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
|
||||
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
|
||||
|
||||
// eseguo le modifiche su una copia della curva originale
|
||||
PtrOwner<ICurveComposite> pCompoCL( CloneCurveComposite( pCompo)) ;
|
||||
if ( IsNull( pCompoCL))
|
||||
// eseguo le modifiche su una copia della curva originale in locale al frame XY
|
||||
PtrOwner<ICurveComposite> pCompoLoc( CloneCurveComposite( pCompo)) ;
|
||||
if ( IsNull( pCompoLoc))
|
||||
return false ;
|
||||
pCompoLoc->ToLoc( frLocXY) ;
|
||||
|
||||
// ricavo il punto iniziale e finale
|
||||
Point3d ptStart ; pCompoLoc->GetStartPoint( ptStart) ;
|
||||
Point3d ptEnd ; pCompoLoc->GetEndPoint( ptEnd) ;
|
||||
|
||||
// merge per uniformità
|
||||
bool bOk = pCompoCL->MergeCurves( dMergeLinTol, dMergeAndTolDeg, false) ;
|
||||
bool bOk = pCompoLoc->MergeCurves( dMergeLinTol, dMergeAndTolDeg, false) ;
|
||||
// rimozione Spikes o Curve Z
|
||||
bOk = bOk && pCompoCL->RemoveSmallDefects( dSmallDefLinTol, dSmallDefAngTolDeg, true) ;
|
||||
bOk = bOk && pCompoLoc->RemoveSmallDefects( dSmallDefLinTol, dSmallDefAngTolDeg, true) ;
|
||||
// interpolazione mediante linee ed archi
|
||||
PolyArc PA ;
|
||||
bOk = bOk && pCompoCL->ApproxWithArcsEx( dArcApproxLinTol, dArcApproxAngTolDeg, LIN_FEA_STD, PA) &&
|
||||
pCompoCL->Clear() && pCompoCL->FromPolyArc( PA) ;
|
||||
bOk = bOk && pCompoLoc->ApproxWithArcsEx( dArcApproxLinTol, dArcApproxAngTolDeg, LIN_FEA_STD, PA) &&
|
||||
pCompoLoc->Clear() && pCompoLoc->FromPolyArc( PA) ;
|
||||
// controllo aggiuntivo sui punti iniziali e finali che siano gli stessi
|
||||
Point3d ptNewStart, ptNewEnd ;
|
||||
bOk = bOk && pCompoCL->GetStartPoint( ptNewStart) && pCompoCL->GetEndPoint( ptNewEnd) &&
|
||||
bOk = bOk && pCompoLoc->GetStartPoint( ptNewStart) && pCompoLoc->GetEndPoint( ptNewEnd) &&
|
||||
AreSamePointApprox( ptNewStart, ptStart) && AreSamePointApprox( ptNewEnd, ptEnd) ;
|
||||
|
||||
// controllo che non si siano create auto-intersezioni
|
||||
SelfIntersCurve SIC( *pCompoCL) ;
|
||||
SelfIntersCurve SIC( *pCompoLoc) ;
|
||||
bOk = bOk && ( SIC.GetCrossIntersCount() == 0) ;
|
||||
|
||||
// se tutto bene, sostiuisco la curva originale con la modificata
|
||||
if ( bOk)
|
||||
pCompo->CopyFrom( pCompoCL) ;
|
||||
if ( bOk) {
|
||||
pCompoLoc->ToGlob( frLocXY) ;
|
||||
pCompo->CopyFrom( pCompoLoc) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -2267,7 +2279,7 @@ SurfFinishing::AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, cons
|
||||
ICRVCOMPOPOVECTOR vpCrvs ;
|
||||
if ( ! CalcPocketing( pSfrCnt, m_TParams.m_dDiam / 2., 0., m_Params.m_dSideStep, m_Params.m_dSideAngle, 5.,
|
||||
POCKET_ZIGZAG, false, false, false, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
|
||||
m_Params.m_dLiTang, GetLeadInType(), vpCrvs)) {
|
||||
GetLeadInType(), m_Params.m_dLiTang, 0., GetLeadOutType(), m_Params.m_dLoTang, false, 0., 0., vpCrvs)) {
|
||||
m_pMchMgr->SetLastError( 3125, "Error in SurfFinishing : CalcPocketing failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2295,7 +2307,7 @@ SurfFinishing::AddOneWay( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, cons
|
||||
ICRVCOMPOPOVECTOR vpCrvs ;
|
||||
if ( ! CalcPocketing( pSfrCnt, m_TParams.m_dDiam / 2., 0., m_Params.m_dSideStep, m_Params.m_dSideAngle, 5.,
|
||||
POCKET_ONEWAY, false, false, false, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
|
||||
m_Params.m_dLiTang, GetLeadInType(), vpCrvs)) {
|
||||
GetLeadInType(), m_Params.m_dLiTang, 0., GetLeadOutType(), m_Params.m_dLoTang, false, 0., 0., vpCrvs)) {
|
||||
m_pMchMgr->SetLastError( 3125, "Error in SurfFinishing : CalcPocketing failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2323,7 +2335,7 @@ SurfFinishing::AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, cons
|
||||
ICRVCOMPOPOVECTOR vpCrvs ;
|
||||
if ( ! CalcPocketing( pSfrCnt, m_TParams.m_dDiam / 2., 0., m_Params.m_dSideStep, m_Params.m_dSideAngle, 5.,
|
||||
nType, false, false, false, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
|
||||
m_Params.m_dLiTang, GetLeadInType(), vpCrvs)) {
|
||||
GetLeadInType(), m_Params.m_dLiTang, 0., GetLeadOutType(), m_Params.m_dLoTang, false, 0., 0., vpCrvs)) {
|
||||
m_pMchMgr->SetLastError( 3125, "Error in SurfFinishing : CalcPocketing failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2502,6 +2514,11 @@ SurfFinishing::CalcZConstSilCrv( ICAvParSilhouettesSurfTm* pCavParSilh, const SU
|
||||
if ( pSfrClass == nullptr || ! pSfrClass->IsValid())
|
||||
return false ;
|
||||
|
||||
// definisco un frame implicito rispetto alla superficie di classificazione
|
||||
Frame3d frLocXY ;
|
||||
Point3d ptC ; pSfrClass->GetCentroid( ptC) ;
|
||||
frLocXY.Set( ptC, pSfrClass->GetNormVersor()) ;
|
||||
|
||||
// NB. Essendo una finitura a Z costante, devo controllare che i piani di finitura non facciano
|
||||
// overlap con facce delle TriMesh selezionate con normale simile a vtTool
|
||||
set<double> setZAmbiguos ;
|
||||
@@ -2530,32 +2547,32 @@ SurfFinishing::CalcZConstSilCrv( ICAvParSilhouettesSurfTm* pCavParSilh, const SU
|
||||
if ( ! pCavParSilh->GetSilhouette( dZLoc, vPL))
|
||||
return false ;
|
||||
// classifico le PolyLine in base alla regione
|
||||
POLYLINEVECTOR vPL_InsideSfr ;
|
||||
POLYLINEVECTOR vPLInsideSfr ;
|
||||
for ( auto& PL : vPL) {
|
||||
// porto la PolyLine a contatto con la regione
|
||||
PL.Translate( - dZLoc * pSfrClass->GetNormVersor()) ;
|
||||
// converto in curva composita
|
||||
PtrOwner<ICurveComposite> pCrv_PL( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrv_PL) || ! pCrv_PL->FromPolyLine( PL))
|
||||
PtrOwner<ICurveComposite> pCrvPL( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvPL) || ! pCrvPL->FromPolyLine( PL))
|
||||
return false ;
|
||||
// classifico la curva con la superficie
|
||||
CRVCVECTOR ccClass ;
|
||||
if ( ! pSfrClass->GetCurveClassification( *pCrv_PL, EPS_SMALL, ccClass))
|
||||
if ( ! pSfrClass->GetCurveClassification( *pCrvPL, EPS_SMALL, ccClass))
|
||||
return false ;
|
||||
// tengo tutti i tratti non esterni alla superficie
|
||||
for ( int i = 0 ; i < int( ccClass.size()) ; ++ i) {
|
||||
if ( ccClass[i].nClass != CRVC_OUT) {
|
||||
PtrOwner<ICurveComposite> pCrvCompoPartIn( ConvertCurveToComposite( pCrv_PL->CopyParamRange( ccClass[i].dParS, ccClass[i].dParE))) ;
|
||||
PtrOwner<ICurveComposite> pCrvCompoPartIn( ConvertCurveToComposite( pCrvPL->CopyParamRange( ccClass[i].dParS, ccClass[i].dParE))) ;
|
||||
if ( ! IsNull( pCrvCompoPartIn) && pCrvCompoPartIn->IsValid()) {
|
||||
vPL_InsideSfr.emplace_back( PolyLine()) ;
|
||||
vPLInsideSfr.emplace_back( PolyLine()) ;
|
||||
// riporto la curva alla quota giusta
|
||||
pCrvCompoPartIn->Translate( dZLoc * pSfrClass->GetNormVersor()) ;
|
||||
pCrvCompoPartIn->ApproxWithLines( 0, 0, ICurve::APL_SPECIAL, vPL_InsideSfr.back()) ;
|
||||
pCrvCompoPartIn->ApproxWithLines( 0, 0, ICurve::APL_SPECIAL, vPLInsideSfr.back()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
swap( vPL, vPL_InsideSfr) ;
|
||||
swap( vPL, vPLInsideSfr) ;
|
||||
for ( auto& PL : vPL) {
|
||||
// recupero la curva dalla silhouette
|
||||
PtrOwner<ICurveComposite> pSilCrv( CreateCurveComposite()) ;
|
||||
@@ -2574,7 +2591,7 @@ SurfFinishing::CalcZConstSilCrv( ICAvParSilhouettesSurfTm* pCavParSilh, const SU
|
||||
pTempCrv->MergeCurves( SILH_ARC_TOL / 2., ANG_TOL_STD_DEG))
|
||||
pSilCrv.Set( pTempCrv) ;
|
||||
}
|
||||
SimplifyCurve( pSilCrv) ;
|
||||
SimplifyCurve( pSilCrv, frLocXY) ;
|
||||
vCrvCompo.back().emplace_back( Release( pSilCrv)) ;
|
||||
}
|
||||
// controllo validità delle curve
|
||||
@@ -4762,7 +4779,8 @@ SurfFinishing::GetOffsetCurvesFromPencilProjection( const ICRVCOMPOPOVECTOR& vCr
|
||||
ICRVCOMPOPOVECTOR vCrvZigZag ;
|
||||
if ( ! CalcPocketing( pSfrChunk, m_TParams.m_dDiam / 2., 0., m_Params.m_dSideStep, m_Params.m_dSideAngle,
|
||||
5., POCKET_SUB_ZIGZAG, false, false, m_Params.m_bInvert, true, false,
|
||||
false, P_INVALID, nullptr, true, INFINITO, INFINITO, GetLeadInType(), vCrvZigZag))
|
||||
false, P_INVALID, nullptr, true, INFINITO, GetLeadInType(), m_Params.m_dLiTang, 0.,
|
||||
GetLeadOutType(), m_Params.m_dLoTang, false, 0., 0., vCrvZigZag))
|
||||
return false ;
|
||||
// inserisco le curve ricavate
|
||||
for ( auto& pCompo : vCrvZigZag) {
|
||||
@@ -5460,7 +5478,7 @@ SurfFinishing::CalcOptimalZigZagCurves( const ISurfFlatRegion* pSfrLoc, const Fr
|
||||
ICRVCOMPOPOVECTOR vpCrvs ;
|
||||
if ( ! CalcPocketing( pSfrChunk, m_TParams.m_dDiam / 2., 0., m_Params.m_dSideStep, m_Params.m_dSideAngle, 5.,
|
||||
nSubType, false, false, false, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
|
||||
m_Params.m_dLiTang, GetLeadInType(), vpCrvs)) {
|
||||
GetLeadInType(), m_Params.m_dLiTang, 0., GetLeadOutType(), m_Params.m_dLoTang, false, 0., 0., vpCrvs)) {
|
||||
m_pMchMgr->SetLastError( 3125, "Error in SurfFinishing : CalcPocketing failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -5806,7 +5824,7 @@ SurfFinishing::CalcOptimalZConstCurves( const ISurfFlatRegion* pSfrLoc, const SU
|
||||
PtrOwner<ICurveComposite> pNewCrvCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pNewCrvCompo) || ! pNewCrvCompo->FromPolyLine( PL))
|
||||
continue ;
|
||||
SimplifyCurve( pNewCrvCompo) ;
|
||||
SimplifyCurve( pNewCrvCompo, frSfr) ;
|
||||
vvCrvCompo[i].emplace_back( Release( pNewCrvCompo)) ;
|
||||
// memorizzo come primo TempParam la distanza della superficie ( per coerenza)
|
||||
vvCrvCompo[i].back()->SetTempParam( dSfrDist, 0) ;
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ class SurfFinishing : public Machining
|
||||
double dDepth, ISurfFlatRegion* pSfrCnt) ;
|
||||
bool ProcessCrvCompo( int nPathId, int nPvId, int nClId) ;
|
||||
bool ProcessSfr( int nPathId, int nPvId, int nClId) ;
|
||||
bool SimplifyCurve( ICurveComposite* pCompo,
|
||||
bool SimplifyCurve( ICurveComposite* pCompo, const Frame3d& frLocXY,
|
||||
double dMergeLinTol = 200. * EPS_SMALL, double dMergeAndTolDeg = 200. * EPS_ANG_SMALL,
|
||||
double dSmallDefLinTol = 150. * EPS_SMALL, double dSmallDefAngTolDeg = 2. * ANG_TOL_STD_DEG,
|
||||
double dArcApproxLinTol = 50. * EPS_SMALL, double dArcApproxAngTolDeg = ANG_TOL_STD_DEG) const ;
|
||||
|
||||
+64
-30
@@ -420,6 +420,11 @@ SurfRoughing::SetParam( int nType, double dVal)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_dOffsL = dVal ;
|
||||
return true ;
|
||||
case MPA_OVERL :
|
||||
if ( ! AreSameLenValue( dVal, m_Params.m_dOverlap))
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_dOverlap = dVal ;
|
||||
return true ;
|
||||
case MPA_DEPTH: {
|
||||
string sVal = ToString( dVal) ;
|
||||
if ( sVal != m_Params.m_sDepth)
|
||||
@@ -836,6 +841,9 @@ SurfRoughing::GetParam( int nType, double& dVal) const
|
||||
case MPA_STARTPOS :
|
||||
dVal = m_Params.m_dStartPos ;
|
||||
return true ;
|
||||
case MPA_OVERL :
|
||||
dVal = m_Params.m_dOverlap ;
|
||||
return true ;
|
||||
case MPA_STEP :
|
||||
dVal = m_Params.m_dStep ;
|
||||
return true ;
|
||||
@@ -1228,7 +1236,7 @@ SurfRoughing::Chain( int nGrpDestId)
|
||||
}
|
||||
|
||||
// scorro le regioni piane ricavate dalle curve
|
||||
int nGroupName = -1 ;
|
||||
int nGroupName = 0 ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrCurr( SfrByC.GetSurf()) ;
|
||||
while ( ! IsNull( pSfrCurr) && pSfrCurr->IsValid()) {
|
||||
// la normale del Chunk deve essere coerente con l'estrusione ricavata
|
||||
@@ -1537,6 +1545,12 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// verifico se presente parametro di Overlap
|
||||
if ( m_Params.m_dOverlap > 10. * EPS_SMALL) {
|
||||
if ( ! pSfrSgro->Offset( m_Params.m_dOverlap, ICurve::OFF_EXTEND) || ! pSfrSgro->IsValid())
|
||||
return false ;
|
||||
}
|
||||
|
||||
// inizializzo la classe di intersezione tra grezzo e piani paralleli ( quelli di lavoro)
|
||||
// traslo leggermente il grezzo per gestire il primo e l'ultimo Step
|
||||
pStmRaw->Translate( - vtTool * 5 * EPS_SMALL) ;
|
||||
@@ -2084,6 +2098,10 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// Imposto dati comuni
|
||||
SetPathId( nPxId) ;
|
||||
SetToolDir( vtTool) ;
|
||||
Vector3d vtAux ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
|
||||
vtAux.Normalize() ;
|
||||
SetAuxDir( vtAux) ;
|
||||
|
||||
// se richiesto ordine per ZChunk, aggiusto le geometrie inserite nel gruppo
|
||||
if ( m_bOrderZ)
|
||||
@@ -3007,7 +3025,8 @@ SurfRoughing::CalcPaths( const INTINTVECTOR& vPocket, STEPINFOSRVECTOR& vStepInf
|
||||
if ( ! CalcPocketing( vStepInfo[nInd].pSfrPock, m_TParams.m_dDiam / 2, 0., m_Params.m_dSideStep,
|
||||
m_Params.m_dSideAngle, 5., vStepInfo[nInd].nSubType, true, true, vStepInfo[nInd].bInverted,
|
||||
false, true, true, ptEndLastPath, vStepInfo[nInd].pSfrLimit, false, m_Params.m_dSideStep,
|
||||
m_Params.m_dLiTang, GetLeadInType(), vCrvPaths)) {
|
||||
GetLeadInType(), m_Params.m_dLiTang, m_Params.m_dLiElev, GetLeadOutType(), m_Params.m_dLoTang,
|
||||
false, 0., 0., vCrvPaths)) {
|
||||
if ( vStepInfo[nInd].bIsExtraStep) {
|
||||
string sWarn = "Warning in SurfRoughing : CalcPocketing failed with substep (" + ToString( vStepInfo[nInd].dDepth, 1) + ")" ;
|
||||
m_pMchMgr->SetWarning( 3055, sWarn) ;
|
||||
@@ -3396,9 +3415,6 @@ SurfRoughing::OrderZChunkSteps( STEPDATAMATRIX& vvDataSteps, STEPDATAMATRIX& vIn
|
||||
// se non ho Steps non faccio nulla
|
||||
if ( vvDataSteps.empty())
|
||||
return true ;
|
||||
// se ho solo una riga di Steps, non posso ordinare per Z, l'ordine è già corretto
|
||||
if ( int( vvDataSteps.size()) == 1)
|
||||
return true ;
|
||||
|
||||
// ordino le righe della matrice ( i piani) per Z decrescente ( Z è negativa rispetto al piano { ORIG, Z_AX})
|
||||
sort( vvDataSteps.begin(), vvDataSteps.end(), []( const STEPDATAVECTOR& vSDA, const STEPDATAVECTOR& vSDB) {
|
||||
@@ -4269,52 +4285,60 @@ SurfRoughing::ResetCurveAllTempProp( ICurve* pCurve) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfRoughing::SimplifyCurve( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvCheck) const
|
||||
SurfRoughing::SimplifyCurve( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvCheck, const Frame3d& frLocXY) const
|
||||
{
|
||||
// controllo dei parametri
|
||||
if ( pCompo == nullptr || ! pCompo->IsValid())
|
||||
return false ;
|
||||
|
||||
// ricavo il punto iniziale e finale
|
||||
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
|
||||
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
|
||||
|
||||
// eseguo le modifiche su una copia della curva originale
|
||||
PtrOwner<ICurveComposite> pCompoCL( CloneCurveComposite( pCompo)) ;
|
||||
if ( IsNull( pCompoCL))
|
||||
// eseguo le modifiche su una copia della curva originale in locale al frameXY
|
||||
PtrOwner<ICurveComposite> pCompoLoc( CloneCurveComposite( pCompo)) ;
|
||||
if ( IsNull( pCompoLoc))
|
||||
return false ;
|
||||
pCompoLoc->ToLoc( frLocXY) ;
|
||||
|
||||
// ricavo il punto iniziale e finale
|
||||
Point3d ptStart ; pCompoLoc->GetStartPoint( ptStart) ;
|
||||
Point3d ptEnd ; pCompoLoc->GetEndPoint( ptEnd) ;
|
||||
|
||||
// merge per uniformità
|
||||
bool bOk = pCompoCL->MergeCurves( 200 * EPS_SMALL, 200 * EPS_ANG_SMALL, false) ;
|
||||
bool bOk = pCompoLoc->MergeCurves( 200. * EPS_SMALL, 200. * EPS_ANG_SMALL, false) ;
|
||||
// rimozione Spikes o Curve Z
|
||||
bOk = bOk && pCompoCL->RemoveSmallDefects( 150 * EPS_SMALL, 2 * ANG_TOL_STD_DEG, true) ;
|
||||
bOk = bOk && pCompoLoc->RemoveSmallDefects( 150. * EPS_SMALL, 2. * ANG_TOL_STD_DEG, true) ;
|
||||
// interpolazione mediante linee ed archi
|
||||
PolyArc PA ;
|
||||
bOk = bOk && pCompoCL->ApproxWithArcsEx( 50 * EPS_SMALL, ANG_TOL_STD_DEG, LIN_FEA_STD, PA) &&
|
||||
pCompoCL->Clear() && pCompoCL->FromPolyArc( PA) ;
|
||||
bOk = bOk && pCompoLoc->ApproxWithArcsEx( 50. * EPS_SMALL, ANG_TOL_STD_DEG, LIN_FEA_STD, PA) &&
|
||||
pCompoLoc->Clear() && pCompoLoc->FromPolyArc( PA) ;
|
||||
// controllo aggiuntivo sui punti iniziali e finali che siano gli stessi
|
||||
Point3d ptNewStart, ptNewEnd ;
|
||||
bOk = bOk && pCompoCL->GetStartPoint( ptNewStart) && pCompoCL->GetEndPoint( ptNewEnd) &&
|
||||
bOk = bOk && pCompoLoc->GetStartPoint( ptNewStart) && pCompoLoc->GetEndPoint( ptNewEnd) &&
|
||||
AreSamePointApprox( ptNewStart, ptStart) && AreSamePointApprox( ptNewEnd, ptEnd) ;
|
||||
|
||||
// controllo che non si siano create auto-intersezioni
|
||||
SelfIntersCurve SIC( *pCompoCL) ;
|
||||
SelfIntersCurve SIC( *pCompoLoc) ;
|
||||
bOk = bOk && ( SIC.GetCrossIntersCount() == 0) ;
|
||||
|
||||
// controllo che non si siano create intersezioni con le altre curve in punti interni
|
||||
for ( int i = 0 ; i < int( vCrvCheck.size()) && bOk ; ++ i) {
|
||||
IntersCurveCurve ICC( *vCrvCheck[i], *pCompoCL) ;
|
||||
for ( int j = 0 ; j < int( ICC.GetIntersCount()) && bOk ; ++ j) {
|
||||
IntCrvCrvInfo aInfo ;
|
||||
bOk = bOk && ICC.GetIntCrvCrvInfo( j, aInfo) ;
|
||||
bOk = bOk && ( AreSamePointApprox( ptStart, aInfo.IciA[0].ptI) ||
|
||||
AreSamePointApprox( ptEnd, aInfo.IciA[0].ptI)) ;
|
||||
for ( int i = 0 ; i < ssize( vCrvCheck) && bOk ; ++ i) {
|
||||
PtrOwner<ICurveComposite> pCrvCheckLocXY( CloneCurveComposite( vCrvCheck[i])) ;
|
||||
bOk = bOk && ( ! IsNull( pCrvCheckLocXY)) && pCrvCheckLocXY->IsValid() ;
|
||||
if ( bOk) {
|
||||
pCrvCheckLocXY->ToLoc( frLocXY) ;
|
||||
IntersCurveCurve ICC( *pCrvCheckLocXY, *pCompoLoc) ;
|
||||
for ( int j = 0 ; j < ICC.GetIntersCount() && bOk ; ++ j) {
|
||||
IntCrvCrvInfo aInfo ;
|
||||
bOk = ICC.GetIntCrvCrvInfo( j, aInfo) ;
|
||||
bOk = bOk && ( AreSamePointApprox( ptStart, aInfo.IciA[0].ptI) ||
|
||||
AreSamePointApprox( ptEnd, aInfo.IciA[0].ptI)) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// se tutto bene, sostiuisco la curva originale con la modificata
|
||||
if ( bOk)
|
||||
pCompo->CopyFrom( pCompoCL) ;
|
||||
if ( bOk) {
|
||||
pCompoLoc->ToGlob( frLocXY) ;
|
||||
pCompo->CopyFrom( pCompoLoc) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -4333,12 +4357,17 @@ SurfRoughing::SimplyfySfr( ISurfFlatRegion* pSfr) const
|
||||
return false ;
|
||||
ICRVCOMPOPOVECTOR vCrvEmpty ;
|
||||
|
||||
// recupero il frame localeXY della regione piana
|
||||
Frame3d frLoc ;
|
||||
Point3d ptC ; pSfr->GetCentroid( ptC) ;
|
||||
frLoc.Set( ptC, pSfr->GetNormVersor()) ;
|
||||
|
||||
// scorro tutti i loops di tutte le parti
|
||||
for ( int nC = 0 ; nC < pSfr->GetChunkCount() ; ++ nC) {
|
||||
for ( int nL = 0 ; nL < pSfr->GetLoopCount( nC) ; ++ nL) {
|
||||
// recupero la curva di Loop e la semplifico
|
||||
PtrOwner<ICurveComposite> pCompoLoop( ConvertCurveToComposite( pSfr->GetLoop( nC, nL))) ;
|
||||
if ( IsNull( pCompoLoop) || ! SimplifyCurve( pCompoLoop, vCrvEmpty))
|
||||
if ( IsNull( pCompoLoop) || ! SimplifyCurve( pCompoLoop, vCrvEmpty, frLoc))
|
||||
return false ;
|
||||
// inserisco le curve nella nuova regione (il primo loop di ogni parte è esterno)
|
||||
if ( nL == 0) {
|
||||
@@ -4446,6 +4475,11 @@ SurfRoughing::CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler
|
||||
if ( IsNull( pSfrRegular))
|
||||
return false ;
|
||||
|
||||
// recupero il frame locale XY della superficie
|
||||
Frame3d frLoc ;
|
||||
Point3d ptC ; pSfr->GetCentroid( ptC) ;
|
||||
frLoc.Set( ptC, pSfr->GetNormVersor()) ;
|
||||
|
||||
// scorro tutti i chunk della superficie
|
||||
for ( int nC = 0 ; nC < pSfr->GetChunkCount() ; ++ nC) {
|
||||
// creo una superficie di test
|
||||
@@ -4476,7 +4510,7 @@ SurfRoughing::CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler
|
||||
// se tratto aperto e non coincidente con tutta la curva
|
||||
if ( vpCrvs[i]->GetTempProp( 0) == TEMP_PROP_OPEN_EDGE && int( vpCrvs.size()) != 1) {
|
||||
// semplifico il loop per avere curve più uniformi
|
||||
SimplifyCurve( vpCrvs[i], vCrvClose) ;
|
||||
SimplifyCurve( vpCrvs[i], vCrvClose, frLoc) ;
|
||||
// riporto le proprietà
|
||||
vpCrvs[i]->SetTempProp( TEMP_PROP_OPEN_EDGE) ;
|
||||
for ( int j = 0 ; j < vpCrvs[i]->GetCurveCount() ; ++ j)
|
||||
|
||||
+1
-1
@@ -222,7 +222,7 @@ class SurfRoughing : public Machining
|
||||
bool CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler) ;
|
||||
bool ModifySurfForOpenCloseEdges( ISurfFlatRegion* pSfr, const Vector3d& vtTool, const ICurveComposite* pCrvCompo) const ;
|
||||
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrRef) const ;
|
||||
bool SimplifyCurve( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvCheck) const ;
|
||||
bool SimplifyCurve( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvCheck, const Frame3d& frLocXY) const ;
|
||||
bool SimplyfySfr( ISurfFlatRegion* pSfr) const ;
|
||||
bool CheckSafetyLinearLink( const Point3d& ptCurr, const Point3d& ptDest, const ISurfFlatRegion* pSfrCheck, const Vector3d& vtTool,
|
||||
bool& bSafe) const ;
|
||||
|
||||
+17
-3
@@ -45,6 +45,7 @@ enum nSurfRoughingKey {
|
||||
KEY_NNU,
|
||||
KEY_OL,
|
||||
KEY_OR,
|
||||
KEY_OVL,
|
||||
KEY_PS,
|
||||
KEY_S,
|
||||
KEY_SA,
|
||||
@@ -78,6 +79,7 @@ static const array<string,KEY_ZZZ> sSurfRoughingKey = {
|
||||
"NNU",
|
||||
"OL",
|
||||
"OR",
|
||||
"OVL",
|
||||
"PS",
|
||||
"S",
|
||||
"SA",
|
||||
@@ -113,7 +115,7 @@ SurfRoughingData::Clone( void) const
|
||||
bool
|
||||
SurfRoughingData::CopyFrom( const MachiningData* pMdata)
|
||||
{
|
||||
// è inutile copiare se sorgente coincide con destinazione
|
||||
// è inutile copiare se sorgente coincide con destinazione
|
||||
if ( pMdata == this)
|
||||
return true ;
|
||||
// la sorgente deve essere dello stesso tipo
|
||||
@@ -138,6 +140,7 @@ SurfRoughingData::CopyFrom( const MachiningData* pMdata)
|
||||
m_bInvert = pSdata->m_bInvert ;
|
||||
m_sDepth = pSdata->m_sDepth ;
|
||||
m_dStartPos = pSdata->m_dStartPos ;
|
||||
m_dOverlap = pSdata->m_dOverlap ;
|
||||
m_dStep = pSdata->m_dStep ;
|
||||
m_dSubStep = pSdata->m_dSubStep ;
|
||||
m_dSideStep = pSdata->m_dSideStep ;
|
||||
@@ -183,6 +186,7 @@ SurfRoughingData::SameAs(const MachiningData* pMdata) const
|
||||
m_bInvert == pSdata->m_bInvert &&
|
||||
m_sDepth == pSdata->m_sDepth &&
|
||||
abs( m_dStartPos - pSdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dOverlap - pSdata->m_dOverlap) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dStep - pSdata->m_dStep) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dSubStep - pSdata->m_dSubStep) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dSideStep - pSdata->m_dSideStep) < EPS_MACH_LEN_PAR &&
|
||||
@@ -202,7 +206,7 @@ SurfRoughingData::SameAs(const MachiningData* pMdata) const
|
||||
int
|
||||
SurfRoughingData::GetSize( void) const
|
||||
{
|
||||
// in debug verifico validità ultimo campo
|
||||
// in debug verifico validità ultimo campo
|
||||
assert( sSurfRoughingKey[KEY_UUID] == "UUID") ;
|
||||
return KEY_ZZZ ;
|
||||
}
|
||||
@@ -294,6 +298,9 @@ SurfRoughingData::FromString( const string& sString, int& nKey)
|
||||
case KEY_OL :
|
||||
bOk = ::FromString( sVal, m_dOffsL) ;
|
||||
break ;
|
||||
case KEY_OVL :
|
||||
bOk = ::FromString( sVal, m_dOverlap) ;
|
||||
break ;
|
||||
case KEY_PS :
|
||||
bOk = ::FromString( sVal, m_dStartPos) ;
|
||||
break ;
|
||||
@@ -358,6 +365,7 @@ SurfRoughingData::ToString( int nInd) const
|
||||
case KEY_NNU : return ( sSurfRoughingKey[KEY_NNU] + "=" + m_sUserNotes) ;
|
||||
case KEY_OL : return ( sSurfRoughingKey[KEY_OL] + "=" + ::ToString( m_dOffsL)) ;
|
||||
case KEY_OR : return ( sSurfRoughingKey[KEY_OR] + "=" + ::ToString( m_dOffsR)) ;
|
||||
case KEY_OVL : return ( sSurfRoughingKey[KEY_OVL] + "=" + ::ToString( m_dOverlap)) ;
|
||||
case KEY_PS : return ( sSurfRoughingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
|
||||
case KEY_S : return ( sSurfRoughingKey[KEY_S] + "=" + ::ToString( m_dSpeed)) ;
|
||||
case KEY_SA : return ( sSurfRoughingKey[KEY_SA] + "=" + ::ToString( m_dSideAngle)) ;
|
||||
@@ -377,7 +385,7 @@ SurfRoughingData::ToString( int nInd) const
|
||||
bool
|
||||
SurfRoughingData::IsOptional( int nKey) const
|
||||
{
|
||||
return ( nKey == KEY_LIEL || nKey == KEY_SST) ;
|
||||
return ( nKey == KEY_LIEL || nKey == KEY_SST || nKey == KEY_OVL) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -502,6 +510,9 @@ SurfRoughingData::SetParam( int nType, double dVal)
|
||||
case MPA_OFFSL :
|
||||
m_dOffsL = dVal ;
|
||||
return true ;
|
||||
case MPA_OVERL :
|
||||
m_dOverlap = dVal ;
|
||||
return true ;
|
||||
case MPA_DEPTH :
|
||||
m_sDepth = ::ToString( dVal) ;
|
||||
return true ;
|
||||
@@ -643,6 +654,9 @@ SurfRoughingData::GetParam( int nType, double& dVal) const
|
||||
case MPA_OFFSL :
|
||||
dVal = m_dOffsL ;
|
||||
return true ;
|
||||
case MPA_OVERL :
|
||||
dVal = m_dOverlap ;
|
||||
return true ;
|
||||
case MPA_STARTPOS :
|
||||
dVal = m_dStartPos ;
|
||||
return true ;
|
||||
|
||||
+7
-6
@@ -23,16 +23,17 @@ struct SurfRoughingData : public MachiningData
|
||||
std::string m_sInitAngs ; // angoli iniziali suggeriti (Nome1=val1,Nome2=val2)
|
||||
std::string m_sBlockedAxis ; // eventuale asse rotante bloccato (Nome=val)
|
||||
int m_nSolCh ; // criterio scelta soluzione (quando possibili molteplici)
|
||||
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
|
||||
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
|
||||
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
|
||||
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
|
||||
double m_dTipFeed ; // velocità di lavorazione di testa ( se 0 da utensile)
|
||||
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
|
||||
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
|
||||
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
|
||||
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
|
||||
double m_dTipFeed ; // velocità di lavorazione di testa ( se 0 da utensile)
|
||||
double m_dOffsR ; // offset radiale ( se UNKNOWN_PAR da utensile)
|
||||
double m_dOffsL ; // offset longitudinale ( se UNKNOWN_PAR da utensile)
|
||||
bool m_bInvert ; // flag di inversione direzione lavorazione
|
||||
std::string m_sDepth ; // affondamento massimo (espressione numerica)
|
||||
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
|
||||
double m_dOverlap ; // distanza di sovrapposizione con il contorno
|
||||
double m_dStep ; // passo di affondamento (0=nessun passo)
|
||||
double m_dSideStep ; // distanza tra le passate
|
||||
double m_dSubStep ; // distanza tra le passate intermedie
|
||||
@@ -50,7 +51,7 @@ struct SurfRoughingData : public MachiningData
|
||||
SurfRoughingData( void)
|
||||
: m_ToolUuid(), m_nSolCh( 0), m_dSpeed( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
|
||||
m_dOffsR( UNKNOWN_PAR), m_dOffsL( UNKNOWN_PAR), m_bInvert( false),
|
||||
m_dStartPos( 0), m_dStep( 0), m_dSideStep( 0), m_dSubStep( 0), m_nSubType( 0), m_dSideAngle( 0),
|
||||
m_dStartPos( 0), m_dOverlap( 0), m_dStep( 0), m_dSideStep( 0), m_dSubStep( 0), m_nSubType( 0), m_dSideAngle( 0),
|
||||
m_nLeadInType( 0), m_dLiTang( 0), m_dLiElev( 0),
|
||||
m_nLeadOutType( 0), m_dLoTang( 0), m_dApprox( 0) {}
|
||||
SurfRoughingData* Clone( void) const override ;
|
||||
|
||||
+19
-17
@@ -1740,10 +1740,20 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sPathName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, GREEN) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, m_dElev) ;
|
||||
|
||||
// Sistemazioni per angoli interni
|
||||
AdjustPathForInternalAngles( pCompo) ;
|
||||
|
||||
// creo l'anteprima del percorso
|
||||
if ( ! GeneratePreView( nPxId, pCompo, dAddedOverlap))
|
||||
if ( ! GeneratePreView( nPxId, pCompo, vtTool, dAddedOverlap))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -1783,10 +1793,10 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, double dAddedOverlap)
|
||||
WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, const Vector3d& vtTool, double dAddedOverlap)
|
||||
{
|
||||
// colore taglio, dipendente da angolo di inclinazione
|
||||
Color colCut = LIME ;
|
||||
Color colCut = TEAL ;
|
||||
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL)
|
||||
colCut = FUCHSIA ;
|
||||
// creo copia della curva composita
|
||||
@@ -1804,7 +1814,7 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
|
||||
PtrOwner<ISurfFlatRegion> pSfr ;
|
||||
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
|
||||
double dRad = 0.5 * m_TParams.m_dDiam * dSideCoeff ;
|
||||
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), dRad, false, false)) ;
|
||||
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), dRad, false, true)) ;
|
||||
if ( IsNull( pSfr))
|
||||
return false ;
|
||||
// aggiungo eventuali anelli su angoli esterni
|
||||
@@ -1822,7 +1832,7 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
|
||||
m_pGeomDB->SetMaterial( nRRId, INVISIBLE) ;
|
||||
|
||||
// regione per attacco
|
||||
PtrOwner<ISurfFlatRegion> pSfrLI( GenerateLeadInPreview( pCompo, bClosed)) ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrLI( GenerateLeadInPreview( pCompo, vtTool, bClosed)) ;
|
||||
if ( IsNull( pSfrLI))
|
||||
return false ;
|
||||
if ( pSfrLI->IsValid()) {
|
||||
@@ -1832,7 +1842,6 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
|
||||
if ( IsNull( pCrvLI))
|
||||
return false ;
|
||||
int nCLIId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrvLI)) ;
|
||||
// int nCLIId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfrLI)) ;
|
||||
if ( nCLIId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// assegno nome e colore
|
||||
@@ -1854,7 +1863,7 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
|
||||
}
|
||||
|
||||
// regione per uscita
|
||||
PtrOwner<ISurfFlatRegion> pSfrLO( GenerateLeadOutPreview( pCompo)) ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrLO( GenerateLeadOutPreview( pCompo, vtTool)) ;
|
||||
if ( IsNull( pSfrLO))
|
||||
return false ;
|
||||
if ( pSfrLO->IsValid()) {
|
||||
@@ -2015,7 +2024,7 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ISurfFlatRegion*
|
||||
WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo, bool bClosed)
|
||||
WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo, const Vector3d& vtN, bool bClosed)
|
||||
{
|
||||
// Creo la superficie
|
||||
PtrOwner<ISurfFlatRegion> pSfr( CreateSurfFlatRegion()) ;
|
||||
@@ -2028,8 +2037,6 @@ WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo, bool bClosed
|
||||
// Recupero punto e direzione iniziali del percorso
|
||||
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
|
||||
Vector3d vtStart ; pCompo->GetStartDir( vtStart) ;
|
||||
// Recupero versore estrusione
|
||||
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
|
||||
|
||||
// Verifico il tipo
|
||||
int nType = GetLeadInType() ;
|
||||
@@ -2082,7 +2089,7 @@ WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo, bool bClosed
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ISurfFlatRegion*
|
||||
WaterJetting::GenerateLeadOutPreview( const ICurveComposite* pCompo)
|
||||
WaterJetting::GenerateLeadOutPreview( const ICurveComposite* pCompo, const Vector3d& vtN)
|
||||
{
|
||||
// Creo la regione
|
||||
PtrOwner<ISurfFlatRegion> pSfr( CreateSurfFlatRegion()) ;
|
||||
@@ -2112,8 +2119,6 @@ WaterJetting::GenerateLeadOutPreview( const ICurveComposite* pCompo)
|
||||
// Recupero punto e direzione iniziali del percorso
|
||||
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtEnd ; pCompo->GetEndDir( vtEnd) ;
|
||||
// Recupero versore estrusione
|
||||
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
|
||||
// Calcolo la curva di uscita
|
||||
PtrOwner<ICurve> pCrv ;
|
||||
switch ( nType) {
|
||||
@@ -2320,9 +2325,6 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
// recupero distanze di sicurezza
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
|
||||
// Recupero versore estrusione
|
||||
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
|
||||
|
||||
// verifico se la curva è chiusa a meno di eventuale dAddedOverlap
|
||||
bool bClosed = ( pCompo->IsClosed() || dAddedOverlap > EPS_SMALL) ;
|
||||
|
||||
@@ -2404,7 +2406,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
|
||||
// anello
|
||||
bool bLoopOk = true ;
|
||||
PtrOwner<ICurve> pCrvA( GetArc2PVN( ptPe, ptPs, vtEnd, vtN)) ;
|
||||
PtrOwner<ICurve> pCrvA( GetArc2PVN( ptPe, ptPs, vtEnd, vtTool)) ;
|
||||
if ( ! IsNull( pCrvA) && pCrvA->GetType() == CRV_ARC) {
|
||||
// verifico che l'anello non interferisca con la curva di lavoro
|
||||
IntersCurveCurve intAC( *pCrvA, *pCompo) ;
|
||||
|
||||
+3
-3
@@ -82,9 +82,9 @@ class WaterJetting : public Machining
|
||||
bool VerifySideAngle( void) ;
|
||||
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
|
||||
bool AdjustPathForInternalAngles( ICurveComposite* pCompo) ;
|
||||
bool GeneratePreView( int nPathId, const ICurveComposite* pCompo, double dAddedOverlap) ;
|
||||
ISurfFlatRegion* GenerateLeadInPreview( const ICurveComposite* pCompo, bool bClosed) ;
|
||||
ISurfFlatRegion* GenerateLeadOutPreview( const ICurveComposite* pCompo) ;
|
||||
bool GeneratePreView( int nPathId, const ICurveComposite* pCompo, const Vector3d& vtTool, double dAddedOverlap) ;
|
||||
ISurfFlatRegion* GenerateLeadInPreview( const ICurveComposite* pCompo, const Vector3d& vtN, bool bClosed) ;
|
||||
ISurfFlatRegion* GenerateLeadOutPreview( const ICurveComposite* pCompo, const Vector3d& vtN) ;
|
||||
bool AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
|
||||
bool AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool, bool bSplitArcs, double dAddedOverlap) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, bool bSplit) ;
|
||||
|
||||
Reference in New Issue
Block a user