EgtMachKernel 1.8e4 :
- modifiche per lavorazione di lama di curve dalla parte convessa (esterna) con continuità - aggiunta massima inclinazione lama per archi interni come parametro generale delle lavorazioni.
This commit is contained in:
@@ -566,8 +566,6 @@ bool
|
||||
Drilling::Chain( int nGrpDestId)
|
||||
{
|
||||
// vettore puntatori alle curve
|
||||
typedef PtrOwner<ICurve> POWNCURVE ;
|
||||
typedef std::vector<POWNCURVE> POCRVVECTOR ;
|
||||
POCRVVECTOR vpCrvs ;
|
||||
vpCrvs.reserve( m_vId.size()) ;
|
||||
// recupero tutte le curve e le porto in globale
|
||||
|
||||
Binary file not shown.
@@ -297,6 +297,8 @@ MachMgr::MdbSetGeneralParam( int nType, double dVal)
|
||||
return pMsMgr->SetHoleDiamToler( dVal) ;
|
||||
case MGP_EXTSAWARCMINRAD :
|
||||
return pMsMgr->SetExtSawArcMinRad( dVal) ;
|
||||
case MGP_INTSAWARCMAXSIDEANG :
|
||||
return pMsMgr->SetIntSawArcMaxSideAng( dVal) ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
@@ -363,6 +365,9 @@ MachMgr::MdbGetGeneralParam( int nType, double& dVal) const
|
||||
case MGP_EXTSAWARCMINRAD :
|
||||
dVal = pMsMgr->GetExtSawArcMinRad() ;
|
||||
return true ;
|
||||
case MGP_INTSAWARCMAXSIDEANG :
|
||||
dVal = pMsMgr->GetIntSawArcMaxSideAng() ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
+26
-2
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2017
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachiningsMgr.cpp Data : 02.03.17 Versione : 1.8c1
|
||||
// File : MachiningsMgr.cpp Data : 17.05.17 Versione : 1.8e1
|
||||
// Contenuto : Implementazione gestore database lavorazioni.
|
||||
//
|
||||
//
|
||||
@@ -9,6 +9,7 @@
|
||||
// Modifiche : 02.06.15 DS Creazione modulo.
|
||||
// 13.07.16 DS Agg. gestione SplitArcs (MF_CURR_VER = 1005).
|
||||
// 02.03.17 DS Aggiunto controllo nome.
|
||||
// 17.05.17 DS Agg. gestione IntSawArcMaxSideAng (MF_CURR_VER = 1006).
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -36,7 +37,7 @@ const string MF_HEADER = "[HEADER]" ;
|
||||
const string MF_VERSION = "VERSION" ;
|
||||
const string MF_TOTAL = "TOTAL" ;
|
||||
const string MF_SIZE = "SIZE" ;
|
||||
const int MF_CURR_VER = 1005 ;
|
||||
const int MF_CURR_VER = 1006 ;
|
||||
const string MF_GENERAL = "[GENERAL]" ;
|
||||
const string MF_3AXCOMP = "3AXCOMP" ;
|
||||
const bool MF_CURR_3AXCOMP = false ;
|
||||
@@ -52,6 +53,8 @@ const string MF_HOLEDTOL = "HOLEDTOL" ;
|
||||
const double MF_CURR_HOLEDTOL = 10 * EPS_SMALL ;
|
||||
const string MF_EXTSAWARCMINRAD = "EXTSAWARCMINRAD" ;
|
||||
const double MF_CURR_EXTSAWARCMINRAD = 200 ;
|
||||
const string MF_INTSAWARCMAXSIDEANG = "INTSAWARCMAXSIDEANG" ;
|
||||
const double MF_CURR_INTSAWARCMAXSIDEANG = 45 ;
|
||||
const string MF_SPLITARCS = "SPLITARCS" ;
|
||||
const int MF_CURR_SPLITARCS = SPLAR_NEVER ;
|
||||
|
||||
@@ -70,6 +73,7 @@ MachiningsMgr::MachiningsMgr( void)
|
||||
m_dExtraROnDrillRegion = MF_CURR_EXTRARDR ;
|
||||
m_dHoleDiamToler = MF_CURR_HOLEDTOL ;
|
||||
m_dExtSawArcMinRad = MF_CURR_EXTSAWARCMINRAD ;
|
||||
m_dIntSawArcMaxSideAng = MF_CURR_INTSAWARCMAXSIDEANG ;
|
||||
m_nSplitArcs = MF_CURR_SPLITARCS ;
|
||||
}
|
||||
|
||||
@@ -269,6 +273,8 @@ MachiningsMgr::LoadGeneral( Scanner& TheScanner, bool& bEnd)
|
||||
bOk = FromString( sVal, m_dHoleDiamToler) ;
|
||||
else if ( ToUpper( sKey) == MF_EXTSAWARCMINRAD)
|
||||
bOk = FromString( sVal, m_dExtSawArcMinRad) ;
|
||||
else if ( ToUpper( sKey) == MF_INTSAWARCMAXSIDEANG)
|
||||
bOk = FromString( sVal, m_dIntSawArcMaxSideAng) ;
|
||||
else if ( ToUpper( sKey) == MF_SPLITARCS)
|
||||
bOk = FromString( sVal, m_nSplitArcs) ;
|
||||
else
|
||||
@@ -443,6 +449,8 @@ MachiningsMgr::SaveGeneral( Writer& TheWriter) const
|
||||
bOk = bOk && TheWriter.OutText( sOut) ;
|
||||
sOut = MF_EXTSAWARCMINRAD + "=" + ToString( m_dExtSawArcMinRad) ;
|
||||
bOk = bOk && TheWriter.OutText( sOut) ;
|
||||
sOut = MF_INTSAWARCMAXSIDEANG + "=" + ToString( m_dIntSawArcMaxSideAng) ;
|
||||
bOk = bOk && TheWriter.OutText( sOut) ;
|
||||
sOut = MF_SPLITARCS + "=" + ToString( m_nSplitArcs) ;
|
||||
bOk = bOk && TheWriter.OutText( sOut) ;
|
||||
|
||||
@@ -1014,6 +1022,22 @@ MachiningsMgr::SetExtSawArcMinRad( double dRad)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachiningsMgr::SetIntSawArcMaxSideAng( double dSideAng)
|
||||
{
|
||||
// deve essere un valore positivo e minore o uguale al limite
|
||||
const double MAX_SIDE_ANG = 60 ;
|
||||
if ( dSideAng < - EPS_ANG_SMALL || dSideAng > MAX_SIDE_ANG + EPS_ANG_SMALL)
|
||||
return false ;
|
||||
// se cambiato, salvo e setto modifica
|
||||
if ( fabs( dSideAng - m_dIntSawArcMaxSideAng) > EPS_ANG_SMALL) {
|
||||
m_dIntSawArcMaxSideAng = dSideAng ;
|
||||
m_bModified = true ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachiningsMgr::SetSplitArcs( int nFlag)
|
||||
|
||||
@@ -69,6 +69,9 @@ class MachiningsMgr
|
||||
bool SetExtSawArcMinRad( double dRad) ;
|
||||
double GetExtSawArcMinRad( void)
|
||||
{ return m_dExtSawArcMinRad ; }
|
||||
bool SetIntSawArcMaxSideAng( double dSideAng) ;
|
||||
double GetIntSawArcMaxSideAng( void)
|
||||
{ return m_dIntSawArcMaxSideAng ; }
|
||||
bool SetSplitArcs( int nFlag) ;
|
||||
int GetSplitArcs( void)
|
||||
{ return m_nSplitArcs ; }
|
||||
@@ -110,5 +113,6 @@ class MachiningsMgr
|
||||
double m_dExtraROnDrillRegion ;
|
||||
double m_dHoleDiamToler ;
|
||||
double m_dExtSawArcMinRad ;
|
||||
double m_dIntSawArcMaxSideAng ;
|
||||
int m_nSplitArcs ;
|
||||
} ;
|
||||
+2
-2
@@ -117,8 +117,8 @@ class Operation : public IUserObj
|
||||
int AddLinearMove( const Point3d& ptP, const std::string& sName) ;
|
||||
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN) ;
|
||||
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, const std::string& sName) ;
|
||||
int AddCurveMove( const ICurve* pCrv) ;
|
||||
int AddCurveMove( const ICurve* pCrv, const std::string& sName) ;
|
||||
int AddCurveMove( const ICurve* pCrv, bool bOnlySimple = false) ;
|
||||
int AddCurveMove( const ICurve* pCrv, const std::string& sName, bool bOnlySimple = false) ;
|
||||
bool ResetMoveData( void) ;
|
||||
|
||||
protected :
|
||||
|
||||
+8
-5
@@ -303,7 +303,7 @@ Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddCurveMove( const ICurve* pCrv)
|
||||
Operation::AddCurveMove( const ICurve* pCrv, bool bOnlySimple)
|
||||
{
|
||||
// verifico che la curva esista
|
||||
if ( pCrv == nullptr)
|
||||
@@ -324,8 +324,8 @@ Operation::AddCurveMove( const ICurve* pCrv)
|
||||
pArc->GetEndPoint( ptP3) ;
|
||||
return AddArcMove( ptP3, ptCen, dAngCen, vtN) ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
// se ammesse curve composite
|
||||
else if ( ! bOnlySimple) {
|
||||
// in ogni caso, converto in archi e rette
|
||||
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
if ( ! pCompo->AddCurve( *pCrv))
|
||||
@@ -364,13 +364,16 @@ Operation::AddCurveMove( const ICurve* pCrv)
|
||||
}
|
||||
return nFirstId ;
|
||||
}
|
||||
// altrimenti
|
||||
else
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddCurveMove( const ICurve* pCrv, const string& sName)
|
||||
Operation::AddCurveMove( const ICurve* pCrv, const string& sName, bool bOnlySimple)
|
||||
{
|
||||
int nFirstId = AddCurveMove( pCrv) ;
|
||||
int nFirstId = AddCurveMove( pCrv, bOnlySimple) ;
|
||||
int nId = nFirstId ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
m_pGeomDB->SetName( nId, sName) ;
|
||||
|
||||
+445
-296
@@ -23,6 +23,7 @@
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkChainCurves.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
#include "/EgtDev/Include/EGnStringKeyVal.h"
|
||||
@@ -1123,18 +1124,77 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
|
||||
VerifyArcs( pCompo) ;
|
||||
|
||||
// ciclo sulle curve elementari
|
||||
// flag di curva chiusa
|
||||
bool bClosed = pCompo->IsClosed() ;
|
||||
int nMaxInd = pCompo->GetCurveCount() - 1 ;
|
||||
|
||||
// calcolo gli eventuali punti di perdita di tangenza e di cambio di concavità
|
||||
DBLVECTOR vU ;
|
||||
const double ANG_PERD_TG = 1.0 ;
|
||||
const ICurveArc* pArc = ( bClosed ? GetCurveArc( pCompo->GetLastCurve()) : nullptr) ;
|
||||
int nCurrConv = ( pArc != nullptr ? ( pArc->GetAngCenter() > 0 ? 1 : - 1) : 0) ;
|
||||
for ( int i = ( bClosed ? 0 : 1) ; i < pCompo->GetCurveCount() ; ++ i) {
|
||||
// verifico perdita di tangenza
|
||||
Point3d ptPrev, ptNext ;
|
||||
Vector3d vtPrev, vtNext ;
|
||||
if ( pCompo->GetPointTang( i, ICurve::FROM_MINUS, ptPrev, vtPrev) &&
|
||||
pCompo->GetPointTang( i, ICurve::FROM_PLUS, ptNext, vtNext) &&
|
||||
vtPrev * vtNext < cos( ANG_PERD_TG * DEGTORAD)) {
|
||||
vU.push_back( i) ;
|
||||
nCurrConv = 0 ;
|
||||
continue ;
|
||||
}
|
||||
// verifico cambio di concavità e/o lavorazione interna
|
||||
const ICurve* pCrv = pCompo->GetCurve( i) ;
|
||||
if ( pCrv->GetType() == CRV_ARC) {
|
||||
if ( GetCurveArc( pCrv)->GetAngCenter() > 0) {
|
||||
if ( nCurrConv == - 1 || m_Params.m_nWorkSide == SAW_WS_LEFT)
|
||||
vU.push_back( i) ;
|
||||
nCurrConv = 1 ;
|
||||
}
|
||||
else {
|
||||
if ( nCurrConv == 1 || m_Params.m_nWorkSide == SAW_WS_RIGHT)
|
||||
vU.push_back( i) ;
|
||||
nCurrConv = - 1 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// creo i tratti di curva continui e uniformi
|
||||
POCRVVECTOR vpCrvs ;
|
||||
vpCrvs.reserve( vU.size() + 2) ;
|
||||
if ( vU.size() == 0)
|
||||
vpCrvs.emplace_back( pCompo->Clone()) ;
|
||||
else {
|
||||
if ( bClosed) {
|
||||
vpCrvs.emplace_back( pCompo->CopyParamRange( vU.back(), vU.front())) ;
|
||||
for ( int i = 1 ; i < int( vU.size()) ; ++ i)
|
||||
vpCrvs.emplace_back( pCompo->CopyParamRange( vU[i-1], vU[i])) ;
|
||||
}
|
||||
else {
|
||||
vpCrvs.emplace_back( pCompo->CopyParamRange( 0, vU.front())) ;
|
||||
for ( int i = 1 ; i < int( vU.size()) ; ++ i)
|
||||
vpCrvs.emplace_back( pCompo->CopyParamRange( vU[i-1], vU[i])) ;
|
||||
vpCrvs.emplace_back( pCompo->CopyParamRange( vU.back(), pCompo->GetCurveCount())) ;
|
||||
}
|
||||
}
|
||||
|
||||
// ciclo sulle curve
|
||||
int nMaxInd = int( vpCrvs.size()) - 1 ;
|
||||
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
|
||||
// curva precedente
|
||||
int j = (( i == 0 && bClosed) ? nMaxInd : i - 1) ;
|
||||
const ICurve* pCrvP = pCompo->GetCurve( j) ; ;
|
||||
const ICurve* pCrvP = nullptr ;
|
||||
if ( i > 0)
|
||||
pCrvP = vpCrvs[i - 1] ;
|
||||
else if ( bClosed)
|
||||
pCrvP = vpCrvs[nMaxInd] ;
|
||||
// curva corrente
|
||||
const ICurve* pCrvC = pCompo->GetCurve( i) ;
|
||||
const ICurve* pCrvC = vpCrvs[i] ;
|
||||
// curva successiva
|
||||
int k = (( i == nMaxInd && bClosed) ? 0 : i + 1) ;
|
||||
const ICurve* pCrvN = pCompo->GetCurve( k) ;
|
||||
const ICurve* pCrvN = nullptr ;
|
||||
if ( i < nMaxInd)
|
||||
pCrvN = vpCrvs[i + 1] ;
|
||||
else if ( bClosed)
|
||||
pCrvN = vpCrvs[0] ;
|
||||
// elaborazioni sulla curva corrente
|
||||
string sName = sPathName + "_" + ToString( i) ;
|
||||
if ( ! ProcessEntity( pCrvP, pCrvC, pCrvN, dDepth, dExtraCut, i == 0, i == nMaxInd, sName, nPvId, nClId))
|
||||
@@ -1150,38 +1210,53 @@ Sawing::ProcessEntity( const ICurve* pCrvP, const ICurve* pCrvC, const ICurve* p
|
||||
double dDepth, double dExtraCut, bool bIsFirst, bool bIsLast,
|
||||
const string& sName, int nPvId, int nClId)
|
||||
{
|
||||
switch ( pCrvC->GetType()) {
|
||||
case CRV_LINE :
|
||||
{
|
||||
const ICurveLine* pLine = GetCurveLine( pCrvC) ;
|
||||
if ( pLine == nullptr)
|
||||
return false ;
|
||||
return ProcessLine( pCrvP, pLine, pCrvN, dDepth, dExtraCut, bIsFirst, bIsLast, sName, nPvId, nClId) ;
|
||||
}
|
||||
case CRV_ARC :
|
||||
// la curva corrente deve essere una composita
|
||||
const ICurveComposite* pCompo = GetCurveComposite( pCrvC) ;
|
||||
if ( pCompo == nullptr)
|
||||
return false ;
|
||||
|
||||
// se formata da una sola linea
|
||||
if ( pCompo->GetCurveCount() == 1 && pCompo->GetFirstCurve()->GetType() == CRV_LINE) {
|
||||
const ICurveLine* pLine = GetCurveLine( pCompo->GetFirstCurve()) ;
|
||||
if ( pLine == nullptr)
|
||||
return false ;
|
||||
return ProcessLine( pCrvP, pLine, pCrvN, dDepth, dExtraCut, bIsFirst, bIsLast, sName, nPvId, nClId) ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
if ( m_Params.m_nCurveUse == SAW_CRV_KEEP) {
|
||||
const ICurveArc* pArc = GetCurveArc( pCrvC) ;
|
||||
if ( pArc == nullptr)
|
||||
return false ;
|
||||
// verifico che non ci sia angolo di fianco
|
||||
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL) {
|
||||
m_pMchMgr->SetLastError( 2207, "Error in Sawing : SideAngle not allowed on Arc") ;
|
||||
return false ;
|
||||
}
|
||||
// se arco lavorato dall'esterno
|
||||
if ( ( pArc->GetAngCenter() > 0 && m_Params.m_nWorkSide == SAW_WS_RIGHT) ||
|
||||
( pArc->GetAngCenter() < 0 && m_Params.m_nWorkSide == SAW_WS_LEFT))
|
||||
return ProcessExtArc( pCrvP, pArc, pCrvN, dDepth, dExtraCut, bIsFirst, bIsLast, sName, nPvId, nClId) ;
|
||||
// altrimenti arco lavorato dall'interno
|
||||
else
|
||||
// determino la convessità
|
||||
int nConv = 0 ;
|
||||
for ( int i = 0 ; i < pCompo->GetCurveCount() ; ++ i) {
|
||||
const ICurveArc* pArc = GetCurveArc( pCompo->GetCurve( i)) ;
|
||||
if ( pArc != nullptr) {
|
||||
nConv = ( pArc->GetAngCenter() > 0 ? 1 : - 1) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// se curva lavorata dall'esterno
|
||||
if ( ( nConv > 0 && m_Params.m_nWorkSide == SAW_WS_RIGHT) ||
|
||||
( nConv < 0 && m_Params.m_nWorkSide == SAW_WS_LEFT))
|
||||
return ProcessExtCurve( pCrvP, pCompo, pCrvN, dDepth, dExtraCut, bIsFirst, bIsLast, sName, nPvId, nClId) ;
|
||||
// altrimenti curva lavorata dall'interno
|
||||
else {
|
||||
// deve essere un solo arco
|
||||
const ICurveArc* pArc = GetCurveArc( pCompo->GetFirstCurve()) ;
|
||||
if ( pArc == nullptr || pCompo->GetCurveCount() != 1)
|
||||
return false ;
|
||||
// eseguo
|
||||
return ProcessIntArc( pCrvP, pArc, pCrvN, dDepth, dExtraCut, bIsFirst, bIsLast, sName, nPvId, nClId) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG_INFO( GetEMkLogger(), "Warning in Sawing : Skipped Arc") ;
|
||||
return true ;
|
||||
}
|
||||
default :
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1553,65 +1628,94 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Sawing::ProcessExtArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve* pCrvN,
|
||||
double dDepth, double dExtraCut, bool bIsFirst, bool bIsLast,
|
||||
const string& sName, int nPvId, int nClId)
|
||||
Sawing::ProcessExtCurve( const ICurve* pCrvP, const ICurveComposite* pCrvC, const ICurve* pCrvN,
|
||||
double dDepth, double dExtraCut, bool bIsFirst, bool bIsLast,
|
||||
const string& sName, int nPvId, int nClId)
|
||||
{
|
||||
// copio la curva
|
||||
PtrOwner<ICurveArc> pArc( pArcC->Clone()) ;
|
||||
if ( IsNull( pArc))
|
||||
PtrOwner<ICurveComposite> pCrv( pCrvC->Clone()) ;
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
// verifico che il raggio sia superiore al minimo
|
||||
if ( pArc->GetRadius() < m_pMchMgr->GetCurrMachiningsMgr()->GetExtSawArcMinRad()) {
|
||||
// verifico che il raggio di ogni arco componente sia superiore al minimo
|
||||
double dMinRad = INFINITO ;
|
||||
for ( const ICurve* pSmpCrv = pCrv->GetFirstCurve() ;
|
||||
pSmpCrv != nullptr ;
|
||||
pSmpCrv = pCrv->GetNextCurve()) {
|
||||
if ( pSmpCrv->GetType() == CRV_ARC) {
|
||||
double dRad = GetCurveArc( pSmpCrv)->GetRadius() ;
|
||||
if ( dRad < dMinRad)
|
||||
dMinRad = dRad ;
|
||||
}
|
||||
}
|
||||
if ( dMinRad < m_pMchMgr->GetCurrMachiningsMgr()->GetExtSawArcMinRad()) {
|
||||
LOG_INFO( GetEMkLogger(), "Warning in Sawing : Radius too small in ExtSawArc") ;
|
||||
return true ;
|
||||
}
|
||||
// Recupero le direzioni iniziale, intermedia e finale dell'arco
|
||||
Vector3d vtStaDirC ;
|
||||
pArc->GetStartDir( vtStaDirC) ;
|
||||
Vector3d vtMidDirC ;
|
||||
pArc->GetMidDir( vtMidDirC) ;
|
||||
Vector3d vtEndDirC ;
|
||||
pArc->GetEndDir( vtEndDirC) ;
|
||||
// calcolo i versori fresa e correzione
|
||||
Vector3d vtStaTool, vtStaCorr, vtMidTool, vtMidCorr, vtEndTool, vtEndCorr ;
|
||||
if ( ! CalculateToolAndCorrVersors( vtStaDirC, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtStaTool, vtStaCorr) ||
|
||||
! CalculateToolAndCorrVersors( vtMidDirC, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtMidTool, vtMidCorr) ||
|
||||
! CalculateToolAndCorrVersors( vtEndDirC, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtEndTool, vtEndCorr) ||
|
||||
! AreSameVectorApprox( vtStaCorr, vtMidCorr) ||
|
||||
! AreSameVectorApprox( vtStaCorr, vtEndCorr)) {
|
||||
m_pMchMgr->SetLastError( 2208, "Error in Sawing : Entity CalculateToolAndCorrVersors") ;
|
||||
return false ;
|
||||
// se curva chiusa ne forzo il punto di partenza a Xmax ( per limiti corse assi C Omag)
|
||||
if ( pCrv->IsClosed()) {
|
||||
BBox3d b3Crv ;
|
||||
pCrv->GetLocalBBox( b3Crv) ;
|
||||
Point3d ptTest = 0.5 * ( b3Crv.GetMin() + b3Crv.GetMax()) + Point3d( 100000, 0, 0) ;
|
||||
DistPointCurve dstPtCurve( ptTest, *pCrv) ;
|
||||
double dU ; int nFlag ;
|
||||
if ( dstPtCurve.GetParamAtMinDistPoint( 0, dU, nFlag)) {
|
||||
dU = 0.1 * round( 10 * dU) ;
|
||||
pCrv->ChangeStartPoint( dU) ;
|
||||
pCrvP = pCrv ;
|
||||
pCrvN = pCrv ;
|
||||
}
|
||||
}
|
||||
|
||||
// correzioni per lato lama, lato mandrino
|
||||
if ( ! AdjustForSide( pArc)) {
|
||||
if ( ! AdjustForSide( pCrv)) {
|
||||
m_pMchMgr->SetLastError( 2209, "Error in Sawing : Entity AdjustForSide") ;
|
||||
return false ;
|
||||
}
|
||||
// aggiungo affondamento
|
||||
pArc->Translate( - vtStaCorr * dDepth) ;
|
||||
// aggiungo affondamento (sempre in Z globale)
|
||||
pCrv->Translate( - Z_AX * dDepth) ;
|
||||
// calcolo elevazione (sui due bordi della striscia)
|
||||
double dElev, dElev2 ;
|
||||
Point3d ptStart, ptMid, ptEnd ;
|
||||
pArc->GetStartPoint( ptStart) ;
|
||||
pArc->GetMidPoint( ptMid) ;
|
||||
pArc->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtStaThick = vtStaTool * m_TParams.m_dThick ;
|
||||
Vector3d vtMidThick = vtMidTool * m_TParams.m_dThick ;
|
||||
Vector3d vtEndThick = vtEndTool * m_TParams.m_dThick ;
|
||||
if ( ! GetElevation( m_nPhase, ptStart, ptMid, ptEnd, vtStaCorr, dElev) ||
|
||||
! GetElevation( m_nPhase, ptStart + vtStaThick, ptMid + vtMidThick, ptEnd + vtEndThick, vtStaCorr, dElev2) ) {
|
||||
m_pMchMgr->SetLastError( 2210, "Error in Sawing : Entity GetElevation") ;
|
||||
return false ;
|
||||
double dElev = 0 ;
|
||||
for ( const ICurve* pSmpCrv = pCrv->GetFirstCurve() ;
|
||||
pSmpCrv != nullptr ;
|
||||
pSmpCrv = pCrv->GetNextCurve()) {
|
||||
Point3d ptSta, ptMid, ptEnd ;
|
||||
pSmpCrv->GetStartPoint( ptSta) ;
|
||||
pSmpCrv->GetMidPoint( ptMid) ;
|
||||
pSmpCrv->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtStaDir, vtMidDir, vtEndDir ;
|
||||
pSmpCrv->GetStartDir( vtStaDir) ;
|
||||
pSmpCrv->GetMidDir( vtMidDir) ;
|
||||
pSmpCrv->GetEndDir( vtEndDir) ;
|
||||
Vector3d vtStaTool, vtStaCorr, vtMidTool, vtMidCorr, vtEndTool, vtEndCorr ;
|
||||
if ( ! CalculateToolAndCorrVersors( vtStaDir, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtStaTool, vtStaCorr) ||
|
||||
! CalculateToolAndCorrVersors( vtMidDir, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtMidTool, vtMidCorr) ||
|
||||
! CalculateToolAndCorrVersors( vtEndDir, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtEndTool, vtEndCorr) ||
|
||||
! AreSameVectorApprox( vtStaCorr, vtMidCorr) ||
|
||||
! AreSameVectorApprox( vtStaCorr, vtEndCorr)) {
|
||||
m_pMchMgr->SetLastError( 2208, "Error in Sawing : Entity CalculateToolAndCorrVersors") ;
|
||||
return false ;
|
||||
}
|
||||
Vector3d vtStaThick = vtStaTool * m_TParams.m_dThick ;
|
||||
Vector3d vtMidThick = vtMidTool * m_TParams.m_dThick ;
|
||||
Vector3d vtEndThick = vtEndTool * m_TParams.m_dThick ;
|
||||
double dElev1, dElev2 ;
|
||||
if ( ! GetElevation( m_nPhase, ptSta, ptMid, ptEnd, vtStaCorr, dElev1) ||
|
||||
! GetElevation( m_nPhase, ptSta + vtStaThick, ptMid + vtMidThick, ptEnd + vtEndThick, vtStaCorr, dElev2) ) {
|
||||
m_pMchMgr->SetLastError( 2210, "Error in Sawing : Entity GetElevation") ;
|
||||
return false ;
|
||||
}
|
||||
dElev = max( dElev, max( dElev1, dElev2)) ;
|
||||
}
|
||||
dElev = max( dElev, dElev2) ;
|
||||
|
||||
// calcolo tipo angolo con precedente
|
||||
bool bExtAngPC = true ;
|
||||
if ( pCrvP != nullptr) {
|
||||
Vector3d vtDirP ;
|
||||
pCrvP->GetEndDir( vtDirP) ;
|
||||
Vector3d vtStaDir ;
|
||||
pCrv->GetStartDir( vtStaDir) ;
|
||||
double dAngPC ;
|
||||
vtDirP.GetAngleXY( vtStaDirC, dAngPC) ;
|
||||
vtDirP.GetAngleXY( vtStaDir, dAngPC) ;
|
||||
if ( ( m_Params.m_nWorkSide == SAW_WS_LEFT && dAngPC > EPS_ANG_SMALL) ||
|
||||
( m_Params.m_nWorkSide == SAW_WS_RIGHT && dAngPC < - EPS_ANG_SMALL))
|
||||
bExtAngPC = false ;
|
||||
@@ -1619,17 +1723,19 @@ Sawing::ProcessExtArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve
|
||||
// calcolo tipo angolo con successivo
|
||||
bool bExtAngCN = true ;
|
||||
if ( pCrvN != nullptr) {
|
||||
Vector3d vtEndDir ;
|
||||
pCrv->GetEndDir( vtEndDir) ;
|
||||
Vector3d vtDirN ;
|
||||
pCrvN->GetStartDir( vtDirN) ;
|
||||
double dAngCN ;
|
||||
vtEndDirC.GetAngleXY( vtDirN, dAngCN) ;
|
||||
vtEndDir.GetAngleXY( vtDirN, dAngCN) ;
|
||||
if ( ( m_Params.m_nWorkSide == SAW_WS_LEFT && dAngCN > EPS_ANG_SMALL) ||
|
||||
( m_Params.m_nWorkSide == SAW_WS_RIGHT && dAngCN < - EPS_ANG_SMALL))
|
||||
bExtAngCN = false ;
|
||||
}
|
||||
// aggiusto per tipo estremi
|
||||
bool bToSkip = false ;
|
||||
if ( ! AdjustArcForEdges( pArc, dElev, 1.0, bIsFirst, bIsLast, bExtAngPC, bExtAngCN, bToSkip)) {
|
||||
if ( ! AdjustCurveForEdges( pCrv, dElev, 1.0, bIsFirst, bIsLast, bExtAngPC, bExtAngCN, bToSkip)) {
|
||||
m_pMchMgr->SetLastError( 2211, "Error in Sawing : Entity AdjustForEdges") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1637,26 +1743,16 @@ Sawing::ProcessExtArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve
|
||||
LOG_INFO( GetEMkLogger(), "Warning in Sawing : skipped Entity too small") ;
|
||||
return true ;
|
||||
}
|
||||
// ricalcolo i versori fresa alle estremità (potrebbero essere cambiate)
|
||||
pArc->GetStartDir( vtStaDirC) ;
|
||||
pArc->GetMidDir( vtMidDirC) ;
|
||||
pArc->GetEndDir( vtEndDirC) ;
|
||||
if ( ! CalculateToolAndCorrVersors( vtStaDirC, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtStaTool, vtStaCorr) ||
|
||||
! CalculateToolAndCorrVersors( vtMidDirC, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtMidTool, vtMidCorr) ||
|
||||
! CalculateToolAndCorrVersors( vtEndDirC, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtEndTool, vtEndCorr)) {
|
||||
m_pMchMgr->SetLastError( 2212, "Error in Sawing : Entity CalculateToolAndCorrVersors 2nd") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Se richiesto Preview
|
||||
if ( nPvId != GDB_ID_NULL) {
|
||||
if ( ! GenerateExtArcPv( pArc, vtStaTool, vtMidTool, vtEndTool, vtStaCorr, dElev, dExtraCut, sName, nPvId))
|
||||
if ( ! GenerateExtCurvePv( pCrv, dElev, dExtraCut, sName, nPvId))
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Se richiesta geometria di lavorazione
|
||||
if ( nClId != GDB_ID_NULL) {
|
||||
if ( ! GenerateExtArcCl( pArc, vtStaTool, vtMidTool, vtEndTool, vtStaCorr, dElev, dExtraCut, sName, nClId))
|
||||
if ( ! GenerateExtCurveCl( pCrv, dElev, dExtraCut, sName, nClId))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -1668,11 +1764,10 @@ Sawing::ProcessExtArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Sawing::GenerateExtArcPv( const ICurveArc* pArc, const Vector3d& vtStaTool, const Vector3d& vtMidTool,
|
||||
const Vector3d& vtEndTool, const Vector3d& vtCorr,
|
||||
double dElev, double dExtraCut, const string& sName, int nPvId)
|
||||
Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv,
|
||||
double dElev, double dExtraCut, const string& sName, int nPvId)
|
||||
{
|
||||
// creo gruppo per anteprima di lavorazione dell'arco
|
||||
// creo gruppo per anteprima di lavorazione della curva
|
||||
int nPxId = m_pGeomDB->AddGroup( GDB_ID_NULL, nPvId, Frame3d()) ;
|
||||
if ( nPxId == GDB_ID_NULL)
|
||||
return false ;
|
||||
@@ -1682,105 +1777,140 @@ Sawing::GenerateExtArcPv( const ICurveArc* pArc, const Vector3d& vtStaTool, cons
|
||||
// disabilito eventuale registrazione comandi EXE (riabilitazione automatica)
|
||||
CmdLogOff cmdLogOff ;
|
||||
|
||||
// lunghezza taglio parziale
|
||||
double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0) ;
|
||||
|
||||
// calcolo dei raggi
|
||||
double dIntRad ;
|
||||
double dExtRad ;
|
||||
if ( AreHeadWorkOnSameSide()) {
|
||||
dIntRad = pArc->GetRadius() ;
|
||||
double dRadTot = pArc->GetRadius() + m_TParams.m_dThick ;
|
||||
dExtRad = sqrt( dRadTot * dRadTot + dDeltaT * dDeltaT) ;
|
||||
}
|
||||
else {
|
||||
dIntRad = pArc->GetRadius() - m_TParams.m_dThick ;
|
||||
dExtRad = sqrt( pArc->GetRadius() * pArc->GetRadius() + dDeltaT * dDeltaT) ;
|
||||
}
|
||||
|
||||
// contorno per parte di taglio completo
|
||||
PtrOwner<ICurveComposite> pCompo( GenerateExtArcPvTrueCut( pArc, dIntRad, dExtRad, 0)) ;
|
||||
if ( IsNull( pCompo))
|
||||
return false ;
|
||||
pCompo->Translate( dElev * vtCorr + Vector3d( 0, 0, 0.1)) ;
|
||||
int nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, Release( pCompo)) ;
|
||||
m_pGeomDB->SetName( nId, MCH_PV_CUT) ;
|
||||
m_pGeomDB->SetMaterial( nId, LIME) ;
|
||||
|
||||
// contorno per parte iniziale di taglio
|
||||
PtrOwner<ICurveComposite> pCompo2( GenerateExtArcPvPreCut( pArc, dIntRad, dExtRad, dDeltaT, 0)) ;
|
||||
if ( IsNull( pCompo2))
|
||||
return false ;
|
||||
pCompo2->Translate( dElev * vtCorr) ;
|
||||
int nId2 = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, Release( pCompo2)) ;
|
||||
m_pGeomDB->SetName( nId2, MCH_PV_PRE_CUT) ;
|
||||
m_pGeomDB->SetMaterial( nId2, BLUE) ;
|
||||
|
||||
// contorno per parte finale di taglio
|
||||
PtrOwner<ICurveComposite> pCompo3( GenerateExtArcPvPostCut( pArc, dIntRad, dExtRad, dDeltaT, 0)) ;
|
||||
if ( IsNull( pCompo3))
|
||||
return false ;
|
||||
pCompo3->Translate( dElev * vtCorr) ;
|
||||
int nId3 = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, Release( pCompo3)) ;
|
||||
m_pGeomDB->SetName( nId3, MCH_PV_POST_CUT) ;
|
||||
m_pGeomDB->SetMaterial( nId3, BLUE) ;
|
||||
|
||||
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
|
||||
double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
|
||||
|
||||
// regione ridotta di taglio per nesting (escluse parti iniziali e finali)
|
||||
PtrOwner<ICurveComposite> pCmpRr( GenerateExtArcPvTrueCut( pArc, dIntRad, dExtRad, dExtraL)) ;
|
||||
if ( IsNull( pCmpRr))
|
||||
return false ;
|
||||
SurfFlatRegionByContours SfrCntrRr ;
|
||||
SfrCntrRr.AddCurve( Release( pCmpRr)) ;
|
||||
ISurfFlatRegion* pSfrRr = SfrCntrRr.GetSurf() ;
|
||||
if ( pSfrRr == nullptr)
|
||||
return false ;
|
||||
pSfrRr->Translate( dElev * vtCorr) ;
|
||||
int nRrId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, pSfrRr) ;
|
||||
m_pGeomDB->SetName( nRrId, MCH_PV_RRCUT) ;
|
||||
m_pGeomDB->SetMaterial( nRrId, INVISIBLE) ;
|
||||
// lunghezza taglio parziale
|
||||
double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0) ;
|
||||
|
||||
// regione di pre-taglio
|
||||
PtrOwner<ICurveComposite> pCmpRs( GenerateExtArcPvPreCut( pArc, dIntRad, dExtRad, dDeltaT, dExtraL)) ;
|
||||
if ( IsNull( pCmpRs))
|
||||
return false ;
|
||||
SurfFlatRegionByContours SfrCntrRs ;
|
||||
SfrCntrRs.AddCurve( Release( pCmpRs)) ;
|
||||
ISurfFlatRegion* pSfrRs = SfrCntrRs.GetSurf() ;
|
||||
if ( pSfrRs == nullptr)
|
||||
return false ;
|
||||
pSfrRs->Translate( dElev * vtCorr) ;
|
||||
int nRsId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, pSfrRs) ;
|
||||
m_pGeomDB->SetName( nRsId, MCH_PV_RLICUT) ;
|
||||
m_pGeomDB->SetMaterial( nRsId, INVISIBLE) ;
|
||||
// massima larghezza di taglio
|
||||
double dMaxW = 0 ;
|
||||
|
||||
// regione di post-taglio
|
||||
PtrOwner<ICurveComposite> pCmpRe( GenerateExtArcPvPostCut( pArc, dIntRad, dExtRad, dDeltaT, dExtraL)) ;
|
||||
if ( IsNull( pCmpRe))
|
||||
return false ;
|
||||
SurfFlatRegionByContours SfrCntrRe ;
|
||||
SfrCntrRe.AddCurve( Release( pCmpRe)) ;
|
||||
ISurfFlatRegion* pSfrRe = SfrCntrRe.GetSurf() ;
|
||||
if ( pSfrRe == nullptr)
|
||||
return false ;
|
||||
pSfrRe->Translate( dElev * vtCorr) ;
|
||||
int nReId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, pSfrRe) ;
|
||||
m_pGeomDB->SetName( nReId, MCH_PV_RLOCUT) ;
|
||||
m_pGeomDB->SetMaterial( nReId, INVISIBLE) ;
|
||||
// versore correzione sempre come Z+
|
||||
Vector3d vtCorr = Z_AX ;
|
||||
|
||||
// regione completa (unione delle tre precedenti)
|
||||
int nRId = m_pGeomDB->Copy( nRrId, GDB_ID_NULL, nRrId, GDB_BEFORE) ;
|
||||
m_pGeomDB->SetName( nRId, MCH_PV_RCUT) ;
|
||||
m_pGeomDB->SetMaterial( nRId, INVISIBLE) ;
|
||||
if ( nRId == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! ExeSurfFrAdd( nRId, nRsId) || ! ExeSurfFrAdd( nRId, nReId))
|
||||
return false ;
|
||||
// ciclo sulle curve
|
||||
int nMaxInd = pCrv->GetCurveCount() - 1 ;
|
||||
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
|
||||
|
||||
// flag per prima/ultima curva
|
||||
bool bFirst = ( i == 0) ;
|
||||
bool bLast = ( i == nMaxInd) ;
|
||||
|
||||
// recupero curva, necessariamente linea o arco
|
||||
const ICurveLine* pLine = GetCurveLine( pCrv->GetCurve( i)) ;
|
||||
const ICurveArc* pArc = GetCurveArc( pCrv->GetCurve( i)) ;
|
||||
|
||||
// se linea
|
||||
if ( pLine != nullptr) {
|
||||
dMaxW = max( dMaxW, m_TParams.m_dThick) ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// se arco
|
||||
else if ( pArc != nullptr) {
|
||||
|
||||
// calcolo dei raggi
|
||||
double dIntRad ;
|
||||
double dExtRad ;
|
||||
if ( AreHeadWorkOnSameSide()) {
|
||||
dIntRad = pArc->GetRadius() ;
|
||||
double dRadTot = pArc->GetRadius() + m_TParams.m_dThick ;
|
||||
dExtRad = sqrt( dRadTot * dRadTot + dDeltaT * dDeltaT) ;
|
||||
}
|
||||
else {
|
||||
dIntRad = pArc->GetRadius() - m_TParams.m_dThick ;
|
||||
dExtRad = sqrt( pArc->GetRadius() * pArc->GetRadius() + dDeltaT * dDeltaT) ;
|
||||
}
|
||||
dMaxW = max( dMaxW, dExtRad - dIntRad) ;
|
||||
|
||||
// contorno per parte di taglio completo
|
||||
PtrOwner<ICurveComposite> pCompo( GenerateExtArcPvTrueCut( pArc, dIntRad, dExtRad, 0)) ;
|
||||
if ( IsNull( pCompo))
|
||||
return false ;
|
||||
pCompo->Translate( dElev * vtCorr + Vector3d( 0, 0, 0.1)) ;
|
||||
int nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, Release( pCompo)) ;
|
||||
m_pGeomDB->SetName( nId, MCH_PV_CUT) ;
|
||||
m_pGeomDB->SetMaterial( nId, LIME) ;
|
||||
|
||||
// contorno per parte iniziale di taglio
|
||||
PtrOwner<ICurveComposite> pCompo2( GenerateExtArcPvPreCut( pArc, dIntRad, dExtRad, dDeltaT, 0)) ;
|
||||
if ( IsNull( pCompo2))
|
||||
return false ;
|
||||
pCompo2->Translate( dElev * vtCorr) ;
|
||||
int nId2 = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, Release( pCompo2)) ;
|
||||
m_pGeomDB->SetName( nId2, ( bFirst ? MCH_PV_PRE_CUT : MCH_PV_CUT)) ;
|
||||
m_pGeomDB->SetMaterial( nId2, ( bFirst ? BLUE : LIME)) ;
|
||||
|
||||
// contorno per parte finale di taglio
|
||||
PtrOwner<ICurveComposite> pCompo3( GenerateExtArcPvPostCut( pArc, dIntRad, dExtRad, dDeltaT, 0)) ;
|
||||
if ( IsNull( pCompo3))
|
||||
return false ;
|
||||
pCompo3->Translate( dElev * vtCorr) ;
|
||||
int nId3 = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, Release( pCompo3)) ;
|
||||
m_pGeomDB->SetName( nId3, ( bLast ? MCH_PV_POST_CUT : MCH_PV_CUT)) ;
|
||||
m_pGeomDB->SetMaterial( nId3, ( bLast ? BLUE : LIME)) ;
|
||||
|
||||
// regione ridotta di taglio per nesting (escluse parti iniziali e finali)
|
||||
PtrOwner<ICurveComposite> pCmpRr( GenerateExtArcPvTrueCut( pArc, dIntRad, dExtRad, dExtraL)) ;
|
||||
if ( IsNull( pCmpRr))
|
||||
return false ;
|
||||
SurfFlatRegionByContours SfrCntrRr ;
|
||||
SfrCntrRr.AddCurve( Release( pCmpRr)) ;
|
||||
ISurfFlatRegion* pSfrRr = SfrCntrRr.GetSurf() ;
|
||||
if ( pSfrRr == nullptr)
|
||||
return false ;
|
||||
pSfrRr->Translate( dElev * vtCorr) ;
|
||||
int nRrId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, pSfrRr) ;
|
||||
m_pGeomDB->SetName( nRrId, MCH_PV_RRCUT) ;
|
||||
m_pGeomDB->SetMaterial( nRrId, INVISIBLE) ;
|
||||
|
||||
// regione di pre-taglio
|
||||
PtrOwner<ICurveComposite> pCmpRs( GenerateExtArcPvPreCut( pArc, dIntRad, dExtRad, dDeltaT, dExtraL)) ;
|
||||
if ( IsNull( pCmpRs))
|
||||
return false ;
|
||||
SurfFlatRegionByContours SfrCntrRs ;
|
||||
SfrCntrRs.AddCurve( Release( pCmpRs)) ;
|
||||
ISurfFlatRegion* pSfrRs = SfrCntrRs.GetSurf() ;
|
||||
if ( pSfrRs == nullptr)
|
||||
return false ;
|
||||
pSfrRs->Translate( dElev * vtCorr) ;
|
||||
int nRsId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, pSfrRs) ;
|
||||
m_pGeomDB->SetName( nRsId, ( bFirst ? MCH_PV_RLICUT : MCH_PV_RRCUT)) ;
|
||||
m_pGeomDB->SetMaterial( nRsId, INVISIBLE) ;
|
||||
|
||||
// regione di post-taglio
|
||||
PtrOwner<ICurveComposite> pCmpRe( GenerateExtArcPvPostCut( pArc, dIntRad, dExtRad, dDeltaT, dExtraL)) ;
|
||||
if ( IsNull( pCmpRe))
|
||||
return false ;
|
||||
SurfFlatRegionByContours SfrCntrRe ;
|
||||
SfrCntrRe.AddCurve( Release( pCmpRe)) ;
|
||||
ISurfFlatRegion* pSfrRe = SfrCntrRe.GetSurf() ;
|
||||
if ( pSfrRe == nullptr)
|
||||
return false ;
|
||||
pSfrRe->Translate( dElev * vtCorr) ;
|
||||
int nReId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, pSfrRe) ;
|
||||
m_pGeomDB->SetName( nReId, ( bLast ? MCH_PV_RLOCUT : MCH_PV_RRCUT)) ;
|
||||
m_pGeomDB->SetMaterial( nReId, INVISIBLE) ;
|
||||
|
||||
// regione completa (unione delle tre precedenti)
|
||||
int nRId = m_pGeomDB->Copy( nRrId, GDB_ID_NULL, nRrId, GDB_BEFORE) ;
|
||||
m_pGeomDB->SetName( nRId, MCH_PV_RCUT) ;
|
||||
m_pGeomDB->SetMaterial( nRId, INVISIBLE) ;
|
||||
if ( nRId == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! ExeSurfFrAdd( nRId, nRsId) || ! ExeSurfFrAdd( nRId, nReId))
|
||||
return false ;
|
||||
}
|
||||
|
||||
// altrimenti errore
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
// salvo in info del gruppo la larghezza XY del taglio e la distanza XY tra centro e bordo taglio
|
||||
m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_WT, dExtRad - dIntRad) ;
|
||||
m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_WT, dMaxW) ;
|
||||
m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_DT, dDeltaT) ;
|
||||
|
||||
return true ;
|
||||
@@ -1947,79 +2077,77 @@ Sawing::GenerateExtArcPvPostCut( const ICurveArc* pArc, double dIntRad, double d
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Sawing::GenerateExtArcCl( const ICurveArc* pArc, const Vector3d& vtStaTool, const Vector3d& vtMidTool,
|
||||
const Vector3d& vtEndTool, const Vector3d& vtCorr,
|
||||
double dElev, double dExtraCut, const string& sName, int nClId)
|
||||
Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
|
||||
double dElev, double dExtraCut, const string& sName, int nClId)
|
||||
{
|
||||
// creo gruppo per geometria di lavorazione dell'arco
|
||||
// creo gruppo per geometria di lavorazione della curva
|
||||
int nPxId = m_pGeomDB->AddGroup( GDB_ID_NULL, nClId, Frame3d()) ;
|
||||
if ( nPxId == GDB_ID_NULL)
|
||||
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, Vector3d( 0, 0, 1)) ;
|
||||
|
||||
// calcolo dati di inizio
|
||||
Vector3d vtStaDir ;
|
||||
pCrv->GetStartDir( vtStaDir) ;
|
||||
Vector3d vtStaTool, vtStaCorr ;
|
||||
CalculateToolAndCorrVersors( vtStaDir, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle,
|
||||
vtStaTool, vtStaCorr) ;
|
||||
|
||||
// calcolo dati di fine
|
||||
Vector3d vtEndDir ;
|
||||
pCrv->GetEndDir( vtEndDir) ;
|
||||
Vector3d vtEndTool, vtEndCorr ;
|
||||
CalculateToolAndCorrVersors( vtEndDir, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle,
|
||||
vtEndTool, vtEndCorr) ;
|
||||
|
||||
// assegno il vettore estrusione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
|
||||
// assegno il punto di inizio al gruppo del percorso
|
||||
Point3d ptStart ; pArc->GetStartPoint( ptStart) ;
|
||||
Point3d ptStart ; pCrv->GetStartPoint( ptStart) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
|
||||
// Imposto dati comuni
|
||||
SetPathId( nPxId) ;
|
||||
SetCorrAuxDir( vtCorr) ;
|
||||
SetCorrAuxDir( vtStaCorr) ;
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
|
||||
// angolo al centro massimo
|
||||
const double MAX_ANG_CEN = 150.0 ;
|
||||
|
||||
// Se una sola passata
|
||||
if ( m_Params.m_dStepExtArc < EPS_SMALL || ( dElev - dExtraCut) <= m_Params.m_dStepExtArc) {
|
||||
// 1 -> approccio
|
||||
SetToolDir( vtStaTool) ;
|
||||
Point3d ptP1 ;
|
||||
pArc->GetStartPoint( ptP1) ;
|
||||
if ( ! AddApproach( ptP1, vtCorr, dSafeZ, dElev, dAppr))
|
||||
pCrv->GetStartPoint( ptP1) ;
|
||||
if ( ! AddApproach( ptP1, vtStaCorr, dSafeZ, dElev, dAppr))
|
||||
return false ;
|
||||
// 2 -> movimento in affondo al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
SetFeed( GetTipFeed()) ;
|
||||
Point3d ptP2 ;
|
||||
pArc->GetStartPoint( ptP2) ;
|
||||
pCrv->GetStartPoint( ptP2) ;
|
||||
if ( AddLinearMove( ptP2) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// 3 -> movimento di lato al punto finale
|
||||
SetFeed( GetFeed()) ;
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
Point3d ptP3 ;
|
||||
pArc->GetEndPoint( ptP3) ;
|
||||
// se angolo al centro minore del limite, un solo arco
|
||||
if ( abs( dAngCen) < MAX_ANG_CEN) {
|
||||
SetToolDir( vtEndTool) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// altrimenti due archi
|
||||
else {
|
||||
Point3d ptMid ;
|
||||
pArc->GetMidPoint( ptMid) ;
|
||||
// prima metà arco
|
||||
SetToolDir( vtMidTool) ;
|
||||
if ( AddArcMove( ptMid, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// seconda metà arco
|
||||
SetToolDir( vtEndTool) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
|
||||
for ( const ICurve* pSmpCrv = pCrv->GetFirstCurve() ;
|
||||
pSmpCrv != nullptr ;
|
||||
pSmpCrv = pCrv->GetNextCurve()) {
|
||||
Vector3d vtCurrDir ;
|
||||
pSmpCrv->GetEndDir( vtCurrDir) ;
|
||||
Vector3d vtCurrTool, vtCurrCorr ;
|
||||
CalculateToolAndCorrVersors( vtCurrDir, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtCurrTool, vtCurrCorr) ;
|
||||
SetToolDir( vtCurrTool) ;
|
||||
if ( AddCurveMove( pSmpCrv, true) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 4 -> retrazione
|
||||
Point3d ptP4 ;
|
||||
pArc->GetEndPoint( ptP4) ;
|
||||
if ( ! AddRetract( ptP4, vtCorr, dSafeZ, dElev, dAppr))
|
||||
pCrv->GetEndPoint( ptP4) ;
|
||||
if ( ! AddRetract( ptP4, vtEndCorr, dSafeZ, dElev, dAppr))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -2028,8 +2156,8 @@ Sawing::GenerateExtArcCl( const ICurveArc* pArc, const Vector3d& vtStaTool, cons
|
||||
// 1 -> approccio
|
||||
SetToolDir( vtStaTool) ;
|
||||
Point3d ptP1 ;
|
||||
pArc->GetStartPoint( ptP1) ;
|
||||
if ( ! AddApproach( ptP1, vtCorr, dSafeZ, dElev, dAppr))
|
||||
pCrv->GetStartPoint( ptP1) ;
|
||||
if ( ! AddApproach( ptP1, vtStaCorr, dSafeZ, dElev, dAppr))
|
||||
return false ;
|
||||
// 2-3 -> lavorazione (sempre numero pari di passate)
|
||||
// calcolo numero e valore degli step
|
||||
@@ -2047,11 +2175,11 @@ Sawing::GenerateExtArcCl( const ICurveArc* pArc, const Vector3d& vtStaTool, cons
|
||||
double dDelta = ( ( i != 0) ? dExtraCut + i * dStep : 0) ;
|
||||
// estremi del movimento (dispari vanno, pari tornano)
|
||||
Point3d ptP2 ;
|
||||
pArc->GetStartPoint( ptP2) ;
|
||||
ptP2 += vtCorr * dDelta ;
|
||||
pCrv->GetStartPoint( ptP2) ;
|
||||
ptP2 += vtStaCorr * dDelta ;
|
||||
Point3d ptP3 ;
|
||||
pArc->GetEndPoint( ptP3) ;
|
||||
ptP3 += vtCorr * dDelta ;
|
||||
pCrv->GetEndPoint( ptP3) ;
|
||||
ptP3 += vtStaCorr * dDelta ;
|
||||
if ( ( i % 2) == 0)
|
||||
swap( ptP2, ptP3) ;
|
||||
// movimento in affondo
|
||||
@@ -2062,37 +2190,59 @@ Sawing::GenerateExtArcCl( const ICurveArc* pArc, const Vector3d& vtStaTool, cons
|
||||
return false ;
|
||||
// movimento di lato
|
||||
SetFeed( GetFeed()) ;
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
// se angolo al centro minore del limite, un solo arco
|
||||
if ( abs( dAngCen) < MAX_ANG_CEN) {
|
||||
double dCurrAngCen = dAngCen * ((( i % 2) == 0) ? -1 : 1) ;
|
||||
SetToolDir( ( ( i % 2) == 0) ? vtStaTool : vtEndTool) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dCurrAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// se andata
|
||||
if ( ( i % 2) != 0) {
|
||||
// ciclo diretto sulle curve semplici componenti
|
||||
for ( const ICurve* pSmpCrv = pCrv->GetFirstCurve() ;
|
||||
pSmpCrv != nullptr ;
|
||||
pSmpCrv = pCrv->GetNextCurve()) {
|
||||
// calcolo direzione utensile
|
||||
Vector3d vtCurrDir ;
|
||||
pSmpCrv->GetEndDir( vtCurrDir) ;
|
||||
Vector3d vtCurrTool, vtCurrCorr ;
|
||||
CalculateToolAndCorrVersors( vtCurrDir, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtCurrTool, vtCurrCorr) ;
|
||||
SetToolDir( vtCurrTool) ;
|
||||
// copia della curva
|
||||
PtrOwner<ICurve> pCopy( pSmpCrv->Clone()) ;
|
||||
if ( IsNull( pCopy))
|
||||
return false ;
|
||||
// traslazione
|
||||
pCopy->Translate( vtCurrCorr * dDelta) ;
|
||||
// emissione
|
||||
if ( AddCurveMove( pCopy, true) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti due archi
|
||||
// altrimenti ritorno
|
||||
else {
|
||||
Point3d ptMid ;
|
||||
pArc->GetMidPoint( ptMid) ;
|
||||
ptMid += vtCorr * dDelta ;
|
||||
double dCurrAngCen = dAngCen / 2 * ((( i % 2) == 0) ? -1 : 1) ;
|
||||
// prima metà arco
|
||||
SetToolDir( vtMidTool) ;
|
||||
if ( AddArcMove( ptMid, ptCen, dCurrAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// seconda metà arco
|
||||
SetToolDir( ( ( i % 2) == 0) ? vtStaTool : vtEndTool) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dCurrAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// ciclo inverso sulle curve semplici componenti
|
||||
for ( const ICurve* pSmpCrv = pCrv->GetLastCurve() ;
|
||||
pSmpCrv != nullptr ;
|
||||
pSmpCrv = pCrv->GetPrevCurve()) {
|
||||
// calcolo direzione utensile
|
||||
Vector3d vtCurrDir ;
|
||||
pSmpCrv->GetStartDir( vtCurrDir) ;
|
||||
Vector3d vtCurrTool, vtCurrCorr ;
|
||||
CalculateToolAndCorrVersors( vtCurrDir, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtCurrTool, vtCurrCorr) ;
|
||||
SetToolDir( vtCurrTool) ;
|
||||
// copia della curva
|
||||
PtrOwner<ICurve> pCopy( pSmpCrv->Clone()) ;
|
||||
if ( IsNull( pCopy))
|
||||
return false ;
|
||||
// traslazione e inversione
|
||||
pCopy->Translate( vtCurrCorr * dDelta) ;
|
||||
pCopy->Invert() ;
|
||||
// emissione
|
||||
if ( AddCurveMove( pCopy, true) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 4 -> retrazione
|
||||
SetToolDir( vtStaTool) ;
|
||||
Point3d ptP4 ;
|
||||
pArc->GetStartPoint( ptP4) ;
|
||||
if ( ! AddRetract( ptP4, vtCorr, dSafeZ, dElev, dAppr))
|
||||
pCrv->GetStartPoint( ptP4) ;
|
||||
if ( ! AddRetract( ptP4, vtStaCorr, dSafeZ, dElev, dAppr))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -2101,8 +2251,8 @@ Sawing::GenerateExtArcCl( const ICurveArc* pArc, const Vector3d& vtStaTool, cons
|
||||
// 1 -> approccio
|
||||
SetToolDir( vtStaTool) ;
|
||||
Point3d ptP1 ;
|
||||
pArc->GetStartPoint( ptP1) ;
|
||||
if ( ! AddApproach( ptP1, vtCorr, dSafeZ, dElev, dAppr))
|
||||
pCrv->GetStartPoint( ptP1) ;
|
||||
if ( ! AddApproach( ptP1, vtStaCorr, dSafeZ, dElev, dAppr))
|
||||
return false ;
|
||||
// 2-3 -> lavorazione
|
||||
// calcolo numero e valore degli step
|
||||
@@ -2118,61 +2268,60 @@ Sawing::GenerateExtArcCl( const ICurveArc* pArc, const Vector3d& vtStaTool, cons
|
||||
SetFlag( 0) ;
|
||||
SetFeed( GetTipFeed()) ;
|
||||
Point3d ptP2 ;
|
||||
pArc->GetStartPoint( ptP2) ;
|
||||
ptP2 += vtCorr * dDelta ;
|
||||
pCrv->GetStartPoint( ptP2) ;
|
||||
ptP2 += vtStaCorr * dDelta ;
|
||||
if ( AddLinearMove( ptP2) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// movimento di lato al punto finale
|
||||
SetFeed( GetFeed()) ;
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
Point3d ptP3 ;
|
||||
pArc->GetEndPoint( ptP3) ;
|
||||
ptP3 += vtCorr * dDelta ;
|
||||
// se angolo al centro minore del limite, un solo arco
|
||||
if ( abs( dAngCen) < MAX_ANG_CEN) {
|
||||
SetToolDir( vtEndTool) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
for ( const ICurve* pSmpCrv = pCrv->GetFirstCurve() ;
|
||||
pSmpCrv != nullptr ;
|
||||
pSmpCrv = pCrv->GetNextCurve()) {
|
||||
Vector3d vtCurrDir ;
|
||||
pSmpCrv->GetEndDir( vtCurrDir) ;
|
||||
Vector3d vtCurrTool, vtCurrCorr ;
|
||||
CalculateToolAndCorrVersors( vtCurrDir, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtCurrTool, vtCurrCorr) ;
|
||||
SetToolDir( vtCurrTool) ;
|
||||
// copia della curva
|
||||
PtrOwner<ICurve> pCopy( pSmpCrv->Clone()) ;
|
||||
if ( IsNull( pCopy))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti due archi
|
||||
else {
|
||||
Point3d ptMid ;
|
||||
pArc->GetMidPoint( ptMid) ;
|
||||
ptMid += vtCorr * dDelta ;
|
||||
// prima metà arco
|
||||
SetToolDir( vtMidTool) ;
|
||||
if ( AddArcMove( ptMid, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// seconda metà arco
|
||||
SetToolDir( vtEndTool) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
|
||||
// traslazione
|
||||
pCopy->Translate( vtCurrCorr * dDelta) ;
|
||||
// emissione
|
||||
if ( AddCurveMove( pCopy, true) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se non è ultimo passo
|
||||
if ( i != 0) {
|
||||
// movimento di risalita sopra il punto finale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
// ricavo punto di risalita e punto iniziale
|
||||
Point3d ptP4 ;
|
||||
pArc->GetEndPoint( ptP4) ;
|
||||
ptP4 += vtCorr * ( dElev + dAppr) ;
|
||||
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// movimento di ritorno sopra il punto iniziale
|
||||
SetToolDir( vtStaTool) ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
pCrv->GetEndPoint( ptP4) ;
|
||||
ptP4 += vtEndCorr * ( dElev + dAppr) ;
|
||||
Point3d ptP5 ;
|
||||
pArc->GetStartPoint( ptP5) ;
|
||||
ptP5 += vtCorr * ( dElev + dAppr) ;
|
||||
if ( AddLinearMove( ptP5) == GDB_ID_NULL)
|
||||
return false ;
|
||||
pCrv->GetStartPoint( ptP5) ;
|
||||
ptP5 += vtStaCorr * ( dElev + dAppr) ;
|
||||
// se sono diversi o le direzioni utensile sono diverse
|
||||
if ( ! AreSamePointApprox( ptP4, ptP5) ||
|
||||
! AreSameVectorApprox( vtEndTool, vtStaTool)) {
|
||||
// movimento di risalita sopra il punto finale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// movimento di ritorno sopra il punto iniziale
|
||||
SetToolDir( vtStaTool) ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( AreSamePointEpsilon( ptP4, ptP5, 10 * EPS_SMALL))
|
||||
ptP5 -= vtStaCorr * 10 * EPS_SMALL ;
|
||||
if ( AddLinearMove( ptP5) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 4 -> retrazione
|
||||
Point3d ptP4 ;
|
||||
pArc->GetEndPoint( ptP4) ;
|
||||
if ( ! AddRetract( ptP4, vtCorr, dSafeZ, dElev, dAppr))
|
||||
pCrv->GetEndPoint( ptP4) ;
|
||||
if ( ! AddRetract( ptP4, vtEndCorr, dSafeZ, dElev, dAppr))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -2196,11 +2345,11 @@ Sawing::ProcessIntArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve
|
||||
if ( IsNull( pArc))
|
||||
return false ;
|
||||
// determino l'inclinazione per ottenere il raggio e ne verifico il limite
|
||||
const double MAX_SIDE_ANG = 60 + EPS_ANG_SMALL ;
|
||||
double dMaxSideAng = m_pMchMgr->GetCurrMachiningsMgr()->GetIntSawArcMaxSideAng()+ EPS_ANG_SMALL ;
|
||||
double dSawRad = m_TParams.m_dDiam / 2 ;
|
||||
double dRad = pArc->GetRadius() ;
|
||||
double dSinA = dSawRad / dRad ;
|
||||
if ( dSinA > sin( MAX_SIDE_ANG * DEGTORAD)) {
|
||||
if ( dSinA > sin( dMaxSideAng * DEGTORAD)) {
|
||||
LOG_INFO( GetEMkLogger(), "Warning in Sawing : Radius too small in IntSawArc") ;
|
||||
return true ;
|
||||
}
|
||||
@@ -2284,7 +2433,7 @@ Sawing::ProcessIntArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve
|
||||
double dDelta = dElev * dSinA / dCosA + m_TParams.m_dThick * dCosA ; // larghezza impronta
|
||||
double dLenCoeff = ( dRad + 0.8 * dDelta) / dRad ; // coefficiente per riportare lunghezza
|
||||
bool bToSkip = false ;
|
||||
if ( ! AdjustArcForEdges( pArc, dSlantElev, dLenCoeff, bIsFirst, bIsLast, bExtAngPC, bExtAngCN, bToSkip)) {
|
||||
if ( ! AdjustCurveForEdges( pArc, dSlantElev, dLenCoeff, bIsFirst, bIsLast, bExtAngPC, bExtAngCN, bToSkip)) {
|
||||
m_pMchMgr->SetLastError( 2211, "Error in Sawing : Entity AdjustForEdges") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3133,8 +3282,8 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Sawing::AdjustArcForEdges( ICurveArc* pArc, double dElev, double dLenCoeff,
|
||||
bool bIsFirst, bool bIsLast, bool bExtAngPC, bool bExtAngCN, bool& bToSkip)
|
||||
Sawing::AdjustCurveForEdges( ICurve* pCrv, double dElev, double dLenCoeff,
|
||||
bool bIsFirst, bool bIsLast, bool bExtAngPC, bool bExtAngCN, bool& bToSkip)
|
||||
{
|
||||
// --- gli archi non vanno estesi al bordo del grezzo ---
|
||||
// distanza XY tra centro e bordo taglio
|
||||
@@ -3170,7 +3319,7 @@ Sawing::AdjustArcForEdges( ICurveArc* pArc, double dElev, double dLenCoeff,
|
||||
// controllo se lunghezza entità accettabile
|
||||
const double MIN_LEN = 10 ;
|
||||
double dLenXY ;
|
||||
pArc->GetLength( dLenXY) ;
|
||||
pCrv->GetLength( dLenXY) ;
|
||||
if ( dDeltaI + dLenXY + dDeltaF < MIN_LEN) {
|
||||
bToSkip = true ;
|
||||
return true ;
|
||||
@@ -3178,13 +3327,13 @@ Sawing::AdjustArcForEdges( ICurveArc* pArc, double dElev, double dLenCoeff,
|
||||
bToSkip = false ;
|
||||
// modifico gli estremi
|
||||
if ( dDeltaF > EPS_SMALL)
|
||||
pArc->ExtendEndByLen( dDeltaF) ;
|
||||
pCrv->ExtendEndByLen( dDeltaF) ;
|
||||
else if ( dDeltaF < - EPS_SMALL)
|
||||
pArc->TrimEndAtLen( dLenXY + dDeltaF) ;
|
||||
pCrv->TrimEndAtLen( dLenXY + dDeltaF) ;
|
||||
if ( dDeltaI > EPS_SMALL)
|
||||
pArc->ExtendStartByLen( dDeltaI) ;
|
||||
pCrv->ExtendStartByLen( dDeltaI) ;
|
||||
else if ( dDeltaI < - EPS_SMALL)
|
||||
pArc->TrimStartAtLen( fabs( dDeltaI)) ;
|
||||
pCrv->TrimStartAtLen( fabs( dDeltaI)) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -80,21 +80,19 @@ class Sawing : public Machining
|
||||
double dElev, double dExtraCut, const string& sName, int nPvId) ;
|
||||
bool GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const Vector3d& vtCorr,
|
||||
double dElev, double dExtraCut, const string& sName, int nClId) ;
|
||||
bool ProcessExtArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve* pCrvN,
|
||||
double dDepth, double dExtraCut, bool bIsFirst, bool bIsLast,
|
||||
const string& sName, int nPvId, int nClId) ;
|
||||
bool GenerateExtArcPv( const ICurveArc* pArc, const Vector3d& vtStaTool, const Vector3d& vtMidTool,
|
||||
const Vector3d& vtEndTool, const Vector3d& vtCorr,
|
||||
double dElev, double dExtraCut, const string& sName, int nPvId) ;
|
||||
bool ProcessExtCurve( const ICurve* pCrvP, const ICurveComposite* pCrvC, const ICurve* pCrvN,
|
||||
double dDepth, double dExtraCut, bool bIsFirst, bool bIsLast,
|
||||
const string& sName, int nPvId, int nClId) ;
|
||||
bool GenerateExtCurvePv( const ICurveComposite* pCrv,
|
||||
double dElev, double dExtraCut, const string& sName, int nPvId) ;
|
||||
ICurveComposite* GenerateExtArcPvTrueCut( const ICurveArc* pArc, double dIntRad, double dExtRad,
|
||||
double dSafety) ;
|
||||
ICurveComposite* GenerateExtArcPvPreCut( const ICurveArc* pArc, double dIntRad, double dExtRad,
|
||||
double dDeltaT, double dSafety) ;
|
||||
ICurveComposite* GenerateExtArcPvPostCut( const ICurveArc* pArc, double dIntRad, double dExtRad,
|
||||
double dDeltaT, double dSafety) ;
|
||||
bool GenerateExtArcCl( const ICurveArc* pArc, const Vector3d& vtStaTool, const Vector3d& vtMidTool,
|
||||
const Vector3d& vtEndTool, const Vector3d& vtCorr,
|
||||
double dElev, double dExtraCut, const string& sName, int nClId) ;
|
||||
bool GenerateExtCurveCl( const ICurveComposite* pCrv,
|
||||
double dElev, double dExtraCut, const string& sName, int nClId) ;
|
||||
bool ProcessIntArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve* pCrvN,
|
||||
double dDepth, double dExtraCut, bool bIsFirst, bool bIsLast,
|
||||
const string& sName, int nPvId, int nClId) ;
|
||||
@@ -118,8 +116,8 @@ class Sawing : public Machining
|
||||
bool AdjustIntArcForSide( ICurve* pCurve, double dSideAng) ;
|
||||
bool AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtCorr, const Vector3d& vtThick,
|
||||
bool bIsFirst, bool bIsLast, bool bExtAngPC, bool bExtAngCN, bool& ToSkip) ;
|
||||
bool AdjustArcForEdges( ICurveArc* pArc, double dElev, double dLenCoeff,
|
||||
bool bIsFirst, bool bIsLast, bool bExtAngPC, bool bExtAngCN, bool& ToSkip) ;
|
||||
bool AdjustCurveForEdges( ICurve* pCrv, double dElev, double dLenCoeff,
|
||||
bool bIsFirst, bool bIsLast, bool bExtAngPC, bool bExtAngCN, bool& ToSkip) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr) ;
|
||||
bool AreHeadWorkOnSameSide( void) const ;
|
||||
|
||||
Reference in New Issue
Block a user