EgtMachKernel :

- prima versione spezzatura archi in milling.
This commit is contained in:
Dario Sassi
2016-07-13 19:29:38 +00:00
parent 40f3f3e023
commit cfbb69ccba
4 changed files with 61 additions and 7 deletions
+36 -5
View File
@@ -943,6 +943,22 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
string sPathName ;
m_pGeomDB->GetName( nPathId, sPathName) ;
// eventuale approssimazione con segmenti di linea
bool bSplitArcs = ( m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() == SPLAR_ALWAYS) ;
if ( bSplitArcs) {
const double ANG_TOL_MAX_DEG = 90 ;
PolyLine PL ;
if ( pCompo->ApproxWithLines( 50 * EPS_SMALL, ANG_TOL_MAX_DEG, ICurve::APL_SPECIAL, PL)) {
// sostituisco le linee alle curve originali
pCompo->Clear() ;
pCompo->FromPolyLine( PL) ;
// riassegno estrusione e spessore
pCompo->SetExtrusion( vtExtr) ;
pCompo->SetThickness( dThick) ;
}
}
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
const double MAX_ANG_CEN = 150 + EPS_ANG_SMALL ;
int nMaxInd = pCompo->GetCurveCount() - 1 ;
@@ -1041,7 +1057,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
}
// aggiungo attacco
SetFeed( GetStartFeed()) ;
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr)) {
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, bSplitArcs)) {
LOG_INFO( GetEMkLogger(), "Error in Milling : LeadIn not computable") ;
return false ;
}
@@ -1075,7 +1091,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
// aggiungo uscita
Point3d ptP1 ;
SetFeed( GetStartFeed()) ;
if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, ptP1)) {
if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, ptP1, bSplitArcs)) {
LOG_INFO( GetEMkLogger(), "Error in Milling : LeadOut not computable") ;
return false ;
}
@@ -1181,9 +1197,19 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
//----------------------------------------------------------------------------
bool
Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN)
Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
const Vector3d& vtN, bool bSplitArcs)
{
switch ( m_Params.m_nLeadInType) {
// assegno i parametri
int nType = m_Params.m_nLeadInType ;
if ( bSplitArcs) {
if ( nType == MILL_LI_TANGENT)
nType = MILL_LI_LINEAR ;
if ( nType == MILL_LI_HELIX)
nType = MILL_LI_LINEAR ; // prevedere un nuovo tipo zig-zag
}
// eseguo a seconda del tipo
switch ( nType) {
case MILL_LI_NONE :
return true ;
case MILL_LI_LINEAR :
@@ -1253,7 +1279,8 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
//----------------------------------------------------------------------------
bool
Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN, Point3d& ptP1)
Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
Point3d& ptP1, bool bSplitArcs)
{
// assegno i parametri
int nType = m_Params.m_nLeadOutType ;
@@ -1264,6 +1291,10 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
dTang = m_Params.m_dLiTang ;
dPerp = m_Params.m_dLiPerp ;
}
if ( bSplitArcs) {
if ( nType == MILL_LO_TANGENT)
nType = MILL_LO_LINEAR ;
}
// eseguo a seconda del tipo
switch ( nType) {
case MILL_LO_NONE :