EgtMachKernel 2.2d1 :
- in fresatura corretti e modificati attacchi a zigzag e a spirale specie per percorsi aperti - in fresatura corretto step di spirale su percorso aperto - in fresatura con lama aggiunti altri controlli su movimenti assiali - in taglio con lama ammesse anche superfici regione - in mortasatura (taglio con sega a catena) corretto calcolo elevazione su inizio e fine con attacco da sotto.
This commit is contained in:
Binary file not shown.
+124
-43
@@ -1061,8 +1061,8 @@ Milling::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
return true ;
|
||||
}
|
||||
// se altrimenti ammesse superfici trimesh ed è tale
|
||||
else if ( ( nType == GEO_NONE || nType == SRF_TRIMESH) && pGObj->GetType() == SRF_TRIMESH) {
|
||||
nType = SRF_TRIMESH ;
|
||||
else if ( ( nType == GEO_NONE || nType == GEO_SURF) && pGObj->GetType() == SRF_TRIMESH) {
|
||||
nType = GEO_SURF ;
|
||||
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
|
||||
if ( pSurf == nullptr)
|
||||
return false ;
|
||||
@@ -1083,8 +1083,8 @@ Milling::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
return true ;
|
||||
}
|
||||
// se altrimenti ammesse regioni ed è tale
|
||||
else if ( ( nType == GEO_NONE || nType == SRF_FLATRGN) && pGObj->GetType() == SRF_FLATRGN) {
|
||||
nType = SRF_FLATRGN ;
|
||||
else if ( ( nType == GEO_NONE || nType == GEO_SURF) && pGObj->GetType() == SRF_FLATRGN) {
|
||||
nType = GEO_SURF ;
|
||||
const ISurfFlatRegion* pReg = ::GetSurfFlatRegion( pGObj) ;
|
||||
if ( pReg == nullptr)
|
||||
return false ;
|
||||
@@ -1179,7 +1179,7 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
// ritorno
|
||||
return true ;
|
||||
}
|
||||
// se altrimenti superficie
|
||||
// se altrimenti superficie trimesh
|
||||
else if ( pGObj->GetType() == SRF_TRIMESH) {
|
||||
// recupero la trimesh
|
||||
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
|
||||
@@ -1759,6 +1759,16 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
SetPathId( nPxId) ;
|
||||
SetToolDir( vtTool) ;
|
||||
|
||||
// Controlli per lama (non deve fare movimenti assiali nel pezzo)
|
||||
if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0) {
|
||||
// Non ammesse passate a spirale
|
||||
if ( m_Params.m_nStepType == MILL_ST_SPIRAL)
|
||||
m_Params.m_nStepType = MILL_ST_ZIGZAG ;
|
||||
// Non ammessa elevazione in attacco e uscita
|
||||
m_Params.m_dLiElev = 0 ;
|
||||
m_Params.m_dLoElev = 0 ;
|
||||
}
|
||||
|
||||
// Se lama con elevazione e step di fianco
|
||||
if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0 && dSideElev > 10 * EPS_SMALL && dOkStep > EPS_SMALL) {
|
||||
m_bStepOn = true ;
|
||||
@@ -2267,6 +2277,11 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
dStElev -= ( ptP1 - ptStart) * vtTool ;
|
||||
// determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
|
||||
bool bUnderStart = m_bAboveHead && GetPointUnderRaw( ptP1, vtTool, GetRadiusForStartEndElevation(), m_TParams.m_dLen, dStElev) ;
|
||||
// se attacco a zigzag o a spirale, l'elevazione va nell'attacco
|
||||
if ( IsLeadInHelixOrZigzag()) {
|
||||
ptP1 += vtTool * ( dStElev + LIO_ELEV_TOL) ;
|
||||
dStElev = - LIO_ELEV_TOL ;
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bOutStart, bAboveStart)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
@@ -2293,6 +2308,11 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// se attacco a zigzag o a spirale, non affondo
|
||||
else if ( IsLeadInHelixOrZigzag()) {
|
||||
ptP1 += vtTool * ( dStElev + LIO_ELEV_TOL) ;
|
||||
dStElev = - LIO_ELEV_TOL ;
|
||||
}
|
||||
// altrimenti, affondo in feed opportuna
|
||||
else {
|
||||
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_NOTIP || m_TParams.m_nType == TT_MILL_POLISHING) ;
|
||||
@@ -2355,12 +2375,14 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
}
|
||||
else
|
||||
dEndElev = - LIO_ELEV_TOL ;
|
||||
// aggiungo uscita
|
||||
Point3d ptP1 ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtTool, dEndElev, bInvert, pCompo, bSplitArcs, ptP1)) {
|
||||
m_pMchMgr->SetLastError( 2311, "Error in Milling : LeadOut not computable") ;
|
||||
return false ;
|
||||
// se non c'è attacco a zigzag o a spirale oppure ultimo step, aggiungo uscita
|
||||
Point3d ptP1 = ptEnd ;
|
||||
if ( ! IsLeadInHelixOrZigzag() || j == nStep) {
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtTool, dEndElev, bInvert, pCompo, bSplitArcs, ptP1)) {
|
||||
m_pMchMgr->SetLastError( 2311, "Error in Milling : LeadOut not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// se ultimo step aggiungo retrazione per frese normali
|
||||
if ( j == nStep && ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
|
||||
@@ -2619,15 +2641,17 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
double dOscRampLen, dOscFlatLen ;
|
||||
AdjustOscillParams( pCompo, bPathOscEnable, dOscRampLen, dOscFlatLen) ;
|
||||
|
||||
// imposto flag di percorso chiuso
|
||||
bool bClosed = pCompo->IsClosed() ;
|
||||
|
||||
// determino numero e affondamento degli step
|
||||
int nStep = max( 1, static_cast<int>( ceil( ( dElev + dStart) / dOkStep))) ;
|
||||
int nStep = max( 1, static_cast<int>( ceil( ( dElev + dStart) / ( bClosed ? dOkStep : dOkStep / 2)))) ;
|
||||
if ( m_TParams.m_nType == TT_MILL_POLISHING)
|
||||
nStep = max( 1, nStep - 1) ;
|
||||
double dStep = ( dElev + dStart) / nStep ;
|
||||
|
||||
// determino dati del percorso
|
||||
double dTotLen ; pCompo->GetLength( dTotLen) ;
|
||||
bool bClosed = pCompo->IsClosed() ;
|
||||
int nMaxInd = pCompo->GetCurveCount() - 1 ;
|
||||
|
||||
// se chiuso -> sempre in avanti
|
||||
@@ -3336,9 +3360,9 @@ Milling::GetLeadInType( void) const
|
||||
if ( ( m_Params.m_nLeadInType == MILL_LI_HELIX || m_Params.m_nLeadInType == MILL_LI_ZIGZAG) &&
|
||||
( m_Params.m_dLiTang < min( 0.1 * m_TParams.m_dDiam, 1.0) || m_Params.m_dLiElev < 10 * EPS_SMALL))
|
||||
return MILL_LI_NONE ;
|
||||
if ( ( m_Params.m_nLeadInType == MILL_LI_HELIX || m_Params.m_nLeadInType == MILL_LI_ZIGZAG) &&
|
||||
m_bStepOn && m_Params.m_nStepType == MILL_ST_ZIGZAG)
|
||||
return MILL_LI_NONE ;
|
||||
//if ( ( m_Params.m_nLeadInType == MILL_LI_HELIX || m_Params.m_nLeadInType == MILL_LI_ZIGZAG) &&
|
||||
// m_bStepOn && m_Params.m_nStepType == MILL_ST_ZIGZAG)
|
||||
// return MILL_LI_NONE ;
|
||||
if ( ( m_Params.m_nLeadInType == MILL_LI_HELIX || m_Params.m_nLeadInType == MILL_LI_ZIGZAG) &&
|
||||
m_bStepOn && m_Params.m_nStepType == MILL_ST_SPIRAL)
|
||||
return MILL_LI_NONE ;
|
||||
@@ -3360,17 +3384,20 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
|
||||
double dElev = min( m_Params.m_dLiElev, dStElev + LIO_ELEV_TOL) ;
|
||||
// se step invertito
|
||||
if ( bInvert) {
|
||||
switch ( m_Params.m_nLeadOutType) {
|
||||
case MILL_LO_LINEAR : nType = MILL_LI_LINEAR ; break ;
|
||||
case MILL_LO_TANGENT : nType = MILL_LI_TANGENT ; break ;
|
||||
case MILL_LO_GLIDE : nType = MILL_LI_GLIDE ; break ;
|
||||
case MILL_LO_AS_LI : /* resta inalterato */ ; break ;
|
||||
default : nType = MILL_LI_NONE ; break ;
|
||||
}
|
||||
if ( m_Params.m_nLeadOutType != MILL_LO_AS_LI) {
|
||||
dTang = m_Params.m_dLoTang ;
|
||||
dPerp = m_Params.m_dLoPerp ;
|
||||
dElev = min( m_Params.m_dLoElev, dStElev + LIO_ELEV_TOL) ;
|
||||
// va aggiustato se non zigzag o spirale
|
||||
if ( nType != MILL_LI_ZIGZAG && nType != MILL_LI_HELIX) {
|
||||
switch ( m_Params.m_nLeadOutType) {
|
||||
case MILL_LO_LINEAR : nType = MILL_LI_LINEAR ; break ;
|
||||
case MILL_LO_TANGENT : nType = MILL_LI_TANGENT ; break ;
|
||||
case MILL_LO_GLIDE : nType = MILL_LI_GLIDE ; break ;
|
||||
case MILL_LO_AS_LI : /* resta inalterato */ ; break ;
|
||||
default : nType = MILL_LI_NONE ; break ;
|
||||
}
|
||||
if ( m_Params.m_nLeadOutType != MILL_LO_AS_LI) {
|
||||
dTang = m_Params.m_dLoTang ;
|
||||
dPerp = m_Params.m_dLoPerp ;
|
||||
dElev = min( m_Params.m_dLoElev, dStElev + LIO_ELEV_TOL) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// senso di rotazione da dir tg a dir esterna
|
||||
@@ -3433,15 +3460,18 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
double dTang = m_Params.m_dLiTang ;
|
||||
// se step invertito
|
||||
if ( bInvert) {
|
||||
switch ( GetLeadOutType()) {
|
||||
case MILL_LO_LINEAR : nType = MILL_LI_LINEAR ; break ;
|
||||
case MILL_LO_TANGENT : nType = MILL_LI_TANGENT ; break ;
|
||||
case MILL_LO_GLIDE : nType = MILL_LI_GLIDE ; break ;
|
||||
case MILL_LO_AS_LI : /* resta inalterato */ ; break ;
|
||||
default : nType = MILL_LI_NONE ; break ;
|
||||
// va aggiustato se non zigzag o spirale
|
||||
if ( nType != MILL_LI_ZIGZAG && nType != MILL_LI_HELIX) {
|
||||
switch ( GetLeadOutType()) {
|
||||
case MILL_LO_LINEAR : nType = MILL_LI_LINEAR ; break ;
|
||||
case MILL_LO_TANGENT : nType = MILL_LI_TANGENT ; break ;
|
||||
case MILL_LO_GLIDE : nType = MILL_LI_GLIDE ; break ;
|
||||
case MILL_LO_AS_LI : /* resta inalterato */ ; break ;
|
||||
default : nType = MILL_LI_NONE ; break ;
|
||||
}
|
||||
if ( m_Params.m_nLeadOutType != MILL_LO_AS_LI)
|
||||
dTang = m_Params.m_dLoTang ;
|
||||
}
|
||||
if ( m_Params.m_nLeadOutType != MILL_LO_AS_LI)
|
||||
dTang = m_Params.m_dLoTang ;
|
||||
}
|
||||
// verifico di poter fare l'ingresso a inseguimento
|
||||
if ( nType == MILL_LI_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL)
|
||||
@@ -3522,22 +3552,73 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
}
|
||||
case MILL_LI_ZIGZAG :
|
||||
{
|
||||
// recupero la parte richiesta della curva
|
||||
PtrOwner<ICurveComposite> pCrv ;
|
||||
if ( ! bInvert) {
|
||||
double dU ;
|
||||
if ( pCompo->GetParamAtLength( dTang, dU)) {
|
||||
double dParS, dParE ;
|
||||
pCompo->GetDomain( dParS, dParE) ;
|
||||
if ( ! pCrv.Set( CreateCurveComposite()) || ! pCrv->AddCurve( pCompo->CopyParamRange( dParS, dU)))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( ! pCrv.Set( pCompo->Clone()))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
double dLen, dU ;
|
||||
if ( pCompo->GetLength( dLen) && pCompo->GetParamAtLength( dLen - dTang, dU)) {
|
||||
double dParS, dParE ;
|
||||
pCompo->GetDomain( dParS, dParE) ;
|
||||
if ( ! pCrv.Set( CreateCurveComposite()) || ! pCrv->AddCurve( pCompo->CopyParamRange( dU, dParE)))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( ! pCrv.Set( pCompo->Clone()))
|
||||
return false ;
|
||||
}
|
||||
pCrv->Invert() ;
|
||||
}
|
||||
pCrv->SetExtrusion( vtN) ;
|
||||
// la porto alla giusta quota
|
||||
Point3d ptIni ; pCrv->GetStartPoint( ptIni) ;
|
||||
Vector3d vtMove = ptStart - ptIni ;
|
||||
pCrv->Translate( vtMove) ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs && ! ApproxWithLines( pCrv))
|
||||
return false ;
|
||||
// la ripeto a zigzag
|
||||
double dDeltaN = ( ptStart - ptP1) * vtN ;
|
||||
int nStep = int( ceil( - dDeltaN / ( m_Params.m_dLiElev + 10 * EPS_SMALL))) ;
|
||||
double dStep = - dDeltaN / nStep ;
|
||||
Point3d ptPa = ptP1 + vtStart * 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
Point3d ptPb = ptP1 - vtStart * 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
if ( AddLinearMove( ptPa - vtN * ( i - 0.75) * dStep, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
// calcolo quote per pendenza
|
||||
double dNini = ( ptP1 - ORIG) * vtN - ( i - 1) * dStep ;
|
||||
double dNmid = dNini - 0.5 * dStep ;
|
||||
double dNfin = dNmid - 0.5 * dStep ;
|
||||
// copio per zig
|
||||
PtrOwner<ICurveComposite> pCopy1( pCrv->Clone()) ;
|
||||
// assegno la corretta pendenza
|
||||
AdjustCurveSlope( pCopy1, dNini, dNmid) ;
|
||||
// emetto
|
||||
if ( AddCurveMove( pCopy1) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( AddLinearMove( ptPb - vtN * ( i - 0.25) * dStep, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
// copio per zag
|
||||
PtrOwner<ICurveComposite> pCopy2( pCrv->Clone()) ;
|
||||
pCopy2->Invert() ;
|
||||
// assegno la corretta pendenza
|
||||
AdjustCurveSlope( pCopy2, dNmid, dNfin) ;
|
||||
// emetto
|
||||
if ( AddCurveMove( pCopy2) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
return ( AddLinearMove( ptStart, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
return true ;
|
||||
}
|
||||
case MILL_LI_HELIX :
|
||||
{
|
||||
bool bAtLeft = ( m_Params.m_nWorkSide != MILL_WS_RIGHT) ;
|
||||
bool bAtLeft = ( bInvert != ( m_Params.m_nWorkSide != MILL_WS_RIGHT)) ;
|
||||
// vettore dal punto al centro elica
|
||||
Vector3d vtCen = vtStart ;
|
||||
vtCen.Rotate( vtN, 0, ( bAtLeft ? 1 : - 1)) ;
|
||||
@@ -3595,8 +3676,8 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
case MILL_LI_LINEAR : nType = MILL_LO_LINEAR ; break ;
|
||||
case MILL_LI_TANGENT : nType = MILL_LO_TANGENT ; break ;
|
||||
case MILL_LI_GLIDE : nType = MILL_LO_GLIDE ; break ;
|
||||
case MILL_LI_ZIGZAG : nType = MILL_LO_LINEAR ; break ;
|
||||
case MILL_LI_HELIX : nType = MILL_LO_TANGENT ; break ;
|
||||
case MILL_LI_ZIGZAG : nType = MILL_LO_NONE ; break ;
|
||||
case MILL_LI_HELIX : nType = MILL_LO_NONE ; break ;
|
||||
default : nType = MILL_LO_NONE ; break ;
|
||||
}
|
||||
dTang = m_Params.m_dLiTang ;
|
||||
|
||||
+37
-22
@@ -1227,7 +1227,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
|
||||
// calcolo l'elevazione massima
|
||||
double dElev ;
|
||||
if ( CalcPathElevation( pCompo, vtTool, dDepth, 0.5 * m_TParams.m_dDiam, dElev)) {
|
||||
if ( CalcPathElevation( pCompo, vtTool, dDepth, GetRadiusForStartEndElevation(), m_TParams.m_dThick, dElev)) {
|
||||
if ( dElev < EPS_SMALL && AreSameVectorApprox( vtExtr, Z_AX)) {
|
||||
BBox3d b3Crv ;
|
||||
pCompo->GetLocalBBox( b3Crv) ;
|
||||
@@ -1339,7 +1339,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad,
|
||||
Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dThick,
|
||||
double& dElev) const
|
||||
{
|
||||
dElev = 0 ;
|
||||
@@ -1353,22 +1353,27 @@ Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
pCrvC->GetStartPoint( ptStart) ;
|
||||
pCrvC->GetMidPoint( ptMid) ;
|
||||
pCrvC->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtStartPerp, vtMidPerp, vtEndPerp, vtTg ;
|
||||
pCrvC->GetStartDir( vtTg) ;
|
||||
vtStartPerp = vtTg ^ vtTool ;
|
||||
vtStartPerp.Normalize() ;
|
||||
vtStartPerp *= dRad ;
|
||||
pCrvC->GetMidDir( vtTg) ;
|
||||
vtMidPerp = vtTg ^ vtTool ;
|
||||
vtMidPerp.Normalize() ;
|
||||
vtMidPerp *= dRad ;
|
||||
pCrvC->GetEndDir( vtTg) ;
|
||||
vtEndPerp = vtTg ^ vtTool ;
|
||||
vtEndPerp.Normalize() ;
|
||||
Vector3d vtStartPerp, vtEndPerp ;
|
||||
pCrvC->GetStartDir( vtStartPerp) ;
|
||||
vtStartPerp *= -dRad ;
|
||||
pCrvC->GetEndDir( vtEndPerp) ;
|
||||
vtEndPerp *= dRad ;
|
||||
Vector3d vtDepth = vtTool * dDepth ;
|
||||
Vector3d vtTg ; pCrvC->GetMidDir( vtTg) ;
|
||||
Vector3d vtOrtho = vtTool ^ vtTg ;
|
||||
vtOrtho.Normalize() ;
|
||||
vtOrtho *= dThick ;
|
||||
Vector3d vtDepth = -vtTool * dDepth ;
|
||||
// linea centro utensile
|
||||
if ( GetElevation( m_nPhase, ptStart - vtDepth, ptMid - vtDepth, ptEnd - vtDepth, vtTool, dCurrElev)) {
|
||||
if ( GetElevation( m_nPhase, ptStart + vtDepth, ptMid + vtDepth, ptEnd + vtDepth, vtTool, dCurrElev)) {
|
||||
if ( dCurrElev > dElev)
|
||||
dElev = dCurrElev ;
|
||||
}
|
||||
else {
|
||||
m_pMchMgr->SetLastError( 2505, "Error in Mortising : Entity GetElevation") ;
|
||||
return false ;
|
||||
}
|
||||
// sopra centro utensile
|
||||
if ( GetElevation( m_nPhase, ptStart + vtDepth + vtOrtho, ptMid + vtDepth + vtOrtho, ptEnd + vtDepth + vtOrtho, vtTool, dCurrElev)) {
|
||||
if ( dCurrElev > dElev)
|
||||
dElev = dCurrElev ;
|
||||
}
|
||||
@@ -1377,8 +1382,8 @@ Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
return false ;
|
||||
}
|
||||
// da una parte
|
||||
if ( GetElevation( m_nPhase, ptStart + vtStartPerp - vtDepth, ptMid + vtMidPerp - vtDepth,
|
||||
ptEnd + vtEndPerp - vtDepth, vtTool, dCurrElev)) {
|
||||
if ( GetElevation( m_nPhase, ptStart + vtStartPerp + vtDepth, ptMid + vtDepth,
|
||||
ptEnd + vtEndPerp + vtDepth, vtTool, dCurrElev)) {
|
||||
if ( dCurrElev > dElev)
|
||||
dElev = dCurrElev ;
|
||||
}
|
||||
@@ -1387,8 +1392,8 @@ Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
return false ;
|
||||
}
|
||||
// dall'altra parte
|
||||
if ( GetElevation( m_nPhase, ptStart - vtStartPerp - vtDepth, ptMid - vtMidPerp - vtDepth,
|
||||
ptEnd - vtEndPerp - vtDepth, vtTool, dCurrElev)) {
|
||||
if ( GetElevation( m_nPhase, ptStart + vtStartPerp + vtDepth, ptMid + vtDepth,
|
||||
ptEnd + vtEndPerp + vtDepth, vtTool, dCurrElev)) {
|
||||
if ( dCurrElev > dElev)
|
||||
dElev = dCurrElev ;
|
||||
}
|
||||
@@ -1420,10 +1425,15 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
|
||||
// compensazione elevazione/affondamento
|
||||
double dDelta = dElev - dDepth ;
|
||||
|
||||
// determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
|
||||
double dStartElev = 0 ;
|
||||
Point3d ptLi = ptStart + vtTool * dDelta ;
|
||||
bool bUnderStart = GetPointUnderRaw( ptLi, vtTool, GetRadiusForStartEndElevation(), m_TParams.m_dLen, dStartElev) ;
|
||||
|
||||
// 1 -> punto approccio
|
||||
SetFlag( 1) ;
|
||||
double dAppr = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
Point3d ptP1 = ptStart + vtTool * ( dDelta + dAppr) ;
|
||||
Point3d ptP1 = ptStart + vtTool * ( dDelta + dStartElev + dAppr) ;
|
||||
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
@@ -1496,10 +1506,15 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
|
||||
break ;
|
||||
}
|
||||
|
||||
// determino se la fine dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
|
||||
double dEndElev = 0 ;
|
||||
Point3d ptLo = ptLast + vtTool * dDelta ;
|
||||
bool bUnderEnd = GetPointUnderRaw( ptLo, vtTool, GetRadiusForStartEndElevation(), m_TParams.m_dLen, dEndElev) ;
|
||||
|
||||
// 6 -> ritorno all'approccio
|
||||
SetFeed( GetEndFeed()) ;
|
||||
SetFlag( 104) ; // risalita sopra la fine
|
||||
Point3d ptP6 = ptLast + vtTool * ( dDelta + dAppr) ;
|
||||
Point3d ptP6 = ptLast + vtTool * ( dDelta + dEndElev + dAppr) ;
|
||||
if ( AddLinearMove( ptP6) == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ class Mortising : public Machining
|
||||
ICurve* GetCurve( SelData Id) ;
|
||||
bool Chain( int nGrpDestId) ;
|
||||
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
|
||||
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) const ;
|
||||
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dThick, double& dElev) const ;
|
||||
bool GenerateMortisingPv( int nPathId, const ICurveComposite* pCompo) ;
|
||||
bool GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep) ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
|
||||
+1
-1
@@ -363,7 +363,7 @@ Operation::GetPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double
|
||||
Point3d ptTest( ptP.x, ptP.y, (( b3Raw.GetMin() + b3Raw.GetMax()) / 2).z) ;
|
||||
double dNewElev ;
|
||||
if ( GetElevation( m_nPhase, ptTest - 10 * EPS_SMALL * vtTool, vtTool, dToolRadForElev, vtDir, dNewElev))
|
||||
dElev = dNewElev ;
|
||||
dElev = max( dElev, dNewElev) ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
+75
-7
@@ -1032,7 +1032,8 @@ Sawing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
if ( pGObj == nullptr)
|
||||
return false ;
|
||||
// se ammesse curve ed è tale
|
||||
if ( nType != GEO_SURF && ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
if ( ( nType == GEO_NONE || nType == GEO_CURVE) && ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
nType = GEO_CURVE ;
|
||||
const ICurve* pCurve = nullptr ;
|
||||
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
|
||||
// se direttamente la curva
|
||||
@@ -1055,14 +1056,14 @@ Sawing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
return ( pCurve != nullptr) ;
|
||||
}
|
||||
// se altrimenti ammesse superfici trimesh ed è tale
|
||||
else if ( nType != GEO_CURVE && ( pGObj->GetType() & GEO_SURF) != 0) {
|
||||
else if ( ( nType == GEO_NONE || nType == GEO_SURF) && pGObj->GetType() == SRF_TRIMESH) {
|
||||
nType = GEO_SURF ;
|
||||
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
|
||||
if ( pSurf == nullptr)
|
||||
return false ;
|
||||
// se direttamente la superficie
|
||||
if ( Id.nSub == SEL_SUB_ALL) {
|
||||
nSubs = pSurf->GetFacetCount() ;
|
||||
return true ;
|
||||
}
|
||||
// altrimenti faccia di superficie trimesh
|
||||
else {
|
||||
@@ -1071,8 +1072,28 @@ Sawing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
return false ;
|
||||
// tutto bene
|
||||
nSubs = 0 ;
|
||||
return true ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
// se altrimenti ammesse regioni ed è tale
|
||||
else if ( ( nType == GEO_NONE || nType == GEO_SURF) && pGObj->GetType() == SRF_FLATRGN) {
|
||||
nType = GEO_SURF ;
|
||||
const ISurfFlatRegion* pReg = ::GetSurfFlatRegion( pGObj) ;
|
||||
if ( pReg == nullptr)
|
||||
return false ;
|
||||
// se direttamente la regione
|
||||
if ( Id.nSub == SEL_SUB_ALL) {
|
||||
nSubs = pReg->GetChunkCount() ;
|
||||
}
|
||||
// altrimenti chunk di regione
|
||||
else {
|
||||
// se chunk non esistente
|
||||
if ( Id.nSub >= pReg->GetChunkCount())
|
||||
return false ;
|
||||
// tutto bene
|
||||
nSubs = 0 ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
// altrimenti errore
|
||||
else
|
||||
@@ -1127,8 +1148,8 @@ Sawing::GetCurve( SelData Id)
|
||||
// la restituisco
|
||||
return Release( pCurve) ;
|
||||
}
|
||||
// se altrimenti superficie
|
||||
else if ( ( pGObj->GetType() & GEO_SURF) != 0) {
|
||||
// se altrimenti superficie trimesh
|
||||
else if ( pGObj->GetType() == SRF_TRIMESH) {
|
||||
// recupero la trimesh
|
||||
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
|
||||
if ( pSurf == nullptr)
|
||||
@@ -1158,7 +1179,54 @@ Sawing::GetCurve( SelData Id)
|
||||
vtN.ToGlob( frGlob) ;
|
||||
// sistemazioni varie
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, m_TParams.m_dThick) ;
|
||||
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino !!! da verificare !!!
|
||||
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
|
||||
if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
|
||||
m_Params.m_nWorkSide = SAW_WS_RIGHT ;
|
||||
m_Params.m_bInvert = ( m_Params.m_nWorkSide == SAW_WS_LEFT) ;
|
||||
double dSideAng ;
|
||||
Z_AX.GetAngle( vtN, dSideAng) ;
|
||||
// taglio verticale
|
||||
if ( abs( dSideAng - ANG_RIGHT) < 10 * EPS_ANG_SMALL)
|
||||
m_Params.m_dSideAngle = 0 ;
|
||||
// taglio soprasquadra
|
||||
else if ( dSideAng < ANG_RIGHT) {
|
||||
m_Params.m_dSideAngle = ANG_RIGHT - dSideAng ;
|
||||
m_Params.m_nHeadSide = ( m_Params.m_nWorkSide = SAW_WS_RIGHT ? SAW_HS_RIGHT : SAW_HS_LEFT) ;
|
||||
}
|
||||
// taglio sottosquadra
|
||||
else {
|
||||
m_Params.m_dSideAngle = ANG_RIGHT - dSideAng ;
|
||||
m_Params.m_nHeadSide = ( m_Params.m_nWorkSide = SAW_WS_RIGHT ? SAW_HS_LEFT : SAW_HS_RIGHT) ;
|
||||
}
|
||||
// la restituisco
|
||||
return Release( pCrvCompo) ;
|
||||
}
|
||||
// se altrimenti regione
|
||||
else if ( pGObj->GetType() == SRF_FLATRGN) {
|
||||
// recupero la regione
|
||||
const ISurfFlatRegion* pReg = ::GetSurfFlatRegion( pGObj) ;
|
||||
if ( pReg == nullptr)
|
||||
return false ;
|
||||
// recupero l'indice del chunk
|
||||
int nChunk = ( ( Id.nSub == SEL_SUB_ALL) ? 0 : Id.nSub) ;
|
||||
// recupero il contorno esterno del chunk
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nChunk, 0)))
|
||||
return false ;
|
||||
// recupero la normale della regione
|
||||
Vector3d vtN = pReg->GetNormVersor() ;
|
||||
if ( vtN.IsSmall())
|
||||
return false ;
|
||||
// assegno l'estrusione dalla normale alla faccia
|
||||
pCrvCompo->SetExtrusion( vtN) ;
|
||||
// unisco le eventuali parti allineate
|
||||
pCrvCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ;
|
||||
// la porto in globale
|
||||
pCrvCompo->ToGlob( frGlob) ;
|
||||
vtN.ToGlob( frGlob) ;
|
||||
// sistemazioni varie
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, m_TParams.m_dThick) ;
|
||||
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
|
||||
if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
|
||||
m_Params.m_nWorkSide = SAW_WS_RIGHT ;
|
||||
m_Params.m_bInvert = ( m_Params.m_nWorkSide == SAW_WS_LEFT) ;
|
||||
|
||||
Reference in New Issue
Block a user