EgtMachKernel 2.3b3 :
- in fresatura standard con lama aggiunta gestione approccio e retrazione lama su testa da sopra ma sotto il grezzo.
This commit is contained in:
Binary file not shown.
+106
-9
@@ -2262,13 +2262,24 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
else {
|
||||
// verifico di entrare in aria
|
||||
if ( ! bOutStart) {
|
||||
m_pMchMgr->SetLastError( 2314, "Error in Milling : LeadIn must be out of rawpart") ;
|
||||
return false ;
|
||||
// verifico se sono sotto
|
||||
bool bUnderStart = m_bAboveHead && GetPointUnderRaw( ptP1, vtTool, GetRadiusForStartEndElevation( false), m_TParams.m_dLen, dStElev) ;
|
||||
if ( ! bUnderStart) {
|
||||
m_pMchMgr->SetLastError( 2314, "Error in Milling : LeadIn must be out of rawpart") ;
|
||||
return false ;
|
||||
}
|
||||
// aggiungo opportuno approccio
|
||||
if ( ! AddSawBladeSideApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// affondo al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// affondo al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// aggiungo attacco
|
||||
SetFeed( GetStartFeed()) ;
|
||||
@@ -2352,7 +2363,16 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// per lame non è necessario
|
||||
// per lame quando è necessario
|
||||
else {
|
||||
// verifico se sono sotto
|
||||
bool bUnderEnd = m_bAboveHead && GetPointUnderRaw( ptP1, vtTool, GetRadiusForStartEndElevation( false), m_TParams.m_dLen, dEndElev) ;
|
||||
// se necessario, aggiungo opportuna retrazione
|
||||
if ( bUnderEnd && ! AddSawBladeSideRetract( ptP1, vtTool, dSafeZ, dEndElev, dAppr)) {
|
||||
m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
@@ -3448,6 +3468,44 @@ Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dStElev, double dAppr)
|
||||
{
|
||||
SetFlag( 1) ;
|
||||
// approccio per lame su teste da sopra che attaccano da sotto -> movimento in orizzontale fino all'esterno del grezzo
|
||||
Vector3d vtAppr = vtTool ;
|
||||
vtAppr.z = 0 ;
|
||||
vtAppr.Normalize() ;
|
||||
// se distanza di sicurezza minore di distanza di inizio
|
||||
if ( dSafeZ < dAppr + 10 * EPS_SMALL) {
|
||||
// 1 -> punto sopra inizio
|
||||
Point3d ptP1 = ptP + vtAppr * ( dStElev + dAppr) ;
|
||||
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
// 1a -> punto sopra inizio
|
||||
Point3d ptP1b = ptP + vtAppr * ( dStElev + dAppr) ;
|
||||
Point3d ptP1a = ptP1b + vtAppr * ( dSafeZ - dAppr) ;
|
||||
if ( AddRapidStart( ptP1a) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// 1b -> punto appena sopra inizio
|
||||
if ( ( dStElev + dAppr) > EPS_SMALL) {
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidMove( ptP1b) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// affondo al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( AddLinearMove( ptP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::AddDirectApproach( const Point3d& ptP)
|
||||
@@ -3465,7 +3523,7 @@ bool
|
||||
Milling::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bAboveEnd)
|
||||
{
|
||||
// se testa da sopra senza aggregato da sotto, approccio mai da Z negativo
|
||||
// se testa da sopra senza aggregato da sotto, retrazione mai da Z negativo
|
||||
Vector3d vtAppr = vtTool ;
|
||||
if ( m_bAboveHead && ! m_bAggrBottom && vtTool.z < - EPS_SMALL) {
|
||||
vtAppr.z = 0 ;
|
||||
@@ -3544,6 +3602,41 @@ Milling::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dEndElev, double dAppr)
|
||||
{
|
||||
// retrazione per lame su teste da sopra che attaccano da sotto -> movimento in orizzontale fino all'esterno del grezzo
|
||||
Vector3d vtAppr = vtTool ;
|
||||
vtAppr.z = 0 ;
|
||||
vtAppr.Normalize() ;
|
||||
// se sopra uscita c'è spazio per sicurezza o approccio
|
||||
if ( dEndElev + max( dSafeZ, dAppr) > 10 * EPS_SMALL) {
|
||||
if ( dSafeZ < dAppr + 10 * EPS_SMALL) {
|
||||
// 4 -> movimento di risalita sopra il punto finale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
Point3d ptP4 = ptP + vtAppr * ( dEndElev + dAppr) ;
|
||||
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
// 4a -> movimento di risalita appena sopra il punto finale
|
||||
Point3d ptP4a = ptP + vtAppr * ( dEndElev + dAppr) ;
|
||||
if ( dEndElev + dAppr > EPS_SMALL) {
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( AddLinearMove( ptP4a) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 4b -> movimento di risalita sopra il punto finale
|
||||
Point3d ptP4b = ptP4a + vtAppr * ( dSafeZ - dAppr) ;
|
||||
if ( AddRapidMove( ptP4b) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Milling::GetLeadInType( void) const
|
||||
@@ -4886,8 +4979,12 @@ Milling::AddTabsArc( const ICurveArc* pArc, const Vector3d& vtTool, const DBLVEC
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
Milling::GetRadiusForStartEndElevation( void) const
|
||||
Milling::GetRadiusForStartEndElevation( bool bExtra) const
|
||||
{
|
||||
// se da non estendere
|
||||
if ( ! bExtra)
|
||||
return ( 0.5 * m_TParams.m_dTDiam) ;
|
||||
// aumentato
|
||||
const double DELTA_ELEV_RAD = 20.0 ;
|
||||
double dDeltaRad = DELTA_ELEV_RAD + max( max( m_Params.m_dStartAddLen, m_Params.m_dEndAddLen), 0.0) ;
|
||||
return ( 0.5 * m_TParams.m_dTDiam + dDeltaRad) ;
|
||||
|
||||
@@ -98,9 +98,11 @@ class Milling : public Machining
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bOutStart, bool bAboveStart) ;
|
||||
bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dStElev, double dAppr) ;
|
||||
bool AddDirectApproach( const Point3d& ptP) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bAboveEnd) ;
|
||||
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dEndElev, double dAppr) ;
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
|
||||
@@ -114,7 +116,7 @@ class Milling : public Machining
|
||||
bool CalcTabsPositions( const ICurveComposite* pCompo, double dDepth, bool bPathTabsEnable, const TabData& tdTabs, DBLVECTOR& vdTabs) ;
|
||||
bool AddTabsLine( const ICurveLine* pLine, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
|
||||
bool AddTabsArc( const ICurveArc* pArc, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
double GetRadiusForStartEndElevation( bool bExtra = true) const ;
|
||||
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, double dElev) const ;
|
||||
bool GetPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
|
||||
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU) ;
|
||||
|
||||
+20
-3
@@ -351,7 +351,10 @@ Operation::GetPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double
|
||||
BBox3d b3Tool ;
|
||||
b3Tool.Set( ptP) ;
|
||||
b3Tool.Add( ptQ) ;
|
||||
b3Tool.Expand( dToolRadForElev) ;
|
||||
double dExpandX = sqrt( 1 - vtTool.x * vtTool.x) * dToolRadForElev ;
|
||||
double dExpandY = sqrt( 1 - vtTool.y * vtTool.y) * dToolRadForElev ;
|
||||
double dExpandZ = sqrt( 1 - vtTool.z * vtTool.z) * dToolRadForElev ;
|
||||
b3Tool.Expand( dExpandX, dExpandY, dExpandZ) ;
|
||||
// direzione di fuga per l'elevazione
|
||||
Vector3d vtDir = vtTool ;
|
||||
if ( vtDir.z < - EPS_SMALL)
|
||||
@@ -366,12 +369,26 @@ Operation::GetPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double
|
||||
int nStmId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
|
||||
BBox3d b3Raw ;
|
||||
m_pGeomDB->GetGlobalBBox( nStmId, b3Raw) ;
|
||||
if ( ! b3Raw.IsEmpty() && b3Raw.OverlapsXY( b3Tool) && ptP.z < b3Raw.GetMin().z - 10 * EPS_SMALL) {
|
||||
if ( ! b3Raw.IsEmpty() && b3Raw.OverlapsXY( b3Tool) && ptP.z < b3Raw.GetMin().z - 10 * EPS_SMALL) {
|
||||
double dRawCentZ = ( b3Raw.GetMin().z + b3Raw.GetMax().z) / 2 ;
|
||||
double dRawDimZ = b3Raw.GetMax().z - b3Raw.GetMin().z ;
|
||||
double dToolDimZ = b3Tool.GetMax().z - b3Tool.GetMin().z ;
|
||||
// determino elevazione del punto rispetto al grezzo a metà altezza
|
||||
Point3d ptTest( ptP.x, ptP.y, (( b3Raw.GetMin() + b3Raw.GetMax()) / 2).z) ;
|
||||
Point3d ptTest( ptP.x, ptP.y, dRawCentZ) ;
|
||||
double dNewElev ;
|
||||
if ( GetElevation( m_nPhase, ptTest - 10 * EPS_SMALL * vtTool, vtTool, dToolRadForElev, vtDir, dNewElev))
|
||||
dElev = max( dElev, dNewElev) ;
|
||||
// se direzione di fuga quasi orizzontale (30 deg) e ingombro utensile rilevante rispetto ad altezza grezzo
|
||||
if ( vtDir.z < 0.5 && dToolDimZ > dRawDimZ / 2) {
|
||||
// determino elevazione del punto rispetto al grezzo a metà altezza più metà ingombro utensile
|
||||
ptTest = Point3d( ptP.x, ptP.y, dRawCentZ + dToolDimZ / 2) ;
|
||||
if ( GetElevation( m_nPhase, ptTest - 10 * EPS_SMALL * vtTool, vtTool, dToolRadForElev, vtDir, dNewElev))
|
||||
dElev = max( dElev, dNewElev) ;
|
||||
// determino elevazione del punto rispetto al grezzo a metà altezza meno metà ingombro utensile
|
||||
ptTest = Point3d( ptP.x, ptP.y, dRawCentZ - dToolDimZ / 2) ;
|
||||
if ( GetElevation( m_nPhase, ptTest - 10 * EPS_SMALL * vtTool, vtTool, dToolRadForElev, vtDir, dNewElev))
|
||||
dElev = max( dElev, dNewElev) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user