Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ca72ddf1a4 | |||
| d1406baa2e | |||
| 89d46baf43 | |||
| 1f57693da8 | |||
| 010f676234 | |||
| 1839b45e96 | |||
| 9bc699be18 | |||
| f701828a25 | |||
| f8d2f26692 | |||
| 4e3079e504 | |||
| 0d0f195d8b | |||
| 7fbce2b593 | |||
| 74b2874f56 | |||
| 9540563a87 | |||
| 8eeca04757 | |||
| db6ae7538f |
+26
-22
@@ -51,6 +51,7 @@ using namespace std ;
|
||||
// 2115 = "Error in Drilling : Mirror for Double calculation failed"
|
||||
// 2116 = "Error in Drilling : multi drilling head without valid tools"
|
||||
// 2117 = "Error in Drilling : incorrect multi drilling head"
|
||||
// 2118 = "Error in Drilling : Tool loading failed"
|
||||
// 2151 = "Warning in Drilling : Skipped entity (xx)"
|
||||
// 2152 = "Warning in Drilling : No machinable path"
|
||||
// 2153 = "Warning in Drilling : Tool name changed (xx)"
|
||||
@@ -96,7 +97,6 @@ struct HoleInfo {
|
||||
int nIndInSelVector = 0 ; // indice nel vettore m_vId (id fori selezionati)
|
||||
} ;
|
||||
|
||||
|
||||
struct ToolInfo
|
||||
{
|
||||
const ToolData* pTool ; // puntatore per utensile (nullo se utensile non presente)
|
||||
@@ -618,7 +618,7 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
|
||||
|
||||
// rendo corrente l'utensile usato nella lavorazione
|
||||
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
|
||||
m_pMchMgr->SetLastError( 2322, "Error in Milling : Tool loading failed") ;
|
||||
m_pMchMgr->SetLastError( 2118, "Error in Drilling : Tool loading failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -2110,6 +2110,8 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double
|
||||
GetElevation( m_nPhase, hole.ptIni, hole.vtDir, m_TParams.m_dDiam / 2, hole.vtDir, dElev) ;
|
||||
// determino alcune caratteristiche dell'utensile
|
||||
double dTExtrLen = max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ;
|
||||
// necessità di spezzatura per robot
|
||||
bool bSplitArcs = GetSplitArcs( V_NULL) ;
|
||||
// imposto dati comuni
|
||||
SetPathId( nPathId) ;
|
||||
SetToolDir( hole.vtDir) ;
|
||||
@@ -2131,7 +2133,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double
|
||||
return false ;
|
||||
SetAuxDir( m_vtAggrBottom) ;
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidMove( ptP0, MCH_CL_AGB_IN) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_IN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// altrimenti rinvio normale
|
||||
@@ -2141,7 +2143,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
}
|
||||
if ( AddRapidMove( ptP1) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP1, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
@@ -2154,7 +2156,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double
|
||||
// 2 -> punto fuori (se diverso dal precedente)
|
||||
if ( m_Params.m_dStartPos < dAppr) {
|
||||
Point3d ptP2 = hole.ptIni + hole.vtDir * ( m_Params.m_dStartPos + dTExtrLen) ;
|
||||
if ( AddRapidMove( ptP2) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP2, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 3 -> punto termine velocità ridotta iniziale (se previsto)
|
||||
@@ -2165,7 +2167,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double
|
||||
Point3d ptP3 = hole.ptIni - hole.vtDir * dStartSlowLen ;
|
||||
if ( ! bStd && ! bEndSlow)
|
||||
ptP3 -= hole.vtDir * dAddLen ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 4 -> punto termine velocità standard (se risulta)
|
||||
@@ -2176,7 +2178,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double
|
||||
Point3d ptP4 = hole.ptIni - hole.vtDir * ( hole.dLen - dEndSlowLen) ;
|
||||
if ( ! bEndSlow)
|
||||
ptP4 -= hole.vtDir * dAddLen ;
|
||||
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 5 -> punto termine velocità finale ridotta (se previsto)
|
||||
@@ -2184,27 +2186,27 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double
|
||||
SetFeed( GetTipFeed()) ;
|
||||
SetFlag( 101) ; // fondo del foro
|
||||
Point3d ptP5 = hole.ptIni - hole.vtDir * ( hole.dLen + dAddLen) ;
|
||||
if ( AddLinearMove( ptP5) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP5, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 6 -> ritorno all'approccio del foro
|
||||
SetFeed( GetEndFeed()) ;
|
||||
SetFlag( 104) ; // risalita sopra il foro
|
||||
if ( AddLinearMove( ptP1) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP1, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// 7 -> punto fuori (se uso aggregato da sotto)
|
||||
if ( m_bAggrBottom) {
|
||||
SetFlag( 0) ;
|
||||
Point3d ptP0 = ptP1 + m_vtAggrBottom * ( m_dDistBottom + m_AggrBottom.dEncH + dSafeZ) ;
|
||||
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAppr + dTExtrLen) ;
|
||||
if ( AddRapidMove( ptP0, MCH_CL_AGB_OUT) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_OUT) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// se rinvio da sotto che richiede speciale rotazione
|
||||
if ( m_AggrBottom.nType == 1) {
|
||||
Vector3d vtAux = m_vtAggrBottom ;
|
||||
vtAux.Rotate( Z_AX, 0, 1) ;
|
||||
SetAuxDir( vtAux) ;
|
||||
if ( AddRapidMove( ptP00, MCH_CL_AGB_UP) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP00, bSplitArcs, MCH_CL_AGB_UP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -2241,6 +2243,8 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
GetElevation( m_nPhase, hole.ptIni, hole.vtDir, m_TParams.m_dDiam / 2, hole.vtDir, dElev) ;
|
||||
// determino alcune caratteristiche dell'utensile
|
||||
double dTExtrLen = max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ;
|
||||
// necessità di spezzatura per robot
|
||||
bool bSplitArcs = GetSplitArcs( V_NULL) ;
|
||||
// imposto dati comuni
|
||||
SetPathId( nPathId) ;
|
||||
SetToolDir( hole.vtDir) ;
|
||||
@@ -2262,7 +2266,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
SetAuxDir( m_vtAggrBottom) ;
|
||||
if ( AddRapidMove( ptP0, MCH_CL_AGB_IN) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_IN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// altrimenti rinvio normale
|
||||
@@ -2272,7 +2276,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
}
|
||||
if ( AddRapidMove( ptP1) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP1, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
@@ -2283,7 +2287,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
// 2 -> punto fuori (se diverso dal precedente)
|
||||
if ( m_Params.m_dStartPos < dAppr) {
|
||||
Point3d ptP2 = hole.ptIni + hole.vtDir * ( m_Params.m_dStartPos + dTExtrLen) ;
|
||||
if ( AddRapidMove( ptP2) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP2, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// ciclo di affondamento a step
|
||||
@@ -2303,13 +2307,13 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
SetFeed( GetEndFeed()) ;
|
||||
SetFlag( 103) ; // punto di scarico truciolo
|
||||
Point3d ptPr = hole.ptIni + hole.vtDir * dReturnPos ;
|
||||
if ( AddLinearMove( ptPr) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptPr, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// riaffondo
|
||||
SetFeed( GetEndFeed()) ;
|
||||
SetFlag( 0) ;
|
||||
Point3d ptPa = hole.ptIni - hole.vtDir * ( dCurrLen - APPR_STEP) ;
|
||||
if ( AddLinearMove( ptPa) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptPa, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// lunghezza di fine step
|
||||
@@ -2332,7 +2336,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
Point3d ptP3 = hole.ptIni - hole.vtDir * dLen ;
|
||||
if ( bHoleEnd)
|
||||
ptP3 -= hole.vtDir * dAddLen ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// aggiorno posizione e verifico se step completato
|
||||
dCurrLen = dLen ;
|
||||
@@ -2357,7 +2361,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
Point3d ptP4 = hole.ptIni - hole.vtDir * dLen ;
|
||||
if ( bHoleEnd)
|
||||
ptP4 -= hole.vtDir * dAddLen ;
|
||||
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// aggiorno posizione e verifico se step completato
|
||||
dCurrLen = dLen ;
|
||||
@@ -2381,7 +2385,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
Point3d ptP5 = hole.ptIni - hole.vtDir * dLen ;
|
||||
if ( bHoleEnd)
|
||||
ptP5 -= hole.vtDir * dAddLen ;
|
||||
if ( AddLinearMove( ptP5) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP5, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// aggiorno posizione
|
||||
dCurrLen = dLen ;
|
||||
@@ -2391,7 +2395,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
// 6 -> ritorno all'approccio del foro
|
||||
SetFeed( GetEndFeed()) ;
|
||||
SetFlag( 104) ; // risalita sopra il foro
|
||||
if ( AddLinearMove( ptP1) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP1, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
// 7 -> punto fuori (se uso aggregato da sotto)
|
||||
@@ -2399,14 +2403,14 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
SetFlag( 0) ;
|
||||
Point3d ptP0 = ptP1 + m_vtAggrBottom * ( m_dDistBottom + m_AggrBottom.dEncH + dSafeZ) ;
|
||||
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAppr + dTExtrLen) ;
|
||||
if ( AddRapidMove( ptP0, MCH_CL_AGB_OUT) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_OUT) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// se rinvio da sotto che richiede speciale rotazione
|
||||
if ( m_AggrBottom.nType == 1) {
|
||||
Vector3d vtAux = m_vtAggrBottom ;
|
||||
vtAux.Rotate( Z_AX, 0, 1) ;
|
||||
SetAuxDir( vtAux) ;
|
||||
if ( AddRapidMove( ptP00, MCH_CL_AGB_UP) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP00, bSplitArcs, MCH_CL_AGB_UP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
+2
-1
@@ -20,8 +20,9 @@
|
||||
const double LIN_TOL_STD = 0.1 ;
|
||||
const double LIN_TOL_MID = 0.05 ;
|
||||
const double LIN_TOL_RAW = 0.5 ;
|
||||
const double ANG_TOL_MAX_DEG = 90 ;
|
||||
const double ANG_TOL_STD_DEG = 15 ;
|
||||
const double ANG_TOL_MID_DEG = 45 ;
|
||||
const double ANG_TOL_MAX_DEG = 90 ;
|
||||
const double LIN_FEA_STD = 20 ;
|
||||
|
||||
//----------- Costante per offset salva spigoli di lama su cornici curve ----
|
||||
|
||||
@@ -52,6 +52,7 @@ Head::Clone( void) const
|
||||
pHead->m_bMaxDeltaR2On1 = m_bMaxDeltaR2On1 ;
|
||||
pHead->m_Rot2Stroke = m_Rot2Stroke ;
|
||||
pHead->m_nSolCh = m_nSolCh ;
|
||||
pHead->m_vsOtherColl = m_vsOtherColl ;
|
||||
}
|
||||
catch( ...) {
|
||||
delete pHead ;
|
||||
@@ -73,6 +74,7 @@ Head::Dump( string& sOut, bool bMM, const char* szNewLine) const
|
||||
sOut += "ExitCount=" + ToString( m_nExitCount) + szNewLine ;
|
||||
sOut += "HSet=" + ToString( m_vsHSet) + szNewLine ;
|
||||
sOut += "ADir=" + ToString( m_vtADir) + szNewLine ;
|
||||
sOut += "OtherColl=" + ToString( m_vsOtherColl) + szNewLine ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,10 @@ const std::string MACH_RAW_SOLID = "RawSolid" ;
|
||||
const std::string MACH_RAW_CENTER = "RawCenter" ;
|
||||
// Nome del contorno esterno del grezzo
|
||||
const std::string MACH_RAW_OUTLINE = "RawOutline" ;
|
||||
// Nome della regione superiore del grezzo
|
||||
const std::string MACH_RAW_UP_REG = "RawUpReg" ;
|
||||
// Nome della regione inferiore del grezzo
|
||||
const std::string MACH_RAW_DOWN_REG = "RawDwnReg" ;
|
||||
// Nome del kerf del grezzo
|
||||
const std::string MACH_RAW_KERF = "Kerf" ;
|
||||
|
||||
@@ -131,6 +135,7 @@ const double LIO_ELEV_TOL = 2.0 ;
|
||||
//----------------------------------------------------------------------------
|
||||
// Per FlatParts (vedi Nesting di EgtExecutor)
|
||||
const std::string NST_EXT_LAYER = "OutLoop" ;
|
||||
const std::string NST_PARTREG_LAYER = "Region" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Minima componente zeta di versore utensile per lavorazione da sopra (-45deg)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2023
|
||||
// EgalTech 2015-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachMgr.h Data : 28.10.23 Versione : 2.5j4
|
||||
// File : MachMgr.h Data : 02.04.24 Versione : 2.6d1
|
||||
// Contenuto : Dichiarazione della classe MachMgr.
|
||||
//
|
||||
//
|
||||
@@ -13,6 +13,8 @@
|
||||
// 21.09.22 DS Aggiunta GetAxisOffset.
|
||||
// 25.08.23 DS Aggiunta CopyMachGroup.
|
||||
// 28.10.23 DS Aggiunte GetClEntAxesVal e GetToolSetupPosInCurrSetup.
|
||||
// 30.03.24 DS Aggiunte GetAllAxesNames e GetCalcTable.
|
||||
// 02.04.24 DS Aggiunta GetClEntAxesMask.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -308,6 +310,7 @@ class MachMgr : public IMachMgr
|
||||
bool GetClEntMove( int nEntId, int& nMove) const override ;
|
||||
bool GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const override ;
|
||||
bool GetClEntIndex( int nEntId, int& nIndex) const override ;
|
||||
bool GetClEntAxesMask( int nEntId, int& nMask) const override ;
|
||||
bool GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const override ;
|
||||
// Simulation
|
||||
bool SimInit( void) override ;
|
||||
@@ -327,9 +330,10 @@ class MachMgr : public IMachMgr
|
||||
// Machine Calc
|
||||
bool SetCalcTable( const std::string& sTable) override ;
|
||||
bool SetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) override ;
|
||||
bool GetAllCurrAxesName( STRVECTOR& vAxName) const override ;
|
||||
bool GetAllCurrAxesNames( STRVECTOR& vAxName) const override ;
|
||||
bool SetRotAxisBlock( const std::string& sAxis, double dVal) override ;
|
||||
bool GetRotAxisBlocked( int nInd, std::string& sAxis, double& dVal) const override ;
|
||||
bool GetCalcTable( std::string& sTable) const override ;
|
||||
bool GetCalcTool( std::string& sTool) const override ;
|
||||
bool GetCalcHead( std::string& sHead) const override ;
|
||||
bool GetCalcExit( int& nExit) const override ;
|
||||
@@ -370,6 +374,7 @@ class MachMgr : public IMachMgr
|
||||
bool ResetAxisPos( const std::string& sAxis) override ;
|
||||
bool ResetAllAxesPos( void) override ;
|
||||
bool GetAllTablesNames( STRVECTOR& vNames) const override ;
|
||||
bool GetAllAxesNames( STRVECTOR& vNames) const override ;
|
||||
bool GetAllHeadsNames( STRVECTOR& vNames) const override ;
|
||||
bool GetAllTcPosNames( STRVECTOR& vNames) const override ;
|
||||
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) override ;
|
||||
@@ -494,6 +499,7 @@ class MachMgr : public IMachMgr
|
||||
// RawParts
|
||||
int AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol) ;
|
||||
int AddRawPart( int nSurfId, Color cCol) ;
|
||||
int AddRawPart( int nSurfUpId, int nSurfDownId, double dHeight, Color cCol) ;
|
||||
bool SetRawPartCenter( int nRawId) ;
|
||||
bool ResetRawPartCenter( int nRawId) ;
|
||||
// Parts
|
||||
|
||||
@@ -75,6 +75,24 @@ MachMgr::GetClEntIndex( int nEntId, int& nIndex) const
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntAxesMask( int nEntId, int& nMask) const
|
||||
{
|
||||
// default
|
||||
nMask = 0 ;
|
||||
// verifico validita GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero l'oggetto CamData
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero il tipo di movimento
|
||||
nMask = pCamData->GetAxesMask() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachMgrDBMachinings.cpp Data : 11.11.15 Versione : 1.6k5
|
||||
// File : MachMgrDBMachinings.cpp Data : 29.03.24 Versione : 2.6d1
|
||||
// Contenuto : Implementazione gestione DB lavorazioni della classe MachMgr.
|
||||
//
|
||||
//
|
||||
@@ -304,6 +304,8 @@ MachMgr::MdbSetGeneralParam( int nType, double dVal)
|
||||
return pMsMgr->SetSafeAggrBottZ( dVal) ;
|
||||
case MGP_MAXDEPTHSAFE :
|
||||
return pMsMgr->SetMaxDepthSafe( dVal) ;
|
||||
case MGP_APPROXLINTOL :
|
||||
return pMsMgr->SetApproxLinTol( dVal) ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
@@ -379,6 +381,9 @@ MachMgr::MdbGetGeneralParam( int nType, double& dVal) const
|
||||
case MGP_MAXDEPTHSAFE :
|
||||
dVal = pMsMgr->GetMaxDepthSafe() ;
|
||||
return true ;
|
||||
case MGP_APPROXLINTOL :
|
||||
dVal = pMsMgr->GetApproxLinTol() ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
+21
-2
@@ -534,6 +534,14 @@ MachMgr::SetCalcSolCh( int nScc, bool bExact)
|
||||
return pMch->SetSolCh( nScc, bExact) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcTable( string& sTable) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetCurrTable( sTable) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcTool( string& sTool) const
|
||||
@@ -609,6 +617,17 @@ MachMgr::GetAllTablesNames( STRVECTOR& vNames) const
|
||||
return ( ( pMch != nullptr) ? pMch->GetAllTablesNames( vNames) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetAllAxesNames( STRVECTOR& vNames) const
|
||||
{
|
||||
// pulisco il vettore
|
||||
vNames.clear() ;
|
||||
// richiedo elenco assi alla macchina corrente
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetAllAxesNames( vNames) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetAllHeadsNames( STRVECTOR& vNames) const
|
||||
@@ -649,10 +668,10 @@ MachMgr::GetCurrRotAxes( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetAllCurrAxesName( STRVECTOR& vAxName) const
|
||||
MachMgr::GetAllCurrAxesNames( STRVECTOR& vAxName) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetAllCurrAxesName( vAxName) : false) ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetAllCurrAxesNames( vAxName) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+409
-134
@@ -29,6 +29,7 @@
|
||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
||||
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -96,7 +97,7 @@ MachMgr::AddRawPart( const Point3d& ptOrig, double dLen, double dWidth, double d
|
||||
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
|
||||
// creo solido e outline
|
||||
bOk = bOk && ModifyRawPart( nRawId, ptOrig, dLen, dWidth, dHeight, cCol) ;
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
if ( ! bOk) {
|
||||
m_pGeomDB->Erase( nRawId) ;
|
||||
return GDB_ID_NULL ;
|
||||
@@ -112,7 +113,7 @@ MachMgr::ModifyRawPart( int nRawId, const Point3d& ptOrig, double dLen, double d
|
||||
// le dimensioni non possono essere nulle
|
||||
if ( dLen < EPS_SMALL || dWidth < EPS_SMALL || dHeight < EPS_SMALL)
|
||||
return false ;
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// creo il solido
|
||||
@@ -171,7 +172,7 @@ MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color
|
||||
// verifico il gruppo dei grezzi nella macchinata corrente
|
||||
if ( GetCurrRawGroupId() == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// verifico che il pezzo non sia già usato nella macchinata corrente
|
||||
// verifico che il pezzo non sia già usato nella macchinata corrente
|
||||
if ( m_pGeomDB->GetParentId( nPartId) != GDB_ID_ROOT)
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il tipo di oggetto per definire il grezzo
|
||||
@@ -180,7 +181,7 @@ MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color
|
||||
Point3d ptRef ;
|
||||
// costruzione del grezzo
|
||||
int nRawId = GDB_ID_NULL ;
|
||||
// se grezzo da superficie (per ora senza possibilità di offset)
|
||||
// se grezzo da superficie (per ora senza possibilità di offset)
|
||||
if ( ( nGtype & GEO_SURF) != 0) {
|
||||
// inserisco il grezzo
|
||||
nRawId = AddRawPart( nCrvSrfId, cCol) ;
|
||||
@@ -284,7 +285,7 @@ MachMgr::AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight,
|
||||
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
|
||||
// creo solido e outline
|
||||
bOk = bOk && ModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ;
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
if ( ! bOk) {
|
||||
m_pGeomDB->Erase( nRawId) ;
|
||||
return GDB_ID_NULL ;
|
||||
@@ -297,7 +298,7 @@ MachMgr::AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight,
|
||||
bool
|
||||
MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol)
|
||||
{
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// recupero il riferimento della curva
|
||||
@@ -321,7 +322,7 @@ MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, d
|
||||
// la schiaccio a Z = 0
|
||||
if ( ! pMyCrv->Scale( Frame3d(), 1, 1, 0))
|
||||
return false ;
|
||||
// se non è chiusa, la chiudo
|
||||
// se non è chiusa, la chiudo
|
||||
pMyCrv->Close() ;
|
||||
// la oriento in senso CCW
|
||||
double dAreaXY ;
|
||||
@@ -375,11 +376,11 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
|
||||
if ( nRawGroupId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// recupero l'ingombro della superficie in globale
|
||||
BBox3d b3Crv ;
|
||||
if ( ! m_pGeomDB->GetGlobalBBox( nSurfId, b3Crv))
|
||||
BBox3d b3Surf ;
|
||||
if ( ! m_pGeomDB->GetGlobalBBox( nSurfId, b3Surf))
|
||||
return GDB_ID_NULL ;
|
||||
// inserisco il gruppo del grezzo nella macchinata
|
||||
Frame3d frRaw( b3Crv.GetMin()) ;
|
||||
Frame3d frRaw( b3Surf.GetMin()) ;
|
||||
int nRawId = m_pGeomDB->AddGroup( GDB_ID_NULL, nRawGroupId, frRaw) ;
|
||||
if ( nRawId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
@@ -456,11 +457,11 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
|
||||
int nCrvId = ( bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pCrvCompo)) : GDB_ID_NULL) ;
|
||||
bOk = bOk && ( nCrvId != GDB_ID_NULL) ;
|
||||
// assegno il nome alla curva
|
||||
bOk = bOk && m_pGeomDB->SetName( nCrvId, MACH_RAW_SOLID) ;
|
||||
bOk = bOk && m_pGeomDB->SetName( nCrvId, MACH_RAW_OUTLINE) ;
|
||||
// assegno il colore alla curva
|
||||
bOk = bOk && m_pGeomDB->SetMaterial( nCrvId, cCol) ;
|
||||
bOk = bOk && m_pGeomDB->SetMaterial( nCrvId, cCol) ;
|
||||
}
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
if ( ! bOk) {
|
||||
m_pGeomDB->Erase( nRawId) ;
|
||||
return GDB_ID_NULL ;
|
||||
@@ -471,6 +472,156 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
|
||||
return nRawId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::AddRawPart( int nSfrUpId, int nSfrDownId, double dHeight, Color cCol)
|
||||
{
|
||||
// recupero il gruppo dei grezzi nella macchinata corrente
|
||||
int nRawGroupId = GetCurrRawGroupId() ;
|
||||
if ( nRawGroupId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// recupero l'ingombro della superficie up in globale
|
||||
BBox3d b3Surf ;
|
||||
if ( ! m_pGeomDB->GetGlobalBBox( nSfrUpId, b3Surf))
|
||||
return GDB_ID_NULL ;
|
||||
// inserisco il gruppo del grezzo nella macchinata
|
||||
Frame3d frRaw( b3Surf.GetMin()) ;
|
||||
int nRawId = m_pGeomDB->AddGroup( GDB_ID_NULL, nRawGroupId, frRaw) ;
|
||||
if ( nRawId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// assegno il nome al gruppo
|
||||
bool bOk = m_pGeomDB->SetName( nRawId, MACH_RAW_PART) ;
|
||||
// assegno la fase al gruppo
|
||||
bOk = bOk && m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
|
||||
|
||||
// recupero il frame originale della superficie up ( deve essere lo stesso della down)
|
||||
Frame3d frSurf ;
|
||||
bOk = bOk && m_pGeomDB->GetGlobFrame( nSfrUpId, frSurf) ;
|
||||
|
||||
// creo il volume in modo approssimativo a partire dalle due superfici considerando soltanto un'approssimazione dei bordi esterni
|
||||
// regione up
|
||||
PtrOwner<ISurfFlatRegion> pSurfUp( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrUpId))) ;
|
||||
bOk = bOk && ( ! IsNull( pSurfUp)) ;
|
||||
// calcolo offset e contro-offset per unificare i chunk ed eliminare eventuali rientranze nella superficie
|
||||
double dOffs = 8 ;
|
||||
bOk = bOk && pSurfUp->Offset( dOffs, ICurve::OFF_FILLET) ;
|
||||
bOk = bOk && pSurfUp->Offset( -dOffs, ICurve::OFF_FILLET) ;
|
||||
// recupero il chunk di area maggiore
|
||||
int nKMax = 0 ;
|
||||
if ( bOk && pSurfUp->GetChunkCount() > 1) {
|
||||
double dAreaMax = -1 ;
|
||||
for ( int k = 0 ; k < pSurfUp->GetChunkCount() ; k ++) {
|
||||
PtrOwner<ISurfFlatRegion> pSfrChunk( pSurfUp->CloneChunk( k)) ;
|
||||
double dArea = -1 ; pSfrChunk->GetGrossArea( dArea) ;
|
||||
if ( dArea > dAreaMax) {
|
||||
nKMax = k ;
|
||||
dAreaMax = dArea ;
|
||||
}
|
||||
}
|
||||
}
|
||||
PtrOwner<ICurve> pCrvUp ;
|
||||
bOk = bOk && pCrvUp.Set( pSurfUp->GetLoop( nKMax, 0)) ;
|
||||
bOk = bOk && ( ! IsNull( pCrvUp)) ;
|
||||
|
||||
// regione down
|
||||
PtrOwner<ISurfFlatRegion> pSurfDown( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrDownId))) ;
|
||||
bOk = bOk && ( ! IsNull( pSurfDown)) ;
|
||||
bOk = bOk && pSurfDown->Offset( dOffs, ICurve::OFF_FILLET) ;
|
||||
bOk = bOk && pSurfDown->Offset( -dOffs, ICurve::OFF_FILLET) ;
|
||||
nKMax = 0 ;
|
||||
if ( bOk && pSurfDown->GetChunkCount() > 1) {
|
||||
double dAreaMax = -1 ;
|
||||
for ( int k = 0 ; k < pSurfDown->GetChunkCount() ; k ++) {
|
||||
PtrOwner<ISurfFlatRegion> pSfrChunk( pSurfDown->CloneChunk( k)) ;
|
||||
double dArea = -1 ; pSfrChunk->GetGrossArea( dArea) ;
|
||||
if ( dArea > dAreaMax) {
|
||||
nKMax = k ;
|
||||
dAreaMax = dArea ;
|
||||
}
|
||||
}
|
||||
}
|
||||
PtrOwner<ICurveComposite> pCrvDown ;
|
||||
bOk = bOk && pCrvDown.Set( ConvertCurveToComposite( pSurfDown->GetLoop( nKMax, 0))) ;
|
||||
bOk = bOk && ( ! IsNull( pCrvDown)) ;
|
||||
// sposto il punto di inizio il più vicino possibile a quello della curva up per migliorare il calcolo della rigata
|
||||
if ( bOk) {
|
||||
Point3d ptS ; pCrvUp->GetStartPoint( ptS) ;
|
||||
DistPointCurve distPC( ptS, *pCrvDown) ;
|
||||
double dPar ; int nFlag ;
|
||||
bOk = bOk && distPC.GetParamAtMinDistPoint( 0, dPar, nFlag) ;
|
||||
bOk = bOk && pCrvDown->ChangeStartPoint( dPar) ;
|
||||
}
|
||||
|
||||
// volume
|
||||
PtrOwner<ISurfTriMesh> pStmRaw ;
|
||||
bOk = bOk && pStmRaw.Set( GetSurfTriMeshByFlatContour( pCrvUp)) ;
|
||||
bOk = bOk && ( ! IsNull( pStmRaw)) ;
|
||||
PtrOwner<ISurfTriMesh> pStmLat ;
|
||||
bOk = bOk && pStmLat.Set( GetSurfTriMeshRuled( pCrvDown, pCrvUp, ISurfTriMesh::RLT_MINDIST)) ;
|
||||
bOk = bOk && ( ! IsNull( pStmLat)) ;
|
||||
bOk = bOk && pStmRaw->DoSewing( *pStmLat) ;
|
||||
PtrOwner<ISurfTriMesh> pStmDown ;
|
||||
bOk = bOk && pStmDown.Set( GetSurfTriMeshByFlatContour( pCrvDown)) ;
|
||||
|
||||
bOk = bOk && pStmDown->Invert() ;
|
||||
bOk = bOk && pStmRaw->DoSewing( *pStmDown) ;
|
||||
bOk = bOk && pStmRaw->DoCompacting() ;
|
||||
bOk = bOk && pStmRaw->Repair() ;
|
||||
bOk = bOk && pStmRaw->LocToLoc( frSurf, frRaw) ;
|
||||
int nId = bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pStmRaw)) : GDB_ID_NULL ;
|
||||
bOk = bOk && ( nId != GDB_ID_NULL) ;
|
||||
// assegno il nome al solido
|
||||
bOk = bOk && m_pGeomDB->SetName( nId, MACH_RAW_SOLID) ;
|
||||
// assegno il colore al solido
|
||||
bOk = bOk && m_pGeomDB->SetMaterial( nId, cCol) ;
|
||||
// rendo visibile il solido
|
||||
bOk = bOk && m_pGeomDB->SetStatus( nId, GDB_ST_ON) ;
|
||||
// calcolo il punto centro del solido
|
||||
bOk = bOk && SetRawPartCenter( nRawId) ;
|
||||
|
||||
if ( bOk) {
|
||||
// costruisco la curva di contorno
|
||||
PtrOwner<ISurfFlatRegion> pSfrUp( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrUpId))) ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrDown( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrDownId))) ;
|
||||
bOk = bOk && ( ! IsNull( pSfrUp)) && ( ! IsNull( pSfrDown)) ;
|
||||
if ( bOk)
|
||||
pSfrUp->Add( *pSfrDown) ;
|
||||
PtrOwner<ICurve> pCrv ;
|
||||
bOk = bOk && pCrv.Set( pSfrUp->GetLoop( 0, 0)) ;
|
||||
bOk = bOk && ( ! IsNull( pCrv)) ;
|
||||
bOk = bOk && pCrv->LocToLoc( frSurf, frRaw) ;
|
||||
int nLoop = bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pCrv)) : GDB_ID_NULL ;
|
||||
bOk = bOk && ( nLoop != GDB_ID_NULL) ;
|
||||
bOk = bOk && ExeMove( {nLoop}, -dHeight * Z_AX, RTY_LOC) ;
|
||||
// assegno il nome alla curva
|
||||
bOk = bOk && m_pGeomDB->SetName( nLoop, MACH_RAW_OUTLINE) ;
|
||||
// assegno il colore alla curva
|
||||
bOk = bOk && m_pGeomDB->SetMaterial( nLoop, cCol) ;
|
||||
|
||||
// recupero le superfici up e down
|
||||
int nSurfUpId = ( bOk ? m_pGeomDB->CopyGlob( nSfrUpId, GDB_ID_NULL, nRawId) : GDB_ID_NULL) ;
|
||||
bOk = bOk && ( nSurfUpId != GDB_ID_NULL) ;
|
||||
bOk = bOk && m_pGeomDB->SetName( nSurfUpId, MACH_RAW_UP_REG) ;
|
||||
bOk = bOk && m_pGeomDB->SetMaterial( nSurfUpId, cCol) ;
|
||||
bOk = bOk && m_pGeomDB->SetStatus( nSurfUpId, GDB_ST_OFF) ;
|
||||
int nSurfDownId = ( bOk ? m_pGeomDB->CopyGlob( nSfrDownId, GDB_ID_NULL, nRawId) : GDB_ID_NULL) ;
|
||||
bOk = bOk && ( nSurfDownId != GDB_ID_NULL) ;
|
||||
bOk = bOk && m_pGeomDB->SetName( nSurfDownId, MACH_RAW_DOWN_REG) ;
|
||||
bOk = bOk && m_pGeomDB->SetMaterial( nSurfDownId, cCol) ;
|
||||
bOk = bOk && m_pGeomDB->SetStatus( nSurfDownId, GDB_ST_OFF) ;
|
||||
}
|
||||
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
if ( ! bOk) {
|
||||
m_pGeomDB->Erase( nRawId) ;
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
// tutto ok
|
||||
return nRawId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dHeight)
|
||||
@@ -478,7 +629,7 @@ MachMgr::ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dH
|
||||
// le nuove dimensioni non possono essere nulle
|
||||
if ( dLength < EPS_SMALL || dWidth < EPS_SMALL || dHeight < EPS_SMALL)
|
||||
return false ;
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// recupero il solido del grezzo
|
||||
@@ -520,10 +671,10 @@ MachMgr::ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dH
|
||||
bool
|
||||
MachMgr::ModifyRawPartHeight( int nRawId, double dHeight)
|
||||
{
|
||||
// la nuova altezza non può essere nulla
|
||||
// la nuova altezza non può essere nulla
|
||||
if ( dHeight < EPS_SMALL)
|
||||
return false ;
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// recupero il solido del grezzo
|
||||
@@ -552,10 +703,10 @@ MachMgr::GetRawPartPhases( int nRawId, INTVECTOR& vPhase) const
|
||||
{
|
||||
// pulisco parametro di ritorno
|
||||
vPhase.clear() ;
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// recupero le fasi in cui è presente il grezzo (se manca è fase 1)
|
||||
// recupero le fasi in cui è presente il grezzo (se manca è fase 1)
|
||||
if ( ! m_pGeomDB->GetInfo( nRawId, MACH_RAW_PHASE, vPhase) || vPhase.empty())
|
||||
vPhase.emplace_back( 1) ;
|
||||
return true ;
|
||||
@@ -565,11 +716,11 @@ MachMgr::GetRawPartPhases( int nRawId, INTVECTOR& vPhase) const
|
||||
bool
|
||||
MachMgr::KeepRawPart( int nRawId, int nSouPhase)
|
||||
{
|
||||
// verifico validità e recupero fasi in cui è presente
|
||||
// verifico validità e recupero fasi in cui è presente
|
||||
INTVECTOR vPhase ;
|
||||
if ( ! GetRawPartPhases( nRawId, vPhase))
|
||||
return false ;
|
||||
// se fase corrente già presente, non devo fare alcunché
|
||||
// se fase corrente già presente, non devo fare alcunché
|
||||
if ( find( vPhase.begin(), vPhase.end(), m_nCurrPhase) != vPhase.end())
|
||||
return true ;
|
||||
// aggiungo la fase corrente
|
||||
@@ -621,7 +772,7 @@ MachMgr::KeepRawPart( int nRawId, int nSouPhase)
|
||||
bool
|
||||
MachMgr::VerifyRawPartPhase( int nRawId, int nPhase) const
|
||||
{
|
||||
// verifico validità e recupero fasi in cui è presente
|
||||
// verifico validità e recupero fasi in cui è presente
|
||||
INTVECTOR vPhase ;
|
||||
if ( ! GetRawPartPhases( nRawId, vPhase))
|
||||
return false ;
|
||||
@@ -633,11 +784,11 @@ MachMgr::VerifyRawPartPhase( int nRawId, int nPhase) const
|
||||
bool
|
||||
MachMgr::RemoveRawPartFromCurrPhase( int nRawId)
|
||||
{
|
||||
// verifico validità e recupero fasi in cui è presente
|
||||
// verifico validità e recupero fasi in cui è presente
|
||||
INTVECTOR vPhase ;
|
||||
if ( ! GetRawPartPhases( nRawId, vPhase))
|
||||
return false ;
|
||||
// se non appartiene alla fase corrente, non devo fare alcunché
|
||||
// se non appartiene alla fase corrente, non devo fare alcunché
|
||||
auto iIter = find( vPhase.begin(), vPhase.end(), m_nCurrPhase) ;
|
||||
if ( iIter == vPhase.end())
|
||||
return true ;
|
||||
@@ -664,7 +815,7 @@ MachMgr::RemoveRawPartFromCurrPhase( int nRawId)
|
||||
bool
|
||||
MachMgr::RemoveRawPart( int nRawId)
|
||||
{
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// tolgo dalle disposizioni in cui compare gli eventuali movimenti registrati di questo grezzo
|
||||
@@ -688,7 +839,7 @@ MachMgr::VerifyRawPart( int nRawId, bool bLinkedAllowed) const
|
||||
int nRawGroupId = GetCurrRawGroupId() ;
|
||||
if ( nRawGroupId != GDB_ID_NULL && m_pGeomDB->GetParentId( nRawId) == nRawGroupId)
|
||||
return true ;
|
||||
// se consentito linkaggio ed il grezzo è linkato ad un gruppo della macchina corrente, va bene
|
||||
// se consentito linkaggio ed il grezzo è linkato ad un gruppo della macchina corrente, va bene
|
||||
if ( bLinkedAllowed) {
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch != nullptr && pMch->IsLinkedRawPart( nRawId))
|
||||
@@ -808,12 +959,12 @@ MachMgr::ResetRawPartCenter( int nRawId)
|
||||
bool
|
||||
MachMgr::GetRawPartCenter( int nRawId, Point3d& ptCen)
|
||||
{
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// cerco di recuperare l'oggetto
|
||||
int nGPntId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_CENTER) ;
|
||||
// ne verifico la validità
|
||||
// ne verifico la validità
|
||||
int nMode ;
|
||||
if ( nGPntId == GDB_ID_NULL ||
|
||||
! m_pGeomDB->GetMode( nGPntId, nMode) || nMode != GDB_MD_STD) {
|
||||
@@ -841,7 +992,7 @@ MachMgr::GetRawPartCenter( int nRawId, Point3d& ptCen)
|
||||
bool
|
||||
MachMgr::GetRawPartBBox( int nRawId, BBox3d& b3Raw)
|
||||
{
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// recupero solido del grezzo
|
||||
@@ -849,6 +1000,103 @@ MachMgr::GetRawPartBBox( int nRawId, BBox3d& b3Raw)
|
||||
return m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw) ;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
static bool
|
||||
AssociateSurfs( IGeomDB* pGeomDB, int nSurfUpId, int nSurfDownId, vector<pair<int,int>>& vRawSurfs)
|
||||
{
|
||||
// vRawSurfs contiene tutte le coppie ( id regioneUp, id regioneDown) che definiscono i nuovi grezzi
|
||||
vRawSurfs.clear() ;
|
||||
|
||||
int nUpCnt = ExeSurfFrChunkCount( nSurfUpId) ;
|
||||
int nDownCnt = ExeSurfFrChunkCount( nSurfDownId) ;
|
||||
// se non sono stati creati più grezzi
|
||||
if ( nUpCnt == 1 || nDownCnt == 1) {
|
||||
vRawSurfs.emplace_back( nSurfUpId, nSurfDownId) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
int nUpFirstId = ExeExplodeSurface( nSurfUpId, &nUpCnt) ;
|
||||
int nDownFirstId = ExeExplodeSurface( nSurfDownId, &nDownCnt) ;
|
||||
|
||||
// ad ogni chunk della regione up associo i chunk corrispondenti della regione down
|
||||
INTVECTOR vChunks( nUpCnt, GDB_ID_NULL) ;
|
||||
for ( int nIdD = nDownFirstId ; nIdD < nDownFirstId + nDownCnt ; nIdD ++) {
|
||||
ISurfFlatRegion* pSfrD = GetSurfFlatRegion( pGeomDB->GetGeoObj( nIdD)) ;
|
||||
if ( pSfrD == nullptr)
|
||||
return false ;
|
||||
BBox3d bBoxD ; ExeGetBBox( nIdD, BBF_STANDARD, bBoxD) ;
|
||||
// inidividuo il chunk della superficie up che interagisce maggiormente con il chunk corrente della superficie down
|
||||
int k = -1 ;
|
||||
double dMaxArea = -1 ;
|
||||
for ( int j = 0 ; j < nUpCnt ; j ++) {
|
||||
BBox3d bBoxU ; ExeGetBBox( nUpFirstId + j, BBF_STANDARD, bBoxU) ;
|
||||
if ( bBoxU.OverlapsXY( bBoxD)) {
|
||||
PtrOwner<ISurfFlatRegion> pSfrU( CloneSurfFlatRegion( pGeomDB->GetGeoObj( nUpFirstId + j))) ;
|
||||
if ( IsNull( pSfrU))
|
||||
return false ;
|
||||
// le due superfici sono nello stesso frame
|
||||
pSfrU->Intersect( *pSfrD) ;
|
||||
double dArea = -1 ; pSfrU->GetArea( dArea) ;
|
||||
if ( dArea > dMaxArea) {
|
||||
k = j ;
|
||||
dMaxArea = dArea ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// aggiorno le superfici con l'associazione trovata
|
||||
if ( k == -1)
|
||||
return false ;
|
||||
if ( vChunks[k] == GDB_ID_NULL)
|
||||
vChunks[k] = nIdD ;
|
||||
else {
|
||||
ExeSurfFrAdd( vChunks[k], nIdD) ;
|
||||
ExeErase( {nIdD}) ;
|
||||
}
|
||||
}
|
||||
|
||||
// controllo per ogni chunk della superficie up il corrispondente della nuova superficie down
|
||||
for ( int i = 0 ; i < nUpCnt ; i ++) {
|
||||
ISurfFlatRegion* pSfrU = GetSurfFlatRegion( pGeomDB->GetGeoObj( nUpFirstId + i)) ;
|
||||
if ( pSfrU == nullptr)
|
||||
return false ;
|
||||
BBox3d bBoxU ; ExeGetBBox( nUpFirstId + i, BBF_STANDARD, bBoxU) ;
|
||||
// individuo il chunk della superficie down che interagisce maggiormente con il chunk corrente della superficie up
|
||||
int k = -1 ;
|
||||
double dMaxArea = -1 ;
|
||||
for ( int j = 0 ; j < int( vChunks.size()) ; j ++) {
|
||||
BBox3d bBoxD ; ExeGetBBox( vChunks[j], BBF_STANDARD, bBoxD) ;
|
||||
// se i box interferiscono allora verifico di quanto si sovrappongono le due regioni
|
||||
if ( bBoxD.OverlapsXY( bBoxU)) {
|
||||
PtrOwner<ISurfFlatRegion> pSfrD( CloneSurfFlatRegion( pGeomDB->GetGeoObj( vChunks[j]))) ;
|
||||
if ( IsNull( pSfrD))
|
||||
return false ;
|
||||
pSfrD->Intersect( *pSfrU) ;
|
||||
double dArea = -1 ; pSfrD->GetArea( dArea) ;
|
||||
if ( dArea > dMaxArea) {
|
||||
k = j ;
|
||||
dMaxArea = dArea ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( k == -1)
|
||||
return false ;
|
||||
// se è la stessa associazione individuata da vChunks allora aggiorno il vettore finale dei grezzi
|
||||
if ( k == i)
|
||||
vRawSurfs.emplace_back( nUpFirstId + i, vChunks[i]) ;
|
||||
else {
|
||||
// altrimenti unisco le regioni associate appena individuate sia per la superficie up sia per la down
|
||||
ExeSurfFrAdd( nUpFirstId + k, nUpFirstId + i) ;
|
||||
ExeErase( {nUpFirstId + i}) ;
|
||||
ExeSurfFrAdd( vChunks[k], vChunks[i]) ;
|
||||
ExeErase( {vChunks[i]}) ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
@@ -872,7 +1120,6 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
BBox3d b3Raw ;
|
||||
if ( ! m_pGeomDB->GetGlobalBBox( nRawSolId, b3Raw))
|
||||
return GDB_ID_NULL ;
|
||||
double dZmin = b3Raw.GetMin().z ;
|
||||
double dHeight = b3Raw.GetMax().z - b3Raw.GetMin().z ;
|
||||
// il colore del grezzo
|
||||
Color cCol = AQUA ;
|
||||
@@ -881,19 +1128,31 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
Frame3d frRaw ;
|
||||
if ( ! m_pGeomDB->GetGroupGlobFrame( nRawId, frRaw))
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// creo la regione del grezzo a partire dal suo contorno
|
||||
// recupero il contorno
|
||||
int nOutCrvId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_OUTLINE) ;
|
||||
if ( nOutCrvId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// creo la regione
|
||||
INTVECTOR vCrvIds ;
|
||||
vCrvIds.emplace_back( nOutCrvId) ;
|
||||
int nSfrId = ExeCreateSurfFlatRegion( nRawId, vCrvIds, nullptr) ;
|
||||
if ( nSfrId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
m_pGeomDB->SetLevel( nSfrId, GDB_LV_TEMP) ;
|
||||
|
||||
// creo le regioni inferiore e superiore del grezzo da aggiornare con le lavorazioni
|
||||
int nSfrDownId = GDB_ID_NULL, nSfrUpId = GDB_ID_NULL ;
|
||||
int nSfrDownOrigId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_DOWN_REG) ;
|
||||
int nSfrUpOrigId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_UP_REG) ;
|
||||
if ( nSfrDownOrigId == GDB_ID_NULL || nSfrUpOrigId == GDB_ID_NULL) {
|
||||
// se le regioni del grezzo di partenza non sono definite, le creo a partire dall'outline
|
||||
nSfrDownId = ExeCreateSurfFlatRegion( nRawId, {nOutCrvId}, nullptr) ;
|
||||
if ( nSfrDownId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
nSfrUpId = ExeCopyGlob( nSfrDownId, nRawId, GDB_LAST_SON) ;
|
||||
if ( nSfrUpId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
ExeMove( { nSfrUpId}, dHeight * Z_AX, RTY_LOC) ;
|
||||
}
|
||||
else {
|
||||
nSfrDownId = ExeCopyGlob( nSfrDownOrigId, nRawId, GDB_LAST_SON) ;
|
||||
nSfrUpId = ExeCopyGlob( nSfrUpOrigId, nRawId, GDB_LAST_SON) ;
|
||||
if ( nSfrDownId == GDB_ID_NULL || nSfrUpId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
// se esiste il kerf, ne creo la regione
|
||||
PtrOwner<ISurfFlatRegion> pSfrKerf ;
|
||||
@@ -908,7 +1167,8 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
}
|
||||
|
||||
// recupero le regioni delle lavorazioni
|
||||
INTVECTOR vMchRReg ;
|
||||
INTVECTOR vMchRRegUp ;
|
||||
INTVECTOR vMchRRegDown ;
|
||||
for ( auto nMchId : vMchId) {
|
||||
// recupero gruppo preview lavorazioni nella lavorazione
|
||||
int nPVGrp = m_pGeomDB->GetFirstNameInGroup( nMchId, MCH_PV) ;
|
||||
@@ -916,94 +1176,110 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
return GDB_ID_NULL ;
|
||||
// se vuoto, cerco il rimando al preview nel pezzo
|
||||
if ( m_pGeomDB->GetGroupObjs( nPVGrp) == 0 &&
|
||||
! m_pGeomDB->GetInfo( nPVGrp, MCH_PV_KEY_RELOCATE, nPVGrp))
|
||||
! m_pGeomDB->GetInfo( nPVGrp, MCH_PV_KEY_RELOCATE, nPVGrp))
|
||||
return GDB_ID_NULL ;
|
||||
// ciclo sui percorsi utensile (CL)
|
||||
int nClId = m_pGeomDB->GetFirstGroupInGroup( nPVGrp) ;
|
||||
while ( nClId != GDB_ID_NULL) {
|
||||
// tagli ridotti
|
||||
int nCrId = m_pGeomDB->GetFirstNameInGroup( nClId, MCH_PV_RRCUT) ;
|
||||
while ( nCrId != GDB_ID_NULL) {
|
||||
vMchRReg.emplace_back( nCrId) ;
|
||||
nCrId = m_pGeomDB->GetNextName( nCrId, MCH_PV_RRCUT) ;
|
||||
}
|
||||
// lavorazioni per regione inferiore
|
||||
int nCrDownId = m_pGeomDB->GetFirstNameInGroup( nClId, MCH_PV_DOWN_RAWCUT) ;
|
||||
// se non esiste la regione inferiore la lavorazione non è passante quindi può essere ignorata
|
||||
if ( nCrDownId != GDB_ID_NULL) {
|
||||
while ( nCrDownId != GDB_ID_NULL) {
|
||||
vMchRRegDown.emplace_back( nCrDownId) ;
|
||||
nCrDownId = m_pGeomDB->GetNextName( nCrDownId, MCH_PV_DOWN_RAWCUT) ;
|
||||
}
|
||||
// lavorazioni per regione superiore
|
||||
int nCrUpId = m_pGeomDB->GetFirstNameInGroup( nClId, MCH_PV_UP_RAWCUT) ;
|
||||
while ( nCrUpId != GDB_ID_NULL) {
|
||||
vMchRRegUp.emplace_back( nCrUpId) ;
|
||||
nCrUpId = m_pGeomDB->GetNextName( nCrUpId, MCH_PV_UP_RAWCUT) ;
|
||||
}
|
||||
}
|
||||
// passo al successivo percorso utensile
|
||||
nClId = m_pGeomDB->GetNextGroup( nClId) ;
|
||||
}
|
||||
}
|
||||
|
||||
// sottraggo queste regioni a quella del grezzo
|
||||
for ( auto nMchRReg : vMchRReg) {
|
||||
ExeSurfFrSubtract( nSfrId, nMchRReg) ;
|
||||
}
|
||||
// sottraggo le lavorazioni alle superfici del grezzo
|
||||
for ( auto nMchRReg : vMchRRegUp)
|
||||
ExeSurfFrSubtract( nSfrUpId, nMchRReg) ;
|
||||
for ( auto nMchRReg : vMchRRegDown)
|
||||
ExeSurfFrSubtract( nSfrDownId, nMchRReg) ;
|
||||
|
||||
// classifico i chunks della regione up e down per individuare le regioni che definiscono i nuovi grezzi
|
||||
vector<pair<int,int>> vSurfRaws ;
|
||||
AssociateSurfs( m_pGeomDB, nSfrUpId, nSfrDownId, vSurfRaws) ;
|
||||
|
||||
// creo i grezzi risultanti
|
||||
// creo i nuovi grezzi
|
||||
INTVECTOR vNewIds ;
|
||||
int nCount ;
|
||||
int nChunk = 0 ;
|
||||
int nFirstLoopId = ExeExtractSurfFrChunkLoops( nSfrId, nChunk, nRawId, &nCount) ;
|
||||
while ( nFirstLoopId != GDB_ID_NULL) {
|
||||
// !!! in attesa di gestire i grezzi con i buchi !!!
|
||||
// cancello le eventuali curve successive (sono i loop interni ovvero i buchi)
|
||||
for ( int i = 1 ; i < nCount ; ++ i) {
|
||||
m_pGeomDB->Erase( nFirstLoopId + i) ;
|
||||
}
|
||||
// dichiaro temporanea la curva
|
||||
m_pGeomDB->SetLevel( nFirstLoopId, GDB_LV_TEMP) ;
|
||||
// creo il grezzo
|
||||
int nId = AddRawPart( nFirstLoopId, 0, dZmin, dHeight, cCol) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
vNewIds.emplace_back( nId) ;
|
||||
// imposto lo stato del contorno di questo grezzo come quello del grezzo di partenza
|
||||
int nStat = GDB_ST_ON ;
|
||||
if ( m_pGeomDB->GetStatus( nOutCrvId, nStat) && nStat == GDB_ST_OFF)
|
||||
m_pGeomDB->SetStatus( m_pGeomDB->GetFirstNameInGroup( nId, MACH_RAW_OUTLINE), nStat) ;
|
||||
// assegno la fase al gruppo
|
||||
m_pGeomDB->SetInfo( nId, MACH_RAW_PHASE, m_nCurrPhase) ;
|
||||
// se esiste il kerf uso questa curva per creare il kerf del nuovo grezzo
|
||||
if ( ! IsNull( pSfrKerf)) {
|
||||
// creo la regione con la curva
|
||||
SurfFlatRegionByContours SfrCntr ;
|
||||
SfrCntr.AddCurve( GetCurve( m_pGeomDB->RemoveGeoObjAndErase( nFirstLoopId))) ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrNewKerf( SfrCntr.GetSurf()) ;
|
||||
if ( IsNull( pSfrNewKerf))
|
||||
return GDB_ID_NULL ;
|
||||
// la limito con la regione di kerf precedente (va bene anche se fallisce)
|
||||
pSfrNewKerf->Intersect( *pSfrKerf) ;
|
||||
// se risultato non vuoto
|
||||
if ( pSfrNewKerf->IsValid()) {
|
||||
// riferimento del nuovo grezzo
|
||||
Frame3d frNewRaw ;
|
||||
if ( ! m_pGeomDB->GetGroupGlobFrame( nId, frNewRaw))
|
||||
return GDB_ID_NULL ;
|
||||
// la porto dal riferimento del grezzo originale al riferimento di questo grezzo
|
||||
pSfrNewKerf->LocToLoc( frRaw, frNewRaw) ;
|
||||
// la porto sulla faccia sopra del grezzo
|
||||
pSfrNewKerf->Translate( Vector3d( 0, 0, dHeight)) ;
|
||||
// recupero il contorno e lo inserisco come kerf del nuovo grezzo
|
||||
PtrOwner<ICurve> pCrv( pSfrNewKerf->GetLoop( 0, 0)) ;
|
||||
int nNewKerfId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nId, Release( pCrv)) ;
|
||||
if ( nNewKerfId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
m_pGeomDB->CopyMaterial( nKerfId, nNewKerfId) ;
|
||||
m_pGeomDB->SetName( nNewKerfId, MACH_RAW_KERF) ;
|
||||
}
|
||||
}
|
||||
// altrimenti la cancello
|
||||
else
|
||||
m_pGeomDB->Erase( nFirstLoopId) ;
|
||||
// passo alla prossima curva
|
||||
++ nChunk ;
|
||||
nFirstLoopId = ExeExtractSurfFrChunkLoops( nSfrId, nChunk, nRawId, &nCount) ;
|
||||
}
|
||||
// cancello la regione
|
||||
m_pGeomDB->Erase( nSfrId) ;
|
||||
// verifico esista almeno un nuovo grezzo
|
||||
if ( vNewIds.empty())
|
||||
return GDB_ID_NULL ;
|
||||
INTVECTOR vNewIds ;
|
||||
for ( int i = 0 ; i < int( vSurfRaws.size()) ; i++) {
|
||||
|
||||
// aggiungo il grezzo
|
||||
int nId = AddRawPart( vSurfRaws[i].first, vSurfRaws[i].second, dHeight, cCol) ;
|
||||
m_pGeomDB->Erase( vSurfRaws[i].first) ;
|
||||
m_pGeomDB->Erase( vSurfRaws[i].second) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
vNewIds.emplace_back( nId) ;
|
||||
|
||||
// imposto lo stato del contorno di questo grezzo come quello del grezzo di partenza
|
||||
int nStat = GDB_ST_ON ;
|
||||
if ( m_pGeomDB->GetStatus( nOutCrvId, nStat) && nStat == GDB_ST_OFF)
|
||||
m_pGeomDB->SetStatus( m_pGeomDB->GetFirstNameInGroup( nId, MACH_RAW_OUTLINE), nStat) ;
|
||||
// assegno la fase al gruppo
|
||||
m_pGeomDB->SetInfo( nId, MACH_RAW_PHASE, m_nCurrPhase) ;
|
||||
// se esiste il kerf uso questa curva per creare il kerf del nuovo grezzo
|
||||
if ( ! IsNull( pSfrKerf)) {
|
||||
// riferimento del nuovo grezzo
|
||||
Frame3d frNewRaw ;
|
||||
if ( ! m_pGeomDB->GetGroupGlobFrame( nId, frNewRaw))
|
||||
return GDB_ID_NULL ;
|
||||
// considero il nuovo kerf come la regione superiore del nuovo grezzo
|
||||
int nSfrUpId = m_pGeomDB->GetFirstNameInGroup( nId, MACH_RAW_UP_REG) ;
|
||||
if ( nSfrUpId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrNewKerf( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrUpId))) ;
|
||||
if ( IsNull( pSfrNewKerf))
|
||||
return GDB_ID_NULL ;
|
||||
// porto nello stesso riferimento del grezzo originale
|
||||
pSfrNewKerf->LocToLoc( frNewRaw, frRaw) ;
|
||||
// la limito con la regione di kerf precedente ( va bene anche se fallisce)
|
||||
pSfrNewKerf->Intersect( *pSfrKerf) ;
|
||||
// se risultato non vuoto
|
||||
if ( pSfrNewKerf->IsValid()) {
|
||||
// la porto dal riferimento del grezzo originale al riferimento di questo grezzo
|
||||
pSfrNewKerf->LocToLoc( frRaw, frNewRaw) ;
|
||||
// recupero il contorno esterno del chunk più grande e lo inserisco come kerf del nuovo grezzo
|
||||
double dAreaMax = -1 ;
|
||||
int nKMax = 0 ;
|
||||
for ( int k = 0 ; k < pSfrNewKerf->GetChunkCount() ; k ++) {
|
||||
PtrOwner<ISurfFlatRegion> pSfrChunk( pSfrNewKerf->CloneChunk( k)) ;
|
||||
double dArea = -1 ; pSfrChunk->GetGrossArea( dArea) ;
|
||||
if ( dArea > dAreaMax) {
|
||||
nKMax = k ;
|
||||
dAreaMax = dArea ;
|
||||
}
|
||||
}
|
||||
PtrOwner<ICurve> pCrv( pSfrNewKerf->GetLoop( nKMax, 0)) ;
|
||||
if ( IsNull( pCrv))
|
||||
return GDB_ID_NULL ;
|
||||
int nNewKerfId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nId, Release( pCrv)) ;
|
||||
if ( nNewKerfId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
m_pGeomDB->CopyMaterial( nKerfId, nNewKerfId) ;
|
||||
m_pGeomDB->SetName( nNewKerfId, MACH_RAW_KERF) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// cancello le regioni usate per i conti
|
||||
m_pGeomDB->Erase( nSfrUpId) ;
|
||||
m_pGeomDB->Erase( nSfrDownId) ;
|
||||
// verifico esista almeno un nuovo grezzo
|
||||
if ( vNewIds.empty())
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// inserisco i pezzi del grezzo originale nei nuovi grezzi
|
||||
int nGroupId = m_pGeomDB->GetFirstGroupInGroup( nRawId) ;
|
||||
while ( nGroupId != GDB_ID_NULL) {
|
||||
@@ -1013,32 +1289,31 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
// scambio con pezzo
|
||||
int nPartId = SwapRawPartPart( nNewGroupId, true) ;
|
||||
// verifico se il pezzo sta nel grezzo
|
||||
int nLayerId = m_pGeomDB->GetFirstNameInGroup( nPartId, NST_EXT_LAYER) ;
|
||||
int nLayerId = m_pGeomDB->GetFirstNameInGroup( nPartId, NST_PARTREG_LAYER) ;
|
||||
if ( nLayerId == GDB_ID_NULL || m_pGeomDB->GetGdbType( nLayerId) != GDB_TY_GROUP)
|
||||
nLayerId = m_pGeomDB->GetFirstGroupInGroup( nPartId) ;
|
||||
int nEntId = m_pGeomDB->GetFirstInGroup( nLayerId) ;
|
||||
int nEntGeoType = m_pGeomDB->GetGeoType( nEntId) ;
|
||||
Point3d ptTest ;
|
||||
if ( ( ( nEntGeoType & GEO_CURVE) != 0 && ExeMidPoint( nEntId, nNewId, ptTest)) ||
|
||||
( ( nEntGeoType & GEO_CURVE) == 0 && ExeCenterPoint( nEntId, nNewId, ptTest))) {
|
||||
// cerco la regione del pezzo
|
||||
int nEntId = m_pGeomDB->GetFirstInGroup( nLayerId) ;
|
||||
while ( nEntId != GDB_ID_NULL) {
|
||||
int nEntGeoType = m_pGeomDB->GetGeoType( nEntId) ;
|
||||
if ( nEntGeoType == SRF_FLATRGN)
|
||||
break ;
|
||||
nEntId = m_pGeomDB->GetNext( nEntId) ;
|
||||
}
|
||||
if ( nEntId != GDB_ID_NULL) {
|
||||
// verifico se è interna al grezzo
|
||||
int nOutCrvId = m_pGeomDB->GetFirstNameInGroup( nNewId, MACH_RAW_OUTLINE) ;
|
||||
BBox3d b3Raw ; m_pGeomDB->GetGlobalBBox( nOutCrvId, b3Raw) ;
|
||||
double dRawDiam = 0 ; b3Raw.GetDiameter( dRawDiam) ;
|
||||
BBox3d b3Part ; m_pGeomDB->GetGlobalBBox( nEntId, b3Part) ;
|
||||
double dPartDiam = 0 ; b3Part.GetDiameter( dPartDiam) ;
|
||||
if ( dRawDiam > 0.9 * dPartDiam) {
|
||||
ICurve* pCurve = GetCurve( m_pGeomDB->GetGeoObj( nOutCrvId)) ;
|
||||
if ( pCurve != nullptr) {
|
||||
int nSide ;
|
||||
double dDist ;
|
||||
DistPointCurve distPC( ptTest, *pCurve) ;
|
||||
if ( distPC.GetDist( dDist) &&
|
||||
( dDist < 100 * EPS_SMALL ||
|
||||
( distPC.GetSideAtMinDistPoint( 0, Z_AX, nSide) && nSide != MDS_RIGHT)))
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
int nSfrUp = m_pGeomDB->GetFirstNameInGroup( nNewId, MACH_RAW_UP_REG) ;
|
||||
if ( ! ExeSurfFrTestExternal( nSfrUp, nEntId, EPS_SMALL))
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
// altrimenti scambio pezzo ed elimino gruppo
|
||||
nNewGroupId = SwapRawPartPart( nPartId, false) ;
|
||||
m_pGeomDB->Erase( nNewGroupId) ;
|
||||
@@ -1046,5 +1321,5 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
nGroupId = m_pGeomDB->GetNextGroup( nGroupId) ;
|
||||
}
|
||||
|
||||
return vNewIds[0] ;
|
||||
return vNewIds[0] ;
|
||||
}
|
||||
|
||||
+5
-2
@@ -58,6 +58,7 @@ Machine::Machine( void)
|
||||
m_nHeadRotAxes = 0 ;
|
||||
m_nHeadSpecRotAxis = -1 ;
|
||||
m_frLinAx.Reset( false) ;
|
||||
m_frRobot.Reset( false) ;
|
||||
m_nCalcChainType = KIN_CHAIN_NONE ;
|
||||
m_nMachineLook = MCH_LOOK_NONE ;
|
||||
}
|
||||
@@ -212,7 +213,7 @@ Machine::AdjustAuxGeometry( const STRVECTOR& vsAux, int nLay)
|
||||
bool
|
||||
Machine::LoadMachineTable( const string& sName, const string& sParent, int nType,
|
||||
const Point3d& ptRef1, double dCoeffX, double dCoeffY, double dCoeffZ,
|
||||
const string& sGeo, const STRVECTOR& vsAux)
|
||||
const STRVECTOR& vsColl, const string& sGeo, const STRVECTOR& vsAux)
|
||||
{
|
||||
// recupero pezzo e layer della geometria originale della tavola
|
||||
string sPart, sLay ;
|
||||
@@ -251,7 +252,7 @@ Machine::LoadMachineTable( const string& sName, const string& sParent, int nType
|
||||
Table* pTab = new(nothrow) Table ;
|
||||
if ( pTab == nullptr)
|
||||
return false ;
|
||||
pTab->Set( sName, nType, ptRef1, b3Area1) ;
|
||||
pTab->Set( sName, nType, ptRef1, b3Area1, vsColl) ;
|
||||
m_pGeomDB->SetUserObj( nLay, pTab) ;
|
||||
// lo inserisco nel dizionario dei gruppi della macchina
|
||||
return m_mapGroups.emplace( sName, nLay).second ;
|
||||
@@ -1066,6 +1067,8 @@ Machine::SetLook( int nFlag)
|
||||
nTabId = GetFirstTable() ;
|
||||
if ( nTabId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// il gruppo tavola corrente deve essere sempre visibile
|
||||
m_pGeomDB->SetStatus( nTabId, GDB_ST_ON) ;
|
||||
// nascondo o visualizzo i fratelli e tutti i fratelli degli ascendenti della tavola
|
||||
bool bTabOnly = ( nFlag != MCH_LOOK_ALL) ;
|
||||
int nTabCurrId = nTabId ;
|
||||
|
||||
@@ -61,6 +61,7 @@ class Machine
|
||||
{ int nId = GetGroup( sTcPos) ;
|
||||
return ( IsTcPosGroup( nId) ? nId : GDB_ID_NULL) ; }
|
||||
bool GetAllTablesNames( STRVECTOR& vNames) const ;
|
||||
bool GetAllAxesNames( STRVECTOR& vNames) const ;
|
||||
bool GetAllHeadsNames( STRVECTOR& vNames) const ;
|
||||
bool GetAllTcPosNames( STRVECTOR& vNames) const ;
|
||||
int GetFirstTable( void) const ;
|
||||
@@ -97,6 +98,7 @@ class Machine
|
||||
bool GetCurrTableArea1( BBox3d& b3Area1) const ;
|
||||
bool GetCurrTableDeltaRef1( Vector3d& vtDelta1) const ;
|
||||
bool GetCurrTableIsTilting( bool& bTilting, Vector3d& vtTiltingAx) const ;
|
||||
bool GetCurrTableCollGroups( INTVECTOR& vIds) const ;
|
||||
bool SetCurrTool( const std::string& sTool, const std::string& sHead, int nExit) ;
|
||||
bool ResetCurrTool( void) ;
|
||||
int GetCurrTool( void) const ;
|
||||
@@ -121,9 +123,9 @@ class Machine
|
||||
int GetCurrLinAxes( void) const ;
|
||||
int GetCurrRotAxes( void) const ;
|
||||
bool GetCurrAxisName( int nInd, std::string& sAxName) const ;
|
||||
bool GetAllCurrAxesName( STRVECTOR& vAxName) const ;
|
||||
bool GetAllCurrAxesNames( STRVECTOR& vAxName) const ;
|
||||
bool GetCurrAxisToken( int nInd, std::string& sAxToken) const ;
|
||||
bool GetAllCurrAxesToken( STRVECTOR& vAxToken) const ;
|
||||
bool GetAllCurrAxesTokens( STRVECTOR& vAxToken) const ;
|
||||
bool GetCurrAxisMin( int nInd, double& dMin) const ;
|
||||
bool GetCurrAxisMax( int nInd, double& dMax) const ;
|
||||
bool GetCurrAxisOffset( int nInd, double& dOffset) const ;
|
||||
@@ -197,7 +199,7 @@ class Machine
|
||||
bool AdjustAuxGeometry( const STRVECTOR& vsAux, int nLay) ;
|
||||
bool LoadMachineTable( const std::string& sName, const std::string& sParent, int nType,
|
||||
const Point3d& ptRef1, double dCoeffX, double dCoeffY, double dCoeffZ,
|
||||
const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
const STRVECTOR& vsColl, const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
bool AdjustTable( int nLay, const Point3d& ptRef1) ;
|
||||
bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken, bool bInvert,
|
||||
double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
|
||||
@@ -315,6 +317,7 @@ class Machine
|
||||
KINAXISVECTOR m_vCalcLinAx ; // vettore assi lineari attivi per calcoli
|
||||
KINAXISVECTOR m_vCalcRotAx ; // vettore assi rotanti attivi per calcoli
|
||||
Frame3d m_frLinAx ; // sistema di riferimento definito dagli assi lineari
|
||||
Frame3d m_frRobot ; // sistema di riferimento canonico del robot
|
||||
int m_nCalcChainType ; // tipologia testa attiva (nulla, centro di lavoro o robot)
|
||||
Point3d m_ptWristCen ; // centro del polso sferico nel riferimento testa/uscita di calcolo
|
||||
Vector3d m_vtWristRef ; // direzione del polso sferico nel riferimento testa/uscita di calcolo
|
||||
|
||||
@@ -23,6 +23,22 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetAllAxesNames( STRVECTOR& vNames) const
|
||||
{
|
||||
// reset lista nomi
|
||||
vNames.clear() ;
|
||||
// ricerca degli assi
|
||||
for ( const auto& snGro : m_mapGroups) {
|
||||
if ( IsAxisGroup( snGro.second))
|
||||
vNames.push_back( snGro.first) ;
|
||||
}
|
||||
// ordino alfabeticamente
|
||||
sort( vNames.begin(), vNames.end()) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetAxisToken( const string& sAxis, string& sToken) const
|
||||
|
||||
+62
-8
@@ -71,6 +71,8 @@ Machine::SetCurrTable( const string& sTable)
|
||||
m_nCalcTabId = GDB_ID_NULL ;
|
||||
return false ;
|
||||
}
|
||||
// il gruppo tavola corrente deve essere sempre visibile
|
||||
m_pGeomDB->SetStatus( m_nCalcTabId, GDB_ST_ON) ;
|
||||
// lancio eventuale funzione lua di personalizzazione
|
||||
if ( LuaExistsFunction( ON_SET_TABLE)) {
|
||||
// salvo eventuale variabile EMC_VAR già presente
|
||||
@@ -212,6 +214,31 @@ Machine::GetCurrTableIsTilting( bool& bTilting, Vector3d& vtTiltingAx) const
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetCurrTableCollGroups( INTVECTOR& vIds) const
|
||||
{
|
||||
// controllo GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero la tavola corrente
|
||||
Table* pTab = GetTable( m_nCalcTabId) ;
|
||||
if ( pTab == nullptr)
|
||||
return false ;
|
||||
// recupero stringhe con gruppi ausiliari di collisione
|
||||
const STRVECTOR& vsColl = pTab->GetCollGroups() ;
|
||||
for ( const auto& sColl : vsColl) {
|
||||
string sGrp, sSub ;
|
||||
Split( sColl, "/", true, sGrp, sSub) ;
|
||||
int nId = GetGroup( sGrp) ;
|
||||
if ( ! sSub.empty() && nId != GDB_ID_NULL)
|
||||
nId = m_pGeomDB->GetFirstNameInGroup( nId, sSub) ;
|
||||
if ( nId != GDB_ID_NULL)
|
||||
vIds.push_back( nId) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
|
||||
@@ -466,6 +493,8 @@ Machine::CalculateKinematicChain( void)
|
||||
m_nHeadSpecRotAxis = -1 ;
|
||||
m_vCalcLinAx.clear() ;
|
||||
m_vCalcRotAx.clear() ;
|
||||
m_frLinAx.Reset( false) ;
|
||||
m_frRobot.Reset( false) ;
|
||||
m_nCalcChainType = KIN_CHAIN_NONE ;
|
||||
// recupero gli assi di tavola
|
||||
if ( m_nCalcTabId == GDB_ID_NULL)
|
||||
@@ -508,6 +537,19 @@ Machine::CalculateKinematicChain( void)
|
||||
swap( m_vCalcRotAx[0], m_vCalcRotAx[5]) ;
|
||||
swap( m_vCalcRotAx[1], m_vCalcRotAx[4]) ;
|
||||
swap( m_vCalcRotAx[2], m_vCalcRotAx[3]) ;
|
||||
// determino il riferimento canonico del robot
|
||||
if ( ! m_frRobot.Set( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, m_vCalcRotAx[3].vtDir)) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : impossible canonic frame")
|
||||
return false ;
|
||||
}
|
||||
// porto tutti gli assi cinematici e i dati testa nel riferimento canonico
|
||||
for ( int i = 0 ; i < m_nHeadRotAxes ; ++ i) {
|
||||
m_vCalcRotAx[i].ptPos.ToLoc( m_frRobot) ;
|
||||
m_vCalcRotAx[i].vtDir.ToLoc( m_frRobot) ;
|
||||
}
|
||||
m_ptCalcPos.ToLoc( m_frRobot) ;
|
||||
m_vtCalcDir.ToLoc( m_frRobot) ;
|
||||
m_vtCalcADir.ToLoc( m_frRobot) ;
|
||||
// direzione assi rotanti deve essere Z Y Y X Y X
|
||||
if ( ! m_vCalcRotAx[0].vtDir.IsZ() ||
|
||||
! m_vCalcRotAx[1].vtDir.IsY() ||
|
||||
@@ -1239,6 +1281,10 @@ Machine::GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& v
|
||||
vtNew.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
|
||||
}
|
||||
|
||||
// nel caso di robot devo passare dal riferimento canonico robot a quello di macchina
|
||||
if ( m_nCalcChainType == KIN_CHAIN_ROBOT)
|
||||
vtNew.ToGlob( m_frRobot) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1369,6 +1415,10 @@ Machine::GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
|
||||
else
|
||||
return false ;
|
||||
|
||||
// nel caso di robot devo passare dal riferimento canonico robot a quello di macchina
|
||||
if ( m_nCalcChainType == KIN_CHAIN_ROBOT)
|
||||
ptTip.ToGlob( m_frRobot) ;
|
||||
|
||||
// Se richiesto ingombro totale o punto sotto del tip utensile
|
||||
if ( bOverall || bBottom) {
|
||||
// calcolo la direzione fresa
|
||||
@@ -1803,7 +1853,7 @@ Machine::GetCurrAxisName( int nInd, string& sAxName) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetAllCurrAxesName( STRVECTOR& vAxName) const
|
||||
Machine::GetAllCurrAxesNames( STRVECTOR& vAxName) const
|
||||
{
|
||||
vAxName.clear() ;
|
||||
bool bOk = true ;
|
||||
@@ -1852,7 +1902,7 @@ Machine::GetCurrAxisToken( int nInd, string& sAxToken) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetAllCurrAxesToken( STRVECTOR& vAxToken) const
|
||||
Machine::GetAllCurrAxesTokens( STRVECTOR& vAxToken) const
|
||||
{
|
||||
vAxToken.clear() ;
|
||||
bool bOk = true ;
|
||||
@@ -2023,13 +2073,17 @@ Machine::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vecto
|
||||
// pulisco il risultato
|
||||
vAng1.clear() ;
|
||||
vAng2.clear() ;
|
||||
// porto i dati nel riferimento robot
|
||||
Point3d ptPL = GetToLoc( ptP, m_frRobot) ;
|
||||
Vector3d vtDirTL = GetToLoc( vtDirT, m_frRobot) ;
|
||||
Vector3d vtDirAL = GetToLoc( vtDirA, m_frRobot) ;
|
||||
// riferimento utensile
|
||||
Frame3d frTool ;
|
||||
frTool.Set( ORIG, vtDirT, vtDirA) ;
|
||||
frTool.Set( ORIG, vtDirTL, vtDirAL) ;
|
||||
// deduco la posizione richiesta del centro del polso
|
||||
Point3d ptCen = ptP + m_ptWristCen.x * frTool.VersX() +
|
||||
m_ptWristCen.y * frTool.VersY() +
|
||||
( m_dCalcTLen + m_ptWristCen.z) * frTool.VersZ() ;
|
||||
Point3d ptCen = ptPL + m_ptWristCen.x * frTool.VersX() +
|
||||
m_ptWristCen.y * frTool.VersY() +
|
||||
( m_dCalcTLen + m_ptWristCen.z) * frTool.VersZ() ;
|
||||
// deduco la direzione richiesta del centro del polso
|
||||
Vector3d vtCen = m_vtWristRef.x * frTool.VersX() +
|
||||
m_vtWristRef.y * frTool.VersY() +
|
||||
@@ -2104,11 +2158,11 @@ Machine::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vecto
|
||||
for ( int i = 4; i >= 0 ; --i)
|
||||
vtTool.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
|
||||
double dAng6 ; bool bDet6 ;
|
||||
if ( ! vtTool.GetRotation( vtDirT, vtR6, EPS_SMALL, dAng6, bDet6) || ! bDet6) {
|
||||
if ( ! vtTool.GetRotation( vtDirTL, vtR6, EPS_SMALL, dAng6, bDet6) || ! bDet6) {
|
||||
Vector3d vtAux = m_vtCalcADir ;
|
||||
for ( int i = 4; i >= 0 ; --i)
|
||||
vtAux.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
|
||||
if ( ! vtAux.GetRotation( vtDirA, vtR6, EPS_SMALL, dAng6, bDet6) || ! bDet6) {
|
||||
if ( ! vtAux.GetRotation( vtDirAL, vtR6, EPS_SMALL, dAng6, bDet6) || ! bDet6) {
|
||||
LOG_ERROR( GetEMkLogger(), "Error : R6 not calculable (robot)")
|
||||
return false ;
|
||||
}
|
||||
|
||||
+5
-1
@@ -59,6 +59,7 @@ static const string FLD_MAXDELTAR2ON1 = "MaxDeltaR2OnFirst" ;
|
||||
static const string FLD_ROT2STROKE = "Rot2Stroke" ;
|
||||
static const string FLD_SOLCH = "SolCh" ;
|
||||
static const string FLD_OTHCOLL = "OthColl" ;
|
||||
static const string FLD_COLL = "Coll" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Machine* Machine::m_pMchLua = nullptr ;
|
||||
@@ -452,6 +453,9 @@ Machine::LuaEmtTable( lua_State* L)
|
||||
// lettura eventuale campo 'Scale' dalla tabella
|
||||
double vScale[3] = {1.0, 1.0, 1.0} ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_SCALE, vScale) ;
|
||||
// lettura eventuale campo 'Coll' dalla tabella
|
||||
STRVECTOR vsColl ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_COLL, vsColl) ;
|
||||
// lettura campo 'Geo' dalla tabella
|
||||
string sGeo ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
|
||||
@@ -469,7 +473,7 @@ Machine::LuaEmtTable( lua_State* L)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
|
||||
// carico i dati della tavola
|
||||
if ( ! m_pMchLua->LoadMachineTable( sName, sParent, nType, Ref1, vScale[0], vScale[1], vScale[2], sGeo, vsAux))
|
||||
if ( ! m_pMchLua->LoadMachineTable( sName, sParent, nType, Ref1, vScale[0], vScale[1], vScale[2], vsColl, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Table failed") ;
|
||||
|
||||
// restituisco l'indice della tavola
|
||||
|
||||
@@ -148,6 +148,15 @@ Machining::PrepareToolPreview( void) const
|
||||
int nId = m_pGeomDB->CopyGlob( nHeadId, GDB_ID_NULL, nStId) ;
|
||||
m_pGeomDB->SetMode( nId, GDB_MD_STD) ;
|
||||
m_pGeomDB->SetStatus( nId, GDB_ST_OFF) ;
|
||||
// elimino eventuali gruppi opportunamente indicati
|
||||
int nSubId = m_pGeomDB->GetFirstGroupInGroup( nId) ;
|
||||
while ( nSubId != GDB_ID_NULL) {
|
||||
int nNextSubId = m_pGeomDB->GetNextGroup( nSubId) ;
|
||||
bool bShow = true ;
|
||||
if ( m_pGeomDB->GetInfo( nSubId, KEY_PREVIEWSHOW, bShow) && ! bShow)
|
||||
m_pGeomDB->Erase( nSubId) ;
|
||||
nSubId = nNextSubId ;
|
||||
}
|
||||
return ( nId != GDB_ID_NULL) ;
|
||||
}
|
||||
|
||||
|
||||
+27
-3
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2022
|
||||
// EgalTech 2015-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachiningsMgr.cpp Data : 04.02.22 Versione : 2.4b1
|
||||
// File : MachiningsMgr.cpp Data : 29.03.24 Versione : 2.6d1
|
||||
// Contenuto : Implementazione gestore database lavorazioni.
|
||||
//
|
||||
//
|
||||
@@ -16,6 +16,7 @@
|
||||
// 22.06.20 DS Agg. per nuovi parametri attacco tagli di lama (MF_CURR_VER = 1010).
|
||||
// 09.11.20 DS Agg. per nuovi parametri tagli di lama (MF_CURR_VER = 1011).
|
||||
// 04.02.22 DS Agg. per nuovi parametri svuotature con epicicli (MF_CURR_VER = 1012).
|
||||
// 29.03.24 DS Agg. parametro APPROX_LINTOL (MF_CURR_VER = 1013).
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -42,7 +43,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 = 1012 ;
|
||||
const int MF_CURR_VER = 1013 ;
|
||||
const string MF_GENERAL = "[GENERAL]" ;
|
||||
const string MF_3AXCOMP = "3AXCOMP" ;
|
||||
const bool MF_CURR_3AXCOMP = false ;
|
||||
@@ -64,6 +65,8 @@ const string MF_INTSAWARCMAXSIDEANG = "INTSAWARCMAXSIDEANG" ;
|
||||
const double MF_CURR_INTSAWARCMAXSIDEANG = 45 ;
|
||||
const string MF_SPLITARCS = "SPLITARCS" ;
|
||||
const int MF_CURR_SPLITARCS = SPLAR_NEVER ;
|
||||
const string MF_APPROX_LINTOL = "APPROX_LINTOL" ;
|
||||
const double MF_CURR_APPROX_LINTOL = 0.05 ;
|
||||
const string MF_MAXDEPTHSAFE = "MAXDEPTHSAFE" ;
|
||||
const double MF_CURR_MAXDEPTHSAFE = 2.0 ;
|
||||
|
||||
@@ -85,6 +88,7 @@ MachiningsMgr::MachiningsMgr( void)
|
||||
m_dExtSawArcMinRad = MF_CURR_EXTSAWARCMINRAD ;
|
||||
m_dIntSawArcMaxSideAng = MF_CURR_INTSAWARCMAXSIDEANG ;
|
||||
m_nSplitArcs = MF_CURR_SPLITARCS ;
|
||||
m_dApproxLinTol = MF_CURR_APPROX_LINTOL ;
|
||||
m_dMaxDepthSafe = MF_CURR_MAXDEPTHSAFE ;
|
||||
}
|
||||
|
||||
@@ -312,6 +316,8 @@ MachiningsMgr::LoadGeneral( Scanner& TheScanner, bool& bEnd)
|
||||
bOk = FromString( sVal, m_dIntSawArcMaxSideAng) ;
|
||||
else if ( ToUpper( sKey) == MF_SPLITARCS)
|
||||
bOk = FromString( sVal, m_nSplitArcs) ;
|
||||
else if ( ToUpper( sKey) == MF_APPROX_LINTOL)
|
||||
bOk = FromString( sVal, m_dApproxLinTol) ;
|
||||
else if ( ToUpper( sKey) == MF_MAXDEPTHSAFE)
|
||||
bOk = FromString( sVal, m_dMaxDepthSafe) ;
|
||||
else
|
||||
@@ -499,6 +505,10 @@ MachiningsMgr::SaveGeneral( Writer& TheWriter) const
|
||||
sOut = MF_MAXDEPTHSAFE + "=" + ToString( m_dMaxDepthSafe) ;
|
||||
bOk = bOk && TheWriter.OutText( sOut) ;
|
||||
}
|
||||
if ( m_nDbVer >= 1013) {
|
||||
sOut = MF_APPROX_LINTOL + "=" + ToString( m_dApproxLinTol) ;
|
||||
bOk = bOk && TheWriter.OutText( sOut) ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
@@ -1175,6 +1185,20 @@ MachiningsMgr::SetSplitArcs( int nFlag)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachiningsMgr::SetApproxLinTol( double dLinTol)
|
||||
{
|
||||
// verifico non sia inferiore al minimo
|
||||
dLinTol = max( dLinTol, EPS_SMALL) ;
|
||||
// se cambiato, salvo e setto modifica
|
||||
if ( abs( dLinTol - m_dApproxLinTol) > EPS_SMALL) {
|
||||
m_dApproxLinTol = dLinTol ;
|
||||
m_bModified = true ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachiningsMgr::SetMaxDepthSafe( double dSafe)
|
||||
|
||||
+6
-2
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachiningsMgr.h Data : 02.06.15 Versione : 1.6f1
|
||||
// File : MachiningsMgr.h Data : 29.03.24 Versione : 2.6d1
|
||||
// Contenuto : Dichiarazione della classe MachiningsMgr.
|
||||
//
|
||||
//
|
||||
@@ -79,6 +79,9 @@ class MachiningsMgr
|
||||
bool SetSplitArcs( int nFlag) ;
|
||||
int GetSplitArcs( void) const
|
||||
{ return m_nSplitArcs ; }
|
||||
bool SetApproxLinTol( double dLinTol) ;
|
||||
double GetApproxLinTol( void) const
|
||||
{ return m_dApproxLinTol ; }
|
||||
bool SetMaxDepthSafe( double dSafe) ;
|
||||
double GetMaxDepthSafe( void) const
|
||||
{ return m_dMaxDepthSafe ; }
|
||||
@@ -131,5 +134,6 @@ class MachiningsMgr
|
||||
double m_dExtSawArcMinRad ;
|
||||
double m_dIntSawArcMaxSideAng ;
|
||||
int m_nSplitArcs ;
|
||||
double m_dApproxLinTol ;
|
||||
double m_dMaxDepthSafe ;
|
||||
} ;
|
||||
+644
-522
File diff suppressed because it is too large
Load Diff
@@ -85,7 +85,7 @@ class Milling : public Machining
|
||||
bool AdjustPathDrawForSaw( int nClPathId) ;
|
||||
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) const ;
|
||||
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
|
||||
bool GenerateMillingPv( int nPathId, const ICurveComposite* pCompo) ;
|
||||
bool GenerateMillingPv( int nPathId, const ICurveComposite* pCompo, double dRbDist, double dDepth) ;
|
||||
bool AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
double dDepth, double dElev, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
|
||||
bool AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev,
|
||||
@@ -99,14 +99,15 @@ class Milling : public Machining
|
||||
bool AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
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) ;
|
||||
double dElev, double dAppr, bool bOutStart, bool bAboveStart, bool bFirst, bool bSplitArcs) ;
|
||||
bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, const Vector3d& vtTool,
|
||||
double dSafeZ, double dSawStElev, double dStElev, double dAppr) ;
|
||||
bool AddDirectApproach( const Point3d& ptP) ;
|
||||
double dSafeZ, double dSawStElev, double dStElev, double dAppr,
|
||||
bool bFirst, bool bSplitArcs, bool bAddInsert = false) ;
|
||||
bool AddDirectApproach( const Point3d& ptP, bool bSplitArcs) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bAboveEnd) ;
|
||||
double dElev, double dAppr, bool bAboveEnd, bool bSplitArcs) ;
|
||||
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool,
|
||||
double dSafeZ, double dSawEndElev, double dEndElev, double dAppr) ;
|
||||
double dSafeZ, double dSawEndElev, double dEndElev, double dAppr, bool bAddExtract = false) ;
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
|
||||
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) const ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
|
||||
@@ -123,10 +124,12 @@ class Milling : public Machining
|
||||
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( bool bExtra = true) const ;
|
||||
bool GetSimplePointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr) const ;
|
||||
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, double dSafeZ) const ;
|
||||
bool GetPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
|
||||
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false) ;
|
||||
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false) ;
|
||||
bool GetPointBelowRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
|
||||
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) ;
|
||||
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) ;
|
||||
bool CalcOffset( ICurveComposite* pCompo, double dSignOffs) ;
|
||||
bool TrimExtendCurveToClosedStm( ICurveComposite* pCompo, int nCstmId, bool bInvert) ;
|
||||
|
||||
@@ -184,4 +187,6 @@ class Milling : public Machining
|
||||
double m_dCurrTabsLen ; // lunghezza corrente lungo il percorso per tabs
|
||||
bool m_bStartOutRaw ; // flag forzatura inizio fuori dal grezzo
|
||||
bool m_bEndOutRaw ; // flag forzatura fine fuori dal grezzo
|
||||
Vector3d m_vtStartDir ; // direzione iniziale del percorso in elaborazione
|
||||
Vector3d m_vtEndDir ; // direzione finale del percorso in elaborazione
|
||||
} ;
|
||||
+1
-1
@@ -1570,7 +1570,7 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
int nFirstFlag = ( bFirst ? 1 : 0) ;
|
||||
SetFlag( nFirstFlag) ;
|
||||
Point3d ptP1 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + dStartElev + dSafeZ) ;
|
||||
int nStart = ( bFirst ? AddRapidStart( ptP1) : AddRapidMove( ptP1)) ;
|
||||
int nStart = AddRapidStartOrMove( ptP1, bFirst) ;
|
||||
if ( nStart == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
|
||||
+116
-41
@@ -42,7 +42,7 @@ using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const double MAX_DIST_RAW = 200.0 ;
|
||||
const double MAX_ROBOT_G0_LEN = 300.0 ;
|
||||
const double MAX_ROBOT_G0_LEN = 299.0 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
@@ -1242,7 +1242,7 @@ Operation::ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::ApproxWithLines( ICurveComposite* pCompo, double dMaxLen) const
|
||||
Operation::ApproxWithLines( ICurveComposite* pCompo, bool bFeed) const
|
||||
{
|
||||
// recupero estrusione e spessore
|
||||
Vector3d vtExtr = Z_AX ;
|
||||
@@ -1251,10 +1251,12 @@ Operation::ApproxWithLines( ICurveComposite* pCompo, double dMaxLen) const
|
||||
pCompo->GetThickness( dThick) ;
|
||||
// calcolo approssimazione lineare
|
||||
PolyLine PL ;
|
||||
if ( ! pCompo->ApproxWithLines( 50 * EPS_SMALL, ANG_TOL_MAX_DEG, ICurve::APL_SPECIAL, PL))
|
||||
double dLinTol = GetApproxLinTol() ;
|
||||
if ( ! pCompo->ApproxWithLines( dLinTol, ANG_TOL_MID_DEG, ICurve::APL_SPECIAL, PL))
|
||||
return false ;
|
||||
// se prevista massima lunghezza
|
||||
if ( dMaxLen > 100 * EPS_SMALL)
|
||||
double dMaxLen = GetMaxSplitLen( true, bFeed) ;
|
||||
if ( dMaxLen > 99 * EPS_SMALL)
|
||||
PL.AdjustForMaxSegmentLen( dMaxLen) ;
|
||||
// sostituisco le linee alle curve originali
|
||||
pCompo->Clear() ;
|
||||
@@ -2281,21 +2283,45 @@ Operation::CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRot
|
||||
pCamData->SetAxes( CamData::AS_ERR, vAxVal) ;
|
||||
return false ;
|
||||
}
|
||||
// se inizio, scelgo la prima soluzione
|
||||
// se inizio
|
||||
if ( bFirst) {
|
||||
vAxVal = vAng1 ;
|
||||
// porto gli angoli ai valori più vicini ai precedenti con offset di uno o più giri
|
||||
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
|
||||
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
}
|
||||
for ( int i = 0 ; i < int( vAng2.size()) ; ++ i) {
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ;
|
||||
if ( abs( vAng2[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
|
||||
}
|
||||
bFirst = false ;
|
||||
}
|
||||
// altrimenti, scelgo la soluzione più vicina
|
||||
// altrimenti movimenti successivi
|
||||
else {
|
||||
// minimizzo rotazione polso
|
||||
if ( abs( vAng1[3] - vAxRotPrec[3]) < abs( vAng2[3] - vAxRotPrec[3]) + 10 * EPS_ANG_SMALL)
|
||||
vAxVal = vAng1 ;
|
||||
else
|
||||
vAxVal = vAng2 ;
|
||||
// controllo continuità di R6 dalla posizione precedente
|
||||
m_pMchMgr->GetNearestAngleInStroke( 5, vAxRotPrec[5], vAxVal[5]) ;
|
||||
// porto gli angoli ai valori più vicini ai precedenti con offset di uno o più giri
|
||||
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
|
||||
if ( bRotContOnNext)
|
||||
vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ;
|
||||
else
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
|
||||
}
|
||||
for ( int i = 0 ; i < int( vAng2.size()) ; ++ i) {
|
||||
if ( bRotContOnNext)
|
||||
vAng2[i] = AngleNearAngle( vAng2[i], vAxRotPrec[i]) ;
|
||||
else
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ;
|
||||
}
|
||||
}
|
||||
// Scelgo la soluzione più vicina
|
||||
// minimizzo rotazione polso
|
||||
if ( vAng2.empty() || abs( vAng1[3] - vAxRotPrec[3]) < abs( vAng2[3] - vAxRotPrec[3]) + 10 * EPS_ANG_SMALL)
|
||||
vAxVal = vAng1 ;
|
||||
else
|
||||
vAxVal = vAng2 ;
|
||||
// controllo continuità di R6 dalla posizione precedente
|
||||
m_pMchMgr->GetNearestAngleInStroke( 5, vAxRotPrec[5], vAxVal[5]) ;
|
||||
// verifico di essere nelle corse degli assi
|
||||
int nStat ;
|
||||
bool bOsOk = m_pMchMgr->VerifyOutstroke( 0, 0, 0, vAxVal, false, nStat) ;
|
||||
@@ -2957,7 +2983,7 @@ Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation*
|
||||
// elimino eventuali risalite finali
|
||||
if ( pPrevOp == nullptr || ! pPrevOp->RemoveRise())
|
||||
return false ;
|
||||
// aggiungo risalita a Z max alla fine del percorso precedente
|
||||
// aggiungo risalita a Z max alla fine della lavorazione precedente
|
||||
DBLVECTOR vAxNew = vAxPrev ;
|
||||
if ( ! pPrevOp->AddRise( vAxNew))
|
||||
return false ;
|
||||
@@ -2965,11 +2991,14 @@ Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation*
|
||||
// altrimenti precedente appartiene alla stessa operazione
|
||||
else {
|
||||
// eventuali risalite finali già eliminate dal chiamante
|
||||
// aggiungo risalita a Z opportuna alla fine del percorso precedente
|
||||
// aggiungo risalita a Z max alla fine del percorso precedente
|
||||
DBLVECTOR vAxNew = vAxPrev ;
|
||||
if ( ! AddRise( vAxNew, -1, nPrevClPathId))
|
||||
return false ;
|
||||
}
|
||||
// inserisco la posizione iniziale a Zmax in questo percorso
|
||||
if ( ! AddRobotClimb( nEntId, -1))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3435,18 +3464,23 @@ Operation::CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const
|
||||
if ( vAx.size() < 6) {
|
||||
vAx = vAng1 ;
|
||||
}
|
||||
// altrimenti, scelgo la soluzione più vicina
|
||||
else {
|
||||
// salvo precedente R6
|
||||
double dPrevR6 = vAx[5] ;
|
||||
// minimizzo rotazione polso
|
||||
if ( abs( vAng1[3] - vAx[3]) < abs( vAng2[3] - vAx[3]) + 10 * EPS_ANG_SMALL)
|
||||
vAx = vAng1 ;
|
||||
else
|
||||
vAx = vAng2 ;
|
||||
// controllo continuità di R6 dalla posizione precedente
|
||||
m_pMchMgr->GetNearestAngleInStroke( 5, dPrevR6, vAx[5]) ;
|
||||
}
|
||||
// altrimenti, scelgo la soluzione più vicina
|
||||
else {
|
||||
// porto gli angoli ai valori più vicini ai precedenti con offset di uno o più giri
|
||||
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i)
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAx[i], vAng1[i]) ;
|
||||
for ( int i = 0 ; i < int( vAng2.size()) ; ++ i)
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAx[i], vAng2[i]) ;
|
||||
// salvo precedente R6
|
||||
double dPrevR6 = vAx[5] ;
|
||||
// minimizzo rotazione polso
|
||||
if ( vAng2.empty() || abs( vAng1[3] - vAx[3]) < abs( vAng2[3] - vAx[3]) + 10 * EPS_ANG_SMALL)
|
||||
vAx = vAng1 ;
|
||||
else
|
||||
vAx = vAng2 ;
|
||||
// controllo continuità di R6 dalla posizione precedente
|
||||
m_pMchMgr->GetNearestAngleInStroke( 5, dPrevR6, vAx[5]) ;
|
||||
}
|
||||
// verifico di essere nelle corse degli assi
|
||||
int nStat ;
|
||||
if ( ! m_pMchMgr->VerifyOutstroke( 0, 0, 0, vAx, false, nStat) || nStat != 0)
|
||||
@@ -3618,10 +3652,11 @@ Operation::SpecialGetMaxZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TCPOS, GetToolTcPos()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_MCHID, GetOwner()) ;
|
||||
// valori degli assi
|
||||
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
|
||||
for ( int i = 1 ; i <= nNumAx1 ; ++ i)
|
||||
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisPrev( i, EMC_VAR), vAx1[i-1]) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisPrev( i, EMC_VAR, bIsRobot), vAx1[i-1]) ;
|
||||
for ( int i = 1 ; i <= nNumAx2 ; ++ i)
|
||||
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR), vAx2[i-1]) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAx2[i-1]) ;
|
||||
// direzioni utensile
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TDIRP, vtTool1) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TDIR, vtTool2) ;
|
||||
@@ -3754,7 +3789,7 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn
|
||||
return false ;
|
||||
// Recupero assi correnti e ne verifico la costanza
|
||||
STRVECTOR vAxName ;
|
||||
pMch->GetAllCurrAxesName( vAxName) ;
|
||||
pMch->GetAllCurrAxesNames( vAxName) ;
|
||||
if ( vAxName.size() != vAxStart.size() || vAxName.size() != vAxEnd.size())
|
||||
return false ;
|
||||
// Porto la macchina in home
|
||||
@@ -3780,9 +3815,12 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn
|
||||
// Aggancio bloccaggi alla tavola corrente
|
||||
for ( const auto nFxtId : vFxtId)
|
||||
pMch->LinkFixtureToGroup( nFxtId, sTable) ;
|
||||
// Parti di tavola da considerare per la collisione
|
||||
INTVECTOR vTabCollId ;
|
||||
pMch->GetCurrTableCollGroups( vTabCollId) ;
|
||||
// Parti di testa e collegati da considerare per la collisione
|
||||
INTVECTOR vCollId ;
|
||||
pMch->GetCurrHeadCollGroups( vCollId) ;
|
||||
INTVECTOR vHeadCollId ;
|
||||
pMch->GetCurrHeadCollGroups( vHeadCollId) ;
|
||||
|
||||
// Lancio la verifica custom
|
||||
int nRes = SpecialTestCollisionAvoid( vAxStart, vAxEnd) ;
|
||||
@@ -3819,7 +3857,7 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn
|
||||
// Determino sottobox e box della testa e degli altri oggetti da considerare per la collisione
|
||||
BOXIVECTOR vbiSH ;
|
||||
BBox3d b3Head ;
|
||||
for ( int nCId : vCollId) {
|
||||
for ( int nCId : vHeadCollId) {
|
||||
int nHId = m_pGeomDB->GetFirstInGroup( nCId) ;
|
||||
while ( nHId != GDB_ID_NULL) {
|
||||
BBox3d b3Tmp ;
|
||||
@@ -3911,6 +3949,40 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn
|
||||
if ( ExeGetDebugLevel() >= 5) {
|
||||
LOG_DBG_INFO( GetEMkLogger(), ( bCollide ? " COLLIDE" : " avoid")) ;
|
||||
}
|
||||
// Se non trovata collisione, li confronto con oggetti da verificare della tavola
|
||||
if ( ! bCollide) {
|
||||
for ( const auto nTabCollId : vTabCollId) {
|
||||
// verifico i box
|
||||
BBox3d b3TabColl ;
|
||||
int nFlag = BBF_ONLY_VISIBLE | BBF_IGNORE_TEXT | BBF_IGNORE_DIM ;
|
||||
m_pGeomDB->GetGlobalBBox( nTabCollId, b3TabColl, nFlag) ;
|
||||
// eventuale emissione Log
|
||||
if ( ExeGetDebugLevel() >= 5) {
|
||||
string sBox = " TabColl : " + ( b3TabColl.IsEmpty() ? string( "Empty Box") : ToString( b3TabColl, 1)) ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sBox.c_str()) ;
|
||||
}
|
||||
// se i box interferiscono
|
||||
if ( ! b3TabColl.IsEmpty() && b3Head.Overlaps( b3TabColl)) {
|
||||
// eventuale emissione Log
|
||||
if ( ExeGetDebugLevel() >= 5) {
|
||||
LOG_DBG_INFO( GetEMkLogger(), " Can collide -->") ;
|
||||
}
|
||||
// verifico i sottobox
|
||||
for ( const auto& biSH : vbiSH) {
|
||||
if ( biSH.first.Overlaps( b3TabColl)) {
|
||||
bCollide = true ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if ( bCollide)
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// eventuale emissione Log
|
||||
if ( ExeGetDebugLevel() >= 5) {
|
||||
LOG_DBG_INFO( GetEMkLogger(), ( bCollide ? " COLLIDE" : " avoid")) ;
|
||||
}
|
||||
}
|
||||
// Se non trovata collisione, li confronto con i bloccaggi
|
||||
if ( ! bCollide) {
|
||||
for ( const auto nFxtId : vFxtId) {
|
||||
@@ -3984,10 +4056,11 @@ Operation::SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TCPOS, GetToolTcPos()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_MCHID, GetOwner()) ;
|
||||
// valori degli assi
|
||||
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
|
||||
for ( int i = 1 ; i <= int( vAxStart.size()) ; ++ i)
|
||||
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisPrev( i, EMC_VAR), vAxStart[i-1]) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisPrev( i, EMC_VAR, bIsRobot), vAxStart[i-1]) ;
|
||||
for ( int i = 1 ; i <= int( vAxEnd.size()) ; ++ i)
|
||||
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR), vAxEnd[i-1]) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAxEnd[i-1]) ;
|
||||
// eseguo
|
||||
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_TESTCOLLISIONAVOID, false) ;
|
||||
// recupero valori parametri obbligatori
|
||||
@@ -4034,9 +4107,10 @@ Operation::SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nF
|
||||
// direzione utensile
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TDIR, vtTool) ;
|
||||
// valore degli assi
|
||||
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
|
||||
int nNumAxes = int( vAx.size()) ;
|
||||
for ( int i = 1 ; i <= nNumAxes ; ++ i)
|
||||
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR), vAx[i-1]) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAx[i-1]) ;
|
||||
// eseguo
|
||||
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_MOVEZUP, false) ;
|
||||
// recupero valori parametri obbligatori
|
||||
@@ -4046,7 +4120,7 @@ Operation::SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nF
|
||||
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + GVAR_FLAG2, nFlag2) ;
|
||||
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + GVAR_TDIR, vtTool) ;
|
||||
for ( int i = 1 ; i <= nNumAxes ; ++ i)
|
||||
bOk = bOk && pMch->LuaGetGlobVar( GetGlobVarAxisValue( i, EMC_VAR), vAx[i-1]) ;
|
||||
bOk = bOk && pMch->LuaGetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAx[i-1]) ;
|
||||
// reset
|
||||
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
|
||||
// segnalo errori
|
||||
@@ -4088,11 +4162,12 @@ Operation::SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_EXIT, GetExitNbr()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TCPOS, GetToolTcPos()) ;
|
||||
// valore degli assi
|
||||
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
|
||||
int nNumAxes = int( vAxStart.size()) ;
|
||||
for ( int i = 1 ; i <= nNumAxes ; ++ i)
|
||||
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisPrev( i, EMC_VAR), vAxStart[i-1]) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisPrev( i, EMC_VAR, bIsRobot), vAxStart[i-1]) ;
|
||||
for ( int i = 1 ; i <= nNumAxes ; ++ i)
|
||||
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR), vAxEnd[i-1]) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAxEnd[i-1]) ;
|
||||
// eseguo
|
||||
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_MOVERAPID, false) ;
|
||||
// recupero valori parametri obbligatori
|
||||
@@ -4100,7 +4175,7 @@ Operation::SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
|
||||
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MODIF, bModif) ;
|
||||
vAxNew.resize( nNumAxes) ;
|
||||
for ( int i = 1 ; i <= nNumAxes ; ++ i)
|
||||
bOk = bOk && pMch->LuaGetGlobVar( GetGlobVarAxisValue( i, EMC_VAR), vAxNew[i-1]) ;
|
||||
bOk = bOk && pMch->LuaGetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAxNew[i-1]) ;
|
||||
// reset
|
||||
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
|
||||
// segnalo errori
|
||||
|
||||
+34
-5
@@ -14,6 +14,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MachMgr.h"
|
||||
#include "MachConst.h"
|
||||
#include "MachineStruConst.h"
|
||||
#include "/EgtDev/Include/EGkPoint3d.h"
|
||||
@@ -21,7 +22,6 @@
|
||||
#include "/EgtDev/Include/EGkSelection.h"
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
|
||||
class MachMgr ;
|
||||
class CamData ;
|
||||
class ICurve ;
|
||||
class ICurveComposite ;
|
||||
@@ -43,7 +43,7 @@ class Operation : public IUserObj
|
||||
virtual int GetPhase( void) const
|
||||
{ return m_nPhase ; }
|
||||
virtual bool RemoveHome( void) ;
|
||||
std::string GetName( void) const ;
|
||||
std::string GetName( void) const ;
|
||||
|
||||
public :
|
||||
virtual int GetType( void) const = 0 ;
|
||||
@@ -61,6 +61,21 @@ class Operation : public IUserObj
|
||||
{ return true ; }
|
||||
virtual bool AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) const
|
||||
{ return true ; }
|
||||
virtual bool NeedSplit( bool bSplit = true, bool bFeed = true) const
|
||||
{ return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot())) ; }
|
||||
virtual double GetMaxSplitLen( bool bSplit = true, bool bFeed = true) const
|
||||
{ return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot()) ? ( bFeed ? 5 : 50) : 0) ; }
|
||||
virtual bool GetSplitArcs( const Vector3d& vtTool) const
|
||||
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot())
|
||||
return true ;
|
||||
int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ;
|
||||
return ( nSplitArcs == SPLAR_ALWAYS ||
|
||||
( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtTool.IsZplus()) ||
|
||||
( nSplitArcs == SPLAR_GEN_PLANE && vtTool.IsGeneric())) ; }
|
||||
virtual double GetApproxLinTol( void) const
|
||||
{ if ( m_pMchMgr == nullptr)
|
||||
return 50 * EPS_SMALL ;
|
||||
return m_pMchMgr->GetCurrMachiningsMgr()->GetApproxLinTol() ; }
|
||||
|
||||
protected :
|
||||
Operation( void) ;
|
||||
@@ -105,7 +120,7 @@ class Operation : public IUserObj
|
||||
|
||||
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, double dToolThick, int nGrade = 3) ;
|
||||
bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ;
|
||||
bool ApproxWithLines( ICurveComposite* pCompo, double dMaxLen = 0) const ;
|
||||
bool ApproxWithLines( ICurveComposite* pCompo, bool bFeed = true) const ;
|
||||
bool VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) const ;
|
||||
|
||||
bool CalcAndSetBBox( int nClId) ;
|
||||
@@ -198,12 +213,26 @@ class Operation : public IUserObj
|
||||
int AddRapidStart( const Point3d& ptP, const std::string& sName) ;
|
||||
int AddRapidMove( const Point3d& ptP) ;
|
||||
int AddRapidMove( const Point3d& ptP, const std::string& sName) ;
|
||||
int AddRapidMove( const Point3d& ptP, bool bSplit) ;
|
||||
int AddRapidMove( const Point3d& ptP, bool bSplit, const std::string& sName) ;
|
||||
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst)
|
||||
{ return ( bFirst ? AddRapidStart( ptP) : AddRapidMove( ptP)) ; }
|
||||
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst, const std::string& sName)
|
||||
{ return ( bFirst ? AddRapidStart( ptP, sName) : AddRapidMove( ptP, sName)) ; }
|
||||
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst, bool bSplit)
|
||||
{ return ( bFirst ? AddRapidStart( ptP) : AddRapidMove( ptP, bSplit)) ; }
|
||||
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst, bool bSplit, const std::string& sName)
|
||||
{ return ( bFirst ? AddRapidStart( ptP, sName) : AddRapidMove( ptP, bSplit, sName)) ; }
|
||||
int AddLinearMove( const Point3d& ptP) ;
|
||||
int AddLinearMove( const Point3d& ptP, const std::string& sName) ;
|
||||
int AddLinearMove( const Point3d& ptP, bool bSplit) ;
|
||||
int AddLinearMove( const Point3d& ptP, bool bSplit, 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, bool bOnlySimple = false) ;
|
||||
int AddCurveMove( const ICurve* pCrv, const std::string& sName, bool bOnlySimple = false) ;
|
||||
int AddCurveMove( const ICurve* pCrv) ;
|
||||
int AddCurveMove( const ICurve* pCrv, const std::string& sName) ;
|
||||
int AddCurveMove( const ICurve* pCrv, bool bSplit) ;
|
||||
int AddCurveMove( const ICurve* pCrv, bool bSplit, const std::string& sName) ;
|
||||
bool ResetMoveData( void) ;
|
||||
|
||||
protected :
|
||||
|
||||
+111
-6
@@ -212,6 +212,46 @@ Operation::AddRapidMove( const Point3d& ptP, const string& sName)
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddRapidMove( const Point3d& ptP, bool bSplit)
|
||||
{
|
||||
// se non richiesta spezzatura con massima lunghezza, emissione normale
|
||||
if ( ! NeedSplit( bSplit))
|
||||
return AddRapidMove( ptP) ;
|
||||
// altrimenti opportuna spezzatura
|
||||
Point3d ptS ;
|
||||
if ( ! GetCurrPos( ptS))
|
||||
return GDB_ID_NULL ;
|
||||
double dLen = Dist( ptS, ptP) ;
|
||||
double dStep = GetMaxSplitLen( true, false) ;
|
||||
int nStep = int( dLen / dStep + 0.999) ;
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
int nId = AddRapidMove( Media( ptS, ptP, i * 1.0 / nStep)) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nId ;
|
||||
SetFlag( 0) ;
|
||||
SetFlag2( 0) ;
|
||||
}
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddRapidMove( const Point3d& ptP, bool bSplit, const string& sName)
|
||||
{
|
||||
int nFirstId = AddRapidMove( ptP, bSplit) ;
|
||||
int nId = nFirstId ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
m_pGeomDB->SetName( nId, sName) ;
|
||||
nId = m_pGeomDB->GetNext( nId) ;
|
||||
}
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddLinearMove( const Point3d& ptP)
|
||||
@@ -270,6 +310,44 @@ Operation::AddLinearMove( const Point3d& ptP, const string& sName)
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddLinearMove( const Point3d& ptP, bool bSplit)
|
||||
{
|
||||
// se non richiesta spezzatura con massima lunghezza, emissione normale
|
||||
if ( ! NeedSplit( bSplit))
|
||||
return AddLinearMove( ptP) ;
|
||||
// altrimenti opportuna spezzatura
|
||||
Point3d ptS ;
|
||||
if ( ! GetCurrPos( ptS))
|
||||
return GDB_ID_NULL ;
|
||||
double dLen = Dist( ptS, ptP) ;
|
||||
double dStep = GetMaxSplitLen( true, true) ;
|
||||
int nStep = int( dLen / dStep + 0.999) ;
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
int nId = AddLinearMove( Media( ptS, ptP, i * 1.0 / nStep)) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nId ;
|
||||
}
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddLinearMove( const Point3d& ptP, bool bSplit, const string& sName)
|
||||
{
|
||||
int nFirstId = AddLinearMove( ptP, bSplit) ;
|
||||
int nId = nFirstId ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
m_pGeomDB->SetName( nId, sName) ;
|
||||
nId = m_pGeomDB->GetNext( nId) ;
|
||||
}
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN)
|
||||
@@ -346,7 +424,7 @@ Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddCurveMove( const ICurve* pCrv, bool bOnlySimple)
|
||||
Operation::AddCurveMove( const ICurve* pCrv)
|
||||
{
|
||||
// verifico che la curva esista
|
||||
if ( pCrv == nullptr)
|
||||
@@ -367,8 +445,8 @@ Operation::AddCurveMove( const ICurve* pCrv, bool bOnlySimple)
|
||||
pArc->GetEndPoint( ptP3) ;
|
||||
return AddArcMove( ptP3, ptCen, dAngCen, vtN) ;
|
||||
}
|
||||
// se ammesse curve composite
|
||||
else if ( ! bOnlySimple) {
|
||||
// se arco o curva composita
|
||||
else if ( pCrv->GetType() == CRV_ARC || pCrv->GetType() == CRV_COMPO) {
|
||||
// in ogni caso, converto in archi e rette
|
||||
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
if ( ! pCompo->AddCurve( *pCrv))
|
||||
@@ -407,16 +485,43 @@ Operation::AddCurveMove( const ICurve* pCrv, bool bOnlySimple)
|
||||
}
|
||||
return nFirstId ;
|
||||
}
|
||||
// altrimenti
|
||||
// altre curve non ammesse
|
||||
else
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddCurveMove( const ICurve* pCrv, const string& sName, bool bOnlySimple)
|
||||
Operation::AddCurveMove( const ICurve* pCrv, const string& sName)
|
||||
{
|
||||
int nFirstId = AddCurveMove( pCrv, bOnlySimple) ;
|
||||
int nFirstId = AddCurveMove( pCrv) ;
|
||||
int nId = nFirstId ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
m_pGeomDB->SetName( nId, sName) ;
|
||||
nId = m_pGeomDB->GetNext( nId) ;
|
||||
}
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddCurveMove( const ICurve* pCrv, bool bSplit)
|
||||
{
|
||||
// se non richiesta spezzatura, emissione normale
|
||||
if ( ! bSplit)
|
||||
return AddCurveMove( pCrv) ;
|
||||
// altrimenti opportuna spezzatura
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
if ( ! pCompo.Set( ConvertCurveToComposite( pCrv->Clone())) || ! ApproxWithLines( pCompo))
|
||||
return false ;
|
||||
return AddCurveMove( pCompo) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddCurveMove( const ICurve* pCrv, bool bSplit, const string& sName)
|
||||
{
|
||||
int nFirstId = AddCurveMove( pCrv, bSplit) ;
|
||||
int nId = nFirstId ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
m_pGeomDB->SetName( nId, sName) ;
|
||||
|
||||
+112
-44
@@ -103,6 +103,9 @@ static const std::string GVAR_R1 = ".R1" ; // (num) valore de
|
||||
static const std::string GVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante
|
||||
static const std::string GVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante
|
||||
static const std::string GVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante
|
||||
static const std::string GVAR_R5 = ".R5" ; // (num) valore del quinto asse rotante
|
||||
static const std::string GVAR_R6 = ".R6" ; // (num) valore del sesto asse rotante
|
||||
static const std::string GVAR_R7 = ".R7" ; // (num) valore del settimo asse rotante
|
||||
static const std::string GVAR_C1 = ".C1" ; // (num) valore del primo asse lineare per centro arco
|
||||
static const std::string GVAR_C2 = ".C2" ; // (num) valore del secondo asse lineare per centro arco
|
||||
static const std::string GVAR_C3 = ".C3" ; // (num) valore del terzo asse lineare per centro arco
|
||||
@@ -118,6 +121,9 @@ static const std::string GVAR_R1P = ".R1p" ; // (num) valore pr
|
||||
static const std::string GVAR_R2P = ".R2p" ; // (num) valore precedente del secondo asse rotante
|
||||
static const std::string GVAR_R3P = ".R3p" ; // (num) valore precedente del terzo asse rotante
|
||||
static const std::string GVAR_R4P = ".R4p" ; // (num) valore precedente del quarto asse rotante
|
||||
static const std::string GVAR_R5P = ".R5p" ; // (num) valore precedente del quinto asse rotante
|
||||
static const std::string GVAR_R6P = ".R6p" ; // (num) valore precedente del sesto asse rotante
|
||||
static const std::string GVAR_R7P = ".R7p" ; // (num) valore precedente del settimo asse rotante
|
||||
static const std::string GVAR_L1T = ".L1t" ; // (string) token del primo asse lineare
|
||||
static const std::string GVAR_L2T = ".L2t" ; // (string) token del secondo asse lineare
|
||||
static const std::string GVAR_L3T = ".L3t" ; // (string) token del terzo asse lineare
|
||||
@@ -125,6 +131,9 @@ static const std::string GVAR_R1T = ".R1t" ; // (string) token del
|
||||
static const std::string GVAR_R2T = ".R2t" ; // (string) token del secondo asse rotante
|
||||
static const std::string GVAR_R3T = ".R3t" ; // (string) token del terzo asse rotante
|
||||
static const std::string GVAR_R4T = ".R4t" ; // (string) token del quarto asse rotante
|
||||
static const std::string GVAR_R5T = ".R5t" ; // (string) token del quinto asse rotante
|
||||
static const std::string GVAR_R6T = ".R6t" ; // (string) token del sesto asse rotante
|
||||
static const std::string GVAR_R7T = ".R7t" ; // (string) token del settimo asse rotante
|
||||
static const std::string GVAR_C1T = ".C1t" ; // (string) token del primo asse lineare per centro arco
|
||||
static const std::string GVAR_C2T = ".C2t" ; // (string) token del secondo asse lineare per centro arco
|
||||
static const std::string GVAR_C3T = ".C3t" ; // (string) token del terzo asse lineare per centro arco
|
||||
@@ -139,6 +148,9 @@ static const std::string GVAR_R1N = ".R1n" ; // (string) nome del
|
||||
static const std::string GVAR_R2N = ".R2n" ; // (string) nome del secondo asse rotante
|
||||
static const std::string GVAR_R3N = ".R3n" ; // (string) nome del terzo asse rotante
|
||||
static const std::string GVAR_R4N = ".R4n" ; // (string) nome del quarto asse rotante
|
||||
static const std::string GVAR_R5N = ".R5n" ; // (string) nome del quinto asse rotante
|
||||
static const std::string GVAR_R6N = ".R6n" ; // (string) nome del sesto asse rotante
|
||||
static const std::string GVAR_R7N = ".R7n" ; // (string) nome del settimo asse rotante
|
||||
static const std::string GVAR_MASK = ".MASK" ; // (int) mask associato ai movimenti in rapido
|
||||
static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento
|
||||
static const std::string GVAR_FLAG2 = ".FLAG2" ; // (int) secondo flag associato ad ogni movimento
|
||||
@@ -229,64 +241,120 @@ static const std::string ON_RESET_MACHINE = "OnResetMachine" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline std::string
|
||||
GetGlobVarAxisValue( int nAx, const std::string& sVar = GLOB_VAR)
|
||||
GetGlobVarAxisValue( int nAx, const std::string& sVar = GLOB_VAR, bool bIsRobot = false)
|
||||
{
|
||||
switch ( nAx) {
|
||||
case 1 : return ( sVar + GVAR_L1) ;
|
||||
case 2 : return ( sVar + GVAR_L2) ;
|
||||
case 3 : return ( sVar + GVAR_L3) ;
|
||||
case 4 : return ( sVar + GVAR_R1) ;
|
||||
case 5 : return ( sVar + GVAR_R2) ;
|
||||
case 6 : return ( sVar + GVAR_R3) ;
|
||||
case 7 : return ( sVar + GVAR_R4) ;
|
||||
default : return "" ;
|
||||
}
|
||||
if ( ! bIsRobot) {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( sVar + GVAR_L1) ;
|
||||
case 2 : return ( sVar + GVAR_L2) ;
|
||||
case 3 : return ( sVar + GVAR_L3) ;
|
||||
case 4 : return ( sVar + GVAR_R1) ;
|
||||
case 5 : return ( sVar + GVAR_R2) ;
|
||||
case 6 : return ( sVar + GVAR_R3) ;
|
||||
case 7 : return ( sVar + GVAR_R4) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( sVar + GVAR_R1) ;
|
||||
case 2 : return ( sVar + GVAR_R2) ;
|
||||
case 3 : return ( sVar + GVAR_R3) ;
|
||||
case 4 : return ( sVar + GVAR_R4) ;
|
||||
case 5 : return ( sVar + GVAR_R5) ;
|
||||
case 6 : return ( sVar + GVAR_R6) ;
|
||||
case 7 : return ( sVar + GVAR_R7) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline std::string
|
||||
GetGlobVarAxisPrev( int nAx, const std::string& sVar = GLOB_VAR)
|
||||
GetGlobVarAxisPrev( int nAx, const std::string& sVar = GLOB_VAR, bool bIsRobot = false)
|
||||
{
|
||||
switch ( nAx) {
|
||||
case 1 : return ( sVar + GVAR_L1P) ;
|
||||
case 2 : return ( sVar + GVAR_L2P) ;
|
||||
case 3 : return ( sVar + GVAR_L3P) ;
|
||||
case 4 : return ( sVar + GVAR_R1P) ;
|
||||
case 5 : return ( sVar + GVAR_R2P) ;
|
||||
case 6 : return ( sVar + GVAR_R3P) ;
|
||||
case 7 : return ( sVar + GVAR_R4P) ;
|
||||
default : return "" ;
|
||||
}
|
||||
if ( ! bIsRobot) {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( sVar + GVAR_L1P) ;
|
||||
case 2 : return ( sVar + GVAR_L2P) ;
|
||||
case 3 : return ( sVar + GVAR_L3P) ;
|
||||
case 4 : return ( sVar + GVAR_R1P) ;
|
||||
case 5 : return ( sVar + GVAR_R2P) ;
|
||||
case 6 : return ( sVar + GVAR_R3P) ;
|
||||
case 7 : return ( sVar + GVAR_R4P) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( sVar + GVAR_R1P) ;
|
||||
case 2 : return ( sVar + GVAR_R2P) ;
|
||||
case 3 : return ( sVar + GVAR_R3P) ;
|
||||
case 4 : return ( sVar + GVAR_R4P) ;
|
||||
case 5 : return ( sVar + GVAR_R5P) ;
|
||||
case 6 : return ( sVar + GVAR_R6P) ;
|
||||
case 7 : return ( sVar + GVAR_R7P) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline std::string
|
||||
GetGlobVarAxisToken( int nAx)
|
||||
GetGlobVarAxisToken( int nAx, bool bIsRobot = false)
|
||||
{
|
||||
switch ( nAx) {
|
||||
case 1 : return ( GLOB_VAR + GVAR_L1T) ;
|
||||
case 2 : return ( GLOB_VAR + GVAR_L2T) ;
|
||||
case 3 : return ( GLOB_VAR + GVAR_L3T) ;
|
||||
case 4 : return ( GLOB_VAR + GVAR_R1T) ;
|
||||
case 5 : return ( GLOB_VAR + GVAR_R2T) ;
|
||||
case 6 : return ( GLOB_VAR + GVAR_R3T) ;
|
||||
case 7 : return ( GLOB_VAR + GVAR_R4T) ;
|
||||
default : return "" ;
|
||||
}
|
||||
if ( ! bIsRobot) {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( GLOB_VAR + GVAR_L1T) ;
|
||||
case 2 : return ( GLOB_VAR + GVAR_L2T) ;
|
||||
case 3 : return ( GLOB_VAR + GVAR_L3T) ;
|
||||
case 4 : return ( GLOB_VAR + GVAR_R1T) ;
|
||||
case 5 : return ( GLOB_VAR + GVAR_R2T) ;
|
||||
case 6 : return ( GLOB_VAR + GVAR_R3T) ;
|
||||
case 7 : return ( GLOB_VAR + GVAR_R4T) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( GLOB_VAR + GVAR_R1T) ;
|
||||
case 2 : return ( GLOB_VAR + GVAR_R2T) ;
|
||||
case 3 : return ( GLOB_VAR + GVAR_R3T) ;
|
||||
case 4 : return ( GLOB_VAR + GVAR_R4T) ;
|
||||
case 5 : return ( GLOB_VAR + GVAR_R5T) ;
|
||||
case 6 : return ( GLOB_VAR + GVAR_R6T) ;
|
||||
case 7 : return ( GLOB_VAR + GVAR_R7T) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline std::string
|
||||
GetGlobVarAxisName( int nAx)
|
||||
GetGlobVarAxisName( int nAx, bool bIsRobot = false)
|
||||
{
|
||||
switch ( nAx) {
|
||||
case 1 : return ( GLOB_VAR + GVAR_L1N) ;
|
||||
case 2 : return ( GLOB_VAR + GVAR_L2N) ;
|
||||
case 3 : return ( GLOB_VAR + GVAR_L3N) ;
|
||||
case 4 : return ( GLOB_VAR + GVAR_R1N) ;
|
||||
case 5 : return ( GLOB_VAR + GVAR_R2N) ;
|
||||
case 6 : return ( GLOB_VAR + GVAR_R3N) ;
|
||||
case 7 : return ( GLOB_VAR + GVAR_R4N) ;
|
||||
default : return "" ;
|
||||
}
|
||||
if ( ! bIsRobot) {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( GLOB_VAR + GVAR_L1N) ;
|
||||
case 2 : return ( GLOB_VAR + GVAR_L2N) ;
|
||||
case 3 : return ( GLOB_VAR + GVAR_L3N) ;
|
||||
case 4 : return ( GLOB_VAR + GVAR_R1N) ;
|
||||
case 5 : return ( GLOB_VAR + GVAR_R2N) ;
|
||||
case 6 : return ( GLOB_VAR + GVAR_R3N) ;
|
||||
case 7 : return ( GLOB_VAR + GVAR_R4N) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( GLOB_VAR + GVAR_R1N) ;
|
||||
case 2 : return ( GLOB_VAR + GVAR_R2N) ;
|
||||
case 3 : return ( GLOB_VAR + GVAR_R3N) ;
|
||||
case 4 : return ( GLOB_VAR + GVAR_R4N) ;
|
||||
case 5 : return ( GLOB_VAR + GVAR_R5N) ;
|
||||
case 6 : return ( GLOB_VAR + GVAR_R6N) ;
|
||||
case 7 : return ( GLOB_VAR + GVAR_R7N) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+96
-83
@@ -1693,10 +1693,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
|
||||
// verifico se archi vanno approssimati con segmenti di retta
|
||||
int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ;
|
||||
bool bSplitArcs = ( nSplitArcs == SPLAR_ALWAYS ||
|
||||
( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtExtr.IsZplus()) ||
|
||||
( nSplitArcs == SPLAR_GEN_PLANE && vtExtr.IsGeneric())) ;
|
||||
bool bSplitArcs = GetSplitArcs( vtExtr) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
@@ -2076,6 +2073,16 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
}
|
||||
}
|
||||
|
||||
// se necessario, approssimo con rette
|
||||
if ( bSplitArcs) {
|
||||
for ( auto& pMCrv : vpCrvs) {
|
||||
if ( ! ApproxWithLines( pMCrv)) {
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// inserisco i movimenti di svuotatura
|
||||
for ( int j = 1 ; j <= nStep ; ++ j) {
|
||||
// ciclo sui percorsi
|
||||
@@ -2127,7 +2134,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
}
|
||||
// se inizio, approccio globale al punto iniziale
|
||||
if ( bStart) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bOutRawLeadIn || m_bOpenOutRaw)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bSplitArcs, bOutRawLeadIn || m_bOpenOutRaw)) {
|
||||
m_pMchMgr->SetLastError( 2414, "Error in Pocketing : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2135,7 +2142,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
}
|
||||
// altrimenti, approccio di collegamento
|
||||
else {
|
||||
if ( ! AddLinkApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bOutRawLeadIn || m_bOpenOutRaw)) {
|
||||
if ( ! AddLinkApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bSplitArcs, bOutRawLeadIn || m_bOpenOutRaw)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2153,7 +2160,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
@@ -2184,14 +2191,14 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
}
|
||||
// se lucidatura o caso ottimizzato e ultimo percorso di ultimo step, aggiungo retrazione
|
||||
if ( ( m_TParams.m_nType == TT_MILL_POLISHING || bOptimizedZigZag) && k == nPath - 1 && j == nStep) {
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti, aggiungo retrazione di collegamento
|
||||
else {
|
||||
if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2222,7 +2229,17 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
m_pMchMgr->SetLastError( 2413, "Error in Pocketing : Toolpath not computable") ;
|
||||
return false ;
|
||||
}
|
||||
VerifyArcs( pOffs2) ;
|
||||
|
||||
// se necessario, approssimo con rette
|
||||
if ( bSplitArcs) {
|
||||
if ( ! ApproxWithLines( pOffs2)) {
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti verifico archi
|
||||
else
|
||||
VerifyArcs( pOffs2) ;
|
||||
|
||||
// se richiesto, la inverto
|
||||
if ( m_Params.m_bInvert)
|
||||
@@ -2279,7 +2296,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
dStElev = -LIO_ELEV_TOL ;
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddLinkApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr)) {
|
||||
if ( ! AddLinkApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2305,7 +2322,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
@@ -2337,14 +2354,14 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
}
|
||||
// se ci sono ancora curve, aggiungo retrazione di collegamento
|
||||
if ( OffsCrv2.GetCurveCount() > 0) {
|
||||
if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti retrazione finale
|
||||
else {
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3064,8 +3081,16 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
// sposto l'inizio a metà del tratto più lungo
|
||||
AdjustContourStart( pOffs) ;
|
||||
|
||||
// verifico archi
|
||||
VerifyArcs( pOffs) ;
|
||||
// se necessario, approssimo con rette
|
||||
if ( bSplitArcs) {
|
||||
if ( ! ApproxWithLines( pOffs)) {
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti verifico archi
|
||||
else
|
||||
VerifyArcs( pOffs) ;
|
||||
|
||||
// coefficiente di riduzione feed di lavorazione di questa curva
|
||||
double dFeedRid = min( GetSideStep() / m_TParams.m_dDiam, 1.0) ;
|
||||
@@ -3117,7 +3142,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
dStElev = -LIO_ELEV_TOL ;
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, false)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bSplitArcs, false)) {
|
||||
m_pMchMgr->SetLastError( 2414, "Error in Pocketing : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3143,7 +3168,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
SetFeed( dFeedRid * GetFeed()) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
@@ -3175,7 +3200,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
return false ;
|
||||
}
|
||||
// aggiungo retrazione
|
||||
if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3268,7 +3293,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
dStElev = max( dStElev, j * dStep) ;
|
||||
dStElev -= ( ptP - ptS) * vtExtr ;
|
||||
// sempre approccio di collegamento
|
||||
if ( ! AddLinkApproach( ptP, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr)) {
|
||||
if ( ! AddLinkApproach( ptP, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3284,7 +3309,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
ptE.Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
// movimento al punto finale
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddLinearMove( ptE) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptE, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// risalita
|
||||
Point3d ptQ ;
|
||||
@@ -3298,14 +3323,14 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
bFound = inOk.GetNext( dParS, dParE) ;
|
||||
// se ultimo movimento di ultima area, aggiungo retrazione globale
|
||||
if ( j == nStep && i == nYStep && ! bFound && OffsCrv2.GetCurveCount() == 0) {
|
||||
if ( ! AddRetract( ptQ, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
if ( ! AddRetract( ptQ, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2417, "Error in Pocketing : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti aggiungo retrazione di collegamento
|
||||
else {
|
||||
if ( ! AddLinkRetract( ptQ, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
if ( ! AddLinkRetract( ptQ, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3467,7 +3492,7 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
dStElev = -LIO_ELEV_TOL ;
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bOutStart || bForcedOutStart)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bSplitArcs, bOutStart || bForcedOutStart)) {
|
||||
m_pMchMgr->SetLastError( 2414, "Error in Pocketing : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3493,7 +3518,7 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
@@ -3549,7 +3574,7 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
return false ;
|
||||
}
|
||||
// aggiungo retrazione
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2417, "Error in Pocketing : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3659,7 +3684,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
if ( IsNull( pCurve))
|
||||
return false ;
|
||||
// aggiungo affondamento
|
||||
pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
pCurve->Translate( -vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
// se prima entità
|
||||
if ( i == 0 ) {
|
||||
// dati inizio entità
|
||||
@@ -3695,7 +3720,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
dStElev = -LIO_ELEV_TOL ;
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, false)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bSplitArcs, false)) {
|
||||
m_pMchMgr->SetLastError( 2414, "Error in Pocketing : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3721,7 +3746,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
@@ -3777,7 +3802,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
return false ;
|
||||
}
|
||||
// aggiungo retrazione
|
||||
if ( ! AddRetract( ptQ, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
if ( ! AddRetract( ptQ, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2417, "Error in Pocketing : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3954,7 +3979,7 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
|
||||
pRCrv->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL, false) ;
|
||||
// se necessario, approssimo archi con rette
|
||||
if ( bSplitArcs && ! ApproxWithLines( pRCrv)) {
|
||||
m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ;
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
VerifyArcs( pRCrv) ;
|
||||
@@ -3992,7 +4017,7 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
|
||||
}
|
||||
// se necessario, approssimo archi con rette
|
||||
if ( bSplitArcs && ! ApproxWithLines( pMCrv)) {
|
||||
m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ;
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// eventuale sistemazione archi
|
||||
@@ -4181,7 +4206,7 @@ Pocketing::CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double d
|
||||
}
|
||||
// se necessario, approssimo con rette
|
||||
if ( bSplitArcs && ! ApproxWithLines( pMCrv)) {
|
||||
m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ;
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// eventuale sistemazione archi
|
||||
@@ -4198,8 +4223,14 @@ Pocketing::CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double d
|
||||
return false ;
|
||||
}
|
||||
pRCrv->AddCurve( Release( pArc2)) ;
|
||||
// inverto e eventualmente sistemo archi
|
||||
// inverto
|
||||
pRCrv->Invert() ;
|
||||
// se necessario, approssimo con rette
|
||||
if ( bSplitArcs && ! ApproxWithLines( pRCrv)) {
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// eventuale sistemazione archi
|
||||
VerifyArcs( pRCrv) ;
|
||||
}
|
||||
|
||||
@@ -4898,7 +4929,7 @@ Pocketing::ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv,
|
||||
pRCrv->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL, false) ;
|
||||
// se necessario, approssimo archi con rette
|
||||
if ( bSplitArcs && ! ApproxWithLines( pRCrv)) {
|
||||
m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ;
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
VerifyArcs( pRCrv) ;
|
||||
@@ -4923,7 +4954,7 @@ Pocketing::ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv,
|
||||
|
||||
// se necessario, approssimo archi con rette
|
||||
if ( bSplitArcs && ! ApproxWithLines( pMCrv)) {
|
||||
m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ;
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
VerifyArcs( pMCrv) ;
|
||||
@@ -5009,7 +5040,7 @@ Pocketing::AddEpicycles( ICurveComposite* pCompo, ICurveComposite * pCrv, ICurve
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bOutStart)
|
||||
double dElev, double dAppr, bool bSplitArcs, bool bOutStart)
|
||||
{
|
||||
SetFlag( 1) ;
|
||||
// se con aggregato da sotto o equivalente (rinvio a 90 gradi su testa 5 assi)
|
||||
@@ -5034,7 +5065,7 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
|
||||
return false ;
|
||||
SetAuxDir( m_vtAggrBottom) ;
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidMove( ptP0, MCH_CL_AGB_IN) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_IN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// altrimenti rinvio normale
|
||||
@@ -5052,20 +5083,18 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
|
||||
// se distanza di sicurezza minore di distanza di inizio
|
||||
if ( dSafeDist < dAppr + 10 * EPS_SMALL) {
|
||||
// 1 -> punto sopra inizio
|
||||
if ( ( ! m_bAggrBottom && AddRapidStart( ptP1) == GDB_ID_NULL) ||
|
||||
( m_bAggrBottom && AddRapidMove( ptP1) == GDB_ID_NULL))
|
||||
if ( AddRapidStartOrMove( ptP1, ! m_bAggrBottom, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
// 1a -> punto molto sopra inizio
|
||||
Point3d ptP1a = ptP1 + vtTool * ( dSafeDist - dAppr) ;
|
||||
if ( ( ! m_bAggrBottom && AddRapidStart( ptP1a) == GDB_ID_NULL) ||
|
||||
( m_bAggrBottom && AddRapidMove( ptP1a) == GDB_ID_NULL))
|
||||
if ( AddRapidStartOrMove( ptP1a, ! m_bAggrBottom, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// 1 -> punto sopra inizio
|
||||
if ( ( dElev + dAppr) > 10 * EPS_SMALL || (( dElev + dAppr) > -EPS_ZERO && dAppr > EPS_SMALL)) {
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidMove( ptP1) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP1, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
@@ -5075,14 +5104,13 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
|
||||
SetFlag( 0) ;
|
||||
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_NOTIP) ;
|
||||
SetFeed( bStartFeed ? GetStartFeed() : GetTipFeed()) ;
|
||||
if ( ! AreSamePointApprox( ptP1, ptP) && AddLinearMove( ptP) == GDB_ID_NULL)
|
||||
if ( ! AreSamePointApprox( ptP1, ptP) && AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
// affondo diretto al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
if ( ( ! m_bAggrBottom && AddRapidStart( ptP) == GDB_ID_NULL) ||
|
||||
( m_bAggrBottom && AddRapidMove( ptP) == GDB_ID_NULL))
|
||||
if ( AddRapidStartOrMove( ptP, ! m_bAggrBottom, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
@@ -5091,7 +5119,7 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bOutStart)
|
||||
double dElev, double dAppr, bool bSplitArcs, bool bOutStart)
|
||||
{
|
||||
// se sopra attacco c'è spazio per approccio
|
||||
if ( ( dElev + dAppr) > 10 * EPS_SMALL) {
|
||||
@@ -5099,19 +5127,19 @@ Pocketing::AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double d
|
||||
Point3d ptP1b = ptP + vtTool * ( dElev + dAppr) ;
|
||||
if ( ( dElev + dAppr) > EPS_SMALL) {
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidMove( ptP1b) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP1b, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// affondo al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
SetFeed( bOutStart ? GetStartFeed() : GetTipFeed()) ;
|
||||
if ( AddLinearMove( ptP) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
// affondo diretto al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidMove( ptP) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
@@ -5120,14 +5148,14 @@ Pocketing::AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double d
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr)
|
||||
double dElev, double dAppr, bool bSplitArcs)
|
||||
{
|
||||
// se sopra uscita c'è spazio per approccio
|
||||
if ( ( dElev + dAppr) > 10 * EPS_SMALL) {
|
||||
// 4 -> movimento di risalita sopra il punto finale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
Point3d ptP4 = ptP + vtTool * ( dElev + dAppr) ;
|
||||
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
@@ -5136,7 +5164,7 @@ Pocketing::AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dS
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr)
|
||||
double dElev, double dAppr, bool bSplitArcs)
|
||||
{
|
||||
// se con aggregato da sotto o equivalente (rinvio a 90 gradi su testa 5 assi)
|
||||
bool bBottomOutStart = false ;
|
||||
@@ -5154,7 +5182,7 @@ Pocketing::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ
|
||||
// 4 -> movimento di risalita sopra il punto finale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
Point3d ptP4 = ptP + vtTool * ( dElev + dAppr) ;
|
||||
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
@@ -5162,12 +5190,12 @@ Pocketing::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ
|
||||
Point3d ptP4a = ptP + vtTool * ( dElev + dAppr) ;
|
||||
if ( dElev + dAppr > EPS_SMALL) {
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( AddLinearMove( ptP4a) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP4a, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 4b -> movimento di risalita sopra il punto finale
|
||||
Point3d ptP4b = ptP4a + vtTool * ( dSafeDist - dAppr) ;
|
||||
if ( AddRapidMove( ptP4b) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP4b, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -5178,14 +5206,14 @@ Pocketing::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ
|
||||
// post-retract
|
||||
Point3d ptP0 = ptP - Z_AX * dAggZ + m_vtAggrBottom * ( dDistBottom + m_AggrBottom.dEncH + dSafeZ) ;
|
||||
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAggZ - dElev) ;
|
||||
if ( AddRapidMove( ptP0, MCH_CL_AGB_OUT) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_OUT) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// se rinvio da sotto che richiede speciale rotazione
|
||||
if ( m_AggrBottom.nType == 1) {
|
||||
Vector3d vtAux = m_vtAggrBottom ;
|
||||
vtAux.Rotate( Z_AX, 0, 1) ;
|
||||
SetAuxDir( vtAux) ;
|
||||
if ( AddRapidMove( ptP00, MCH_CL_AGB_UP) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP00, bSplitArcs, MCH_CL_AGB_UP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -5252,17 +5280,8 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3
|
||||
PtrOwner<ICurveArc> pArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pArc) || ! pArc->Set( ptCen, vtN, dRad, - vtCen, dAngCen, dDeltaN))
|
||||
return false ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs) {
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pArc))) || ! ApproxWithLines( pCompo))
|
||||
return false ;
|
||||
return ( AddCurveMove( pCompo, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
else {
|
||||
// emetto l'elica
|
||||
return ( AddCurveMove( pArc, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
// emetto l'elica (con eventuale spezzatura)
|
||||
return ( AddCurveMove( pArc, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
// altrimenti zigzag
|
||||
else
|
||||
@@ -5279,12 +5298,12 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3
|
||||
// verifico se fattibile
|
||||
if ( bSkipControl || VerifyLeadInZigZag( pCompo, ptPa, ptPb)) {
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
if ( AddLinearMove( ptPa - vtN * ( i - 0.75) * dStep, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptPa - vtN * ( i - 0.75) * dStep, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( AddLinearMove( ptPb - vtN * ( i - 0.25) * dStep, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptPb - vtN * ( i - 0.25) * dStep, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
return ( AddLinearMove( ptStart, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
return ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
// altrimenti diretto
|
||||
else {
|
||||
@@ -5318,11 +5337,8 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3
|
||||
double dNini = ( ptP1 - ORIG) * vtN ;
|
||||
double dNfin = ( ptStart - ORIG) * vtN ;
|
||||
AdjustCurveSlope( pCrv, dNini, dNfin) ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs && ! ApproxWithLines( pCrv))
|
||||
return false ;
|
||||
// emetto
|
||||
return ( AddCurveMove( pCrv) != GDB_ID_NULL) ;
|
||||
// emetto (con eventuale spezzatura)
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
// altrimenti diretto
|
||||
else
|
||||
@@ -5333,7 +5349,7 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3
|
||||
Point3d ptCurr = ptP1 ;
|
||||
GetCurrPos( ptCurr) ;
|
||||
if ( ! AreSamePointApprox( ptCurr, ptStart)) {
|
||||
if ( AddLinearMove( ptStart, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
@@ -5404,11 +5420,8 @@ Pocketing::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector
|
||||
Point3d ptFin ; pCrv->GetEndPoint( ptFin) ;
|
||||
ptFin += vtN * 1.0 ;
|
||||
pCrv->ModifyEnd( ptFin) ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs && ! ApproxWithLines( pCrv))
|
||||
return false ;
|
||||
// emetto
|
||||
AddCurveMove( pCrv) ;
|
||||
// emetto (con eventuale spezzatura)
|
||||
AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) ;
|
||||
// determino elevazione su fine uscita
|
||||
ptP1 = ptFin ;
|
||||
double dEndElev ;
|
||||
|
||||
+4
-4
@@ -116,13 +116,13 @@ class Pocketing : public Machining
|
||||
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;
|
||||
bool AddEpicycles( ICurveComposite * pCompo, ICurveComposite * pCrv, ICurveComposite * pCrvBound = nullptr) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bOutStart) ;
|
||||
double dElev, double dAppr, bool bSplitArcs, bool bOutStart) ;
|
||||
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bOutStart = false) ;
|
||||
double dElev, double dAppr, bool bSplitArcs, bool bOutStart = false) ;
|
||||
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr) ;
|
||||
double dElev, double dAppr, bool bSplitArcs) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr) ;
|
||||
double dElev, double dAppr, bool bSplitArcs) ;
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
const ICurveComposite* pRCrv, Point3d& ptP1) const ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
|
||||
+16
-12
@@ -521,8 +521,8 @@ bool
|
||||
Processor::UpdateAxes( void)
|
||||
{
|
||||
// Carico i nomi degli assi macchina attivi
|
||||
return m_pMachine->GetAllCurrAxesName( m_AxesName) &&
|
||||
m_pMachine->GetAllCurrAxesToken( m_AxesToken) ;
|
||||
return m_pMachine->GetAllCurrAxesNames( m_AxesName) &&
|
||||
m_pMachine->GetAllCurrAxesTokens( m_AxesToken) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -843,15 +843,16 @@ Processor::OnToolSelect( const string& sTool, const string& sHead, int nExit, co
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, nExit) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos) ;
|
||||
// assegno il token e il nome degli assi
|
||||
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
|
||||
int nNumAxes = int( m_AxesName.size()) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
|
||||
if ( i <= nNumAxes) {
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisToken(i), m_AxesToken[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisName(i), m_AxesName[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisToken( i, bIsRobot), m_AxesToken[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisName( i, bIsRobot), m_AxesName[i-1]) ;
|
||||
}
|
||||
else {
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisToken(i)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisName(i)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisToken( i, bIsRobot)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisName( i, bIsRobot)) ;
|
||||
}
|
||||
}
|
||||
// chiamo la funzione di selezione utensile
|
||||
@@ -983,12 +984,13 @@ Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd
|
||||
// assegno il tipo di movimento
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
|
||||
// assegno il valore degli assi
|
||||
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
|
||||
int nNumAxes = int( AxesEnd.size()) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
|
||||
if ( i <= nNumAxes)
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue(i), AxesEnd[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot), AxesEnd[i-1]) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue(i)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot)) ;
|
||||
}
|
||||
// assegno la mascheratura degli assi
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MASK, nAxesMask) ;
|
||||
@@ -1023,12 +1025,13 @@ Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEn
|
||||
// assegno il tipo di movimento
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
|
||||
// assegno il valore degli assi
|
||||
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
|
||||
int nNumAxes = int( AxesEnd.size()) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
|
||||
if ( i <= nNumAxes)
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue(i), AxesEnd[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot), AxesEnd[i-1]) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue(i)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot)) ;
|
||||
}
|
||||
// assegno il valore del versore utensile
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIR, vtTool) ;
|
||||
@@ -1062,12 +1065,13 @@ Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
|
||||
// assegno il tipo di movimento
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
|
||||
// assegno il valore degli assi
|
||||
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
|
||||
int nNumAxes = int( AxesEnd.size()) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
|
||||
if ( i <= nNumAxes)
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue(i), AxesEnd[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot), AxesEnd[i-1]) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue(i)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot)) ;
|
||||
}
|
||||
// assegno le coordinate del centro
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_C1, ptCen.x) ;
|
||||
|
||||
+86
-47
@@ -4,7 +4,7 @@
|
||||
// File : Sawing.cpp Data : 24.10.15 Versione : 1.6j3
|
||||
// Contenuto : Implementazione gestione tagli con lama.
|
||||
//
|
||||
// Note : Questa lavorazione è sempre espressa nel riferimento globale.
|
||||
// Note : Questa lavorazione è sempre espressa nel riferimento globale.
|
||||
//
|
||||
// Modifiche : 07.06.15 DS Creazione modulo.
|
||||
//
|
||||
@@ -532,15 +532,15 @@ Sawing::SetParam( int nType, const string& sVal)
|
||||
bool
|
||||
Sawing::SetGeometry( const SELVECTOR& vIds)
|
||||
{
|
||||
// verifico validità gestore DB geometrico
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili
|
||||
int nType = GEO_NONE ;
|
||||
for ( const auto& Id : vIds) {
|
||||
// test sull'entità
|
||||
// test sull'entità
|
||||
int nSubs ;
|
||||
if ( ! VerifyGeometry( Id, nSubs, nType)) {
|
||||
string sInfo = "Warning in Sawing : Skipped entity " + ToString( Id) ;
|
||||
@@ -563,14 +563,14 @@ Sawing::Preview( bool bRecalc)
|
||||
// reset numero tagli nella lavorazione
|
||||
m_nCuts = 0 ;
|
||||
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
// recupero gruppo per geometria ausiliaria
|
||||
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
|
||||
bool bChain = false ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nAuxId == GDB_ID_NULL) {
|
||||
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nAuxId == GDB_ID_NULL)
|
||||
@@ -603,7 +603,7 @@ Sawing::Preview( bool bRecalc)
|
||||
|
||||
// recupero gruppo per anteprima di lavorazione (PreView)
|
||||
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nPvId == GDB_ID_NULL) {
|
||||
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nPvId == GDB_ID_NULL)
|
||||
@@ -633,7 +633,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
|
||||
int nCurrCuts = m_nCuts ;
|
||||
m_nCuts = 0 ;
|
||||
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
@@ -662,7 +662,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
|
||||
// recupero gruppo per geometria ausiliaria
|
||||
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
|
||||
bool bChain = false ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nAuxId == GDB_ID_NULL) {
|
||||
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nAuxId == GDB_ID_NULL)
|
||||
@@ -689,7 +689,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
|
||||
|
||||
// recupero gruppo per geometria di lavorazione (Cutter Location)
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nClId == GDB_ID_NULL) {
|
||||
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nClId == GDB_ID_NULL)
|
||||
@@ -732,7 +732,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
|
||||
bool
|
||||
Sawing::Update( bool bPostApply)
|
||||
{
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
@@ -742,7 +742,7 @@ Sawing::Update( bool bPostApply)
|
||||
return true ;
|
||||
}
|
||||
|
||||
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
|
||||
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
|
||||
RemoveClimbRiseHome() ;
|
||||
|
||||
// imposto eventuale asse bloccato da lavorazione
|
||||
@@ -794,7 +794,7 @@ Sawing::Update( bool bPostApply)
|
||||
bool
|
||||
Sawing::AdjustFeeds( void)
|
||||
{
|
||||
// controlli su GeomDB e simili non ripetuti perchè già fatti
|
||||
// controlli su GeomDB e simili non ripetuti perchè già fatti
|
||||
|
||||
// recupero gruppo della geometria di lavorazione (Cutter Location)
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
|
||||
@@ -804,11 +804,11 @@ Sawing::AdjustFeeds( void)
|
||||
// ciclo sui gruppi CL
|
||||
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
|
||||
while ( nClPathId != GDB_ID_NULL) {
|
||||
// ciclo su tutte le entità del percorso CL
|
||||
// ciclo su tutte le entità del percorso CL
|
||||
for ( int nEntId = m_pGeomDB->GetFirstInGroup( nClPathId) ;
|
||||
nEntId != GDB_ID_NULL ;
|
||||
nEntId = m_pGeomDB->GetNext( nEntId)) {
|
||||
// recupero i dati Cam dell'entità
|
||||
// recupero i dati Cam dell'entità
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
continue ;
|
||||
@@ -1075,7 +1075,7 @@ Sawing::UpdateToolData( bool* pbChanged)
|
||||
bool
|
||||
Sawing::GetGeometry( SELVECTOR& vIds) const
|
||||
{
|
||||
// restituisco l'elenco delle entità
|
||||
// restituisco l'elenco delle entità
|
||||
vIds = m_vId ;
|
||||
return true ;
|
||||
}
|
||||
@@ -1098,7 +1098,7 @@ Sawing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
|
||||
if ( pGObj == nullptr)
|
||||
return false ;
|
||||
// se ammesse curve ed è tale
|
||||
// se ammesse curve ed è tale
|
||||
if ( ( nType == GEO_NONE || nType == GEO_CURVE) && ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
nType = GEO_CURVE ;
|
||||
const ICurve* pCurve = nullptr ;
|
||||
@@ -1122,7 +1122,7 @@ Sawing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
}
|
||||
return ( pCurve != nullptr) ;
|
||||
}
|
||||
// se altrimenti ammesse superfici trimesh ed è tale
|
||||
// se altrimenti ammesse superfici trimesh ed è tale
|
||||
else if ( ( nType == GEO_NONE || nType == GEO_SURF) && pGObj->GetType() == SRF_TRIMESH) {
|
||||
nType = GEO_SURF ;
|
||||
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
|
||||
@@ -1142,7 +1142,7 @@ Sawing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
// se altrimenti ammesse regioni ed è tale
|
||||
// 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) ;
|
||||
@@ -1335,7 +1335,7 @@ Sawing::Chain( int nGrpDestId)
|
||||
for ( const auto& Id : m_vId) {
|
||||
// prendo curva
|
||||
vpCrvs.emplace_back( GetCurve( Id)) ;
|
||||
// ne verifico la validità
|
||||
// ne verifico la validità
|
||||
if ( IsNull( vpCrvs.back())) {
|
||||
string sInfo = "Warning in Sawing : Skipped entity " + ToString( Id) ;
|
||||
m_pMchMgr->SetWarning( 2251, sInfo) ;
|
||||
@@ -1477,7 +1477,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// recupero gruppo per geometria temporanea
|
||||
const string GRP_TEMP = "Temp" ;
|
||||
int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nTempId == GDB_ID_NULL) {
|
||||
nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nTempId == GDB_ID_NULL)
|
||||
@@ -1542,7 +1542,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// elaboro la curva composita e la esplodo nelle curve componenti
|
||||
if ( m_Params.m_nCurveUse == SAW_CRV_APPROX ||
|
||||
m_Params.m_nCurveUse == SAW_CRV_CONVEX) {
|
||||
// calcolo l'approssimazione lineare con eventuale convessità
|
||||
// calcolo l'approssimazione lineare con eventuale convessità
|
||||
PolyLine PL ;
|
||||
int nType = ICurve::APL_STD ;
|
||||
if ( m_Params.m_nWorkSide == SAW_WS_LEFT)
|
||||
@@ -1631,7 +1631,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// flag di curva chiusa
|
||||
bool bClosed = pCompo->IsClosed() ;
|
||||
|
||||
// calcolo gli eventuali punti di perdita di tangenza e di cambio di concavità
|
||||
// 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) ;
|
||||
@@ -1647,7 +1647,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
nCurrConv = 0 ;
|
||||
continue ;
|
||||
}
|
||||
// verifico cambio di concavità e/o lavorazione interna
|
||||
// verifico cambio di concavità e/o lavorazione interna
|
||||
const ICurve* pCrv = pCompo->GetCurve( i) ;
|
||||
if ( pCrv->GetType() == CRV_ARC) {
|
||||
if ( GetCurveArc( pCrv)->GetAngCenter() > 0) {
|
||||
@@ -1729,7 +1729,7 @@ Sawing::ProcessEntity( const ICurve* pCrvP, const ICurve* pCrvC, const ICurve* p
|
||||
// altrimenti
|
||||
else {
|
||||
if ( m_Params.m_nCurveUse == SAW_CRV_KEEP) {
|
||||
// determino la convessità
|
||||
// determino la convessità
|
||||
int nConv = 0 ;
|
||||
for ( int i = 0 ; i < pCompo->GetCurveCount() ; ++ i) {
|
||||
const ICurveArc* pArc = GetCurveArc( pCompo->GetCurve( i)) ;
|
||||
@@ -1830,7 +1830,7 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
|
||||
( m_Params.m_nWorkSide == SAW_WS_RIGHT && dAngCN < - EPS_ANG_SMALL))
|
||||
bExtAngCN = false ;
|
||||
}
|
||||
// verifico eventuale attacco speciale a step (se parametri validi e su entità linea singola)
|
||||
// verifico eventuale attacco speciale a step (se parametri validi e su entità linea singola)
|
||||
double dLiStep = 0 ;
|
||||
double dLiElev = 0 ;
|
||||
if ( m_Params.m_dLiTang > 10 * EPS_SMALL && m_Params.m_dLiElev > 10 * EPS_SMALL &&
|
||||
@@ -1851,7 +1851,7 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
|
||||
return true ;
|
||||
}
|
||||
|
||||
// Eventuale variazioni di velocità all'inizio e alla fine del percorso
|
||||
// Eventuale variazioni di velocità all'inizio e alla fine del percorso
|
||||
FseVar FvVar ;
|
||||
if ( pCrvP == nullptr) {
|
||||
string sFsta = ExtractInfo( m_Params.m_sUserNotes, "Fsta=") ;
|
||||
@@ -1999,7 +1999,7 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
ptREnd + vtDir * ( dDtEnd + dExtraL) , RTY_LOC) ;
|
||||
m_pGeomDB->SetName( nReId, MCH_PV_RLOCUT) ;
|
||||
m_pGeomDB->SetMaterial( nReId, INVISIBLE) ;
|
||||
|
||||
|
||||
// eventuali ripetizioni in basso per tagli inclinati
|
||||
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL) {
|
||||
// lunghezza movimento
|
||||
@@ -2057,6 +2057,23 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
}
|
||||
}
|
||||
|
||||
// creo regioni di lavorazione che interessano le superfici superiore e inferiore del grezzo considerando anche gli
|
||||
// allungamenti dei baffi
|
||||
int nSurfUpId = ExeCreateSurfFrRectangle3P( nPxId, ptIni - vtDir * ( dStartWhiskExt + 5 * EPS_SMALL),
|
||||
ptCross + vtDir * ( dEndWhiskExt + 5 * EPS_SMALL),
|
||||
ptEnd + vtDir * ( dEndWhiskExt + 5 * EPS_SMALL), RTY_LOC) ;
|
||||
m_pGeomDB->SetName( nSurfUpId, MCH_PV_UP_RAWCUT) ;
|
||||
m_pGeomDB->SetMaterial( nSurfUpId, INVISIBLE) ;
|
||||
// solo se la lavorazione interessa il fondo del grezzo creo la superficie down
|
||||
if ( dRbHeight < EPS_SMALL) {
|
||||
int nSurfDownId = m_pGeomDB->CopyGlob( nSurfUpId, GDB_ID_NULL, nPxId) ;
|
||||
double dMove = dElev + dRbHeight / cos( m_Params.m_dSideAngle * DEGTORAD) ;
|
||||
Vector3d vtMove = - dMove * vtCorr ; vtMove.z = 0 ;
|
||||
ExeMove( {nSurfDownId}, vtMove, RTY_LOC) ;
|
||||
m_pGeomDB->SetName( nSurfDownId, MCH_PV_DOWN_RAWCUT) ;
|
||||
m_pGeomDB->SetMaterial( nSurfDownId, INVISIBLE) ;
|
||||
}
|
||||
|
||||
// salvo in info gruppo : larghezza XY del taglio, distanza XY tra centro e bordo taglio, extra taglio e quota minima della lama
|
||||
m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_WT, vtToolH.LenXY()) ;
|
||||
if ( dLiElev > EPS_SMALL)
|
||||
@@ -2279,7 +2296,7 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
Point3d ptP3 = pLine->GetEnd() + vtCorr * dDelta ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// se non è ultimo passo
|
||||
// se non è ultimo passo
|
||||
if ( i != 0) {
|
||||
// movimento di risalita sopra il punto finale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
@@ -2475,7 +2492,7 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
|
||||
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL)
|
||||
colCut = FUCHSIA ;
|
||||
|
||||
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
|
||||
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
|
||||
double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
|
||||
|
||||
// lunghezza taglio parziale
|
||||
@@ -2623,6 +2640,17 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
|
||||
return false ;
|
||||
if ( ! ExeSurfFrAdd( nRId, nRsId) || ! ExeSurfFrAdd( nRId, nReId))
|
||||
return false ;
|
||||
|
||||
// creo regioni di lavorazione che interessano le superfici superiore e inferiore del grezzo
|
||||
int nSurfUpId = m_pGeomDB->CopyGlob( nRrId, GDB_ID_NULL, nPxId) ;
|
||||
m_pGeomDB->SetName( nSurfUpId, MCH_PV_UP_RAWCUT) ;
|
||||
m_pGeomDB->SetMaterial( nSurfUpId, INVISIBLE) ;
|
||||
// solo se lavorazione interessa il fondo del grezzo creo la superficie down
|
||||
if ( dRbHeight < EPS_SMALL) {
|
||||
int nSurfDownId = m_pGeomDB->CopyGlob( nSurfUpId, GDB_ID_NULL, nPxId) ;
|
||||
m_pGeomDB->SetName( nSurfDownId, MCH_PV_DOWN_RAWCUT) ;
|
||||
m_pGeomDB->SetMaterial( nSurfDownId, INVISIBLE) ;
|
||||
}
|
||||
}
|
||||
|
||||
// altrimenti errore
|
||||
@@ -2868,7 +2896,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
|
||||
CalculateToolAndCorrVersors( vtCurrDir, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtCurrTool, vtCurrCorr) ;
|
||||
SetToolDir( vtCurrTool) ;
|
||||
SetCorrAuxDir( vtCurrCorr) ;
|
||||
if ( AddCurveMove( pSmpCrv, true) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pSmpCrv) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 4 -> retrazione
|
||||
@@ -2946,7 +2974,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
|
||||
pCopy->SimpleOffset( dOffs) ;
|
||||
}
|
||||
// emissione
|
||||
if ( AddCurveMove( pCopy, true) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pCopy) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -2979,7 +3007,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
|
||||
// inversione
|
||||
pCopy->Invert() ;
|
||||
// emissione
|
||||
if ( AddCurveMove( pCopy, true) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pCopy) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -3046,10 +3074,10 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
|
||||
pCopy->SimpleOffset( dOffs) ;
|
||||
}
|
||||
// emissione
|
||||
if ( AddCurveMove( pCopy, true) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pCopy) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se non è ultimo passo
|
||||
// se non è ultimo passo
|
||||
if ( i != 0) {
|
||||
// ricavo punto di risalita e punto iniziale
|
||||
Point3d ptP4 ;
|
||||
@@ -3193,7 +3221,7 @@ Sawing::ProcessIntArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve
|
||||
m_pMchMgr->SetWarning( 2257, "Warning in Sawing : skipped Entity too small") ;
|
||||
return true ;
|
||||
}
|
||||
// ricalcolo i versori fresa alle estremità (potrebbero essere cambiate)
|
||||
// ricalcolo i versori fresa alle estremità (potrebbero essere cambiate)
|
||||
pArc->GetStartDir( vtStaDirC) ;
|
||||
pArc->GetMidDir( vtMidDirC) ;
|
||||
pArc->GetEndDir( vtEndDirC) ;
|
||||
@@ -3285,7 +3313,7 @@ Sawing::GenerateIntArcPv( const ICurveArc* pArc,
|
||||
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
|
||||
// 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)
|
||||
@@ -3339,6 +3367,17 @@ Sawing::GenerateIntArcPv( const ICurveArc* pArc,
|
||||
if ( ! ExeSurfFrAdd( nRId, nRsId) || ! ExeSurfFrAdd( nRId, nReId))
|
||||
return false ;
|
||||
|
||||
// creo regioni di lavorazione che interessano le superfici superiore e inferiore del grezzo
|
||||
int nSurfUpId = m_pGeomDB->CopyGlob( nRrId, GDB_ID_NULL, nPxId) ;
|
||||
m_pGeomDB->SetName( nSurfUpId, MCH_PV_UP_RAWCUT) ;
|
||||
m_pGeomDB->SetMaterial( nSurfUpId, INVISIBLE) ;
|
||||
// solo se lavorazione interessa il fondo del grezzo creo la superficie down
|
||||
if ( dRbHeight < EPS_SMALL) {
|
||||
int nSurfDownId = m_pGeomDB->CopyGlob( nSurfUpId, GDB_ID_NULL, nPxId) ;
|
||||
m_pGeomDB->SetName( nSurfDownId, MCH_PV_DOWN_RAWCUT) ;
|
||||
m_pGeomDB->SetMaterial( nSurfDownId, INVISIBLE) ;
|
||||
}
|
||||
|
||||
// salvo in info gruppo : larghezza XY del taglio, distanza XY tra centro e bordo taglio, extra taglio e quota minima della lama
|
||||
m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_WT, dDeltaInt + dDeltaExt) ;
|
||||
m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_DT, dDeltaT * dLenCoeff) ;
|
||||
@@ -3571,12 +3610,12 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
|
||||
else {
|
||||
Point3d ptMid ;
|
||||
pArc->GetMidPoint( ptMid) ;
|
||||
// prima metà arco
|
||||
// prima metà arco
|
||||
SetToolDir( vtMidTool) ;
|
||||
SetCorrAuxDir( vtMidCorr) ;
|
||||
if ( AddArcMove( ptMid, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// seconda metà arco
|
||||
// seconda metà arco
|
||||
SetToolDir( vtEndTool) ;
|
||||
SetCorrAuxDir( vtEndCorr) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
|
||||
@@ -3657,12 +3696,12 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
|
||||
pArc->GetMidPoint( ptMid) ;
|
||||
ptMid += Z_AX * dDelta ;
|
||||
double dCurrAngCen = dAngCen / 2 * ((( i % 2) == 0) ? -1 : 1) ;
|
||||
// prima metà arco
|
||||
// prima metà arco
|
||||
SetToolDir( vtMidTool) ;
|
||||
SetCorrAuxDir( vtMidCorr) ;
|
||||
if ( AddArcMove( ptMid, ptCen, dCurrAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// seconda metà arco
|
||||
// seconda metà arco
|
||||
SetToolDir( ( ( i % 2) == 0) ? vtStaTool : vtEndTool) ;
|
||||
SetCorrAuxDir( ( ( i % 2) == 0) ? vtStaCorr : vtEndCorr) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dCurrAngCen, vtN) == GDB_ID_NULL)
|
||||
@@ -3746,18 +3785,18 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
|
||||
Point3d ptMid ;
|
||||
pArc->GetMidPoint( ptMid) ;
|
||||
ptMid += Z_AX * dDelta ;
|
||||
// prima metà arco
|
||||
// prima metà arco
|
||||
SetToolDir( vtMidTool) ;
|
||||
SetCorrAuxDir( vtMidCorr) ;
|
||||
if ( AddArcMove( ptMid, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// seconda metà arco
|
||||
// seconda metà arco
|
||||
SetToolDir( vtEndTool) ;
|
||||
SetCorrAuxDir( vtEndCorr) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se non è ultimo passo
|
||||
// se non è ultimo passo
|
||||
if ( i != 0) {
|
||||
// movimento di risalita sopra il punto finale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
@@ -3879,7 +3918,7 @@ Sawing::CalculateToolAndCorrVersors( const Vector3d& vtTang, int nHeadSide, int
|
||||
bool
|
||||
Sawing::AdjustForSide( ICurve* pCurve)
|
||||
{
|
||||
// se lato lavoro e lato mandrino coincidono, non devo fare alcunché
|
||||
// se lato lavoro e lato mandrino coincidono, non devo fare alcunché
|
||||
if ( ( m_Params.m_nWorkSide == SAW_WS_LEFT && m_Params.m_nHeadSide == SAW_HS_LEFT) ||
|
||||
( m_Params.m_nWorkSide == SAW_WS_RIGHT && m_Params.m_nHeadSide == SAW_HS_RIGHT))
|
||||
return true ;
|
||||
@@ -4048,7 +4087,7 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
|
||||
dDeltaLoExt = dDeltaF ;
|
||||
}
|
||||
}
|
||||
// controllo se lunghezza entità accettabile
|
||||
// controllo se lunghezza entità accettabile
|
||||
const double MIN_LEN = 1 ;
|
||||
double dLenXY = DistXY( pLine->GetStart(), pLine->GetEnd()) ;
|
||||
if ( dDeltaI + dLenXY + dDeltaF < MIN_LEN) {
|
||||
@@ -4119,7 +4158,7 @@ Sawing::AdjustCurveForEdges( ICurve* pCrv, double dElev, double dLenCoeff,
|
||||
dDeltaF = dDeltaT ;
|
||||
}
|
||||
dDeltaF *= dLenCoeff ;
|
||||
// controllo se lunghezza entità accettabile
|
||||
// controllo se lunghezza entità accettabile
|
||||
const double MIN_LEN = 1 ;
|
||||
double dLenXY ;
|
||||
pCrv->GetLength( dLenXY) ;
|
||||
|
||||
+18
-14
@@ -282,15 +282,15 @@ Simulator::Move( int& nStatus)
|
||||
m_dCoeff = 0 ;
|
||||
}
|
||||
|
||||
// Se appena arrivato alla fine di un percorso di lavoro
|
||||
if ( m_nEntId == GDB_ID_NULL && m_nAuxEInd == 0 && m_nCLPathInd > 0) {
|
||||
// Se appena arrivato alla fine di un percorso di lavoro (verifico anche completamento dei comandi aux di start per path vuote)
|
||||
if ( m_nEntId == GDB_ID_NULL && m_nAuxEInd == 0 && m_nCLPathInd > 0 && m_nAuxSInd >= m_nAuxSTot) {
|
||||
// gestione fine percorso di lavoro
|
||||
if ( ! ManagePathEnd( nStatus))
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Se alla fine del percorso dopo esecuzione azioni ausiliarie
|
||||
if ( m_nEntId == GDB_ID_NULL && m_nAuxEInd >= m_nAuxETot) {
|
||||
// Se alla fine del percorso dopo esecuzione azioni ausiliarie (verifico anche completamento dei comandi aux di start per path vuote)
|
||||
if ( m_nEntId == GDB_ID_NULL && m_nAuxEInd >= m_nAuxETot && m_nAuxSInd >= m_nAuxSTot) {
|
||||
// ricerca e gestione inizio percorso di lavoro
|
||||
if ( ! FindAndManagePathStart( nStatus))
|
||||
return false ;
|
||||
@@ -579,8 +579,8 @@ Simulator::UpdateAxes( void)
|
||||
if ( pMachine == nullptr)
|
||||
return false ;
|
||||
// Carico i nomi e i token degli assi macchina attivi
|
||||
if ( ! pMachine->GetAllCurrAxesName( m_AxesName) ||
|
||||
! pMachine->GetAllCurrAxesToken( m_AxesToken))
|
||||
if ( ! pMachine->GetAllCurrAxesNames( m_AxesName) ||
|
||||
! pMachine->GetAllCurrAxesTokens( m_AxesToken))
|
||||
return false ;
|
||||
// Aggiorno flag di invertito, offset, tipo e posizione corrente degli assi macchina attivi
|
||||
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
|
||||
@@ -1622,16 +1622,17 @@ Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit, co
|
||||
! m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos))
|
||||
return false ;
|
||||
// assegno il token e il nome degli assi
|
||||
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
|
||||
int nNumAxes = int( m_AxesName.size()) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
|
||||
if ( i <= nNumAxes) {
|
||||
if ( ! m_pMachine->LuaSetGlobVar( GetGlobVarAxisToken(i), m_AxesToken[i-1]) ||
|
||||
! m_pMachine->LuaSetGlobVar( GetGlobVarAxisName(i), m_AxesName[i-1]))
|
||||
if ( ! m_pMachine->LuaSetGlobVar( GetGlobVarAxisToken( i, bIsRobot), m_AxesToken[i-1]) ||
|
||||
! m_pMachine->LuaSetGlobVar( GetGlobVarAxisName( i, bIsRobot), m_AxesName[i-1]))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( ! m_pMachine->LuaResetGlobVar( GetGlobVarAxisToken(i)) ||
|
||||
! m_pMachine->LuaResetGlobVar( GetGlobVarAxisName(i)))
|
||||
if ( ! m_pMachine->LuaResetGlobVar( GetGlobVarAxisToken( i, bIsRobot)) ||
|
||||
! m_pMachine->LuaResetGlobVar( GetGlobVarAxisName( i, bIsRobot)))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1874,16 +1875,17 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, pCamData->GetIndex()) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
|
||||
// valore degli assi all'inizio e alla fine del movimento
|
||||
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
|
||||
int nNumAxes = int( m_AxesName.size()) ;
|
||||
const DBLVECTOR& AxesEnd = pCamData->GetAxesVal() ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
|
||||
if ( i <= nNumAxes) {
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisPrev( i), m_AxesVal[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue( i), AxesEnd[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisPrev( i, GLOB_VAR, bIsRobot), m_AxesVal[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot), AxesEnd[i-1]) ;
|
||||
}
|
||||
else {
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisPrev( i)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue( i)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisPrev( i, GLOB_VAR, bIsRobot)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot)) ;
|
||||
}
|
||||
}
|
||||
// versori utensile, correzione e ausiliario alla fine del movimento
|
||||
@@ -2137,6 +2139,8 @@ Simulator::SetToolForVmill( const string& sTool, const string& sHead, int nExit,
|
||||
ExeVolZmapSetSawTool( vVmill, sTool, dLen, dDiam, dThick, 0, dCornR, nFlag, bFirst) ;
|
||||
else if ( nType == TT_WATERJET)
|
||||
ExeVolZmapSetStdTool( vVmill, sTool, dLen + 50, dDiam, dCornR, dMaxMat, nFlag, bFirst) ;
|
||||
else if ( nType == TT_ADDITIVE)
|
||||
ExeVolZmapSetAdditiveTool( vVmill, sTool, dLen, dDiam, dCornR, nFlag, bFirst) ;
|
||||
else if ( abs( dSideAng) < EPS_ANG_SMALL || abs( dThick) < EPS_SMALL) {
|
||||
ExeVolZmapSetStdTool( vVmill, sTool, dLen, dDiam, dCornR, dMaxMat, nFlag, bFirst) ;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : Table.cpp Data : 25.05.15 Versione : 1.6e7
|
||||
// File : Table.cpp Data : 19.03.24 Versione : 2.6c2
|
||||
// Contenuto : Oggetto tavola per gruppo tavola di macchina.
|
||||
//
|
||||
//
|
||||
@@ -45,6 +45,7 @@ Table::Clone( void) const
|
||||
pTab->m_sName = m_sName ;
|
||||
pTab->m_nType = m_nType ;
|
||||
pTab->m_ptRef1 = m_ptRef1 ;
|
||||
pTab->m_vsColl = m_vsColl ;
|
||||
}
|
||||
catch( ...) {
|
||||
delete pTab ;
|
||||
@@ -63,7 +64,10 @@ Table::Dump( string& sOut, bool bMM, const char* szNewLine) const
|
||||
sOut += "Id=" + ToString( m_nOwnerId) + szNewLine ;
|
||||
sOut += "Name=" + m_sName + szNewLine ;
|
||||
sOut += "Type=" + ToString( m_nType) + szNewLine ;
|
||||
sOut += "Ref1=(" + ToString( GetInUiUnits(m_ptRef1, bMM), 4) + ")" + szNewLine ;
|
||||
sOut += "Ref1=(" + ToString( GetInUiUnits( m_ptRef1, bMM), 4) + ")" + szNewLine ;
|
||||
sOut += "Area1=(" + ToString( GetInUiUnits( m_b3Area1.GetMin(), bMM), 4) + ";" +
|
||||
ToString( GetInUiUnits( m_b3Area1.GetMax(), bMM), 4) + szNewLine ;
|
||||
sOut += "Coll=" + ToString( m_vsColl) + szNewLine ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -99,11 +103,12 @@ Table::Table( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Table::Set( const string& sName, int nType, const Point3d& ptRef1, const BBox3d& b3Area1)
|
||||
Table::Set( const string& sName, int nType, const Point3d& ptRef1, const BBox3d& b3Area1, const STRVECTOR& vsColl)
|
||||
{
|
||||
m_sName = sName ;
|
||||
m_nType = nType ;
|
||||
m_ptRef1 = ptRef1 ;
|
||||
m_b3Area1 = b3Area1 ;
|
||||
m_vsColl = vsColl ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class Table : public IUserObj
|
||||
|
||||
public :
|
||||
Table( void) ;
|
||||
bool Set( const std::string& sName, int nType, const Point3d& ptRef1, const BBox3d& b3Area1) ;
|
||||
bool Set( const std::string& sName, int nType, const Point3d& ptRef1, const BBox3d& b3Area1, const STRVECTOR& vsColl) ;
|
||||
const std::string& GetName( void)
|
||||
{ return m_sName ; }
|
||||
int GetType( void)
|
||||
@@ -39,6 +39,8 @@ class Table : public IUserObj
|
||||
{ return m_ptRef1 ; }
|
||||
const BBox3d& GetArea1( void)
|
||||
{ return m_b3Area1 ; }
|
||||
const STRVECTOR& GetCollGroups( void) const
|
||||
{ return m_vsColl ; }
|
||||
|
||||
private :
|
||||
int m_nOwnerId ;
|
||||
@@ -47,4 +49,5 @@ class Table : public IUserObj
|
||||
int m_nType ;
|
||||
Point3d m_ptRef1 ;
|
||||
BBox3d m_b3Area1 ;
|
||||
STRVECTOR m_vsColl ;
|
||||
} ;
|
||||
+166
-152
@@ -1676,18 +1676,12 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
m_pGeomDB->GetName( nPathId, sPathName) ;
|
||||
|
||||
// eventuale approssimazione con segmenti di retta
|
||||
int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ;
|
||||
bool bSplitArcs = ( nSplitArcs == SPLAR_ALWAYS ||
|
||||
( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtTool.IsZplus()) ||
|
||||
( nSplitArcs == SPLAR_GEN_PLANE && vtTool.IsGeneric())) ;
|
||||
if ( bSplitArcs && ! ApproxWithLines( pCompo)) {
|
||||
m_pMchMgr->SetLastError( 3211, "Error in WaterJetting : Linear Approx not computable") ;
|
||||
return false ;
|
||||
bool bSplitArcs = GetSplitArcs( vtTool) ;
|
||||
if ( ! bSplitArcs) {
|
||||
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
|
||||
VerifyArcs( pCompo) ;
|
||||
}
|
||||
|
||||
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
|
||||
VerifyArcs( pCompo) ;
|
||||
|
||||
// se abilitato probing, verifico lunghezza entità ed eventualmente le divido
|
||||
if ( m_Params.m_bProbing)
|
||||
VerifyMaxLenCurves( pCompo, m_Params.m_dProbingMaxDist) ;
|
||||
@@ -1780,8 +1774,8 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
|
||||
// calcolo la regione
|
||||
PtrOwner<ISurfFlatRegion> pSfr ;
|
||||
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
|
||||
double Rad = 0.5 * m_TParams.m_dDiam * dSideCoeff ;
|
||||
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), Rad, false, false)) ;
|
||||
double dRad = 0.5 * m_TParams.m_dDiam * dSideCoeff ;
|
||||
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), dRad, false, false)) ;
|
||||
if ( IsNull( pSfr))
|
||||
return false ;
|
||||
// aggiungo eventuale attacco
|
||||
@@ -1793,32 +1787,18 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
|
||||
// aggiungo eventuali anelli su angoli esterni
|
||||
if ( ! AddLoopsPreview( pCompo, pSfr))
|
||||
return false ;
|
||||
// ne recupero il contorno
|
||||
PtrOwner< ICurve> pCrv2 ;
|
||||
pCrv2.Set( pSfr->GetLoop( 0, 0)) ;
|
||||
if ( IsNull( pCrv2))
|
||||
return false ;
|
||||
// inserisco la curva nel DB
|
||||
int nC2Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrv2)) ;
|
||||
if ( nC2Id == GDB_ID_NULL)
|
||||
return false ;
|
||||
// assegno nome e colore
|
||||
m_pGeomDB->SetName( nC2Id, MCH_PV_CUT) ;
|
||||
m_pGeomDB->SetMaterial( nC2Id, colCut) ;
|
||||
// eventuali altri contorni ( interni di contornatura chiusa)
|
||||
const int MAX_INT_LOOP = 1000 ;
|
||||
for ( int i = 1 ; i <= MAX_INT_LOOP ; ++i) {
|
||||
PtrOwner< ICurve> pCrv3 ;
|
||||
pCrv3.Set( pSfr->GetLoop( 0, i)) ;
|
||||
if ( IsNull( pCrv3))
|
||||
break ;
|
||||
// ne recupero i contorni
|
||||
for ( int i = 0 ; i < pSfr->GetLoopCount( 0) ; ++i) {
|
||||
PtrOwner<ICurve> pCrv2( pSfr->GetLoop( 0, i)) ;
|
||||
if ( IsNull( pCrv2))
|
||||
return false ;
|
||||
// inserisco la curva nel DB
|
||||
int nC3Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrv3)) ;
|
||||
if ( nC3Id == GDB_ID_NULL)
|
||||
int nC2Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrv2)) ;
|
||||
if ( nC2Id == GDB_ID_NULL)
|
||||
return false ;
|
||||
// assegno nome e colore
|
||||
m_pGeomDB->SetName( nC3Id, MCH_PV_CUT) ;
|
||||
m_pGeomDB->SetMaterial( nC3Id, colCut) ;
|
||||
m_pGeomDB->SetName( nC2Id, MCH_PV_CUT) ;
|
||||
m_pGeomDB->SetMaterial( nC2Id, colCut) ;
|
||||
}
|
||||
// inserisco la regione nel DB
|
||||
int nRId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfr)) ;
|
||||
@@ -1832,10 +1812,11 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nRrId, MCH_PV_RRCUT) ;
|
||||
m_pGeomDB->SetMaterial( nRrId, INVISIBLE) ;
|
||||
|
||||
// eventuali ripetizioni in basso per tagli inclinati
|
||||
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL) {
|
||||
// creo copia della curva composita
|
||||
PtrOwner< ICurve> pCrv( pCompo->Clone()) ;
|
||||
PtrOwner<ICurveComposite> pCrv( pCompo->Clone()) ;
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
// rimuovo eventuale overlap
|
||||
@@ -1844,98 +1825,114 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
|
||||
pCrv->TrimStartAtLen( dAddedOverlap) ;
|
||||
pCrv->Invert() ;
|
||||
}
|
||||
|
||||
ICURVEPOVECTOR vpCrvs ;
|
||||
if ( m_Params.m_dSideAngle < 0) {
|
||||
// se inclinazione negativa devo considerare separatamente ogni sottocurva della composita
|
||||
vpCrvs.reserve( pCrv->GetCurveCount()) ;
|
||||
for ( int i = 0 ; i < pCrv->GetCurveCount() ; i++)
|
||||
vpCrvs.emplace_back( pCrv->GetCurve( i)->Clone()) ;
|
||||
}
|
||||
else {
|
||||
// se inclinazione positiva posso considerare la curva completa
|
||||
vpCrvs.emplace_back( pCrv->Clone()) ;
|
||||
}
|
||||
|
||||
// offset per raggio utensile
|
||||
double dRad = 0.5 * m_TParams.m_dDiam / cos( m_Params.m_dSideAngle * DEGTORAD) ;
|
||||
double dSignOffs1 = dRad ;
|
||||
double dSignOffs1 = dRad ;
|
||||
if ( ( m_Params.m_nWorkSide == WJET_WS_RIGHT && m_Params.m_dSideAngle > 0) ||
|
||||
( m_Params.m_nWorkSide == WJET_WS_LEFT && m_Params.m_dSideAngle < 0))
|
||||
dSignOffs1 = - dSignOffs1 ;
|
||||
OffsetCurve OffsCrv1 ;
|
||||
OffsCrv1.Make( pCrv, dSignOffs1, ICurve::OFF_FILLET) ;
|
||||
PtrOwner< ICurve> pOffs1( OffsCrv1.GetLongerCurve()) ;
|
||||
if ( IsNull( pOffs1))
|
||||
return false ;
|
||||
// offset per inclinazione
|
||||
double dSignOffs2 = dRad + m_dElev * abs( sin( m_Params.m_dSideAngle * DEGTORAD)) ;
|
||||
if ( ( m_Params.m_nWorkSide == WJET_WS_RIGHT && m_Params.m_dSideAngle < 0) ||
|
||||
( m_Params.m_nWorkSide == WJET_WS_LEFT && m_Params.m_dSideAngle > 0))
|
||||
dSignOffs2 = - dSignOffs2 ;
|
||||
OffsetCurve OffsCrv2 ;
|
||||
OffsCrv2.Make( pCrv, dSignOffs2, ICurve::OFF_EXTEND) ;
|
||||
PtrOwner< ICurve> pOffs2( OffsCrv2.GetLongerCurve()) ;
|
||||
if ( IsNull( pOffs2))
|
||||
return false ;
|
||||
|
||||
// calcolo la regione
|
||||
PtrOwner<ISurfFlatRegion> pSfr ;
|
||||
// se i due offset sono aperti
|
||||
if ( ! pOffs1->IsClosed() && ! pOffs2->IsClosed()) {
|
||||
// li unisco
|
||||
PtrOwner<ICurveComposite> pBound( CreateCurveComposite()) ;
|
||||
if ( IsNull( pBound))
|
||||
return false ;
|
||||
pBound->AddCurve( Release( pOffs1)) ;
|
||||
pOffs2->Invert() ;
|
||||
Point3d ptStart ; pOffs2->GetStartPoint( ptStart) ;
|
||||
pBound->AddLine( ptStart) ;
|
||||
pBound->AddCurve( Release( pOffs2)) ;
|
||||
pBound->Close() ;
|
||||
// creo la regione
|
||||
SurfFlatRegionByContours SfrCntr( false, false) ;
|
||||
SfrCntr.AddCurve( Release( pBound)) ;
|
||||
pSfr.Set( SfrCntr.GetSurf()) ;
|
||||
}
|
||||
// altrimenti sono chiusi
|
||||
else {
|
||||
// creo la regione
|
||||
SurfFlatRegionByContours SfrCntr( false, false) ;
|
||||
SfrCntr.AddCurve( Release( pOffs1)) ;
|
||||
SfrCntr.AddCurve( Release( pOffs2)) ;
|
||||
pSfr.Set( SfrCntr.GetSurf()) ;
|
||||
}
|
||||
PtrOwner<ISurfFlatRegion> pSfr( CreateSurfFlatRegion()) ;
|
||||
if ( IsNull( pSfr))
|
||||
return false ;
|
||||
for ( int i = 0 ; i < int( vpCrvs.size()) ; i++) {
|
||||
OffsetCurve OffsCrv1 ;
|
||||
OffsCrv1.Make( vpCrvs[i], dSignOffs1, ICurve::OFF_FILLET) ;
|
||||
PtrOwner< ICurve> pOffs1( OffsCrv1.GetLongerCurve()) ;
|
||||
if ( IsNull( pOffs1))
|
||||
return false ;
|
||||
OffsetCurve OffsCrv2 ;
|
||||
OffsCrv2.Make( vpCrvs[i], dSignOffs2, ICurve::OFF_EXTEND) ;
|
||||
PtrOwner< ICurve> pOffs2( OffsCrv2.GetLongerCurve()) ;
|
||||
if ( IsNull( pOffs2))
|
||||
return false ;
|
||||
// calcolo la regione corrente
|
||||
PtrOwner<ISurfFlatRegion> pSfrCurr ;
|
||||
// se i due offset sono aperti
|
||||
if ( ! pOffs1->IsClosed() && ! pOffs2->IsClosed()) {
|
||||
// li unisco
|
||||
PtrOwner<ICurveComposite> pBound( CreateCurveComposite()) ;
|
||||
if ( IsNull( pBound))
|
||||
return false ;
|
||||
pBound->AddCurve( Release( pOffs1)) ;
|
||||
pOffs2->Invert() ;
|
||||
Point3d ptStart ; pOffs2->GetStartPoint( ptStart) ;
|
||||
pBound->AddLine( ptStart) ;
|
||||
pBound->AddCurve( Release( pOffs2)) ;
|
||||
pBound->Close() ;
|
||||
// creo la regione
|
||||
SurfFlatRegionByContours SfrCntr( false, false) ;
|
||||
SfrCntr.AddCurve( Release( pBound)) ;
|
||||
pSfrCurr.Set( SfrCntr.GetSurf()) ;
|
||||
}
|
||||
// altrimenti sono chiusi
|
||||
else {
|
||||
// creo la regione
|
||||
SurfFlatRegionByContours SfrCntr( false, false) ;
|
||||
SfrCntr.AddCurve( Release( pOffs1)) ;
|
||||
SfrCntr.AddCurve( Release( pOffs2)) ;
|
||||
pSfrCurr.Set( SfrCntr.GetSurf()) ;
|
||||
}
|
||||
if ( IsNull( pSfrCurr))
|
||||
return false ;
|
||||
|
||||
// aggiungo alla superficie complessiva
|
||||
if ( pSfr->IsValid())
|
||||
pSfr->Add( *pSfrCurr) ;
|
||||
else
|
||||
pSfr.Set( Release( pSfrCurr)) ;
|
||||
}
|
||||
// la regione deve essere rivolta verso Z+
|
||||
if ( pSfr->GetNormVersor().z < 0)
|
||||
pSfr->Invert() ;
|
||||
// ne recupero il contorno
|
||||
PtrOwner< ICurve> pCrv2 ;
|
||||
pCrv2.Set( pSfr->GetLoop( 0, 0)) ;
|
||||
if ( IsNull( pCrv2))
|
||||
return false ;
|
||||
// inserisco la curva nel DB
|
||||
int nC2Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrv2)) ;
|
||||
if ( nC2Id == GDB_ID_NULL)
|
||||
return false ;
|
||||
// assegno nome e colore
|
||||
m_pGeomDB->SetName( nC2Id, MCH_PV_DOWN_CUT) ;
|
||||
m_pGeomDB->SetMaterial( nC2Id, colCut) ;
|
||||
// eventuali altri contorni ( interni di contornatura chiusa)
|
||||
const int MAX_INT_LOOP = 1000 ;
|
||||
for ( int i = 1 ; i <= MAX_INT_LOOP ; ++i) {
|
||||
PtrOwner< ICurve> pCrv3 ;
|
||||
pCrv3.Set( pSfr->GetLoop( 0, i)) ;
|
||||
if ( IsNull( pCrv3))
|
||||
break ;
|
||||
// inserisco la curva nel DB
|
||||
int nC3Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrv3)) ;
|
||||
if ( nC3Id == GDB_ID_NULL)
|
||||
|
||||
// aggiungo eventuali loops
|
||||
AddLoopsPreview( pCrv, pSfr) ;
|
||||
|
||||
// ne recupero i contorni
|
||||
for ( int i = 0 ; i < pSfr->GetLoopCount( 0) ; ++i) {
|
||||
PtrOwner<ICurve> pCrv2( pSfr->GetLoop( 0, i)) ;
|
||||
if ( IsNull( pCrv2))
|
||||
return false ;
|
||||
// assegno nome e colore
|
||||
m_pGeomDB->SetName( nC3Id, MCH_PV_DOWN_CUT) ;
|
||||
m_pGeomDB->SetMaterial( nC3Id, colCut) ;
|
||||
// inserisco la curva nel DB
|
||||
int nC2Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrv2)) ;
|
||||
if ( nC2Id == GDB_ID_NULL)
|
||||
return false ;
|
||||
// assegno nome e colore
|
||||
m_pGeomDB->SetName( nC2Id, MCH_PV_DOWN_CUT) ;
|
||||
m_pGeomDB->SetMaterial( nC2Id, colCut) ;
|
||||
}
|
||||
// inserisco la regione nel DB
|
||||
|
||||
// inserisco la regione nel DB
|
||||
int nRId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfr)) ;
|
||||
if ( nRId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nRId, MCH_PV_DOWN_RCUT) ;
|
||||
m_pGeomDB->SetMaterial( nRId, INVISIBLE) ;
|
||||
// la copio anche come regione ridotta
|
||||
// la copio anche come regione ridotta
|
||||
int nRrId = m_pGeomDB->Copy( nRId, GDB_ID_NULL, nPathId) ;
|
||||
if ( nRrId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nRrId, MCH_PV_DOWN_RRCUT) ;
|
||||
m_pGeomDB->SetMaterial( nRrId, INVISIBLE) ;
|
||||
m_pGeomDB->SetMaterial( nRrId, INVISIBLE) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
@@ -2083,6 +2080,11 @@ WaterJetting::AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* p
|
||||
return false ;
|
||||
// lunghezza tratti lineari e loro punti estremi
|
||||
double dTgLen = 0.5 * m_TParams.m_dDiam * tan( 0.5 * dAng * DEGTORAD) ;
|
||||
if ( m_Params.m_dSideAngle > EPS_ANG_SMALL) {
|
||||
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
|
||||
double dExtraLen = dW / tan( ( 180 - abs( dAng)) / 2 * DEGTORAD) ;
|
||||
dTgLen += dExtraLen ;
|
||||
}
|
||||
Point3d ptP ; pCrvC->GetStartPoint( ptP) ;
|
||||
Point3d ptPe = ptP + vtEnd * dTgLen ;
|
||||
Point3d ptPs = ptP - vtStart * dTgLen ;
|
||||
@@ -2115,7 +2117,6 @@ WaterJetting::AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* p
|
||||
if ( IsNull( pSfr) || ! pSPV->Add( *pSfr))
|
||||
return false ;
|
||||
}
|
||||
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
@@ -2247,7 +2248,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
// imposto versore correzione e ausiliario sul punto di partenza
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i) ;
|
||||
// aggiungo approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 3207, "Error in WaterJetting : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2273,27 +2274,57 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
vtEnd.GetAngleXY( vtStart, dAng) ;
|
||||
// Se angolo esterno e richiesto anello esterno
|
||||
if ( IsExternalAngle( dAng) && m_Params.m_nExtCornerType == WJET_EC_LOOP) {
|
||||
// lunghezza tratti lineari e loro punti estremi
|
||||
// lunghezza tratti lineari
|
||||
double dTgLen = 0.5 * m_TParams.m_dDiam * tan( 0.5 * dAng * DEGTORAD) ;
|
||||
if ( m_Params.m_dSideAngle > EPS_ANG_SMALL) {
|
||||
// se inclinazione positiva calcolo di quanto deve uscire per non rovinare lo spigolo
|
||||
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
|
||||
double dExtraLen = dW / tan( ( 180 - abs( dAng)) / 2 * DEGTORAD) ;
|
||||
dTgLen += dExtraLen ;
|
||||
}
|
||||
// calcolo punti estremi
|
||||
Point3d ptP ; pCrvC->GetStartPoint( ptP) ;
|
||||
Point3d ptPe = ptP + vtEnd * dTgLen ;
|
||||
Point3d ptPs = ptP - vtStart * dTgLen ;
|
||||
|
||||
// tratto prima dell'anello
|
||||
SetFeed( GetActualFeed()) ;
|
||||
if ( AddLinearMove( ptPe) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptPe, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
// anello
|
||||
PtrOwner<ICurve> pCrvA( GetArc2PVN( ptPe, ptPs, vtEnd, vtN)) ;
|
||||
if ( ! IsNull( pCrvA) && pCrvA->GetType() == CRV_ARC) {
|
||||
if ( AddCurveMove( pCrvA) == GDB_ID_NULL)
|
||||
// suddivido l'anello in due parti per forzare il passaggio dalla posizione vtTool = Z_AX
|
||||
PtrOwner<ICurveComposite> pCompoArc( ConvertCurveToComposite( Release( ( pCrvA)))) ;
|
||||
if ( IsNull( pCompoArc))
|
||||
return false ;
|
||||
if ( pCompoArc->AddJoint( 0.5)) {
|
||||
// aggiungo il primo tratto
|
||||
Vector3d vtCorr = CalcCorrDir( pCompoArc, 1) ;
|
||||
SetToolCorrAuxDir( Z_AX, vtCorr) ;
|
||||
if ( AddCurveMove( pCompoArc->GetCurve(0), bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// aggiungo secondo tratto
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i + 0.5) ;
|
||||
if ( AddCurveMove( pCompoArc->GetCurve(1), bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
// se non è possibile suddividere anello
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i + 0.5) ;
|
||||
if ( AddCurveMove( pCompoArc, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( AddLinearMove( ptPs) == GDB_ID_NULL)
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i + 0.5) ;
|
||||
if ( AddLinearMove( ptPs, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// tratto dopo l'anello
|
||||
if ( AddLinearMove( ptP) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se angolo esterno e richiesto rallentamento esterno, eseguo accelerazione
|
||||
@@ -2313,7 +2344,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
return false ;
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i + dU) ;
|
||||
SetFeed( ( 1 - dCoeff) * dMinFeed + dCoeff * GetActualFeed()) ;
|
||||
if ( AddCurveMove( pCrvT) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pCrvT, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
dUprev = dU ;
|
||||
}
|
||||
@@ -2355,7 +2386,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
Vector3d vtCorr = CalcCorrDir( pCompo, i + dU) ;
|
||||
SetToolCorrAuxDir( vtTool, vtCorr) ;
|
||||
SetFeed( ( 1 - dCoeff) * dMinFeed + dCoeff * GetActualFeed()) ;
|
||||
if ( AddCurveMove( pCrvT) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pCrvT, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
dUprev = dU ;
|
||||
}
|
||||
@@ -2392,7 +2423,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
return false ;
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i + dU) ;
|
||||
SetFeed( ( 1 - dCoeff) * GetActualFeed() + dCoeff * dMinFeed) ;
|
||||
if ( AddCurveMove( pCrvT) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pCrvT, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
dUprev = dU ;
|
||||
}
|
||||
@@ -2435,15 +2466,22 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
Vector3d vtCorr = CalcCorrDir( pCompo, i + dU) ;
|
||||
SetToolCorrAuxDir( vtTool, vtCorr) ;
|
||||
SetFeed( ( 1 - dCoeff) * GetActualFeed() + dCoeff * dMinFeed) ;
|
||||
if ( AddCurveMove( pCrvT) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pCrvT, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
dUprev = dU ;
|
||||
}
|
||||
dNextFeed = dMinFeed ;
|
||||
}
|
||||
|
||||
// se successivo non è angolo esterno ad anello imposto versore correzione e ausiliario del punto di arrivo
|
||||
if ( ! IsExternalAngle( dAng) || m_Params.m_nExtCornerType != WJET_EC_LOOP)
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i + 1) ;
|
||||
}
|
||||
// imposto versore correzione e ausiliario del punto di arrivo
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i + 1) ;
|
||||
else {
|
||||
// se ultima entità imposto versore correzione e ausiliario del punto finale
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i + 1) ;
|
||||
}
|
||||
|
||||
// elaborazioni sulla curva corrente
|
||||
if ( pCurve->GetType() == CRV_LINE) {
|
||||
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
@@ -2456,25 +2494,20 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
}
|
||||
else
|
||||
++ nIdxSkip ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
ICurveArc* pArc = GetCurveArc( pCurve) ;
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Point3d ptP3 ; pArc->GetEndPoint( ptP3) ;
|
||||
Point3d ptCurr ; GetCurrPos( ptCurr) ;
|
||||
double dDeltaAng ; pArc->CalcPointAngle( ptCurr, dDeltaAng) ;
|
||||
SetFeed( dNextFeed) ;
|
||||
// controlli per indice del punto di arrivo
|
||||
Point3d ptP3 ; pCurve->GetEndPoint( ptP3) ;
|
||||
if ( SqDistXY( ptP3, m_ptLastProbe) >= m_Params.m_dProbingMinDist * m_Params.m_dProbingMinDist) {
|
||||
SetIndex( i + 1 - nIdxSkip) ;
|
||||
m_ptLastProbe = ptP3 ;
|
||||
}
|
||||
else
|
||||
++ nIdxSkip ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen - dDeltaAng, vtN) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pCurve, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se ultima entità, uscita e retrazione
|
||||
@@ -2491,7 +2524,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
}
|
||||
// aggiungo retrazione
|
||||
SetFlag( 203) ;
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ)) {
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 3210, "Error in WaterJetting : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2525,7 +2558,7 @@ class LeadIOStatus
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
WaterJetting::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ)
|
||||
WaterJetting::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, bool bSplit)
|
||||
{
|
||||
SetFlag( 1) ;
|
||||
// 1 -> punto sopra inizio
|
||||
@@ -2534,18 +2567,18 @@ WaterJetting::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dS
|
||||
return false ;
|
||||
// affondo al punto iniziale
|
||||
SetFlag( ( m_Params.m_bLiHole ? 201 : 202)) ;
|
||||
if ( AddRapidMove( ptP) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP, bSplit) == GDB_ID_NULL)
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
WaterJetting::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ)
|
||||
WaterJetting::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, bool bSplit)
|
||||
{
|
||||
// Risalgo in rapido alla quota di sicurezza
|
||||
Point3d ptP4 = ptP + vtTool * dSafeZ ;
|
||||
if ( AddRapidMove( ptP4) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP4, bSplit) == GDB_ID_NULL)
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
@@ -2595,29 +2628,19 @@ WaterJetting::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
|
||||
{
|
||||
// Assegno il tipo
|
||||
int nType = GetLeadInType() ;
|
||||
double dTang = m_Params.m_dLiTang ;
|
||||
// Eseguo a seconda del tipo
|
||||
switch ( nType) {
|
||||
case WJET_LI_NONE :
|
||||
return true ;
|
||||
case WJET_LI_LINEAR :
|
||||
return ( AddLinearMove( ptStart, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
return ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
case WJET_LI_TANGENT :
|
||||
{
|
||||
PtrOwner<ICurve> pCrv( GetArc2PVN( ptStart, ptP1, - vtStart, vtN)) ;
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
pCrv->Invert() ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs) {
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pCrv))) || ! ApproxWithLines( pCompo))
|
||||
return false ;
|
||||
return ( AddCurveMove( pCompo, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
else {
|
||||
return ( AddCurveMove( pCrv, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
default :
|
||||
return false ;
|
||||
@@ -2667,7 +2690,7 @@ WaterJetting::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vec
|
||||
Vector3d vtPerp = vtEnd ;
|
||||
vtPerp.Rotate( vtN, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp ;
|
||||
return ( AddLinearMove( ptP1, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
return ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
}
|
||||
case WJET_LO_TANGENT :
|
||||
{
|
||||
@@ -2679,16 +2702,7 @@ WaterJetting::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vec
|
||||
PtrOwner<ICurve> pCrv( GetArc2PVN( ptEnd, ptP1, vtEnd, vtN)) ;
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs) {
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pCrv))) || ! ApproxWithLines( pCompo))
|
||||
return false ;
|
||||
return ( AddCurveMove( pCompo, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
}
|
||||
else {
|
||||
return ( AddCurveMove( pCrv, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
}
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
}
|
||||
default :
|
||||
return false ;
|
||||
@@ -2952,7 +2966,7 @@ WaterJetting::CalcOffset( ICurveComposite* pCompo, double dSignOffs)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valore limite angolo per corner
|
||||
const double ANG_CORNER = 10 ;
|
||||
const double ANG_CORNER = 10 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
|
||||
+2
-2
@@ -81,8 +81,8 @@ class WaterJetting : public Machining
|
||||
bool AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
|
||||
bool AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
|
||||
bool AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool, bool bSplitArcs) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, bool bSplit) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, bool bSplit) ;
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
const ICurveComposite* pCompo, Point3d& ptP1) const ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
|
||||
|
||||
Reference in New Issue
Block a user