Merge commit 'c8c8d9e2a52041f2b511b5a4d9325945733f0a22' into svuotature
This commit is contained in:
+113
-5
@@ -33,6 +33,7 @@
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
#include "/EgtDev/Include/EGkCDeBoxClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkCAvToolSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
@@ -379,6 +380,8 @@ Operation::GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2, c
|
||||
return true ;
|
||||
}
|
||||
|
||||
#if 1
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad,
|
||||
@@ -459,6 +462,102 @@ Operation::GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool,
|
||||
return true ;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad,
|
||||
const Vector3d& vtDir, double& dElev) const
|
||||
{
|
||||
const double STD_TOOL_LEN = 100 ;
|
||||
return GetElevation( nPhase, ptP, vtTool, dRad, STD_TOOL_LEN, vtDir, dElev) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen,
|
||||
const Vector3d& vtDir, double& dElev) const
|
||||
{
|
||||
// risultato di default
|
||||
dElev = 0 ;
|
||||
// verifico oggetti base
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// inizializzo elevazioni per ogni grezzo
|
||||
INTDBLVECTOR vRawElev ;
|
||||
// ciclo sui grezzi della fase
|
||||
int nRawId = m_pMchMgr->GetFirstRawPart() ;
|
||||
while ( nRawId != GDB_ID_NULL) {
|
||||
// verifico che il grezzo compaia nella fase
|
||||
if ( m_pMchMgr->VerifyRawPartPhase( nRawId, nPhase)) {
|
||||
// recupero la trimesh del grezzo
|
||||
int nStmId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nStmId)) ;
|
||||
if ( pStm != nullptr) {
|
||||
// recupero il riferimento della trimesh
|
||||
Frame3d frStm ;
|
||||
m_pGeomDB->GetGlobFrame( nStmId, frStm) ;
|
||||
// porto posizione e direzioni in questo riferimento
|
||||
Point3d ptPL = GetToLoc( ptP, frStm) ;
|
||||
Vector3d vtToolL = GetToLoc( vtTool, frStm) ;
|
||||
Vector3d vtDirL = GetToLoc( vtDir, frStm) ;
|
||||
// determino quanto allontanarsi
|
||||
PtrOwner<ICAvToolSurfTm> pCAvTlStm( CreateCAvToolSurfTm()) ;
|
||||
if ( IsNull( pCAvTlStm))
|
||||
return false ;
|
||||
pCAvTlStm->SetStdTool( dLen, dRad, 0) ;
|
||||
pCAvTlStm->SetSurfTm( *pStm) ;
|
||||
double dDist = 0 ;
|
||||
// per Collision Avoid il punto di riferimento non è il tip dell'utensile ma il naso mandrino
|
||||
if ( ! pCAvTlStm->TestPosition( ptPL + dLen * vtToolL, vtToolL, vtDirL, dDist))
|
||||
return false ;
|
||||
if ( dDist > 0)
|
||||
vRawElev.emplace_back( nStmId, dDist) ;
|
||||
}
|
||||
}
|
||||
// passo al grezzo successivo
|
||||
nRawId = m_pMchMgr->GetNextRawPart( nRawId) ;
|
||||
}
|
||||
// se trovate elevazioni
|
||||
if ( ! vRawElev.empty()) {
|
||||
// ordino il vettore secondo l'elevazione crescente
|
||||
sort( vRawElev.begin(), vRawElev.end(), []( const INTDBL& a, const INTDBL& b)
|
||||
{ return a.second < b.second ; }) ;
|
||||
// box dell'utensile nella posizione iniziale
|
||||
BBox3d b3Tool ;
|
||||
b3Tool.Add( ptP) ;
|
||||
b3Tool.Add( ptP + dLen * vtTool) ;
|
||||
if ( vtTool.IsX())
|
||||
b3Tool.Expand( 0, dRad, dRad) ;
|
||||
else if ( vtTool.IsY())
|
||||
b3Tool.Expand( dRad, 0, dRad) ;
|
||||
else if ( vtTool.IsZ())
|
||||
b3Tool.Expand( dRad, dRad, 0) ;
|
||||
else {
|
||||
double dExpandX = dRad * sqrt( 1 - vtTool.x * vtTool.x) ;
|
||||
double dExpandY = dRad * sqrt( 1 - vtTool.y * vtTool.y) ;
|
||||
double dExpandZ = dRad * sqrt( 1 - vtTool.z * vtTool.z) ;
|
||||
b3Tool.Expand( dExpandX, dExpandY, dExpandZ) ;
|
||||
}
|
||||
b3Tool.Expand( MAX_DIST_RAW) ;
|
||||
// verifico la reale interferenza dell'utensile con i diversi grezzi
|
||||
for ( int i = 0 ; i < vRawElev.size() ; ++ i) {
|
||||
// box del grezzo
|
||||
BBox3d b3Raw ;
|
||||
m_pGeomDB->GetGlobalBBox( vRawElev[i].first, b3Raw) ;
|
||||
// confronto con il box dell'utensile nella posizione precedente
|
||||
BBox3d b3CurrTool = b3Tool ;
|
||||
b3CurrTool.Translate( dElev * vtDir) ;
|
||||
if ( b3Raw.Overlaps( b3CurrTool))
|
||||
dElev = vRawElev[i].second ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetAhPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
|
||||
@@ -917,8 +1016,12 @@ Operation::GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3
|
||||
IntersCurveCurve intCC( *pRay, *pOut) ;
|
||||
int nInters = intCC.GetIntersCount() ;
|
||||
IntCrvCrvInfo aInfo ;
|
||||
if ( nInters > 0 && intCC.GetIntCrvCrvInfo( nInters - 1, aInfo))
|
||||
dDist = aInfo.IciA[0].dU * RAY_LEN - EXTRA_LEN ;
|
||||
if ( nInters > 0 && intCC.GetIntCrvCrvInfo( nInters - 1, aInfo)) {
|
||||
if ( ! aInfo.bOverlap)
|
||||
dDist = aInfo.IciA[0].dU * RAY_LEN - EXTRA_LEN ;
|
||||
else
|
||||
dDist = aInfo.IciA[1].dU * RAY_LEN - EXTRA_LEN ;
|
||||
}
|
||||
else
|
||||
dDist = 0 ;
|
||||
return true ;
|
||||
@@ -1698,6 +1801,11 @@ Operation::CalcMirrorByDouble( int nClId, const std::string& sUserNotes)
|
||||
// eseguo mirroring rispetto a piano opportuno
|
||||
m_pGeomDB->MirrorGroup( nDblId, ptOn, vtNorm) ;
|
||||
|
||||
// se presente una differenza in Z, eseguo spostamento
|
||||
double dDeltaZ ;
|
||||
if ( GetValInNotes( sUserNotes, "DeltaZ", dDeltaZ) && abs( dDeltaZ) > EPS_SMALL)
|
||||
m_pGeomDB->TranslateGlob( nDblId, Vector3d( 0, 0, dDeltaZ)) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -2120,7 +2228,7 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
|
||||
else
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
|
||||
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
vAng1[i] = m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
}
|
||||
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente
|
||||
if ( nRStat < 0 && vAng1.size() >= 1) {
|
||||
@@ -2171,13 +2279,13 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
|
||||
else
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
|
||||
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
vAng1[i] = m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
if ( bRotContOnNext)
|
||||
vAng2[i] = AngleNearAngle( vAng2[i], vAxRotPrec[i]) ;
|
||||
else
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ;
|
||||
if ( abs( vAng2[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
vAng2[i] = m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
|
||||
}
|
||||
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente
|
||||
if ( nRStat < 0 && vAng1.size() >= 1) {
|
||||
|
||||
Reference in New Issue
Block a user