Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f0e295d9d6 | |||
| 1b97ec5310 | |||
| 66c7aa5d0c | |||
| 5699de3954 | |||
| 4a1ae0de84 | |||
| ac45a259b6 | |||
| f7251bf3bd | |||
| ed1cd66164 | |||
| 054dc530fb | |||
| 9534c0342d | |||
| bf602419fc | |||
| e1ef39ad72 | |||
| 8648a2c61b | |||
| 96c96383c3 | |||
| f3ea5fed05 | |||
| a4831980e7 | |||
| ec78d61f63 | |||
| e8e757d4bd | |||
| 1dc0206bea | |||
| 614532c2a0 | |||
| 20b56583c3 | |||
| 47951fc21e | |||
| 932700d4b2 | |||
| 40f1e051a4 | |||
| c3542be20a |
@@ -473,6 +473,8 @@ CamData::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
if ( ! m_ptCen.Mirror( ptOn, vtNorm))
|
||||
return false ;
|
||||
m_dAngCen = - m_dAngCen ;
|
||||
if ( ! m_vtN.Mirror( vtNorm))
|
||||
return false ;
|
||||
if ( ! m_vtTool.Mirror( vtNorm))
|
||||
return false ;
|
||||
if ( ! m_vtCorr.Mirror( vtNorm))
|
||||
|
||||
+62
-32
@@ -3336,6 +3336,49 @@ Drilling::VerifyHoleFromBottom( const Hole& hole, SelData Id)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::VerifyParallelDrilling( int nDouble, const Hole& hole)
|
||||
{
|
||||
// verifico se lavorazione in doppio valida
|
||||
if ( nDouble != 1 && nDouble != 2 && nDouble != 3)
|
||||
return false ;
|
||||
|
||||
// se la macchina non presenta nel file .ini la possibilità di lavorazione in doppio parallela, esco
|
||||
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
string sMachIni = pMch->GetMachineDir() + "\\" + pMch->GetMachineName() + ".ini" ;
|
||||
int nDrillingDouble = GetPrivateProfileInt( MACHININGS_SEC.c_str(), DRILLING_PARALLEL_KEY.c_str(), 0, sMachIni.c_str()) ;
|
||||
if ( nDrillingDouble != 1)
|
||||
return false ;
|
||||
|
||||
// recupero il piano di Mirror
|
||||
Point3d ptOn ; Vector3d vtNorm ;
|
||||
if ( ! CalcMirrorPlaneByDouble( nDouble, m_Params.m_sUserNotes, ptOn, vtNorm))
|
||||
return false ;
|
||||
Plane3d plMirror ;
|
||||
if ( ! plMirror.Set( ptOn, vtNorm))
|
||||
return false ;
|
||||
|
||||
// verifico subito che la normale del piano si trovi entro un grado rispetto alla direzione del foro ( tolleranza da .BTL)
|
||||
if ( abs( hole.vtDir * vtNorm) < cos( ( 1. - EPS_ANG_SMALL) * DEGTORAD))
|
||||
return false ;
|
||||
|
||||
// se il punto finale del foro si trova nel semipiano positivo di Mirroring e sufficientemente distante da esso, non eseguo
|
||||
// lavorazione in parallelo
|
||||
Point3d ptHoleEnd = hole.ptIni - hole.dLen * hole.vtDir ;
|
||||
const double SAFE_DIST_TOL = 5. ;
|
||||
double dDist = ( ptHoleEnd - ptOn) * vtNorm ;
|
||||
if ( dDist < EPS_SMALL)
|
||||
return true ;
|
||||
double dSafeTipDist = m_TParams.m_dTLen - m_TParams.m_dLen ;
|
||||
if ( dDist < dSafeTipDist + SAFE_DIST_TOL)
|
||||
return true ;
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double dMHOff, const Vector3d& vtA, const ToolData& currToolData)
|
||||
@@ -3579,30 +3622,12 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
return false ;
|
||||
}
|
||||
// parametri per foro in doppio
|
||||
bool bDouble = ( GetDoubleType( m_Params.m_sUserNotes) != 0) ;
|
||||
int nDouble = GetDoubleType( m_Params.m_sUserNotes) ;
|
||||
bool bDouble = ( nDouble != 0) ;
|
||||
bool bDoubleParallel = false ;
|
||||
if ( bDouble)
|
||||
bDoubleParallel = VerifyParallelDrilling( nDouble, hole) ;
|
||||
double dDoubleLastStep = GetDoubleLastStep() ;
|
||||
bool dDoubleParallel = false ;
|
||||
if ( bDouble) {
|
||||
// nel caso di lavorazione in doppio con flag nel file .ini abilitato, prima della risalita finale, risalgo dell'ultimo step compiuto
|
||||
// se il piano di mirror presenta una normale circa parallela alla direzione del foro ( da BTL 1 grado di tolleranza)
|
||||
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
|
||||
if ( pMch != nullptr) {
|
||||
string sMachIni = pMch->GetMachineDir() + "\\" + pMch->GetMachineName() + ".ini" ;
|
||||
const char* SEC_MACH = "Customizations" ;
|
||||
const char* KEY_DRILLING_DOUBLE = "DrillingDoubleNT" ;
|
||||
int nDrillingDouble = GetPrivateProfileInt( SEC_MACH, KEY_DRILLING_DOUBLE, 0, sMachIni.c_str()) ;
|
||||
if ( nDrillingDouble == 1) {
|
||||
int nDouble = GetDoubleType( m_Params.m_sUserNotes) ;
|
||||
Vector3d vtNorm = V_INVALID ;
|
||||
switch ( nDouble) {
|
||||
case 1 : vtNorm = X_AX ; break ;
|
||||
case 2 : vtNorm = Y_AX ; break ;
|
||||
case 3 : vtNorm = Z_AX ; break ;
|
||||
}
|
||||
dDoubleParallel = ( vtNorm.IsValid() && abs( hole.vtDir * vtNorm) > cos( 1. * DEGTORAD)) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// ciclo di affondamento a step
|
||||
const double MIN_STEP = 1 ;
|
||||
const double APPR_STEP = 1 ;
|
||||
@@ -3653,9 +3678,9 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
Point3d ptP3 = hole.ptIni - hole.vtDir * dLen ;
|
||||
if ( bHoleEnd)
|
||||
ptP3 -= hole.vtDir * dAddLen ;
|
||||
if ( dDoubleParallel && i == nStep) {
|
||||
if ( bDoubleParallel && i == nStep) {
|
||||
SetFlag( 105) ; // movimento in doppio parallelo
|
||||
if ( AddLinearMove( ptP3, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP3, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
@@ -3685,9 +3710,9 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
Point3d ptP4 = hole.ptIni - hole.vtDir * dLen ;
|
||||
if ( bHoleEnd)
|
||||
ptP4 -= hole.vtDir * dAddLen ;
|
||||
if ( dDoubleParallel && i == nStep) {
|
||||
if ( bDoubleParallel && i == nStep) {
|
||||
SetFlag( 105) ; // movimento in doppio parallelo
|
||||
if ( AddLinearMove( ptP4, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP4, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
@@ -3716,9 +3741,9 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
Point3d ptP5 = hole.ptIni - hole.vtDir * dLen ;
|
||||
if ( bHoleEnd)
|
||||
ptP5 -= hole.vtDir * dAddLen ;
|
||||
if ( dDoubleParallel && i == nStep) {
|
||||
if ( bDoubleParallel && i == nStep) {
|
||||
SetFlag( 105) ; // movimento in doppio parallelo
|
||||
if ( AddLinearMove( ptP5, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP5, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
@@ -3732,15 +3757,20 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
|
||||
|
||||
// 6 -> ritorno all'approccio del foro
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( dDoubleParallel) {
|
||||
if ( bDoubleParallel) {
|
||||
SetFlag( 105) ; // movimento in doppio parallelo
|
||||
// aggiungo risalita aggiuntiva per lavorazione in doppio pari a due volte il LastStep
|
||||
Point3d ptEnd ; GetCurrPos( ptEnd) ;
|
||||
if ( AddLinearMove( ptEnd + min( 2. * dLastStep, dCurrLen) * hole.vtDir, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptEnd + min( dLastStep, dCurrLen) * hole.vtDir, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFeed( GetFeed()) ;
|
||||
GetCurrPos( ptEnd) ;
|
||||
if ( AddLinearMove( ptEnd + min( dLastStep, dCurrLen) * hole.vtDir, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
// aggiungo discensa di LastStep per simmetria con secondo utensile
|
||||
GetCurrPos( ptEnd) ;
|
||||
if ( AddLinearMove( ptEnd - dLastStep * hole.vtDir, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptEnd - dLastStep * hole.vtDir, bSplitArcs, MCH_CL_PARALLEL_DBL) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
SetFlag( 104) ; // risalita sopra il foro
|
||||
|
||||
@@ -105,6 +105,7 @@ class Drilling : public Machining
|
||||
bool GenerateHoleRegionPv( int nFirstId, int nCount, int nPvId) ;
|
||||
bool VerifyDiameter( double dHdiam, double dTdiam, double ddiamTol) ;
|
||||
bool VerifyHoleFromBottom( const Hole& hole, SelData Id) ;
|
||||
bool VerifyParallelDrilling( int nDouble, const Hole& hole) ;
|
||||
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double nMHOff, const Vector3d& vtA, const ToolData& currToolData) ;
|
||||
bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHOff, const Vector3d& vtA, const ToolData& currToolData) ;
|
||||
bool MultiHeadDrilling( const SELVECTOR& vId, int nClId, bool bFixed, TABMHDRILL& vDrills, double& dMHOff) ;
|
||||
|
||||
Binary file not shown.
@@ -331,6 +331,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EGkCurvePointDiffGeom.h" />
|
||||
<ClInclude Include="..\Include\EGkDistPointCurve.h" />
|
||||
<ClInclude Include="..\Include\EGkDistPointLine.h" />
|
||||
<ClInclude Include="..\Include\EGkDistPointSurfFr.h" />
|
||||
<ClInclude Include="..\Include\EGkDistPointSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkExtText.h" />
|
||||
<ClInclude Include="..\Include\EGkFrame3d.h" />
|
||||
@@ -348,6 +349,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EGkHashGrids2d.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersCurves.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersCurveSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersLineBox.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersLineSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersLineTria.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersPlaneSurfTm.h" />
|
||||
@@ -368,12 +370,15 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EGkSelection.h" />
|
||||
<ClInclude Include="..\Include\EGkSfrCreate.h" />
|
||||
<ClInclude Include="..\Include\EGkStmFromCurves.h" />
|
||||
<ClInclude Include="..\Include\EGkStmFromTriangleSoup.h" />
|
||||
<ClInclude Include="..\Include\EGkStmStandard.h" />
|
||||
<ClInclude Include="..\Include\EGkStringUtils3d.h" />
|
||||
<ClInclude Include="..\Include\EGkSurf.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfBezier.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfFlatRegion.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfLocal.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfTriMesh.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfTriMeshAux.h" />
|
||||
<ClInclude Include="..\Include\EGkTriangle3d.h" />
|
||||
<ClInclude Include="..\Include\EGkUiUnits.h" />
|
||||
<ClInclude Include="..\Include\EGkUserObj.h" />
|
||||
@@ -480,6 +485,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="TcPos.h" />
|
||||
<ClInclude Include="ToolData.h" />
|
||||
<ClInclude Include="ToolsMgr.h" />
|
||||
<ClInclude Include="ToolUserNotesConst.h" />
|
||||
<ClInclude Include="WaterJetting.h" />
|
||||
<ClInclude Include="WaterJettingData.h" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -785,6 +785,24 @@
|
||||
<ClInclude Include="OperUserNotesConst.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ToolUserNotesConst.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkDistPointSurfFr.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkIntersLineBox.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkStmFromTriangleSoup.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkSurfBezier.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkSurfTriMeshAux.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtMachKernel.rc">
|
||||
|
||||
+8
-3
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2026
|
||||
//----------------------------------------------------------------------------
|
||||
// File : GeoCalc.cpp Data : 12.05.15 Versione : 1.6e3
|
||||
// File : GeoCalc.cpp Data : 08.05.26 Versione : 3.1e2
|
||||
// Contenuto : Funzioni varie e speciali di calcolo geometrico.
|
||||
//
|
||||
//
|
||||
@@ -14,6 +14,7 @@
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "GeoCalc.h"
|
||||
#include "\EgtDev\Include\EGkAngle.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
@@ -33,7 +34,7 @@ GetRotationComponent( const Vector3d& vtDir1, double dComp, const Vector3d& vtDi
|
||||
Vector3d vtU = vtPvZW ;
|
||||
if ( ! vtU.Normalize()) {
|
||||
// determino se equiversi o controversi
|
||||
bool bEquiv = ( vtDir2 * vtRotAx) > 0 ;
|
||||
bool bEquiv = ( vtDir2 * vtRotAx > 0) ;
|
||||
// se le componenti concordano, angolo indeterminato
|
||||
if ( abs( dT0w - ( bEquiv ? dComp : - dComp)) < 0.5 * SIN_EPS_ANG_SMALL) {
|
||||
bDet = false ;
|
||||
@@ -86,6 +87,10 @@ GetRotationComponent( const Vector3d& vtDir1, double dComp, const Vector3d& vtDi
|
||||
double dDeltaAngRad = acos( dNumer / dDenom) ;
|
||||
dAng1Deg = ( dOffsAngRad + dDeltaAngRad) * RADTODEG ;
|
||||
dAng2Deg = ( dOffsAngRad - dDeltaAngRad) * RADTODEG ;
|
||||
if ( abs( dAng1Deg) <= abs( dAng2Deg))
|
||||
dAng2Deg = AngleNearAngle( dAng2Deg, dAng1Deg) ;
|
||||
else
|
||||
dAng1Deg = AngleNearAngle( dAng1Deg, dAng2Deg) ;
|
||||
bDet = true ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
+16
@@ -140,6 +140,21 @@ const std::string TOOLHOLDER_SEC = "ToolHolder" ;
|
||||
const std::string MACHININGS_SEC = "Machinings" ;
|
||||
// Chiave per abilitare discesa e risalita in rapido da fresature con estremi fuori dal grezzo
|
||||
const std::string RAPIDONOUT_KEY = "RapidOnOut" ;
|
||||
// Chiave per Drilling in Doppio in Parallelo
|
||||
const std::string DRILLING_PARALLEL_KEY = "DrillingDoubleNT" ;
|
||||
// Chiave per Pocketing in Doppio in Parallelo
|
||||
const std::string POCKETING_PARALLEL_KEY = "PocketingDoubleNT" ;
|
||||
// Chiave per Ottimizzazione delle Feed in PocketingNT
|
||||
const std::string POCKETING_FEED_KEY = "PocketingAdjustFeedNT" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Tipo di Collegamento tra le lavorazioni (LinkType)
|
||||
enum LINKTYPE {
|
||||
LINK_NULL = 0,
|
||||
LINK_HOME_TO_MACH = 1,
|
||||
LINK_MACH_TO_HOME = 2,
|
||||
LINK_MACH_TO_MACH = 3
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Minimo spessore del grezzo
|
||||
@@ -148,6 +163,7 @@ const double RAW_MIN_H = 1 ;
|
||||
//----------------------------------------------------------------------------
|
||||
// Minima feed
|
||||
const double FEED_MIN = 1 ;
|
||||
constexpr double FEED_MAX_REDUCE = 5 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Massimo angolo al centro per archi di CL
|
||||
|
||||
@@ -328,9 +328,9 @@ class MachMgr : public IMachMgr
|
||||
bool GetClEntAxesStatus( int nEntId, int& nStatus) const override ;
|
||||
bool GetClEntAxesMask( int nEntId, int& nMask) const override ;
|
||||
bool GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const override ;
|
||||
bool GetClEntTDir( int nEntId, Vector3d& vTDir) const override ;
|
||||
bool GetClEntCDir( int nEntId, Vector3d& vCDir) const override ;
|
||||
bool GetClEntADir( int nEntId, Vector3d& vADir) const override ;
|
||||
bool GetClEntTDir( int nEntId, Vector3d& vtTDir) const override ;
|
||||
bool GetClEntCDir( int nEntId, Vector3d& vtCDir) const override ;
|
||||
bool GetClEntADir( int nEntId, Vector3d& vtADir) const override ;
|
||||
// Simulation
|
||||
bool SimInit( void) override ;
|
||||
bool SimStart( bool bFirst) override ;
|
||||
|
||||
+11
-11
@@ -150,10 +150,10 @@ MachMgr::GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntTDir( int nEntId, Vector3d& vTDir) const
|
||||
MachMgr::GetClEntTDir( int nEntId, Vector3d& vtTDir) const
|
||||
{
|
||||
// default
|
||||
vTDir = V_NULL ;
|
||||
vtTDir = V_NULL ;
|
||||
// verifico validità GeomBD
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
@@ -161,17 +161,17 @@ MachMgr::GetClEntTDir( int nEntId, Vector3d& vTDir) const
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero vTDir
|
||||
vTDir = pCamData->GetToolDir() ;
|
||||
// recupero TDir
|
||||
vtTDir = pCamData->GetToolDir() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntCDir( int nEntId, Vector3d& vCDir) const
|
||||
MachMgr::GetClEntCDir( int nEntId, Vector3d& vtCDir) const
|
||||
{
|
||||
// default
|
||||
vCDir = V_NULL ;
|
||||
vtCDir = V_NULL ;
|
||||
// verifico validità GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
@@ -179,17 +179,17 @@ MachMgr::GetClEntCDir( int nEntId, Vector3d& vCDir) const
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero vCDir
|
||||
vCDir = pCamData->GetCorrDir() ;
|
||||
// recupero CDir
|
||||
vtCDir = pCamData->GetCorrDir() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntADir( int nEntId, Vector3d& vADir) const
|
||||
MachMgr::GetClEntADir( int nEntId, Vector3d& vtADir) const
|
||||
{
|
||||
// default
|
||||
vADir = V_NULL ;
|
||||
vtADir = V_NULL ;
|
||||
// verifico validità GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
@@ -198,6 +198,6 @@ MachMgr::GetClEntADir( int nEntId, Vector3d& vADir) const
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero ADir
|
||||
vADir = pCamData->GetAuxDir() ;
|
||||
vtADir = pCamData->GetAuxDir() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
+2
-1
@@ -15,6 +15,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "DllMain.h"
|
||||
#include "MachMgr.h"
|
||||
#include "ToolUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/EgtIniFile.h"
|
||||
@@ -881,7 +882,7 @@ MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType, const
|
||||
// Verifico se sovrascritto da nota dell'utensile
|
||||
string sVal ;
|
||||
if ( ! sUserNotes.empty() &&
|
||||
GetValInNotes( sUserNotes, "TH", sVal) &&
|
||||
GetValInNotes( sUserNotes, TUN_TH, sVal) &&
|
||||
ExistsFile( sToolHolderDir + "\\" + sVal))
|
||||
sToolHolder = sVal ;
|
||||
// Se non trovato ancora, esco
|
||||
|
||||
@@ -66,6 +66,7 @@ Machine::Machine( void)
|
||||
m_frLinAx.Reset( false) ;
|
||||
m_frRobot.Reset( false) ;
|
||||
m_nCalcChainType = KIN_CHAIN_NONE ;
|
||||
m_dPrevAngA = NAN ;
|
||||
m_nMachineLook = MCH_LOOK_NONE ;
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +168,9 @@ class Machine
|
||||
const Frame3d& GetCurrLinAxesFrame( void) const
|
||||
{ return m_frLinAx ; }
|
||||
int GetCurrKinematicChainType( void) const
|
||||
{ return m_nCalcChainType ; }
|
||||
{ return m_nCalcChainType ; }
|
||||
bool SetPrevAngA( double dAngA) const
|
||||
{ m_dPrevAngA = dAngA ; return true ; }
|
||||
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
|
||||
bool GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
@@ -348,6 +350,7 @@ class Machine
|
||||
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
|
||||
mutable double m_dPrevAngA ; // angolo precedente di riferimento per soluzione indeterminata
|
||||
mutable OutStroke m_OutstrokeInfo ; // informazioni su ultima extra corsa
|
||||
// stato di visualizzazione
|
||||
int m_nMachineLook ; // stato di visualizzazione della macchina
|
||||
|
||||
+33
-25
@@ -1384,6 +1384,15 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
dAngA2 = dAngA1 + ( dAngA1 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT) ;
|
||||
dAngB2 = -dAngB1 ;
|
||||
|
||||
// se soluzione indeterminata e suggerito angolo precedente valido
|
||||
if ( abs( dAngB1) < EPS_ANG_SMALL / 2 && isfinite( m_dPrevAngA) && VerifyAngleOutstroke( 1, m_dPrevAngA)) {
|
||||
nStat = 1 ;
|
||||
dAngA1 = m_dPrevAngA ;
|
||||
dAngB1 = 0 ;
|
||||
}
|
||||
else
|
||||
nStat = 2 ;
|
||||
|
||||
// calcolo il terzo asse rotante del polso
|
||||
Vector3d vtR3 = RotAx3.vtDir ;
|
||||
vtR3.Rotate( RotAx2.vtDir, dAngB1) ;
|
||||
@@ -1404,22 +1413,25 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
dAngC2 = dAngC1 + ( dAngC1 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT) ;
|
||||
|
||||
// verifiche dei limiti di corsa
|
||||
nStat = 2 ;
|
||||
// se non riesco ad aggiustare, elimino
|
||||
if ( ! AdjustAngleInStroke( RotAx1.stroke, dAngA2) ||
|
||||
! AdjustAngleInStroke( RotAx2.stroke, dAngB2) ||
|
||||
! AdjustAngleInStroke( RotAx3.stroke, dAngC2))
|
||||
-- nStat ;
|
||||
// se non riesco ad aggiustare, elimino
|
||||
if ( ! AdjustAngleInStroke( RotAx1.stroke, dAngA1) ||
|
||||
! AdjustAngleInStroke( RotAx2.stroke, dAngB1) ||
|
||||
! AdjustAngleInStroke( RotAx3.stroke, dAngC1)) {
|
||||
-- nStat ;
|
||||
// riloco eventuale soluzione rimasta
|
||||
if ( nStat >= 1) {
|
||||
dAngA1 = dAngA2 ;
|
||||
dAngB1 = dAngB2 ;
|
||||
dAngC1 = dAngC2 ;
|
||||
if ( nStat >= 2) {
|
||||
// se non riesco ad aggiustare, elimino
|
||||
if ( ! AdjustAngleInStroke( RotAx1.stroke, dAngA2) ||
|
||||
! AdjustAngleInStroke( RotAx2.stroke, dAngB2) ||
|
||||
! AdjustAngleInStroke( RotAx3.stroke, dAngC2))
|
||||
-- nStat ;
|
||||
}
|
||||
if ( nStat >= 1) {
|
||||
// se non riesco ad aggiustare, elimino
|
||||
if ( ! AdjustAngleInStroke( RotAx1.stroke, dAngA1) ||
|
||||
! AdjustAngleInStroke( RotAx2.stroke, dAngB1) ||
|
||||
! AdjustAngleInStroke( RotAx3.stroke, dAngC1)) {
|
||||
-- nStat ;
|
||||
// riloco eventuale soluzione rimasta
|
||||
if ( nStat >= 1) {
|
||||
dAngA1 = dAngA2 ;
|
||||
dAngB1 = dAngB2 ;
|
||||
dAngC1 = dAngC2 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1873,7 +1885,7 @@ bool
|
||||
Machine::GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const
|
||||
{
|
||||
// se angolo fittizio (non esiste l'asse rotante corrispondente), non c'è alcunchè da fare
|
||||
if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size()))
|
||||
if ( nInd < 0 || nInd >= ssize( m_vCalcRotAx))
|
||||
return true ;
|
||||
// cerco l'angolo più vicino stando nella corsa
|
||||
while ( dAng - dAngRef > ANG_STRAIGHT + EPS_ANG_ZERO && dAng - ANG_FULL >= m_vCalcRotAx[nInd].stroke.Min)
|
||||
@@ -1889,7 +1901,7 @@ bool
|
||||
Machine::LimitAngleToStroke( int nInd, double& dAng) const
|
||||
{
|
||||
// se angolo fittizio (non esiste l'asse rotante corrispondente), non c'è alcunchè da fare
|
||||
if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size()))
|
||||
if ( nInd < 0 || nInd >= ssize( m_vCalcRotAx))
|
||||
return true ;
|
||||
// se angolo fuori corsa, lo porto all'estremo più vicino
|
||||
dAng = Clamp( dAng, m_vCalcRotAx[nInd].stroke.Min, m_vCalcRotAx[nInd].stroke.Max) ;
|
||||
@@ -1901,7 +1913,7 @@ bool
|
||||
Machine::VerifyAngleOutstroke( int nInd, double dAng) const
|
||||
{
|
||||
// se angolo fittizio (non esiste l'asse rotante corrispondente), va bene
|
||||
if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size()))
|
||||
if ( nInd < 0 || nInd >= ssize( m_vCalcRotAx))
|
||||
return true ;
|
||||
// se angolo fuori corsa, errore
|
||||
if ( dAng < m_vCalcRotAx[nInd].stroke.Min)
|
||||
@@ -2380,13 +2392,9 @@ Machine::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vecto
|
||||
return false ;
|
||||
}
|
||||
// deduco la posizione richiesta del centro del polso
|
||||
Point3d ptCen = ptPL + m_ptWristCen.x * frTool.VersX() +
|
||||
m_ptWristCen.y * frTool.VersY() +
|
||||
( m_dCalcTLen + m_ptWristCen.z) * frTool.VersZ() ;
|
||||
Point3d ptCen = ptPL + GetToGlob( m_ptWristCen + m_dCalcTLen * Z_AX, frTool) ;
|
||||
// deduco la direzione richiesta del centro del polso
|
||||
Vector3d vtCen = m_vtWristRef.x * frTool.VersX() +
|
||||
m_vtWristRef.y * frTool.VersY() +
|
||||
m_vtWristRef.z * frTool.VersZ() ;
|
||||
Vector3d vtCen = GetToGlob( m_vtWristRef, frTool) ;
|
||||
// calcolo il primo asse rotante
|
||||
Vector3d vtArm = ptCen - m_vCalcRotAx[0].ptPos ;
|
||||
double dAng1 ; bool bDet1 ;
|
||||
|
||||
@@ -317,6 +317,9 @@ Machine::LuaEmtAddClimb( lua_State* L)
|
||||
if ( m_pMchLua == nullptr ||
|
||||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// verifica "Main" e "Double"
|
||||
if ( ! EqualNoCase( sMain, MCH_CL) && ! EqualNoCase( sMain, MCH_DBL))
|
||||
return luaL_error( L, ( " Error in EmtAddClimb : " + sMain).c_str()) ;
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// imposto la discesa (primo movimento del primo percorso della lavorazione)
|
||||
@@ -343,6 +346,9 @@ Machine::LuaEmtRemoveClimb( lua_State* L)
|
||||
if ( m_pMchLua == nullptr ||
|
||||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// verifica "Main" e "Double"
|
||||
if ( ! EqualNoCase( sMain, MCH_CL) && ! EqualNoCase( sMain, MCH_DBL))
|
||||
return luaL_error( L, ( " Error in EmtAddClimb : " + sMain).c_str()) ;
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// elimino le discese (primi movimenti "CLIMB" del primo percorso della lavorazione)
|
||||
@@ -377,6 +383,9 @@ Machine::LuaEmtAddRise( lua_State* L)
|
||||
if ( m_pMchLua == nullptr ||
|
||||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// verifica "Main" e "Double"
|
||||
if ( ! EqualNoCase( sMain, MCH_CL) && ! EqualNoCase( sMain, MCH_DBL))
|
||||
return luaL_error( L, ( " Error in EmtAddClimb : " + sMain).c_str()) ;
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// aggiungo la risalita (ultimo movimento dell'ultimo percorso della lavorazione)
|
||||
@@ -403,6 +412,9 @@ Machine::LuaEmtRemoveRise( lua_State* L)
|
||||
if ( m_pMchLua == nullptr ||
|
||||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// verifica "Main" e "Double"
|
||||
if ( ! EqualNoCase( sMain, MCH_CL) && ! EqualNoCase( sMain, MCH_DBL))
|
||||
return luaL_error( L, ( " Error in EmtAddClimb : " + sMain).c_str()) ;
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// elimino le risalite (ultimi movimenti "RISE" dell'ultimo percorso della lavorazione)
|
||||
|
||||
+55
-26
@@ -17,6 +17,7 @@
|
||||
#include "MachMgr.h"
|
||||
#include "Machining.h"
|
||||
#include "OperUserNotesConst.h"
|
||||
#include "ToolUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
@@ -325,13 +326,15 @@ Machining::MyPrepareToolPreview( bool bDouble)
|
||||
|
||||
// se necessario, imposto l'utensile corrente
|
||||
string sTool, sTcPos, sHead ;
|
||||
double dTLen ;
|
||||
int nExitDBLId ;
|
||||
if ( ! bDouble) {
|
||||
sTool = GetToolName() ;
|
||||
sHead = GetHeadName() ;
|
||||
dTLen = GetToolData().m_dLen ;
|
||||
}
|
||||
else {
|
||||
if ( ! GetDoubleToolData( sTool, sTcPos, sHead, nExitDBLId))
|
||||
if ( ! GetDoubleToolData( sTool, sTcPos, sHead, nExitDBLId, dTLen))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -583,7 +586,7 @@ Machining::MyPrepareToolPreview( bool bDouble)
|
||||
bOk = bOk && ( nFrId != GDB_ID_NULL) ;
|
||||
const IGeoFrame3d* frExit = ( bOk ? GetGeoFrame3d( m_pGeomDB->GetGeoObj( nFrId)) : nullptr) ;
|
||||
bOk = bOk && ( frExit != nullptr) ;
|
||||
Point3d ptToolTip = ( bOk ? ( frExit->GetFrame()).Orig() - GetToolData().m_dLen * ( frExit->GetFrame()).VersZ() : P_INVALID) ;
|
||||
Point3d ptToolTip = ( bOk ? ( frExit->GetFrame()).Orig() - dTLen * ( frExit->GetFrame()).VersZ() : P_INVALID) ;
|
||||
bOk = bOk && ptToolTip.IsValid() ;
|
||||
if ( bOk) {
|
||||
PtrOwner<IGeoPoint3d> ptGToolTip( CreateGeoPoint3d()) ;
|
||||
@@ -698,9 +701,11 @@ Machining::RemoveToolPreview( void)
|
||||
// recupero i gruppi per l'anteprima utensile
|
||||
int nStId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST) ;
|
||||
int nStIdDBL = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST_DBL) ;
|
||||
// li svuoto
|
||||
// svuoto il gruppo dell'utensile principale
|
||||
m_pGeomDB->EmptyGroup( nStId) ;
|
||||
m_pGeomDB->EmptyGroup( nStIdDBL) ;
|
||||
// rimuovo il gruppo dell'utensile secondario ( non lo svuoto, in quanto potrei ricalcolare la stessa lavorazione
|
||||
// come singola, ritrovandomi un gruppo per il DBL in ToolPreview())
|
||||
m_pGeomDB->Erase( nStIdDBL) ;
|
||||
// reset delle variabili membro
|
||||
m_nPreviewHeadId = GDB_ID_NULL ;
|
||||
m_nPreviewHeadIdDBL = GDB_ID_NULL ;
|
||||
@@ -1040,7 +1045,7 @@ Machining::ToolPreview( int nEntId, int nStep) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machining::GetDoubleType( const string& sUserNotes)
|
||||
Machining::GetDoubleType( const string& sUserNotes) const
|
||||
{
|
||||
int nDouble ;
|
||||
if ( ! GetValInNotes( sUserNotes, UN_DOUBLE, nDouble) ||
|
||||
@@ -1053,6 +1058,14 @@ Machining::GetDoubleType( const string& sUserNotes)
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machining::GetDoubleToolData( string& sDblTool, string& sDblTcPos, string& sDblHead, int& nDblExit) const
|
||||
{
|
||||
double dDummy ;
|
||||
return GetDoubleToolData( sDblTool, sDblTcPos, sDblHead, nDblExit, dDummy) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machining::GetDoubleToolData( string& sDblTool, string& sDblTcPos, string& sDblHead, int& nDblExit, double& dDblLen) const
|
||||
{
|
||||
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
|
||||
return false ;
|
||||
@@ -1061,12 +1074,13 @@ Machining::GetDoubleToolData( string& sDblTool, string& sDblTcPos, string& sDblH
|
||||
if ( pTMgr == nullptr)
|
||||
return false ;
|
||||
// recupero dati utensile in doppio
|
||||
if ( ! GetValInNotes( GetToolData().m_sUserNotes, "DOUBLE", sDblTool))
|
||||
if ( ! GetValInNotes( GetToolData().m_sUserNotes, TUN_DOUBLE, sDblTool))
|
||||
return false ;
|
||||
const ToolData* pTdata = pTMgr->GetTool( sDblTool) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
dDblLen = pTdata->m_dLen ;
|
||||
if ( ! m_pMchMgr->GetCurrSetupMgr().GetToolData( sDblTool, sDblTcPos, sDblHead, nDblExit)) {
|
||||
const ToolData* pTdata = pTMgr->GetTool( sDblTool) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
sDblHead = pTdata->m_sHead ;
|
||||
nDblExit = pTdata->m_nExit ;
|
||||
}
|
||||
@@ -1075,7 +1089,32 @@ Machining::GetDoubleToolData( string& sDblTool, string& sDblTcPos, string& sDblH
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes)
|
||||
Machining::CalcMirrorPlaneByDouble( int nDouble, const string& sUserNotes, Point3d& ptOn, Vector3d& vtNorm) const
|
||||
{
|
||||
// verifico parametro per lavorazione in doppio
|
||||
if ( nDouble != 1 && nDouble != 2 && nDouble != 3)
|
||||
return false ;
|
||||
|
||||
// determino posizione del piano di mirroring mediante centro del Box del grezzo
|
||||
BBox3d b3Raw ;
|
||||
if ( ! GetCurrRawsGlobBox( b3Raw) || ! b3Raw.GetCenter( ptOn))
|
||||
return false ;
|
||||
switch ( nDouble) {
|
||||
case 1 : vtNorm = X_AX ; break ;
|
||||
case 2 : vtNorm = Y_AX ; break ;
|
||||
case 3 : vtNorm = Z_AX ; break ;
|
||||
}
|
||||
// se presente nota utente con posizione del piano, allora dal punto più basso salgo di tale valore per individuare la quota
|
||||
double dPlanePos ;
|
||||
if ( GetValInNotes( sUserNotes, UN_MIRRORAX, dPlanePos))
|
||||
ptOn = b3Raw.GetMin() + dPlanePos * vtNorm ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes) const
|
||||
{
|
||||
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
|
||||
return false ;
|
||||
@@ -1125,20 +1164,10 @@ Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes)
|
||||
nPathId = m_pGeomDB->GetNextName( nPathId, MCH_PATH + "*") ;
|
||||
}
|
||||
|
||||
// determino posizione del piano di mirroring
|
||||
BBox3d b3Raw ;
|
||||
Point3d ptOn ;
|
||||
if ( ! GetCurrRawsGlobBox( b3Raw) || ! b3Raw.GetCenter( ptOn))
|
||||
// calcolo il piano di Mirroring
|
||||
Point3d ptOn ; Vector3d vtNorm ;
|
||||
if ( ! CalcMirrorPlaneByDouble( nDouble, sUserNotes, ptOn, vtNorm))
|
||||
return false ;
|
||||
Vector3d vtNorm ;
|
||||
switch ( nDouble) {
|
||||
case 1 : vtNorm = X_AX ; break ;
|
||||
case 2 : vtNorm = Y_AX ; break ;
|
||||
case 3 : vtNorm = Z_AX ; break ;
|
||||
}
|
||||
double dPlanePos ;
|
||||
if ( GetValInNotes( sUserNotes, UN_MIRRORAX, dPlanePos))
|
||||
ptOn = b3Raw.GetMin() + dPlanePos * vtNorm ;
|
||||
|
||||
// eseguo mirroring rispetto a piano opportuno
|
||||
nPathId = m_pGeomDB->GetFirstNameInGroup( nDblId, MCH_PATH + "*") ;
|
||||
@@ -1146,15 +1175,15 @@ Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes)
|
||||
int nEntId = m_pGeomDB->GetFirstInGroup( nPathId) ;
|
||||
while ( nEntId != GDB_ID_NULL) {
|
||||
string sName ; m_pGeomDB->GetName( nEntId, sName) ;
|
||||
// nel caso di fuorature in doppio, il movimento deve essere sincronizzato
|
||||
if ( sName == MCH_CL_DBP) {
|
||||
// nel caso di forature in doppio, il movimento deve essere sincronizzato
|
||||
if ( sName == MCH_CL_PARALLEL_DBL) {
|
||||
INTVECTOR vSyncEntId ;
|
||||
do {
|
||||
vSyncEntId.push_back( nEntId) ;
|
||||
nEntId = m_pGeomDB->GetNext( nEntId) ;
|
||||
sName.clear() ;
|
||||
m_pGeomDB->GetName( nEntId, sName) ;
|
||||
} while ( sName == MCH_CL_DBP) ;
|
||||
} while ( sName == MCH_CL_PARALLEL_DBL) ;
|
||||
Vector3d vtRef ;
|
||||
bool bOk = true ;
|
||||
for ( int i = 0 ; bOk && i < ssize( vSyncEntId) ; ++ i) {
|
||||
|
||||
+5
-3
@@ -26,6 +26,7 @@ class Machining : public Operation
|
||||
int GetExitNbr( void) const override ;
|
||||
const std::string& GetToolTcPos( void) const override ;
|
||||
bool NeedPrevHome( void) const override ;
|
||||
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const override ;
|
||||
|
||||
public :
|
||||
virtual bool Prepare( const std::string& sMchName) = 0 ;
|
||||
@@ -61,9 +62,10 @@ class Machining : public Operation
|
||||
~Machining( void) ;
|
||||
bool SpecialApply( std::string& sErr) ;
|
||||
bool PostApply( std::string& sErr) ;
|
||||
int GetDoubleType( const std::string& sUserNotes) ;
|
||||
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const override ;
|
||||
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ;
|
||||
int GetDoubleType( const std::string& sUserNotes) const ;
|
||||
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit, double& dDblLen) const ;
|
||||
bool CalcMirrorPlaneByDouble( int nDouble, const std::string& sUserNotes, Point3d& ptOn, Vector3d& vtNorm) const ;
|
||||
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) const ;
|
||||
bool ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const ;
|
||||
|
||||
private :
|
||||
|
||||
+15
-9
@@ -4034,8 +4034,9 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
}
|
||||
bool bAdjustLoPerp = ( m_Params.m_dLoPerp > 10 * EPS_SMALL) ;
|
||||
if ( bAdjustLoPerp) {
|
||||
m_Params.m_dLoTang = 0 ;
|
||||
m_Params.m_dLoPerp = 0. ;
|
||||
double dNewLoPerp = max( 0., m_Params.m_dLoPerp - ( nStep - 1) * dStep) ;
|
||||
m_Params.m_dLoTang *= dNewLoPerp / m_Params.m_dLoPerp ;
|
||||
m_Params.m_dLoPerp = dNewLoPerp ;
|
||||
}
|
||||
|
||||
// ciclo sugli step
|
||||
@@ -4059,11 +4060,16 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
if ( ! TrimExtendCurveToClosedStm( pMyCompo, nTriExtCstm, bInvert))
|
||||
pMyCompo.Set( pMyCopy) ;
|
||||
}
|
||||
// dopo primo step annullo parametri di attacco
|
||||
if ( j > 1 && bAdjustLiPerp) {
|
||||
// se necessario e invertito oppure step successivo annullo parametri di attacco
|
||||
if ( bAdjustLiPerp && ( bInvert || j == 2)) {
|
||||
m_Params.m_dLiPerp = 0. ;
|
||||
m_Params.m_dLiTang = 0. ;
|
||||
}
|
||||
// se necessario e non invertito oppure step successivo annullo parametri di uscita
|
||||
if ( bAdjustLoPerp && ( ! bInvert || j == 2)) {
|
||||
m_Params.m_dLoPerp = 0. ;
|
||||
m_Params.m_dLoTang = 0. ;
|
||||
}
|
||||
// ciclo sulle curve elementari
|
||||
int nMaxInd = pMyCompo->GetCurveCount() - 1 ;
|
||||
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
|
||||
@@ -6510,11 +6516,11 @@ Milling::CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bI
|
||||
// verifico curva
|
||||
if ( pCompo == nullptr)
|
||||
return false ;
|
||||
// se utensile centrato, direzione di correzione nulla
|
||||
if ( m_Params.m_nWorkSide == MILL_WS_CENTER)
|
||||
return true ;
|
||||
// calcolo del versore correzione
|
||||
Vector3d vtCorr = CalcCorrDir( pCompo, dU, bInvertSide, bSawSpecial) ;
|
||||
// versore correzione nullo per default
|
||||
Vector3d vtCorr ;
|
||||
// se utensile non centrato, calcolo del versore correzione
|
||||
if ( m_Params.m_nWorkSide != MILL_WS_CENTER)
|
||||
vtCorr = CalcCorrDir( pCompo, dU, bInvertSide, bSawSpecial) ;
|
||||
// imposto versore correzione
|
||||
SetCorrDir( vtCorr) ;
|
||||
// se rinvio da sotto in uso, non devo impostare direzione aux da correzione
|
||||
|
||||
@@ -26,6 +26,7 @@ static const std::string UN_DOUBLE = "DOUBLE" ;
|
||||
static const std::string UN_MIRRORAX = "MirrorAx" ;
|
||||
static const std::string UN_DELTAZ = "DeltaZ" ;
|
||||
static const std::string UN_VTAUXDIR = "VtAuxDir" ;
|
||||
static const std::string UN_STARTZMAX = "StartZmax" ;
|
||||
|
||||
// Solo per Drilling
|
||||
static const std::string UN_LASTSTEP = "LastStep" ;
|
||||
@@ -51,6 +52,7 @@ static const std::string UN_OPENMINSAFE = "OpenMinSafe" ;
|
||||
static const std::string UN_MAXOPTSIZE = "MaxOptSize" ;
|
||||
static const std::string UN_PROJEXT = "ExtProj" ;
|
||||
static const std::string UN_ADJUSTFEED = "AdjustFeed" ;
|
||||
static const std::string UN_MINFEED = "MinFeed" ;
|
||||
|
||||
// Solo per Sawing
|
||||
static const std::string UN_DOWNSE = "DownSE" ;
|
||||
@@ -72,6 +74,7 @@ static const std::string UN_ANGLETOL = "AngleTol" ;
|
||||
static const std::string UN_PLANEZ = "PlaneZ" ;
|
||||
static const std::string UN_ORDER = "Order" ;
|
||||
static const std::string UN_SUPP_RAD_OFFS = "SuppRadOffs" ;
|
||||
// come per PocketingNT, viene usato il parametro UN_MINFEED
|
||||
|
||||
// Solo per Waterjetting
|
||||
static const std::string UN_START = "START" ;
|
||||
|
||||
+128
-96
@@ -1917,6 +1917,7 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact, double dS
|
||||
// calcolo il valore degli assi macchina di tutti i movimenti
|
||||
bool bOk = true ;
|
||||
if ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_MCENT) {
|
||||
m_pGeomDB->SetInfo( nClId, KEY_KINTYPE, KIN_CHAIN_MCENT) ;
|
||||
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
|
||||
while ( nClPathId != GDB_ID_NULL) {
|
||||
if ( ! CalculateClPathMcentAxesValues( nClPathId, dAngDeltaMinForHome, vAxRotHome, vAxRotPrec))
|
||||
@@ -1925,6 +1926,7 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact, double dS
|
||||
}
|
||||
}
|
||||
else if ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_ROBOT) {
|
||||
m_pGeomDB->SetInfo( nClId, KEY_KINTYPE, KIN_CHAIN_ROBOT) ;
|
||||
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
|
||||
while ( nClPathId != GDB_ID_NULL) {
|
||||
if ( ! CalculateClPathRobotAxesValues( nClPathId, dAngDeltaMinForHome, vAxRotHome, vAxRotPrec))
|
||||
@@ -1932,8 +1934,10 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact, double dS
|
||||
nClPathId = m_pGeomDB->GetNextGroup( nClPathId) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
m_pGeomDB->SetInfo( nClId, KEY_KINTYPE, KIN_CHAIN_NONE) ;
|
||||
bOk = false ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
@@ -2210,8 +2214,8 @@ Operation::MyCalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinF
|
||||
double dCoeff = double( i) / nNumStep ;
|
||||
Point3d ptCurr = Media( ptPrec, ptP, dCoeff) ;
|
||||
DBLVECTOR vAng( vAxRot.size()) ;
|
||||
for ( int i = 0 ; i < int( vAxRot.size()) ; ++ i)
|
||||
vAng[i] = vAxRotPrec[i] * ( 1 - dCoeff) + vAxRot[i] * dCoeff ;
|
||||
for ( int j = 0 ; j < ssize( vAxRot) ; ++ j)
|
||||
vAng[j] = vAxRotPrec[j] * ( 1 - dCoeff) + vAxRot[j] * dCoeff ;
|
||||
int nStat = 0 ;
|
||||
bool bPaOk = pMachine->VerifyProtectedAreas( ptCurr.x, ptCurr.y, ptCurr.z, vAng, nStat) ;
|
||||
if ( ! bPaOk || nStat != 0) {
|
||||
@@ -2236,8 +2240,8 @@ Operation::MyCalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinF
|
||||
ptMid.Rotate( ptCen, vtN, - dAngCen / 2) ;
|
||||
// determino i valori degli assi al punto medio
|
||||
DBLVECTOR vAngMid( vAxRot.size()) ;
|
||||
for ( size_t i = 0 ; i < vAxRot.size() ; ++ i)
|
||||
vAngMid[i] = ( vAxRotPrec[i] + vAxRot[i]) / 2 ;
|
||||
for ( int j = 0 ; j < ssize( vAxRot) ; ++ j)
|
||||
vAngMid[j] = ( vAxRotPrec[j] + vAxRot[j]) / 2 ;
|
||||
double dXmid, dYmid, dZmid ;
|
||||
bool bLmidOk = m_pMchMgr->GetCalcPositions( ptMid, vAngMid, dXmid, dYmid, dZmid) ;
|
||||
if ( ! bLmidOk) {
|
||||
@@ -2249,8 +2253,8 @@ Operation::MyCalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinF
|
||||
Point3d ptEnd = ptP - dDeltaN * vtN ;
|
||||
// determino i valori degli assi al punto finale
|
||||
DBLVECTOR vAngEnd( vAxRot.size()) ;
|
||||
for ( size_t i = 0 ; i < vAxRot.size() ; ++ i)
|
||||
vAngEnd[i] = vAxRot[i] ;
|
||||
for ( int j = 0 ; j < ssize( vAxRot) ; ++ j)
|
||||
vAngEnd[j] = vAxRot[j] ;
|
||||
double dXend, dYend, dZend ;
|
||||
bool bLendOk = m_pMchMgr->GetCalcPositions( ptEnd, vAngEnd, dXend, dYend, dZend) ;
|
||||
if ( ! bLendOk) {
|
||||
@@ -2308,8 +2312,8 @@ Operation::MyCalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinF
|
||||
double dCoeff = double( i) / NUM_VERIF_STEP ;
|
||||
Point3d ptCurr = ptCen + vtCurr + vtN * dDeltaN * dCoeff ;
|
||||
DBLVECTOR vAng( vAxRot.size()) ;
|
||||
for ( size_t i = 0 ; i < vAxRot.size() ; ++ i)
|
||||
vAng[i] = vAxRotPrec[i] * ( 1 - dCoeff) + vAxRot[i] * dCoeff ;
|
||||
for ( int j = 0 ; j < ssize( vAxRot) ; ++ j)
|
||||
vAng[j] = vAxRotPrec[j] * ( 1 - dCoeff) + vAxRot[j] * dCoeff ;
|
||||
int nStat ;
|
||||
bool bOsOk = m_pMchMgr->VerifyOutstroke( ptCurr.x, ptCurr.y, ptCurr.z, vAng, false, nStat) ;
|
||||
if ( ! bOsOk || nStat != 0) {
|
||||
@@ -2354,34 +2358,41 @@ Operation::CalculateMcentRotAxesValues( bool bFirst, const Vector3d& vtTool, con
|
||||
double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec, DBLVECTOR& vAxRot)
|
||||
{
|
||||
// macchina
|
||||
Machine* pMachine = m_pMchMgr->GetCurrMachine() ;
|
||||
if ( pMachine == nullptr)
|
||||
return false ;
|
||||
// continuità su assi rotanti nei movimenti successivi al primo per tutte le lavorazioni, tranne disposizioni
|
||||
bool bRotContOnNext = ( GetType() != OPER_DISP) ;
|
||||
// massima variazione secondo asse rotante per continuità
|
||||
const double dMaxDeltaR2 = 30 ;
|
||||
// imposto primo asse precedente (per caso con 3 rotanti liberi)
|
||||
pMachine->SetPrevAngA( ( ! vAxRotPrec.empty() ? vAxRotPrec[0] : NAN)) ;
|
||||
// calcolo degli assi rotanti della macchina
|
||||
int nRStat ;
|
||||
DBLVECTOR vAng1, vAng2 ;
|
||||
bool bROk = m_pMchMgr->GetCalcAngles( vtTool, vtAux, nRStat, vAng1, vAng2) ;
|
||||
bool bROk = pMachine->GetAngles( vtTool, vtAux, nRStat, vAng1, vAng2) ;
|
||||
pMachine->SetPrevAngA( NAN) ;
|
||||
if ( ! bROk || nRStat == 0)
|
||||
return false ;
|
||||
if ( abs( nRStat) == 1) {
|
||||
// se primo movimento
|
||||
if ( bFirst) {
|
||||
// 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]) ;
|
||||
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
|
||||
pMachine->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
|
||||
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
pMachine->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
}
|
||||
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente, limitandolo alla corsa
|
||||
if ( nRStat < 0 && vAng1.size() >= 1) {
|
||||
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
|
||||
// ignoro gli assi bloccati
|
||||
if ( m_pMchMgr->IsKinematicRotAxisBlocked( i))
|
||||
if ( pMachine->IsKinematicRotAxisBlocked( i))
|
||||
continue ;
|
||||
// assegno il precedente ed esco
|
||||
vAng1[i] = vAxRotPrec[i] ;
|
||||
m_pMchMgr->LimitAngleToStroke( i, vAng1[i]) ;
|
||||
pMachine->LimitAngleToStroke( i, vAng1[i]) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@@ -2389,19 +2400,19 @@ Operation::CalculateMcentRotAxesValues( bool bFirst, const Vector3d& vtTool, con
|
||||
// per movimenti successivi
|
||||
else {
|
||||
// scelgo gli angoli più vicini, per continuità non applico offset per stare nelle corse
|
||||
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
|
||||
if ( bRotContOnNext)
|
||||
vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ;
|
||||
else
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
|
||||
pMachine->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
|
||||
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
pMachine->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
}
|
||||
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente
|
||||
if ( nRStat < 0 && vAng1.size() >= 1) {
|
||||
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
|
||||
// ignoro gli assi bloccati
|
||||
if ( m_pMchMgr->IsKinematicRotAxisBlocked( i))
|
||||
if ( pMachine->IsKinematicRotAxisBlocked( i))
|
||||
continue ;
|
||||
// assegno il precedente ed esco
|
||||
vAng1[i] = vAxRotPrec[i] ;
|
||||
@@ -2416,23 +2427,23 @@ Operation::CalculateMcentRotAxesValues( bool bFirst, const Vector3d& vtTool, con
|
||||
// se primo movimento
|
||||
if ( bFirst) {
|
||||
// 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]) ;
|
||||
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
|
||||
pMachine->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
|
||||
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ;
|
||||
pMachine->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
pMachine->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ;
|
||||
if ( abs( vAng2[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
|
||||
pMachine->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
|
||||
}
|
||||
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente, limitandolo alla corsa
|
||||
if ( nRStat < 0 && vAng1.size() >= 1) {
|
||||
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
|
||||
// ignoro gli assi bloccati
|
||||
if ( m_pMchMgr->IsKinematicRotAxisBlocked( i))
|
||||
if ( pMachine->IsKinematicRotAxisBlocked( i))
|
||||
continue ;
|
||||
// assegno il precedente ed esco
|
||||
vAng1[i] = vAxRotPrec[i] ;
|
||||
m_pMchMgr->LimitAngleToStroke( i, vAng1[i]) ;
|
||||
pMachine->LimitAngleToStroke( i, vAng1[i]) ;
|
||||
vAng2[i] = vAng1[i] ;
|
||||
break ;
|
||||
}
|
||||
@@ -2440,25 +2451,25 @@ Operation::CalculateMcentRotAxesValues( bool bFirst, const Vector3d& vtTool, con
|
||||
}
|
||||
else {
|
||||
// scelgo gli angoli più vicini, per continuità non applico offset per stare nelle corse
|
||||
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
|
||||
if ( bRotContOnNext)
|
||||
vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ;
|
||||
else
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
|
||||
pMachine->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
|
||||
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
pMachine->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
if ( bRotContOnNext)
|
||||
vAng2[i] = AngleNearAngle( vAng2[i], vAxRotPrec[i]) ;
|
||||
else
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ;
|
||||
pMachine->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ;
|
||||
if ( abs( vAng2[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
|
||||
pMachine->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
|
||||
}
|
||||
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente
|
||||
if ( nRStat < 0 && vAng1.size() >= 1) {
|
||||
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
|
||||
// ignoro gli assi bloccati
|
||||
if ( m_pMchMgr->IsKinematicRotAxisBlocked( i))
|
||||
if ( pMachine->IsKinematicRotAxisBlocked( i))
|
||||
continue ;
|
||||
// assegno il precedente ed esco
|
||||
vAng1[i] = vAxRotPrec[i] ;
|
||||
@@ -2467,32 +2478,33 @@ Operation::CalculateMcentRotAxesValues( bool bFirst, const Vector3d& vtTool, con
|
||||
}
|
||||
}
|
||||
// verifico che le soluzioni siano nelle corse
|
||||
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
|
||||
if ( ! m_pMchMgr->VerifyAngleOutstroke( i, vAng1[i]))
|
||||
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
|
||||
if ( ! pMachine->VerifyAngleOutstroke( i, vAng1[i]))
|
||||
bAng1 = false ;
|
||||
if ( ! m_pMchMgr->VerifyAngleOutstroke( i, vAng2[i]))
|
||||
if ( ! pMachine->VerifyAngleOutstroke( i, vAng2[i]))
|
||||
bAng2 = false ;
|
||||
}
|
||||
}
|
||||
// scelgo la soluzione più vicina alla precedente
|
||||
double dDelta1 = 0 ;
|
||||
double dDelta2 = 0 ;
|
||||
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vAng1) ; ++ i) {
|
||||
// ignoro gli assi bloccati
|
||||
if ( m_pMchMgr->IsKinematicRotAxisBlocked( i))
|
||||
if ( pMachine->IsKinematicRotAxisBlocked( i))
|
||||
continue ;
|
||||
// calcolo i delta asse con eventuale peso
|
||||
bool bFirst = ( i == 0) ;
|
||||
dDelta1 += abs( vAng1[i] - vAxRotPrec[i]) * ( bFirst ? m_pMchMgr->GetCalcRot1W() : 1) ;
|
||||
dDelta2 += abs( vAng2[i] - vAxRotPrec[i]) * ( bFirst ? m_pMchMgr->GetCalcRot1W() : 1) ;
|
||||
dDelta1 += abs( vAng1[i] - vAxRotPrec[i]) * ( bFirst ? pMachine->GetCurrRot1W() : 1) ;
|
||||
dDelta2 += abs( vAng2[i] - vAxRotPrec[i]) * ( bFirst ? pMachine->GetCurrRot1W() : 1) ;
|
||||
}
|
||||
if ( bAng2 && ( dDelta2 < dDelta1 - EPS_ANG_SMALL || ! bAng1))
|
||||
if ( bAng2 && ( dDelta2 < dDelta1 - 10 * EPS_ANG_SMALL || ! bAng1))
|
||||
swap( vAng1, vAng2) ;
|
||||
// se imposto limite su variazione di secondo asse rotante
|
||||
if ( ( m_pMchMgr->GetCalcMaxDeltaR2OnFirst() || ! bFirst) && dMaxDeltaR2 > EPS_ANG_SMALL && vAng1.size() >= 2) {
|
||||
double dR2Diff1 = vAng1[1] - vAxRotPrec[1] ;
|
||||
double dR2Diff2 = vAng2[1] - vAxRotPrec[1] ;
|
||||
if ( abs( dR2Diff1) > abs( dR2Diff2) && abs( dR2Diff1) > dMaxDeltaR2)
|
||||
if ( ( pMachine->GetCurrCalcMaxDeltaR2OnFirst() || ! bFirst) && dMaxDeltaR2 > EPS_ANG_SMALL && vAng1.size() >= 2) {
|
||||
double dR2Diff1 = abs( vAng1[1] - vAxRotPrec[1]) ;
|
||||
double dR2Diff2 = abs( vAng2[1] - vAxRotPrec[1]) ;
|
||||
if ( dR2Diff1 > dR2Diff2 + 10 * EPS_ANG_SMALL &&
|
||||
dR2Diff1 > dMaxDeltaR2 && ( dR2Diff2 < dMaxDeltaR2 || dR2Diff2 < dR2Diff1 - dMaxDeltaR2))
|
||||
swap( vAng1, vAng2) ;
|
||||
}
|
||||
}
|
||||
@@ -3407,7 +3419,8 @@ Operation::AdjustStartEndMovementsStd( bool bVerifyPreviousLink)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::MoveHeadFromHomeToMach( bool bCurrMain, const string& sToolName, const string& sHeadName, int nExitNbr, int nStartZMax)
|
||||
Operation::MoveHeadFromHomeToMach( bool bCurrMain, const string& sToolName, const string& sHeadName, int nExitNbr, int nStartZMax,
|
||||
int nOtherLinkType)
|
||||
{
|
||||
// verifico gestore delle lavorazioni e operazione
|
||||
if ( m_pMchMgr == nullptr)
|
||||
@@ -3422,7 +3435,7 @@ Operation::MoveHeadFromHomeToMach( bool bCurrMain, const string& sToolName, cons
|
||||
if ( ! AdjustOneStartEndMovement( GetFirstFullToolpath( bCurrMain), GDB_ID_NULL, nullptr, vAxVal, 0, true))
|
||||
return false ;
|
||||
// eseguo collegamento speciale
|
||||
if ( ! ManageSpecialLink( nullptr, GDB_ID_NULL, false, this, GDB_ID_NULL, bCurrMain, nStartZMax))
|
||||
if ( ! ManageSpecialLink( nullptr, GDB_ID_NULL, false, this, GDB_ID_NULL, bCurrMain, nStartZMax, nOtherLinkType))
|
||||
return false ;
|
||||
|
||||
// riporto l'utensile corrente come originale
|
||||
@@ -3437,7 +3450,7 @@ bool
|
||||
Operation::MoveHeadFromMachToMach( Operation* pPrevOpe,
|
||||
bool bPrevMain, const string& sPrevToolName, const string& sPrevHeadName, int nPrevExitNbr,
|
||||
bool bCurrMain, const string& sCurrToolName, const string& sCurrHeadName, int nCurrExitNbr,
|
||||
bool bToolChangeNeeded, int nStartZMax)
|
||||
bool bToolChangeNeeded, int nStartZMax, int nOtherLinkType, int nOtherLinkType1)
|
||||
{
|
||||
// verifico gestore delle lavorazioni e operazione precedente
|
||||
if ( m_pMchMgr == nullptr || pPrevOpe == nullptr)
|
||||
@@ -3463,7 +3476,7 @@ Operation::MoveHeadFromMachToMach( Operation* pPrevOpe,
|
||||
if ( ! AdjustOneStartEndMovement( GetFirstFullToolpath( bCurrMain), GDB_ID_NULL, pPrevOpe, vAxVal, dPrevOffsX, false))
|
||||
return false ;
|
||||
// gestione collegamento speciale
|
||||
if ( ! ManageSpecialLink( pPrevOpe, GDB_ID_NULL, bPrevMain, this, GDB_ID_NULL, bCurrMain, nStartZMax))
|
||||
if ( ! ManageSpecialLink( pPrevOpe, GDB_ID_NULL, bPrevMain, this, GDB_ID_NULL, bCurrMain, nStartZMax, nOtherLinkType))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -3471,12 +3484,12 @@ Operation::MoveHeadFromMachToMach( Operation* pPrevOpe,
|
||||
else {
|
||||
// imposto la lavorazione precedente come corrente ed effettuo collegamento
|
||||
m_pMchMgr->SetCurrMachining( pPrevOpe->GetOwner()) ;
|
||||
if ( ! MoveHeadFromMachToHome( pPrevOpe, bPrevMain, sPrevToolName, sPrevHeadName, nPrevExitNbr, nStartZMax))
|
||||
if ( ! MoveHeadFromMachToHome( pPrevOpe, bPrevMain, sPrevToolName, sPrevHeadName, nPrevExitNbr, nStartZMax, nOtherLinkType))
|
||||
return false ;
|
||||
|
||||
// ripristino la lavorazione corrente ed effettuo collegamento
|
||||
m_pMchMgr->SetCurrMachining( GetOwner()) ;
|
||||
if ( ! MoveHeadFromHomeToMach( bCurrMain, sCurrToolName, sCurrHeadName, nCurrExitNbr, nStartZMax))
|
||||
if ( ! MoveHeadFromHomeToMach( bCurrMain, sCurrToolName, sCurrHeadName, nCurrExitNbr, nStartZMax, nOtherLinkType1))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -3490,7 +3503,7 @@ Operation::MoveHeadFromMachToMach( Operation* pPrevOpe,
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::MoveHeadFromMachToHome( Operation* pPrevOpe, bool bPrevMain, const string& sPrevToolName, const string& sPrevHeadName, int nPrevExitNbr,
|
||||
int nStartZMax)
|
||||
int nStartZMax, int nOtherLinkType)
|
||||
{
|
||||
// verifico gestore delle lavorazioni e operazione precedente
|
||||
if ( m_pMchMgr == nullptr || pPrevOpe == nullptr)
|
||||
@@ -3506,7 +3519,7 @@ Operation::MoveHeadFromMachToHome( Operation* pPrevOpe, bool bPrevMain, const st
|
||||
return false ;
|
||||
}
|
||||
// eventuale rilascio utensile speciale di lavorazione precedente
|
||||
if ( ! pPrevOpe->ManageSpecialLink( pPrevOpe, GDB_ID_NULL, bPrevMain, nullptr, GDB_ID_NULL, false, nStartZMax))
|
||||
if ( ! pPrevOpe->ManageSpecialLink( pPrevOpe, GDB_ID_NULL, bPrevMain, nullptr, GDB_ID_NULL, false, nStartZMax, nOtherLinkType))
|
||||
return false ;
|
||||
|
||||
// riporto l'utensile corrente come originale
|
||||
@@ -3554,10 +3567,10 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
|
||||
if ( sPrevTool.empty() || NeedPrevHome()) {
|
||||
// -->! la lavorazione corrente è per forza in doppio !<--
|
||||
// Dalla sua posizione di Home porto la Testa Main sul percorso Main corrente
|
||||
if ( ! MoveHeadFromHomeToMach( true, GetToolName(), GetHeadName(), GetExitNbr(), nStartZMax))
|
||||
if ( ! MoveHeadFromHomeToMach( true, GetToolName(), GetHeadName(), GetExitNbr(), nStartZMax, LINK_HOME_TO_MACH))
|
||||
return false ;
|
||||
// Dalla sua posizione di Home porto da Testa Double sul percorso Double corrente
|
||||
if ( ! MoveHeadFromHomeToMach( false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, nStartZMax))
|
||||
if ( ! MoveHeadFromHomeToMach( false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, nStartZMax, LINK_HOME_TO_MACH))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
@@ -3568,10 +3581,11 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
|
||||
if ( ! ToolChangeNeeded( *pPrevOpe, true, *this, true) && nStartZMax == 0) {
|
||||
// Come prima cosa sposto la testa Main della prima lavorazione sul percorso Main della lavorazione corrente
|
||||
if ( ! MoveHeadFromMachToMach( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr,
|
||||
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax))
|
||||
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax,
|
||||
LINK_HOME_TO_MACH, LINK_NULL))
|
||||
return false ;
|
||||
// Successivamente porto la testa Double dalla sua Home alla lavorazione corrente ( in doppio) sul percorso
|
||||
if ( ! MoveHeadFromHomeToMach( false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, nStartZMax))
|
||||
if ( ! MoveHeadFromHomeToMach( false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, nStartZMax, LINK_MACH_TO_MACH))
|
||||
return false ;
|
||||
}
|
||||
// -->! 2) Verifico se l'unico utensile della lavorazione precedente ( in quanto singola) è compatibile
|
||||
@@ -3579,10 +3593,11 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
|
||||
else if ( ! ToolChangeNeeded( *pPrevOpe, true, *this, false) && nStartZMax == 0) {
|
||||
// Come prima cosa sposto la testa Main della lavorazione precedente sul percorso Double della lavorazione corrente
|
||||
if ( ! MoveHeadFromMachToMach( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr,
|
||||
false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, false, nStartZMax))
|
||||
false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, false, nStartZMax,
|
||||
LINK_HOME_TO_MACH, LINK_NULL))
|
||||
return false ;
|
||||
// Successivamente porto la testa Main dalla sua Home alla lavorazione corrente ( in doppio) sul percorso
|
||||
if ( ! MoveHeadFromHomeToMach( true, GetToolName(), GetHeadName(), GetExitNbr(), nStartZMax))
|
||||
if ( ! MoveHeadFromHomeToMach( true, GetToolName(), GetHeadName(), GetExitNbr(), nStartZMax, LINK_MACH_TO_MACH))
|
||||
return false ;
|
||||
}
|
||||
// -->! 3) In questo caso l'unico utensile della lavorazione precedente ( in quanto singola) non è compatibile
|
||||
@@ -3590,10 +3605,11 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
|
||||
else {
|
||||
// Porto la Testa Main sul percorso Main corrente
|
||||
if ( ! MoveHeadFromMachToMach( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr,
|
||||
true, GetToolName(), GetHeadName(), GetExitNbr(), true, nStartZMax))
|
||||
true, GetToolName(), GetHeadName(), GetExitNbr(), true, nStartZMax,
|
||||
LINK_NULL, LINK_HOME_TO_MACH))
|
||||
return false ;
|
||||
// Dalla sua posizione di Home porto da Testa Double sul percorso Double corrente
|
||||
if ( ! MoveHeadFromHomeToMach( false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, nStartZMax))
|
||||
if ( ! MoveHeadFromHomeToMach( false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, nStartZMax, LINK_HOME_TO_MACH))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -3603,33 +3619,36 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
|
||||
// con l'Utensile presente sul percorso Main della lavorazione corrente ( in quanto singola) !<--
|
||||
if ( ! ToolChangeNeeded( *pPrevOpe, true, *this, true) && nStartZMax == 0) {
|
||||
// Come prima cosa sposto la testa Double della lavorazione precedente ( in doppio) in Home
|
||||
if ( ! MoveHeadFromMachToHome( pPrevOpe, false, sPrevDblTool, sPrevDblHead, nPrevDblExitNbr, nStartZMax))
|
||||
if ( ! MoveHeadFromMachToHome( pPrevOpe, false, sPrevDblTool, sPrevDblHead, nPrevDblExitNbr, nStartZMax, LINK_MACH_TO_MACH))
|
||||
return false ;
|
||||
// Sposto al testa Main della lavorazione precedente sul percorso Main corrente
|
||||
if ( ! MoveHeadFromMachToMach( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr,
|
||||
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax))
|
||||
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax,
|
||||
LINK_MACH_TO_HOME, LINK_NULL))
|
||||
return false ;
|
||||
}
|
||||
// -->! 2) Verifico se l'utensile secondario della lavorazione precedente ( in doppio) è compatibile
|
||||
// con l'Utensile presente sul percorso Double della lavorazione corrente ( in quanto singola) !<--
|
||||
else if ( ! ToolChangeNeeded( *pPrevOpe, false, *this, true) && nStartZMax == 0) {
|
||||
// Come prima cosa sposto la testa Main della lavorazione precedente ( in doppio) in Home
|
||||
if ( ! MoveHeadFromMachToHome( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr, nStartZMax))
|
||||
if ( ! MoveHeadFromMachToHome( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr, nStartZMax, LINK_MACH_TO_MACH))
|
||||
return false ;
|
||||
// Sposto al testa Double della lavorazione precedente sul percorso corrente
|
||||
if ( ! MoveHeadFromMachToMach( pPrevOpe, false, sPrevDblTool, sPrevDblHead, nPrevDblExitNbr,
|
||||
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax))
|
||||
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax,
|
||||
LINK_MACH_TO_HOME, LINK_NULL))
|
||||
return false ;
|
||||
}
|
||||
// -->! 3) In questo caso l'unico utensile della lavorazione corrente ( in quanto singola) non è compatibile
|
||||
// con nessun utensile della lavorazione precedente ( in doppio) !<--
|
||||
else {
|
||||
// Come prima cosa sposto la testa Double della lavorazione precedente ( in doppio) in Home
|
||||
if ( ! MoveHeadFromMachToHome( pPrevOpe, false, sPrevDblTool, sPrevDblHead, nPrevDblExitNbr, nStartZMax))
|
||||
if ( ! MoveHeadFromMachToHome( pPrevOpe, false, sPrevDblTool, sPrevDblHead, nPrevDblExitNbr, nStartZMax, LINK_MACH_TO_HOME))
|
||||
return false ;
|
||||
// Sposto la testa Main della lavorazione precedente sul percorso corrente
|
||||
if ( ! MoveHeadFromMachToMach( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr,
|
||||
true, GetToolName(), GetHeadName(), GetExitNbr(), true, nStartZMax))
|
||||
true, GetToolName(), GetHeadName(), GetExitNbr(), true, nStartZMax,
|
||||
LINK_MACH_TO_HOME, LINK_NULL))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -3639,22 +3658,26 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
|
||||
if ( ! ToolChangeNeeded( *pPrevOpe, true, *this, true) && ! ToolChangeNeeded( *pPrevOpe, false, *this, false) && nStartZMax == 0) {
|
||||
// Porto la testa Main dalla lavorazione precedente alla lavorazione corrente
|
||||
if ( ! MoveHeadFromMachToMach( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr,
|
||||
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax))
|
||||
true, GetToolName(), GetHeadName(), GetExitNbr(), false, nStartZMax,
|
||||
LINK_MACH_TO_MACH, LINK_NULL))
|
||||
return false ;
|
||||
// Porto la testa double delle lavorazione precedente alla lavorazine corrente
|
||||
if ( ! MoveHeadFromMachToMach( pPrevOpe, false, sPrevDblTool, sPrevDblHead, nPrevDblExitNbr,
|
||||
false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, false, nStartZMax))
|
||||
false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, false, nStartZMax,
|
||||
LINK_MACH_TO_MACH, LINK_NULL))
|
||||
return false ;
|
||||
}
|
||||
// -->! 2) Per tutto il resto porto sempre in Home per sicurezza passando da una lavorazione all'altra !<--
|
||||
else {
|
||||
// Porto la testa Main dalla lavorazione precedente alla lavorazione corrente
|
||||
if ( ! MoveHeadFromMachToMach( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr,
|
||||
true, GetToolName(), GetHeadName(), GetExitNbr(), true, nStartZMax))
|
||||
true, GetToolName(), GetHeadName(), GetExitNbr(), true, nStartZMax,
|
||||
LINK_MACH_TO_HOME, LINK_HOME_TO_MACH))
|
||||
return false ;
|
||||
// Porto la testa Double delle lavorazione precedente alla lavorazine corrente
|
||||
if ( ! MoveHeadFromMachToMach( pPrevOpe, false, sPrevDblTool, sPrevDblHead, nPrevDblExitNbr,
|
||||
false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, true, nStartZMax))
|
||||
false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, true, nStartZMax,
|
||||
LINK_MACH_TO_HOME, LINK_HOME_TO_MACH))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -3673,7 +3696,7 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
|
||||
DBLVECTOR vAxVal ;
|
||||
bOk = bOk && GetClPathFinalAxesValues( nPrevCLPathId, false, vAxVal) ;
|
||||
bOk = bOk && AdjustOneStartEndMovement( nCLPathId, nPrevCLPathId, nullptr, vAxVal, 0, false) ;
|
||||
bOk = bOk && ManageSpecialLink( this, nPrevCLPathId, true, this, nCLPathId, true, nStartZMax) ;
|
||||
bOk = bOk && ManageSpecialLink( this, nPrevCLPathId, true, this, nCLPathId, true, nStartZMax, LINK_NULL) ;
|
||||
// passo al successivo
|
||||
nPrevCLPathId = nCLPathId ;
|
||||
nCLPathId = GetNextFullToolpath( nCLPathId) ;
|
||||
@@ -3705,13 +3728,13 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
|
||||
// Utensile Main
|
||||
bOk = bOk && GetClPathFinalAxesValues( nPrevCLPathId, false, vAxVal) ;
|
||||
bOk = bOk && AdjustOneStartEndMovement( nCLPathId, nPrevCLPathId, nullptr, vAxVal, 0, false) ;
|
||||
bOk = bOk && ManageSpecialLink( this, nPrevCLPathId, true, this, nCLPathId, true, nStartZMax) ;
|
||||
bOk = bOk && ManageSpecialLink( this, nPrevCLPathId, true, this, nCLPathId, true, nStartZMax, LINK_MACH_TO_HOME) ;
|
||||
// Utensile Double
|
||||
DBLVECTOR vAxDblVal ;
|
||||
bOk = bOk && m_pMchMgr->SetCalcTool( sCurrDblTool, sCurrDblHead, nCurrDblExitNbr) ;
|
||||
bOk = bOk && GetClPathFinalAxesValues( nPrevDBLPathId, false, vAxDblVal) ;
|
||||
bOk = bOk && AdjustOneStartEndMovement( nDBLPathId, nPrevDBLPathId, nullptr, vAxDblVal, 0, false) ;
|
||||
bOk = bOk && ManageSpecialLink( this, nPrevDBLPathId, false, this, nDBLPathId, false, nStartZMax) ;
|
||||
bOk = bOk && ManageSpecialLink( this, nPrevDBLPathId, false, this, nDBLPathId, false, nStartZMax, LINK_MACH_TO_HOME) ;
|
||||
bOk = bOk && m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()) ;
|
||||
// passo al successivo
|
||||
nPrevCLPathId = nCLPathId ;
|
||||
@@ -3724,12 +3747,12 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
|
||||
// per utensile Main
|
||||
DBLVECTOR vAxVal ;
|
||||
bOk = bOk && AddRise( vAxVal) ;
|
||||
bOk = bOk && ManageSpecialLink( this, GDB_ID_NULL, true, nullptr, GDB_ID_NULL, true, 0) ;
|
||||
bOk = bOk && ManageSpecialLink( this, GDB_ID_NULL, true, nullptr, GDB_ID_NULL, true, 0, LINK_NULL) ;
|
||||
// per utensile Double
|
||||
DBLVECTOR vAxDblVal ;
|
||||
bOk = bOk && m_pMchMgr->SetCalcTool( sCurrDblTool, sCurrDblHead, nCurrDblExitNbr) ;
|
||||
bOk = bOk && AddRise( vAxDblVal, NAN, GDB_ID_NULL, false) ;
|
||||
bOk = bOk && ManageSpecialLink( this, GDB_ID_NULL, false, nullptr, GDB_ID_NULL, false, 0) ;
|
||||
bOk = bOk && ManageSpecialLink( this, GDB_ID_NULL, false, nullptr, GDB_ID_NULL, false, 0, LINK_NULL) ;
|
||||
bOk = bOk && m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()) ;
|
||||
// -->! se ultima operazione o la successiva lo richiede, vado in Home !<--
|
||||
int nNextOpId = m_pMchMgr->GetNextActiveOperation( m_nOwnerId) ;
|
||||
@@ -3896,7 +3919,7 @@ Operation::AdjustStartEndMovementsNew( void)
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::ManageSpecialLink( Operation* pPrevOpe, int nPrevClPathId, bool bPrevMain, Operation* pNextOpe, int nNextClPathId, bool bNextMain,
|
||||
int nStartZmax)
|
||||
int nStartZmax, int nOtherLinkType)
|
||||
{
|
||||
// controlli
|
||||
if ( pPrevOpe == nullptr && pNextOpe == nullptr)
|
||||
@@ -3939,7 +3962,7 @@ Operation::ManageSpecialLink( Operation* pPrevOpe, int nPrevClPathId, bool bPrev
|
||||
return false ;
|
||||
|
||||
// chiamo funzione script OnSpecialRapidMove per avere posizioni di movimento
|
||||
bool bOk = SpecialLink( vNeatAxSta, vNeatAxEnd, nLinkType, pPrevOpe, bPrevMain, pNextOpe, bNextMain, nStartZmax) ;
|
||||
bool bOk = SpecialLink( vNeatAxSta, vNeatAxEnd, nLinkType, pPrevOpe, bPrevMain, pNextOpe, bNextMain, nStartZmax, nOtherLinkType) ;
|
||||
|
||||
// in caso di errore eseguo inserimento con segnalazione di errore
|
||||
if ( ! bOk) {
|
||||
@@ -4943,6 +4966,10 @@ Operation::AddRobotClimb( int nEntId, double dDeltaZ)
|
||||
int nNewEntId = m_pGeomDB->Copy( nEntId, GDB_ID_NULL, nEntId, GDB_BEFORE) ;
|
||||
if ( nNewEntId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// aggiorno il CamData
|
||||
pCdEnt = GetCamData( m_pGeomDB->GetUserObj( nNewEntId)) ;
|
||||
if ( pCdEnt == nullptr)
|
||||
return false ;
|
||||
// modifico quella originale (è la prima del percorso)
|
||||
m_pGeomDB->SetName( nNewEntId, MCH_CL_CLIMB) ;
|
||||
m_pGeomDB->RemoveInfo( nNewEntId, KEY_CL_DOUBLE) ;
|
||||
@@ -4954,7 +4981,7 @@ Operation::AddRobotClimb( int nEntId, double dDeltaZ)
|
||||
double dStep = dNewDeltaZ / nStep ;
|
||||
for ( int i = 1 ; i < nStep ; ++ i) {
|
||||
// copio l'entità
|
||||
int nNewId = m_pGeomDB->Copy( nEntId, GDB_ID_NULL, nEntId, GDB_AFTER) ;
|
||||
int nNewId = m_pGeomDB->Copy( nNewEntId, GDB_ID_NULL, nNewEntId, GDB_AFTER) ;
|
||||
if ( nNewId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// calcolo la posizione sopra il punto a Zmax
|
||||
@@ -5297,7 +5324,7 @@ Operation::GetUserNotesZmax( void) const
|
||||
string sUserNotes ;
|
||||
if ( m_pMchMgr != nullptr && m_pMchMgr->GetMachiningParam( MPA_USERNOTES, sUserNotes)) {
|
||||
int nVal ;
|
||||
if ( FromString( ExtractInfo( sUserNotes, "StartZmax="), nVal))
|
||||
if ( GetValInNotes( sUserNotes, UN_STARTZMAX, nVal))
|
||||
return nVal ;
|
||||
}
|
||||
return 0 ;
|
||||
@@ -5926,23 +5953,24 @@ Operation::SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
|
||||
bool
|
||||
Operation::SpecialLink( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nLinkType,
|
||||
const Operation* pPrevOpe, bool bPrevMain, const Operation* pNextOpe, bool bNextMain,
|
||||
int nStartZMax)
|
||||
int nStartZMax, int nOtherLinkType)
|
||||
{
|
||||
// recupero la macchina corrente
|
||||
Machine* pMch = ( m_pMchMgr != nullptr ? m_pMchMgr->GetCurrMachine() : nullptr) ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// costanti
|
||||
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
|
||||
static const string EVAR_PREVMCHID = ".PREVMCHID" ; // IN (int) identificativo lavorazione precedente
|
||||
static const string EVAR_PREVPHASE = ".PREVPHASE" ; // IN (int) indice fase della lavorazione precedente
|
||||
static const string EVAR_PREVMAIN = ".PREVMAIN" ; // IN (bool) flag lavorazione principale o double precedente
|
||||
static const string EVAR_NEXTMCHID = ".NEXTMCHID" ; // IN (int) identificativo lavorazione successiva
|
||||
static const string EVAR_NEXTPHASE = ".NEXTPHASE" ; // IN (int) indice fase della lavorazione successiva
|
||||
static const string EVAR_NEXTMAIN = ".NEXTMAIN" ; // IN (bool) flag lavorazione principale o double successiva
|
||||
static const string EVAR_STARTZMAX = ".STARTZMAX" ; // IN (int) identificativo StartZMax
|
||||
static const string EVAR_LINKTYPE = ".LINKTYPE" ; // IN (int) codice tipo collegamento (1=Inizio, 2=Fine, 3=FinePrec+InizioSucc)
|
||||
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
|
||||
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
|
||||
static const string EVAR_PREVMCHID = ".PREVMCHID" ; // IN (int) identificativo lavorazione precedente
|
||||
static const string EVAR_PREVPHASE = ".PREVPHASE" ; // IN (int) indice fase della lavorazione precedente
|
||||
static const string EVAR_PREVMAIN = ".PREVMAIN" ; // IN (bool) flag lavorazione principale o double precedente
|
||||
static const string EVAR_NEXTMCHID = ".NEXTMCHID" ; // IN (int) identificativo lavorazione successiva
|
||||
static const string EVAR_NEXTPHASE = ".NEXTPHASE" ; // IN (int) indice fase della lavorazione successiva
|
||||
static const string EVAR_NEXTMAIN = ".NEXTMAIN" ; // IN (bool) flag lavorazione principale o double successiva
|
||||
static const string EVAR_STARTZMAX = ".STARTZMAX" ; // IN (int) identificativo StartZMax
|
||||
static const string EVAR_LINKTYPE = ".LINKTYPE" ; // IN (int) codice tipo collegamento (1=Inizio, 2=Fine, 3=FinePrec+InizioSucc)
|
||||
static const string EVAR_OTHERLINKTYPE = ".OTHERLINKTYPE" ; // IN (int) codice tipo collegamento per altra lavorazione (0=Non Presente, 1=Inizio, 2=Fine, 3=FinePrec+InizioSucc)
|
||||
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
|
||||
static const string ON_SPECIAL_LINK = "OnSpecialLink" ;
|
||||
|
||||
// se la funzione non è definita, esco
|
||||
@@ -5967,14 +5995,18 @@ Operation::SpecialLink( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_EXIT, nExitNbr) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TCPOS, sTcPos) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PREVMCHID, ( pPrevOpe != nullptr ? pPrevOpe->GetOwner() : GDB_ID_NULL)) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PREVMAIN, ( bPrevMain ? MCH_CL : MCH_DBL)) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PREVMAIN, ( pPrevOpe != nullptr ? ( bPrevMain ? MCH_CL : MCH_DBL) : MCH_HOME)) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PREVPHASE, ( pPrevOpe != nullptr ? pPrevOpe->m_nPhase : 0)) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_NEXTMCHID, ( pNextOpe != nullptr ? pNextOpe->GetOwner() : GDB_ID_NULL)) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_NEXTPHASE, ( pNextOpe != nullptr ? pNextOpe->m_nPhase : 0)) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_NEXTMAIN, ( bNextMain ? MCH_CL : MCH_DBL)) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_NEXTMAIN, ( pNextOpe != nullptr ? ( bNextMain ? MCH_CL : MCH_DBL) : MCH_HOME)) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTZMAX, nStartZMax) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_PHASE, m_nPhase) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_LINKTYPE, nLinkType) ;
|
||||
if ( nOtherLinkType == LINK_NULL)
|
||||
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR + EVAR_OTHERLINKTYPE) ;
|
||||
else
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OTHERLINKTYPE, nOtherLinkType) ;
|
||||
// valore degli assi
|
||||
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
|
||||
int nNumAxes = ssize( vAxStart) ;
|
||||
|
||||
+6
-5
@@ -240,16 +240,17 @@ class Operation : public IUserObj
|
||||
bool AdjustStartEndMovementsStd( bool bVerifyPreviousLink) ;
|
||||
bool AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOpe, const DBLVECTOR& vAxPrev, double dPrevOffsX, bool bMaxZ) ;
|
||||
bool AdjustStartEndMovementsNew( void) ;
|
||||
bool MoveHeadFromHomeToMach( bool bMain, const std::string& sToolName, const std::string& sHeadName, int nExitNbr, int nStartZMax) ;
|
||||
bool MoveHeadFromHomeToMach( bool bMain, const std::string& sToolName, const std::string& sHeadName, int nExitNbr, int nStartZMax,
|
||||
int nOtherLinkType) ;
|
||||
bool MoveHeadFromMachToMach( Operation* pPrevOpe,
|
||||
bool bPrevMain, const std::string& sPrevToolName, const std::string& sPrevHeadName, int nPrevExitNbr,
|
||||
bool bCurrMain, const std::string& sCurrToolName, const std::string& sCurrHeadName, int nCurrExitNbr,
|
||||
bool bToolChange, int nStartZMax) ;
|
||||
bool bToolChange, int nStartZMax, int nOtherLinkType, int nOtherLinkType1) ;
|
||||
bool MoveHeadFromMachToHome( Operation* pPrevOpe, bool bCurrMain, const std::string& sCurrToolName, const std::string& sCurrHeadName, int nCurrExitNbr,
|
||||
int nStartZMax) ;
|
||||
int nStartZMax, int nOtherLinkType) ;
|
||||
bool ManageDoubleOperNew( Operation* pPrevOpe) ;
|
||||
bool ManageSpecialLink( Operation* pPrevOpe, int nPrevClPathId, bool bPrevMain, Operation* pNextOpe, int nNextClPathId, bool bNextMain,
|
||||
int nStartZMax) ;
|
||||
int nStartZMax, int nOtherLinkType = LINK_NULL) ;
|
||||
bool ToolChangeNeeded( const Operation& Ope1, bool bMain1, const Operation& Ope2, bool bMain2) const ;
|
||||
bool AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, bool bMain = true,
|
||||
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "", bool bFirst = true) ;
|
||||
@@ -278,7 +279,7 @@ class Operation : public IUserObj
|
||||
bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, DBLVECTOR& vAxNew, bool& bModif) ;
|
||||
bool SpecialLink( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nLinkType,
|
||||
const Operation* pPrevOpe, bool bPrevMain, const Operation* pNextOpe, bool bNextMain,
|
||||
int nStartZMax) ;
|
||||
int nStartZMax, int nOtherLinkType = LINK_NULL) ;
|
||||
bool SpecialPrevMachiningOffset( const Operation* pPrevOpe, double& dOffsetX) ;
|
||||
|
||||
protected :
|
||||
|
||||
+18
-2
@@ -115,7 +115,7 @@ PocketingData::Clone( void) const
|
||||
bool
|
||||
PocketingData::CopyFrom( const MachiningData* pMdata)
|
||||
{
|
||||
// è inutile copiare se sorgente coincide con destinazione
|
||||
// è inutile copiare se sorgente coincide con destinazione
|
||||
if ( pMdata == this)
|
||||
return true ;
|
||||
// la sorgente deve essere dello stesso tipo
|
||||
@@ -150,6 +150,8 @@ PocketingData::CopyFrom( const MachiningData* pMdata)
|
||||
m_dLiElev = pSdata->m_dLiElev ;
|
||||
m_nLeadOutType = pSdata->m_nLeadOutType ;
|
||||
m_dLoTang = pSdata->m_dLoTang ;
|
||||
m_dEpicyclesDist = pSdata->m_dEpicyclesDist ;
|
||||
m_dEpicyclesRad = pSdata->m_dEpicyclesRad ;
|
||||
m_sSysNotes = pSdata->m_sSysNotes ;
|
||||
m_sUserNotes = pSdata->m_sUserNotes ;
|
||||
return true ;
|
||||
@@ -194,6 +196,8 @@ PocketingData::SameAs(const MachiningData* pMdata) const
|
||||
abs( m_dLiElev - pSdata->m_dLiElev) < EPS_MACH_LEN_PAR &&
|
||||
m_nLeadOutType == pSdata->m_nLeadOutType &&
|
||||
abs( m_dLoTang - pSdata->m_dLoTang) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dEpicyclesDist - pSdata->m_dEpicyclesDist) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dEpicyclesRad - pSdata->m_dEpicyclesRad) < EPS_MACH_LEN_PAR &&
|
||||
m_sSysNotes == pSdata->m_sSysNotes &&
|
||||
m_sUserNotes == pSdata->m_sUserNotes) ;
|
||||
}
|
||||
@@ -202,7 +206,7 @@ PocketingData::SameAs(const MachiningData* pMdata) const
|
||||
int
|
||||
PocketingData::GetSize( void) const
|
||||
{
|
||||
// in debug verifico validità ultimo campo
|
||||
// in debug verifico validità ultimo campo
|
||||
assert( sPocketingKey[KEY_UUID] == "UUID") ;
|
||||
return KEY_ZZZ ;
|
||||
}
|
||||
@@ -534,6 +538,12 @@ PocketingData::SetParam( int nType, double dVal)
|
||||
case MPA_LOTANG :
|
||||
m_dLoTang = dVal ;
|
||||
return true ;
|
||||
case MPA_EPICYCLESDIST :
|
||||
m_dEpicyclesDist = dVal ;
|
||||
return true ;
|
||||
case MPA_EPICYCLESRAD :
|
||||
m_dEpicyclesRad = dVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
@@ -669,6 +679,12 @@ PocketingData::GetParam( int nType, double& dVal) const
|
||||
case MPA_LOTANG :
|
||||
dVal = m_dLoTang ;
|
||||
return true ;
|
||||
case MPA_EPICYCLESDIST :
|
||||
dVal = m_dEpicyclesDist ;
|
||||
return true ;
|
||||
case MPA_EPICYCLESRAD :
|
||||
dVal = m_dEpicyclesRad ;
|
||||
return true ;
|
||||
}
|
||||
dVal = 0 ;
|
||||
return false ;
|
||||
|
||||
+886
-74
File diff suppressed because it is too large
Load Diff
+15
-5
@@ -33,6 +33,7 @@ struct PathInfoPO {
|
||||
PtrOwner<ICurveComposite> pCrvPath ; // percorso del centro utensile
|
||||
PtrOwner<ICurveComposite> pCrvGlideIn ; // curva per LeadIn a guida
|
||||
PtrOwner<ICurveComposite> pCrvGlideOut ; // curva per LeadOut a guida
|
||||
PtrOwner<ICurveComposite> pCrvZigZagIn ; // curva per LeadIn a ZigZag ( caso speciale)
|
||||
PtrOwner<ICurveComposite> pCrvRet ; // curva di ritorno ( per ora solo caso fori)
|
||||
} ;
|
||||
// tipo percorso
|
||||
@@ -129,12 +130,15 @@ class PocketingNT : public Machining
|
||||
double dRad, double dLen, double& dElev) ;
|
||||
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
|
||||
bool GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) ;
|
||||
bool CalcGeoExtSurfFr( const ISurfFlatRegion* pSfrPock, const Vector3d& vtTool, double dDepth, const ISurfTriMesh* pStmRaw,
|
||||
const SELVECTOR& vGeoSel, ISURFFRPOVECTOR& vSfrGeoExt) ;
|
||||
bool CalcLimitRegion( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrRaw, ISurfFlatRegion* pSfrLimit) ;
|
||||
bool CalcPaths( STEPINFOPOVECTOR& vStepInfo) ;
|
||||
bool CalcRetCurve( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath,
|
||||
const Vector3d& vtTool, bool bHolePocketing, bool bInVsOut, ICurveComposite* pCrvGlide) ;
|
||||
bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dStep, bool bSplitArcs, Point3d& ptPockStart, Point3d& ptPockEnd) ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
double GetRightStartFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
|
||||
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;
|
||||
bool AddEpicycles( ICurveComposite * pCompo, ICurveComposite * pCrv, ICurveComposite * pCrvBound = nullptr) ;
|
||||
@@ -148,16 +152,16 @@ class PocketingNT : public Machining
|
||||
double dElev, double dAppr, bool bSplitArcs) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bSplitArcs) ;
|
||||
bool CalcFirstElevation( const Point3d& ptStart, const Point3d& ptP1, const Vector3d& vtTool,
|
||||
bool CalcFirstElevation( const Point3d& ptP1, const Vector3d& vtTool,
|
||||
const StepInfoPO& currStep, double dSafeZ, double dStep, double& dCurrElev,
|
||||
double& dEscapeElev, Vector3d& vtEscape) const ;
|
||||
bool CalcLastElevation( const Point3d& ptStart, const Point3d& ptP1, const Vector3d& vtTool,
|
||||
bool CalcLastElevation( const Point3d& ptP1, const Vector3d& vtTool,
|
||||
const StepInfoPO& currStep, double dSafeZ, double dStep, double& dCurrElev,
|
||||
double& dEscapeElev, Vector3d& vtEscape) const ;
|
||||
bool CalcLeadInStart( Point3d& ptStart, const Vector3d& vtTool, const ICurveComposite* pCrvPath, Point3d& ptP1) ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
const ISurfFlatRegion* pSfr, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
|
||||
bool bNoneForced, bool bSkipControl) ;
|
||||
const ISurfFlatRegion* pSfr, const ICurveComposite* pRCrv, const ICurveComposite* pRZigZag,
|
||||
bool bAtLeft, bool bSplitArcs, bool bNoneForced, bool bSkipControl) ;
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN, const ISurfFlatRegion* pSfr,
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1) ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
@@ -171,7 +175,13 @@ class PocketingNT : public Machining
|
||||
bool VerifyLeadInHelix( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptCen, double dHelixRad) ;
|
||||
bool VerifyLeadInZigZag( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptPa, const Point3d& ptPb) ;
|
||||
bool VerifyLeadInOutGlide( const ISurfFlatRegion* pSfr, ICurveComposite* pCrvGlide) ;
|
||||
bool AddSpecialLeadInZigZag( const ICurveComposite* pCompoPath, const Point3d& ptStart, const Vector3d& vtTool, int nStep, double dStep) ;
|
||||
bool CalcDistanceFromRawSurface( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist, Vector3d& vtNorm) ;
|
||||
bool VerifyParallelPocketing( int nDouble, const STEPINFOPOVECTOR& vStepInfo) const ;
|
||||
bool CalcDoubleParallelPenultimateStep( int nDouble, int nIdDblS, double dStep, double dLastStep, const Point3d& ptNeatEnd, const Vector3d& vtEnd,
|
||||
const INTVECTOR& vLeadOutId, const ISurfFlatRegion* pSfrLimit, const Vector3d& vtTool,
|
||||
bool bSplitArcs, double dMinFeed) ;
|
||||
double GetDoubleLastStep( void) ;
|
||||
// debug
|
||||
void DebugDrawSfr( const ISurfFlatRegion* pSfr, bool bUniform, int nlayer = GDB_ID_ROOT) ;
|
||||
void DebugDrawLoop( const ICurveComposite* pCrvCompo, int nLayer, bool bUniform) ;
|
||||
|
||||
+16
-2
@@ -398,6 +398,13 @@ Processor::ProcessMachining( int nOpId, int nOpInd)
|
||||
bool
|
||||
Processor::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
|
||||
{
|
||||
// verifico se Path in doppio
|
||||
int nDblPathId = GDB_ID_NULL ;
|
||||
int nDblId = m_pGeomDB->GetFirstNameInGroup( nOpId, MCH_DBL) ;
|
||||
if ( nDblId != GDB_ID_NULL) {
|
||||
string sCLPathName ; m_pGeomDB->GetName( nClPathId, sCLPathName) ;
|
||||
nDblPathId = m_pGeomDB->GetFirstNameInGroup( nDblId, sCLPathName) ;
|
||||
}
|
||||
// Recupero punti di inizio e fine del percorso
|
||||
Point3d ptStart ;
|
||||
m_pGeomDB->GetInfo( nClPathId, KEY_START, ptStart) ;
|
||||
@@ -424,7 +431,7 @@ Processor::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
|
||||
int nAS = 0 ;
|
||||
m_pGeomDB->GetInfo( nClPathId, KEY_AS_TOT, nAS) ;
|
||||
// Emetto inizio percorso di lavoro
|
||||
if ( ! OnPathStart( nClPathId, nClPathInd, nAS, ptStart, ptEnd, vtExtr,
|
||||
if ( ! OnPathStart( nClPathId, nClPathInd, nDblPathId, nAS, ptStart, ptEnd, vtExtr,
|
||||
ptMin, ptMax, vAxMin, vAxMax, dElev, vActiveExit))
|
||||
return false ;
|
||||
|
||||
@@ -963,18 +970,25 @@ Processor::OnMachiningEnd( void)
|
||||
{
|
||||
// chiamo la funzione di fine lavorazione
|
||||
bool bOk = CallOnMachiningEnd() ;
|
||||
// reset eventuale Path in double
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Processor::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
Processor::OnPathStart( int nClPathId, int nClPathInd, int nDblPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
|
||||
{
|
||||
// assegno identificativo e indice percorso di lavorazione
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHIND, nClPathInd) ;
|
||||
// assegno identificativo eventuale percorso in doppio
|
||||
if ( nDblPathId == GDB_ID_NULL)
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DBLPATHID, nDblPathId) ;
|
||||
// assegno numero di dati ausiliari iniziali
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXTOT, nAS) ;
|
||||
// assegno punti iniziale e finale e versore estrusione del percorso originale
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ class Processor
|
||||
bool OnMachiningStart( int nOpId, int nOpInd, double dSpeed, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
|
||||
bool OnMachiningEnd( void) ;
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nDblPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
|
||||
bool OnPathEnd( int nAE) ;
|
||||
|
||||
+7
-6
@@ -208,9 +208,6 @@ SimulatorSP::Start( bool bFirst)
|
||||
// Verifico attrezzaggio
|
||||
if ( ! VerifySetup())
|
||||
bOk = false ;
|
||||
// Recupero il materiale associato alla macchina
|
||||
string sMachIni = m_pMachine->GetMachineDir() + "\\" + m_pMachine->GetMachineName() + ".ini" ;
|
||||
m_sMachineMaterial = GetPrivateProfileStringUtf8( GENERAL_SEC.c_str(), MATERIAL_KEY.c_str(), "", sMachIni.c_str()) ;
|
||||
}
|
||||
|
||||
// Reset utensile, interpolazione e assi correnti
|
||||
@@ -1722,12 +1719,16 @@ SimulatorSP::TraceToolTipMove( int nMoveType)
|
||||
Frame3d frExit ;
|
||||
if ( ! m_pGeomDB->GetGroupGlobFrame( nExitId, frExit))
|
||||
return false ;
|
||||
Point3d ptTip = frExit.Orig() - ( m_sMachineMaterial != "Additive" ? m_dTLen : 0) * frExit.VersZ() ;
|
||||
// determino se tracciare uscita mandrino o punta utensile e aggiusto di conseguenza
|
||||
static const string TRACE_ONEXIT = "OnExit" ;
|
||||
bool bOnExit = false ;
|
||||
m_pGeomDB->GetInfo( m_nTraceGroup, TRACE_ONEXIT, bOnExit) ;
|
||||
Point3d ptTip = frExit.Orig() - ( ! bOnExit ? m_dTLen : 0) * frExit.VersZ() ;
|
||||
// disabilito gestione segnalazione modifiche progetto
|
||||
SetModifiedOff modOff ;
|
||||
// eseguo tracciatura
|
||||
static string TRACE_MOVE = "Move" ;
|
||||
static int TRACE_MAX_LINE = 1000 ;
|
||||
static const string TRACE_MOVE = "Move" ;
|
||||
static const int TRACE_MAX_LINE = 1000 ;
|
||||
if ( m_nCurrTrace == GDB_ID_NULL) {
|
||||
m_nCurrTrace = ExeCreateGeoPoint( nTraceGrpId, ptTip, GDB_ID_ROOT) ;
|
||||
m_pGeomDB->SetInfo( m_nCurrTrace, TRACE_MOVE, nMoveType) ;
|
||||
|
||||
@@ -147,7 +147,6 @@ class SimulatorSP : public ISimulator
|
||||
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
|
||||
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
|
||||
Machine* m_pMachine ; // puntatore alla macchina
|
||||
std::string m_sMachineMaterial ; // nome del materiale associato alla macchina
|
||||
PerformanceCounter* m_pPerfCnt ; // timer per calcolo FPS
|
||||
int m_nStatus ; // stato interno del simulatore (creato, inizializzato, pronto al movimento)
|
||||
double m_dStep ; // lunghezza di riferimento per la velocità di simulazione
|
||||
|
||||
+5
-5
@@ -2278,7 +2278,7 @@ SurfFinishing::AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, cons
|
||||
// calcolo lo ZigZag
|
||||
ICRVCOMPOPOVECTOR vpCrvs ;
|
||||
if ( ! CalcPocketing( pSfrCnt, m_TParams.m_dDiam / 2., 0., m_Params.m_dSideStep, m_Params.m_dSideAngle, 5.,
|
||||
POCKET_ZIGZAG, false, false, false, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
|
||||
POCKET_ZIGZAG, false, false, false, true, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
|
||||
GetLeadInType(), m_Params.m_dLiTang, 0., GetLeadOutType(), m_Params.m_dLoTang, false, 0., 0., vpCrvs)) {
|
||||
m_pMchMgr->SetLastError( 3125, "Error in SurfFinishing : CalcPocketing failed") ;
|
||||
return false ;
|
||||
@@ -2306,7 +2306,7 @@ SurfFinishing::AddOneWay( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, cons
|
||||
// calcolo OneWay
|
||||
ICRVCOMPOPOVECTOR vpCrvs ;
|
||||
if ( ! CalcPocketing( pSfrCnt, m_TParams.m_dDiam / 2., 0., m_Params.m_dSideStep, m_Params.m_dSideAngle, 5.,
|
||||
POCKET_ONEWAY, false, false, false, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
|
||||
POCKET_ONEWAY, false, false, false, true, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
|
||||
GetLeadInType(), m_Params.m_dLiTang, 0., GetLeadOutType(), m_Params.m_dLoTang, false, 0., 0., vpCrvs)) {
|
||||
m_pMchMgr->SetLastError( 3125, "Error in SurfFinishing : CalcPocketing failed") ;
|
||||
return false ;
|
||||
@@ -2334,7 +2334,7 @@ SurfFinishing::AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, cons
|
||||
int nType = ( bInVsOut ? POCKET_SPIRALIN : POCKET_SPIRALOUT) ;
|
||||
ICRVCOMPOPOVECTOR vpCrvs ;
|
||||
if ( ! CalcPocketing( pSfrCnt, m_TParams.m_dDiam / 2., 0., m_Params.m_dSideStep, m_Params.m_dSideAngle, 5.,
|
||||
nType, false, false, false, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
|
||||
nType, false, false, false, true, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
|
||||
GetLeadInType(), m_Params.m_dLiTang, 0., GetLeadOutType(), m_Params.m_dLoTang, false, 0., 0., vpCrvs)) {
|
||||
m_pMchMgr->SetLastError( 3125, "Error in SurfFinishing : CalcPocketing failed") ;
|
||||
return false ;
|
||||
@@ -4778,7 +4778,7 @@ SurfFinishing::GetOffsetCurvesFromPencilProjection( const ICRVCOMPOPOVECTOR& vCr
|
||||
// lavoro a ZigZag
|
||||
ICRVCOMPOPOVECTOR vCrvZigZag ;
|
||||
if ( ! CalcPocketing( pSfrChunk, m_TParams.m_dDiam / 2., 0., m_Params.m_dSideStep, m_Params.m_dSideAngle,
|
||||
5., POCKET_SUB_ZIGZAG, false, false, m_Params.m_bInvert, true, false,
|
||||
5., POCKET_SUB_ZIGZAG, false, false, m_Params.m_bInvert, true, true, false,
|
||||
false, P_INVALID, nullptr, true, INFINITO, GetLeadInType(), m_Params.m_dLiTang, 0.,
|
||||
GetLeadOutType(), m_Params.m_dLoTang, false, 0., 0., vCrvZigZag))
|
||||
return false ;
|
||||
@@ -5477,7 +5477,7 @@ SurfFinishing::CalcOptimalZigZagCurves( const ISurfFlatRegion* pSfrLoc, const Fr
|
||||
// eseguo il calcolo della lavorazione ZigZag
|
||||
ICRVCOMPOPOVECTOR vpCrvs ;
|
||||
if ( ! CalcPocketing( pSfrChunk, m_TParams.m_dDiam / 2., 0., m_Params.m_dSideStep, m_Params.m_dSideAngle, 5.,
|
||||
nSubType, false, false, false, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
|
||||
nSubType, false, false, false, true, true, false, false, P_INVALID, nullptr, true, m_Params.m_dSideStep,
|
||||
GetLeadInType(), m_Params.m_dLiTang, 0., GetLeadOutType(), m_Params.m_dLoTang, false, 0., 0., vpCrvs)) {
|
||||
m_pMchMgr->SetLastError( 3125, "Error in SurfFinishing : CalcPocketing failed") ;
|
||||
return false ;
|
||||
|
||||
+170
-74
@@ -124,6 +124,7 @@ static string KEY_SUBSTEP = "SUBSTEP" ;
|
||||
#include "/EgtDev/Include/EgtPerfCounter.h"
|
||||
#include "/EgtDev/Include/EGkExtText.h"
|
||||
string sPathSrfBool = "C:\\Temp\\" ;
|
||||
int nGrpDebugFeed = GDB_ID_NULL, nLayDebugFeed = GDB_ID_NULL ;
|
||||
#endif
|
||||
|
||||
const double STEP_TOL = 10. * EPS_SMALL ;
|
||||
@@ -2458,71 +2459,83 @@ SurfRoughing::GetToolCollisionRegion( const ISurfFlatRegion* pSfrSgro, double& d
|
||||
// recupero il Box della ventosa
|
||||
BBox3d bFxtBox ;
|
||||
if ( m_pGeomDB->GetGlobalBBox( nFxtId, bFxtBox) && ! bFxtBox.IsEmpty()) {
|
||||
// espando il Box per evitare la collisione con l'utensile
|
||||
bFxtBox.Expand( SAFE_TOL) ;
|
||||
#if ENABLE_DEBUG_SFR_COLLISION
|
||||
ICurveComposite* _pCompoFxt = CreateCurveComposite() ;
|
||||
_pCompoFxt->AddPoint( bFxtBox.GetMin()) ;
|
||||
_pCompoFxt->AddLine( bFxtBox.GetMin() + X_AX * bFxtBox.GetDimX()) ;
|
||||
_pCompoFxt->AddLine( bFxtBox.GetMax() - Z_AX * bFxtBox.GetDimZ()) ;
|
||||
_pCompoFxt->AddLine( bFxtBox.GetMin() + Y_AX * bFxtBox.GetDimY()) ;
|
||||
_pCompoFxt->Close() ;
|
||||
_pCompoFxt->SetExtrusion( Z_AX) ;
|
||||
_pCompoFxt->SetThickness( bFxtBox.GetDimZ()) ;
|
||||
int nFxtId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, _pCompoFxt) ;
|
||||
m_pGeomDB->SetMaterial( nFxtId, YELLOW) ;
|
||||
#endif
|
||||
// recupero la TriMesh del Box
|
||||
PtrOwner<ICurveComposite> pCompoFxt( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompoFxt))
|
||||
return false ;
|
||||
pCompoFxt->AddPoint( bFxtBox.GetMin()) ;
|
||||
pCompoFxt->AddLine( bFxtBox.GetMin() + X_AX * bFxtBox.GetDimX()) ;
|
||||
pCompoFxt->AddLine( bFxtBox.GetMax() - Z_AX * bFxtBox.GetDimZ()) ;
|
||||
pCompoFxt->AddLine( bFxtBox.GetMin() + Y_AX * bFxtBox.GetDimY()) ;
|
||||
pCompoFxt->Close() ;
|
||||
CICURVEPVECTOR vpCrvs ;
|
||||
vpCrvs.emplace_back( pCompoFxt) ;
|
||||
PtrOwner<ISurfTriMesh> pStmCollFxt( GetSurfTriMeshByRegionExtrusion( vpCrvs, Z_AX * bFxtBox.GetDimZ())) ;
|
||||
if ( IsNull( pStmCollFxt) || ! pStmCollFxt->IsValid() || pStmCollFxt->GetTriangleCount() == 0)
|
||||
return false ;
|
||||
// recupero la sua proiezione nel piano di sgrossatura come regione piana
|
||||
Plane3d plProj ;
|
||||
if ( ! plProj.Set( frLoc.Orig() - dDepth * frLoc.VersZ(), frLoc.VersZ()))
|
||||
return false ;
|
||||
POLYLINEVECTOR vPL ;
|
||||
if ( ! pStmCollFxt->GetSilhouette( plProj, EPS_SMALL, vPL)) // proiezione di 6 triangoli, veloce
|
||||
return false ;
|
||||
// se completamente dietro al piano, non influenza la sgrossatura attuale
|
||||
if ( vPL.empty())
|
||||
continue ;
|
||||
SurfFlatRegionByContours SfrByC ;
|
||||
for ( const PolyLine& PL : vPL) {
|
||||
PtrOwner<ICurveComposite> pCompoLoop( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompoLoop) || ! pCompoLoop->FromPolyLine( PL) ||
|
||||
! SfrByC.AddCurve( Release( pCompoLoop)))
|
||||
return false ;
|
||||
}
|
||||
PtrOwner<ISurfFlatRegion> pSfrFxtColl( SfrByC.GetSurf()) ;
|
||||
if ( IsNull( pSfrFxtColl) || ! pSfrFxtColl->IsValid())
|
||||
return false ;
|
||||
if ( AreOppositeVectorApprox( pSfrFxtColl->GetNormVersor(), frLoc.VersZ()))
|
||||
pSfrFxtColl->Invert() ;
|
||||
// aggiorno la regione di collissione per l'utensile
|
||||
if ( ! pSfrColl->IsValid()) {
|
||||
if ( ! pSfrColl->CopyFrom( pSfrFxtColl))
|
||||
return false ;
|
||||
// se sgrossatura orientata come come Z_AX
|
||||
if ( AreSameVectorApprox( pSfrSgro->GetNormVersor(), Z_AX)) {
|
||||
// controllo se limitare la Depth della tavola
|
||||
double dTabDist = abs( ( ptCen - bFxtBox.GetMax()) * pSfrSgro->GetNormVersor()) ;
|
||||
if ( dDepth > dTabDist - DIST_TABLE) {
|
||||
dDepth = dTabDist - DIST_TABLE ;
|
||||
string sWarn = "Warning in SurfRoughing : Depth reduced at " + ToString( dDepth, 3) ;
|
||||
m_pMchMgr->SetWarning( 3057, sWarn) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( ! pSfrColl->Add( *pSfrFxtColl))
|
||||
// espando il Box per evitare la collisione con l'utensile
|
||||
bFxtBox.Expand( SAFE_TOL) ;
|
||||
#if ENABLE_DEBUG_SFR_COLLISION
|
||||
ICurveComposite* _pCompoFxt = CreateCurveComposite() ;
|
||||
_pCompoFxt->AddPoint( bFxtBox.GetMin()) ;
|
||||
_pCompoFxt->AddLine( bFxtBox.GetMin() + X_AX * bFxtBox.GetDimX()) ;
|
||||
_pCompoFxt->AddLine( bFxtBox.GetMax() - Z_AX * bFxtBox.GetDimZ()) ;
|
||||
_pCompoFxt->AddLine( bFxtBox.GetMin() + Y_AX * bFxtBox.GetDimY()) ;
|
||||
_pCompoFxt->Close() ;
|
||||
_pCompoFxt->SetExtrusion( Z_AX) ;
|
||||
_pCompoFxt->SetThickness( bFxtBox.GetDimZ()) ;
|
||||
int nFxtId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, _pCompoFxt) ;
|
||||
m_pGeomDB->SetMaterial( nFxtId, YELLOW) ;
|
||||
#endif
|
||||
// recupero la TriMesh del Box
|
||||
PtrOwner<ICurveComposite> pCompoFxt( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompoFxt))
|
||||
return false ;
|
||||
pCompoFxt->AddPoint( bFxtBox.GetMin()) ;
|
||||
pCompoFxt->AddLine( bFxtBox.GetMin() + X_AX * bFxtBox.GetDimX()) ;
|
||||
pCompoFxt->AddLine( bFxtBox.GetMax() - Z_AX * bFxtBox.GetDimZ()) ;
|
||||
pCompoFxt->AddLine( bFxtBox.GetMin() + Y_AX * bFxtBox.GetDimY()) ;
|
||||
pCompoFxt->Close() ;
|
||||
CICURVEPVECTOR vpCrvs ;
|
||||
vpCrvs.emplace_back( pCompoFxt) ;
|
||||
PtrOwner<ISurfTriMesh> pStmCollFxt( GetSurfTriMeshByRegionExtrusion( vpCrvs, Z_AX * bFxtBox.GetDimZ())) ;
|
||||
if ( IsNull( pStmCollFxt) || ! pStmCollFxt->IsValid() || pStmCollFxt->GetTriangleCount() == 0)
|
||||
return false ;
|
||||
// recupero la sua proiezione nel piano di sgrossatura come regione piana
|
||||
Plane3d plProj ;
|
||||
if ( ! plProj.Set( frLoc.Orig() - dDepth * frLoc.VersZ(), frLoc.VersZ()))
|
||||
return false ;
|
||||
POLYLINEVECTOR vPL ;
|
||||
if ( ! pStmCollFxt->GetSilhouette( plProj, EPS_SMALL, vPL)) // proiezione di 6 triangoli, veloce
|
||||
return false ;
|
||||
// se completamente dietro al piano, non influenza la sgrossatura attuale
|
||||
if ( vPL.empty())
|
||||
continue ;
|
||||
SurfFlatRegionByContours SfrByC ;
|
||||
for ( const PolyLine& PL : vPL) {
|
||||
PtrOwner<ICurveComposite> pCompoLoop( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompoLoop) || ! pCompoLoop->FromPolyLine( PL) ||
|
||||
! SfrByC.AddCurve( Release( pCompoLoop)))
|
||||
return false ;
|
||||
}
|
||||
PtrOwner<ISurfFlatRegion> pSfrFxtColl( SfrByC.GetSurf()) ;
|
||||
if ( IsNull( pSfrFxtColl) || ! pSfrFxtColl->IsValid())
|
||||
return false ;
|
||||
if ( AreOppositeVectorApprox( pSfrFxtColl->GetNormVersor(), frLoc.VersZ()))
|
||||
pSfrFxtColl->Invert() ;
|
||||
// aggiorno la regione di collissione per l'utensile
|
||||
if ( ! pSfrColl->IsValid()) {
|
||||
if ( ! pSfrColl->CopyFrom( pSfrFxtColl))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( ! pSfrColl->Add( *pSfrFxtColl))
|
||||
return false ;
|
||||
}
|
||||
#if ENABLE_DEBUG_SFR_COLLISION
|
||||
ISurfFlatRegion* _pSfrFxt = CreateSurfFlatRegion() ;
|
||||
_pSfrFxt->CopyFrom( pSfrFxtColl) ;
|
||||
int _nSfrFxtId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, _pSfrFxt) ;
|
||||
m_pGeomDB->SetMaterial( _nSfrFxtId, Color( 255, 255, 0, 50)) ;
|
||||
#endif
|
||||
}
|
||||
#if ENABLE_DEBUG_SFR_COLLISION
|
||||
ISurfFlatRegion* _pSfrFxt = CreateSurfFlatRegion() ;
|
||||
_pSfrFxt->CopyFrom( pSfrFxtColl) ;
|
||||
int _nSfrFxtId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, _pSfrFxt) ;
|
||||
m_pGeomDB->SetMaterial( _nSfrFxtId, Color( 255, 255, 0, 50)) ;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2594,6 +2607,9 @@ SurfRoughing::GetToolCollisionRegion( const ISurfFlatRegion* pSfrSgro, double& d
|
||||
}
|
||||
}
|
||||
}
|
||||
// se non ho una superficie di Blocco, allora non devo fare nulla
|
||||
if ( IsNull( pSfrBlock) || ! pSfrBlock->IsValid())
|
||||
return true ;
|
||||
|
||||
// determino la superficie di collisione
|
||||
pSfrColl->Clear() ;
|
||||
@@ -2957,6 +2973,9 @@ SurfRoughing::CalcPaths( const INTINTVECTOR& vPocket, STEPINFOSRVECTOR& vStepInf
|
||||
// del percorso successivo)
|
||||
Point3d ptEndLastPath = P_INVALID ;
|
||||
|
||||
// determino se Conventional Milling o Climb Milling per curve singole
|
||||
bool bConventionalMilling = ( m_Params.m_nSubType == POCKET_ONEWAY || m_Params.m_nSubType == POCKET_CONFORMAL_ONEWAY) ;
|
||||
|
||||
// scorro gli indici delle superfici
|
||||
int nInd = 0 ;
|
||||
for ( auto& vId : vPocket) {
|
||||
@@ -3024,7 +3043,7 @@ SurfRoughing::CalcPaths( const INTINTVECTOR& vPocket, STEPINFOSRVECTOR& vStepInf
|
||||
ICRVCOMPOPOVECTOR vCrvPaths ;
|
||||
if ( ! CalcPocketing( vStepInfo[nInd].pSfrPock, m_TParams.m_dDiam / 2, 0., m_Params.m_dSideStep,
|
||||
m_Params.m_dSideAngle, 5., vStepInfo[nInd].nSubType, true, true, vStepInfo[nInd].bInverted,
|
||||
false, true, true, ptEndLastPath, vStepInfo[nInd].pSfrLimit, false, m_Params.m_dSideStep,
|
||||
false, bConventionalMilling, true, true, ptEndLastPath, vStepInfo[nInd].pSfrLimit, false, m_Params.m_dSideStep,
|
||||
GetLeadInType(), m_Params.m_dLiTang, m_Params.m_dLiElev, GetLeadOutType(), m_Params.m_dLoTang,
|
||||
false, 0., 0., vCrvPaths)) {
|
||||
if ( vStepInfo[nInd].bIsExtraStep) {
|
||||
@@ -3137,13 +3156,13 @@ SurfRoughing::GetLinkFromPaths( STEPINFOSRVECTOR& vStepInfo, int i, int j, const
|
||||
// recupero anche il suo punto iniziale, ovvero il punto finale del Link
|
||||
int nLinkType = -1 ;
|
||||
Point3d ptEnd ;
|
||||
if ( j < int( vStepInfo[i].vPaths.size()) - 1) {
|
||||
if ( j < ssize( vStepInfo[i].vPaths) - 1) {
|
||||
nLinkType = PLANAR ;
|
||||
vStepInfo[i].vPaths[j+1].pCrvPath->GetStartPoint( ptEnd) ;
|
||||
}
|
||||
else {
|
||||
// --- se non esiste lo Step i+1 errore
|
||||
if ( i + 1 >= int( vStepInfo.size()))
|
||||
if ( i + 1 >= ssize( vStepInfo))
|
||||
return false ;
|
||||
vStepInfo[i+1].vPaths.front().pCrvPath->GetStartPoint( ptEnd) ;
|
||||
nLinkType = ( ( ptEnd - ptStart) * vtTool < - 50 * EPS_SMALL ? DOWN : ABOVE) ;
|
||||
@@ -3191,7 +3210,7 @@ SurfRoughing::GetLinkFromPaths( STEPINFOSRVECTOR& vStepInfo, int i, int j, const
|
||||
return false ;
|
||||
// nel caso stessi ordinando per ZChunk, devo controllare di essere fuori dalla limite
|
||||
// anche per lo Step i+1
|
||||
// NB. Nel caso stessi ordinando per piani, vuol dire che ho già svuotato tutti il piano i-esimo
|
||||
// NB. Nel caso stessi ordinando per piani, vuol dire che ho già svuotato tutto il piano i-esimo
|
||||
// Se Safe, allora definisco il collegamento
|
||||
if ( bSafe) {
|
||||
pCrvLink->AddPoint( ptStart) ;
|
||||
@@ -3778,6 +3797,11 @@ SurfRoughing::AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool,
|
||||
STEPINFOSRVECTOR vStepInfo ;
|
||||
if ( ! CalcPaths( vPocket, vStepInfo))
|
||||
return false ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
nGrpDebugFeed = m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, GLOB_FRM) ;
|
||||
nLayDebugFeed = m_pGeomDB->AddGroup( GDB_ID_NULL, nGrpDebugFeed, GLOB_FRM) ;
|
||||
m_pGeomDB->SetName( nGrpDebugFeed, "Feed") ;
|
||||
#endif
|
||||
|
||||
// recupero distanze di sicurezza
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
@@ -3788,13 +3812,18 @@ SurfRoughing::AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool,
|
||||
// punto finale del percorso precedente al corrente
|
||||
Point3d ptEnd = P_INVALID ;
|
||||
|
||||
// recupero parametro di Feed minima
|
||||
double dMinFeed = GetFeed() / FEED_MAX_REDUCE ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MINFEED, dMinFeed))
|
||||
dMinFeed = Clamp( dMinFeed, GetFeed() / FEED_MAX_REDUCE, GetFeed()) ;
|
||||
|
||||
// scorro il vettore dei piani di pocketing
|
||||
for ( int i = 0 ; i < int( vStepInfo.size()) ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vStepInfo) ; ++ i) {
|
||||
|
||||
// riferimento alle informazioni relative allo step i-esimo
|
||||
StepInfoSR& currStep = vStepInfo[i] ;
|
||||
// scorro i percorsi calcolati per il piano di pocketing i-esimo
|
||||
for ( int j = 0 ; j < int( currStep.vPaths.size()) ; ++ j) {
|
||||
for ( int j = 0 ; j < ssize( currStep.vPaths) ; ++ j) {
|
||||
|
||||
// riferimento alle informazioni relative al percorso j-esimo del piano di pocketing i-esimo
|
||||
PathInfoSR& currPath = currStep.vPaths[j] ;
|
||||
@@ -3871,17 +3900,18 @@ SurfRoughing::AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool,
|
||||
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
Vector3d vtMove ; pLine->GetStartDir( vtMove) ;
|
||||
SetFeed( Clamp( dCoeffFeed * GetFeed(), dMinFeed, GetFeed())) ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
DrawFeed( pLine, dCoeffFeed * GetRightFeed( vtMove, vtTool)) ;
|
||||
DrawFeed( pCurve->Clone(), dCoeffFeed * GetFeed(), nLayDebugFeed) ;
|
||||
#endif
|
||||
SetFeed( dCoeffFeed * GetRightFeed( vtMove, vtTool)) ;
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
ICurveArc* pArc = GetCurveArc( pCurve) ;
|
||||
SetFeed( Clamp( dCoeffFeed * GetFeed(), dMinFeed, GetFeed())) ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
DrawFeed( pArc, dCoeffFeed * GetFeed()) ;
|
||||
DrawFeed( pCurve->Clone(), dCoeffFeed * GetFeed(), nLayDebugFeed) ;
|
||||
#endif
|
||||
SetFeed( dCoeffFeed * GetFeed()) ;
|
||||
if ( AddCurveMove( pArc, bSplitArcs) == GDB_ID_NULL)
|
||||
@@ -3894,7 +3924,7 @@ SurfRoughing::AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool,
|
||||
pCurve->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtEnd ; pCurve->GetEndDir( vtEnd) ;
|
||||
// se sono l'ultima entità globale del percorso
|
||||
if ( i == int( vStepInfo.size()) - 1 && j == int( currStep.vPaths.size()) - 1) {
|
||||
if ( i == ssize( vStepInfo) - 1 && j == ssize( currStep.vPaths) - 1) {
|
||||
// aggiungo LeadOut
|
||||
Point3d ptP1 ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
@@ -3921,6 +3951,9 @@ SurfRoughing::AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool,
|
||||
}
|
||||
// imposto EndFeed e aggiungo il Link
|
||||
SetFeed( GetEndFeed()) ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
DrawFeed( pCrvLink->Clone(), GetEndFeed(), nLayDebugFeed) ;
|
||||
#endif
|
||||
AddCurveMove( pCrvLink, bSplitArcs) ;
|
||||
}
|
||||
}
|
||||
@@ -4113,6 +4146,12 @@ SurfRoughing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
|
||||
PtrOwner<ICurveArc> pArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pArc) || ! pArc->Set( ptCen, vtN, dRad, - vtCen, dAngCen, dDeltaN))
|
||||
return false ;
|
||||
// dovendo creare l'elica, sono nel materiale, quindi regolo la Feed
|
||||
Vector3d vtTanHelix ; pArc->GetStartDir( vtTanHelix) ;
|
||||
SetFeed( GetRightStartFeed( vtTanHelix, vtN)) ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
DrawFeed( pArc->Clone(), GetRightStartFeed( vtTanHelix, vtN), nLayDebugFeed) ;
|
||||
#endif
|
||||
// emetto l'elica (con eventuale spezzatura)
|
||||
return ( AddCurveMove( pArc, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
@@ -4128,14 +4167,30 @@ SurfRoughing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
|
||||
double dStep = - dDeltaN / nStep ;
|
||||
Point3d ptPa = ptP1 + vtStart * 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
Point3d ptPb = ptP1 - vtStart * 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
Vector3d vtTanZigZag = ( ptPa - vtN * 0.25 * dStep) - ptP1 ;
|
||||
SetFeed( GetRightStartFeed( vtTanZigZag, vtN)) ;
|
||||
// verifico se fattibile
|
||||
if ( bSkipControl || VerifyLeadInZigZag( pSfr, ptStart, ptPa, ptPb)) {
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||
Point3d ptCurr ; GetCurrPos( ptCurr) ; pLine->Set( ptCurr, ptPa - vtN * ( i - 0.75) * dStep) ;
|
||||
DrawFeed( pLine->Clone(), GetRightStartFeed( vtTanZigZag, vtN), nLayDebugFeed) ;
|
||||
#endif
|
||||
if ( AddLinearMove( ptPa - vtN * ( i - 0.75) * dStep, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
GetCurrPos( ptCurr) ; pLine->Set( ptCurr, ptPb - vtN * ( i - 0.25) * dStep) ;
|
||||
DrawFeed( pLine->Clone(), GetRightStartFeed( vtTanZigZag, vtN), nLayDebugFeed) ;
|
||||
#endif
|
||||
if ( AddLinearMove( ptPb - vtN * ( i - 0.25) * dStep, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||
Point3d ptCurr ; GetCurrPos( ptCurr) ; pLine->Set( ptCurr, ptStart) ;
|
||||
DrawFeed( pLine->Clone(), GetRightStartFeed( vtTanZigZag, vtN), nLayDebugFeed) ;
|
||||
#endif
|
||||
return ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
// altrimenti diretto
|
||||
@@ -4170,6 +4225,14 @@ SurfRoughing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
|
||||
double dNini = ( ptP1 - ORIG) * vtN ;
|
||||
double dNfin = ( ptStart - ORIG) * vtN ;
|
||||
AdjustCurveSlope( pCrv, dNini, dNfin) ;
|
||||
// assegno le Feed
|
||||
Point3d ptS ; pCrv->GetStartPoint( ptS) ;
|
||||
Point3d ptE ; pCrv->GetEndPoint( ptE) ;
|
||||
Vector3d vtFeedMove = ptE - ptS ;
|
||||
SetFeed( GetRightStartFeed( vtFeedMove, vtN)) ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
DrawFeed( pCrv->Clone(), GetRightStartFeed( vtFeedMove, vtN), nLayDebugFeed) ;
|
||||
#endif
|
||||
// emetto (con eventuale spezzatura)
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
@@ -4182,6 +4245,17 @@ SurfRoughing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
|
||||
Point3d ptCurr = ptP1 ;
|
||||
GetCurrPos( ptCurr) ;
|
||||
if ( ! AreSamePointApprox( ptCurr, ptStart)) {
|
||||
Vector3d vtMove = ptStart - ptCurr ; vtMove.Normalize() ;
|
||||
double dElev = 0. ;
|
||||
bool bInMaterial = true ;
|
||||
if ( GetElevation( m_nPhase, ptCurr, ptStart, vtN, GetRadiusForStartEndElevation(), m_TParams.m_dLen, vtN, dElev) && dElev < 10. * EPS_SMALL)
|
||||
bInMaterial = false ;
|
||||
// Feed di Testa
|
||||
SetFeed( bInMaterial ? GetTipFeed() : GetStartFeed()) ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ; pLine->Set( ptCurr, ptStart) ;
|
||||
DrawFeed( pLine->Clone(), bInMaterial ? GetTipFeed() : GetStartFeed(), nLayDebugFeed) ;
|
||||
#endif
|
||||
if ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
@@ -4260,6 +4334,24 @@ SurfRoughing::GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) cons
|
||||
return min( GetFeed(), GetTipFeed() / abs( dCosMove)) ;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
double
|
||||
SurfRoughing::GetRightStartFeed( const Vector3d& vtMove, const Vector3d& vtTool) const
|
||||
{
|
||||
// Determino i versori
|
||||
Vector3d vtM = vtMove ;
|
||||
vtM.Normalize() ;
|
||||
Vector3d vtT = vtTool ;
|
||||
vtT.Normalize() ;
|
||||
// Angolo tra movimento e versore utensile
|
||||
double dCosMove = vtM * vtT ;
|
||||
// Se l'utensile non ha movimento significativo di punta, si restituisce la feed standard
|
||||
if ( dCosMove > - COS_ORTO_ANG_SMALL)
|
||||
return GetStartFeed() ;
|
||||
// Altrimenti non si deve superare la massima velocità di punta prevista
|
||||
return min( GetStartFeed(), GetTipFeed() / abs( dCosMove)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfRoughing::ResetCurveAllTempProp( ICurve* pCurve) const
|
||||
@@ -4899,15 +4991,19 @@ SurfRoughing::DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bUniform, Color C
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
SurfRoughing::DrawFeed( const ICurve* pCrv, double dFeed) const
|
||||
SurfRoughing::DrawFeed( const ICurve* pCrv, double dFeed, int nLay) const
|
||||
{
|
||||
if ( pCrv == nullptr)
|
||||
return ;
|
||||
|
||||
double dMinFeed = GetFeed() * GetSideStep() / m_TParams.m_dDiam ;
|
||||
// recupero parametro di Feed minima
|
||||
double dMinFeed = GetFeed() / FEED_MAX_REDUCE ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MINFEED, dMinFeed))
|
||||
dMinFeed = Clamp( dMinFeed, GetFeed() / FEED_MAX_REDUCE, GetFeed()) ;
|
||||
double myAngle = 120 * ( ( ( dFeed - dMinFeed) / ( GetFeed() - dMinFeed))) ;
|
||||
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pCrv->Clone()) ;
|
||||
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nLay, pCrv->Clone()) ;
|
||||
m_pGeomDB->SetMaterial( nInd, GetColorFromHSV( HSV( myAngle, 1., 1.))) ;
|
||||
return ;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
+2
-1
@@ -215,6 +215,7 @@ class SurfRoughing : public Machining
|
||||
ISurfFlatRegion* pSfrSearchCorners) const ;
|
||||
bool GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) const ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
double GetRightStartFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
bool ResetCurveAllTempProp( ICurve* pCurve) const ;
|
||||
bool RemoveChunksUnderTolerance( ISurfFlatRegion* pSfr, double dTol, ISurfFlatRegion* pSfrLimit,
|
||||
@@ -270,7 +271,7 @@ class SurfRoughing : public Machining
|
||||
|
||||
/* debug functions */
|
||||
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf, Color Col, bool bAlphaCoverage, std::string sName) const ;
|
||||
void DrawFeed( const ICurve* pCrv, double dFeed) const ;
|
||||
void DrawFeed( const ICurve* pCrv, double dFeed, int nLay) const ;
|
||||
void DrawNormalShaderSurfTm( const ISurfTriMesh* pStm, std::string sName) const ;
|
||||
/* end debug functions */
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2026-2026
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ToolUserNotesConst.h Data : 09.04.26 Versione : 3.1d3
|
||||
// Contenuto : Costanti per le note utente degli utensili.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 10.11.25 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Generali
|
||||
static const std::string TUN_TH = "TH" ;
|
||||
static const std::string TUN_DOUBLE = "DOUBLE" ;
|
||||
Reference in New Issue
Block a user