EgtMachKernel :
- aggiunto flag in Ini macchina [Machinings] RapidOnOut=1 per abilitare approcci e retrazioni in rapido diretti su estremi fresature 1 passata fuori dal grezzo - migliorata precisione nella verifica collisioni per link tra lavorazioni con vere geometrie utensile con nome Tool_* (Tool_C, Tool_S,...).
This commit is contained in:
@@ -122,6 +122,12 @@ const std::string MILLHOLDER_KEY = "MillHolder" ;
|
||||
// Sezione portautensili nel file INI di macchina
|
||||
const std::string TOOLHOLDER_SEC = "ToolHolder" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Sezione lavorazioni nel file INI di macchina
|
||||
const std::string MACHININGS_SEC = "Machinings" ;
|
||||
// Chiave per abilitare discesa e risalita in rapido da fresature con estremi fuori dal grezzo
|
||||
const std::string RAPIDONOUT_KEY = "RapidOnOut" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Minimo spessore del grezzo
|
||||
const double RAW_MIN_H = 1 ;
|
||||
|
||||
@@ -126,7 +126,7 @@ class Machine
|
||||
bool GetAllCurrAxesNames( STRVECTOR& vAxName) const ;
|
||||
bool GetCurrAxisToken( int nInd, std::string& sAxToken) const ;
|
||||
bool GetAllCurrAxesTokens( STRVECTOR& vAxToken) const ;
|
||||
bool GetCurrAxisType( int nInd, bool& bHead) const ;
|
||||
bool GetCurrAxisType( int nInd, bool& bLinear, bool& bHead) const ;
|
||||
bool GetCurrAxisMin( int nInd, double& dMin) const ;
|
||||
bool GetCurrAxisMax( int nInd, double& dMax) const ;
|
||||
bool GetCurrAxisOffset( int nInd, double& dOffset) const ;
|
||||
|
||||
+3
-1
@@ -1949,15 +1949,17 @@ Machine::GetAllCurrAxesTokens( STRVECTOR& vAxToken) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetCurrAxisType( int nInd, bool& bHead) const
|
||||
Machine::GetCurrAxisType( int nInd, bool& bLinear, bool& bHead) const
|
||||
{
|
||||
int nLinAxes = int( m_vCalcLinAx.size()) ;
|
||||
int nRotAxes = int( m_vCalcRotAx.size()) ;
|
||||
if ( nInd >= 0 && nInd < nLinAxes) {
|
||||
bLinear = true ;
|
||||
bHead = m_vCalcLinAx[nInd].bHead ;
|
||||
return true ;
|
||||
}
|
||||
else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) {
|
||||
bLinear = false ;
|
||||
bHead = m_vCalcRotAx[nInd-nLinAxes].bHead ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
+20
-4
@@ -39,6 +39,7 @@
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
#include "/EgtDev/Include/EGnStringKeyVal.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EgtIniFile.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
@@ -2267,6 +2268,10 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
// delta da punto lavoro a punto tip
|
||||
Vector3d vtWkTip = -vtTool * dExtraLen ;
|
||||
|
||||
// Recupero flag per rapidi su inizio/fine se fuori
|
||||
string sMachIni = m_pMchMgr->GetCurrMachine()->GetMachineDir() + "\\" + m_pMchMgr->GetCurrMachine()->GetMachineName() + ".ini" ;
|
||||
bool bRapidOnOut = ( GetPrivateProfileInt( MACHININGS_SEC.c_str(), RAPIDONOUT_KEY.c_str(), 0, sMachIni.c_str()) == 1) ;
|
||||
|
||||
// in caso di tabs ne aggiusto i parametri secondo il percorso
|
||||
TabData tdTabs ;
|
||||
AdjustTabsParams( pCompo, bPathTabsEnable, tdTabs) ;
|
||||
@@ -2327,9 +2332,16 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
}
|
||||
// imposto versore correzione e ausiliario sul punto di partenza
|
||||
CalcAndSetCorrAuxDir( pCompo, i, false, true) ;
|
||||
// se richiesto rapido quando fuori e sono già in aria
|
||||
if ( bRapidOnOut && bOutStart) {
|
||||
// affondo al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// aggiungo approccio per frese normali e frese che non lavorano di testa con attacco opportuno oppure fuori
|
||||
if ( ( m_TParams.m_nType & TF_MILL) != 0 &&
|
||||
( m_TParams.m_nType != TT_MILL_NOTIP || LeadInRawIsOk() || m_bStartOutRaw)) {
|
||||
else if ( ( m_TParams.m_nType & TF_MILL) != 0 &&
|
||||
( m_TParams.m_nType != TT_MILL_NOTIP || LeadInRawIsOk() || m_bStartOutRaw)) {
|
||||
// correggo elevazione iniziale per punto inizio attacco (se testa da sopra senza aggregato approccio mai Z-)
|
||||
Vector3d vtEscape = vtTool ;
|
||||
if ( ( m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab && vtTool.z < -EPS_SMALL) ||
|
||||
@@ -2499,9 +2511,13 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
if ( ! vtRetr.Normalize())
|
||||
vtRetr = FromNearestHorizontalOrtho( vtTool, vtDir1) ;
|
||||
bool bOutEnd = GetPointOutOfRaw( ptP1 + vtWkTip, vtTool, vtRetr, dSafeZ) ;
|
||||
// se richiesto rapido quando fuori e sono già in aria
|
||||
if ( bRapidOnOut && bOutEnd) {
|
||||
// non devo fare alcunché
|
||||
}
|
||||
// aggiungo retrazione per frese normali e frese che non lavorano di testa già fuori
|
||||
if ( ( m_TParams.m_nType & TF_MILL) != 0 &&
|
||||
( m_TParams.m_nType != TT_MILL_NOTIP || m_bEndOutRaw)) {
|
||||
else if ( ( m_TParams.m_nType & TF_MILL) != 0 &&
|
||||
( m_TParams.m_nType != TT_MILL_NOTIP || m_bEndOutRaw)) {
|
||||
// determino se la fine dell'uscita è sopra il grezzo
|
||||
bool bAboveEnd = false ;
|
||||
if ( m_bAboveHead) {
|
||||
|
||||
+74
-13
@@ -4050,7 +4050,7 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn
|
||||
DBLVECTOR vAxMid( int( vAxName.size())) ;
|
||||
// ciclo sugli assi correnti, assegno opportunamente valori a seconda del tipo (testa o tavola)
|
||||
for ( int i = 0 ; i < int( vAxName.size()) ; ++ i) {
|
||||
bool bHead ; pMch->GetCurrAxisType( i, bHead) ;
|
||||
bool bLinear, bHead ; pMch->GetCurrAxisType( i, bLinear, bHead) ;
|
||||
if ( nHeadOrder == -1)
|
||||
vAxMid[i] = ( bHead ? vAxEnd[i] : vAxStart[i]) ;
|
||||
else if ( nHeadOrder == +1) {
|
||||
@@ -4078,6 +4078,30 @@ Operation::OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR&
|
||||
// Parti di testa e collegati da considerare per la collisione
|
||||
INTVECTOR vHeadCollId ;
|
||||
pMch->GetCurrHeadCollGroups( vHeadCollId) ;
|
||||
if ( vHeadCollId.empty())
|
||||
return true ;
|
||||
// Recupero utensili veri e propri e li nascondo
|
||||
INTVECTOR vCutterId ;
|
||||
int nExitId = m_pGeomDB->GetFirstGroupInGroup( vHeadCollId[0]) ;
|
||||
while ( nExitId != GDB_ID_NULL) {
|
||||
int nExitStat ;
|
||||
if ( m_pGeomDB->GetStatus( nExitId, nExitStat) && nExitStat != GDB_ST_OFF) {
|
||||
int nToolId = m_pGeomDB->GetFirstGroupInGroup( nExitId) ;
|
||||
while ( nToolId != GDB_ID_NULL) {
|
||||
int nToolStat ;
|
||||
if ( m_pGeomDB->GetStatus( nToolId, nToolStat) && nToolStat != GDB_ST_OFF) {
|
||||
int nCutterId = m_pGeomDB->GetFirstNameInGroup( nToolId, TNA_TOOL_START + "*") ;
|
||||
while ( nCutterId != GDB_ID_NULL) {
|
||||
vCutterId.emplace_back( nCutterId) ;
|
||||
m_pGeomDB->SetStatus( nCutterId, GDB_ST_OFF) ;
|
||||
nCutterId = m_pGeomDB->GetNextName( nCutterId, TNA_TOOL_START + "*") ;
|
||||
}
|
||||
}
|
||||
nToolId = m_pGeomDB->GetNextGroup( nToolId) ;
|
||||
}
|
||||
}
|
||||
nExitId = m_pGeomDB->GetNextGroup( nExitId) ;
|
||||
}
|
||||
|
||||
// distanza di sicurezza
|
||||
const double TOL_SAFEDIST = 5.0 ;
|
||||
@@ -4085,11 +4109,18 @@ Operation::OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR&
|
||||
double dSafeDist = GetSafeZ() ;
|
||||
dSafeDist = max( dSafeDist - TOL_SAFEDIST, MIN_SAFEDIST) ;
|
||||
// Vado nelle posizioni da controllare
|
||||
const int COLL_STEP = 16 ;
|
||||
const int COLL_STEP_MIN = 1 ;
|
||||
const int COLL_STEP_STD = 16 ;
|
||||
double dMoveLen = 0 ;
|
||||
for ( int j = 0 ; j < int( vAxName.size()) ; ++ j) {
|
||||
bool bLinear, bHead ; pMch->GetCurrAxisType( j, bLinear, bHead) ;
|
||||
dMoveLen += abs( vAxEnd[j] - vAxStart[j]) * ( bLinear ? 1 : 10) ;
|
||||
}
|
||||
int nStep = ( dMoveLen < 10 ? COLL_STEP_MIN : COLL_STEP_STD) ;
|
||||
bool bCollide = false ;
|
||||
for ( int i = 0 ; i < COLL_STEP && ! bCollide ; ++ i) {
|
||||
for ( int i = 0 ; i <= nStep && ! bCollide ; ++ i) {
|
||||
// Imposto la posizione
|
||||
double dCoeff = double( i) / COLL_STEP ;
|
||||
double dCoeff = double( i) / nStep ;
|
||||
for ( int j = 0 ; j < int( vAxName.size()) ; ++ j) {
|
||||
double dPos = ( 1 - dCoeff) * vAxStart[j] + dCoeff * vAxEnd[j] ;
|
||||
pMch->SetAxisPos( vAxName[j], dPos) ;
|
||||
@@ -4121,10 +4152,28 @@ Operation::OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR&
|
||||
}
|
||||
// eventuale emissione Log
|
||||
if ( ExeGetDebugLevel() >= 5) {
|
||||
string sHead ;
|
||||
if ( ! m_pGeomDB->GetName( nCId, sHead))
|
||||
sHead = "---" ;
|
||||
string sOut = " " + sHead + " : " + ToString( b3Head, 1) ;
|
||||
string sName ;
|
||||
if ( ! m_pGeomDB->GetName( nCId, sName))
|
||||
sName = "---" ;
|
||||
string sOut = " " + sName + " : " + ToString( b3Head, 1) ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
|
||||
}
|
||||
}
|
||||
// Aggiungo eventuali utensili veri e propri
|
||||
for ( int nCutterId : vCutterId) {
|
||||
BBox3d b3Tmp ;
|
||||
m_pGeomDB->GetGlobalBBox( nCutterId, b3Tmp, BBF_STANDARD) ;
|
||||
if ( ! b3Tmp.IsEmpty()) {
|
||||
b3Tmp.Expand( dSafeDist) ;
|
||||
b3Head.Add( b3Tmp) ;
|
||||
vbiSH.emplace_back( b3Tmp, nCutterId) ;
|
||||
}
|
||||
// eventuale emissione Log
|
||||
if ( ExeGetDebugLevel() >= 5) {
|
||||
string sName ;
|
||||
if ( ! m_pGeomDB->GetName( nCutterId, sName))
|
||||
sName = "---" ;
|
||||
string sOut = " " + sName + " : " + ToString( b3Head, 1) ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
|
||||
}
|
||||
}
|
||||
@@ -4153,18 +4202,26 @@ Operation::OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR&
|
||||
// verifico i sottobox
|
||||
for ( const auto& biSH : vbiSH) {
|
||||
if ( biSH.first.Overlaps( b3Raw)) {
|
||||
// box del solido parte della testa
|
||||
bool bCutter = ( find( vCutterId.begin(), vCutterId.end(), biSH.second) != vCutterId.end()) ;
|
||||
// box del solido parte della testa (se cutter è nascosto)
|
||||
BBox3d b3Hsol ;
|
||||
m_pGeomDB->GetLocalBBox( biSH.second, b3Hsol, BBF_ONLY_VISIBLE) ;
|
||||
Point3d ptMin ;
|
||||
Vector3d vtDiag ;
|
||||
b3Hsol.GetMinDim( ptMin, vtDiag.x, vtDiag.y, vtDiag.z) ;
|
||||
int nFlag = ( bCutter ? BBF_STANDARD : BBF_ONLY_VISIBLE) ;
|
||||
m_pGeomDB->GetLocalBBox( biSH.second, b3Hsol, nFlag) ;
|
||||
// riferimento della parte di testa
|
||||
Frame3d frHsol ;
|
||||
if ( m_pGeomDB->GetGdbType( biSH.second) == GDB_TY_GEO)
|
||||
m_pGeomDB->GetGlobFrame( biSH.second, frHsol) ;
|
||||
else
|
||||
m_pGeomDB->GetGroupGlobFrame( biSH.second, frHsol) ;
|
||||
// se cutter, ruoto riferimento di -90deg attorno a Xlocale (per compensare quanto fatto in LoadTool) quindi box di +90deg
|
||||
if ( bCutter) {
|
||||
b3Hsol.Rotate( ORIG, X_AX, 0, 1) ;
|
||||
frHsol.Rotate( frHsol.Orig(), frHsol.VersX(), 0, -1) ;
|
||||
}
|
||||
// dati geometrici del box
|
||||
Point3d ptMin ;
|
||||
Vector3d vtDiag ;
|
||||
b3Hsol.GetMinDim( ptMin, vtDiag.x, vtDiag.y, vtDiag.z) ;
|
||||
// lo porto nel riferimento del grezzo
|
||||
frHsol.ToLoc( frSolid) ;
|
||||
// se utensile cilindrico (faccia XY quadra e origine del riferimento nel suo centro)
|
||||
@@ -4269,6 +4326,10 @@ Operation::OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR&
|
||||
}
|
||||
}
|
||||
|
||||
// Ripristino visualizzazione utensili veri e propri
|
||||
for ( int nCutterId : vCutterId)
|
||||
m_pGeomDB->SetStatus( nCutterId, GDB_ST_ON) ;
|
||||
|
||||
return ( ! bCollide) ;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -108,4 +108,4 @@ SameTool( const ToolData& Td1, const ToolData& Td2, bool bAlsoNameTcPosHeadExit
|
||||
abs( Td1.m_dMinFeed - Td2.m_dMinFeed) < EPS_FEED &&
|
||||
Td1.m_sSysNotes == Td2.m_sSysNotes &&
|
||||
Td1.m_sUserNotes == Td2.m_sUserNotes) ;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user