Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dfa0069a0b | |||
| f089cd1e1c | |||
| 1ebce72c1d | |||
| b87cbbfb5b | |||
| c1b5f41d0d | |||
| a91525108c | |||
| f2b8f25fbd | |||
| 77b0363152 | |||
| 5bd8468d10 | |||
| ae5a7b8064 | |||
| d0bbc52253 | |||
| b1e7534b28 | |||
| db30954eb3 | |||
| 8c59084a99 | |||
| 01fda01f1a | |||
| cd55865151 | |||
| bfe3fc1267 | |||
| 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 |
+14
@@ -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))
|
||||
@@ -585,11 +587,23 @@ CamData::CamData( void)
|
||||
bool
|
||||
CamData::SetMoveType( int nMove)
|
||||
{
|
||||
if ( nMove < 0 || nMove > 3)
|
||||
return false ;
|
||||
m_nMove = nMove ;
|
||||
ResetObjGraphics() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CamData::SetCorrType( int nCorr)
|
||||
{
|
||||
if ( nCorr != 0 && nCorr != 41 && nCorr != 42 && nCorr != 140 && nCorr != 141 && nCorr != 142)
|
||||
return false ;
|
||||
m_nCorre = nCorr ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CamData::SetToolDir( const Vector3d& vtDir)
|
||||
|
||||
@@ -46,6 +46,7 @@ class CamData : public IUserObj
|
||||
public :
|
||||
CamData( void) ;
|
||||
bool SetMoveType( int nMove) ;
|
||||
bool SetCorrType( int nCorr) ;
|
||||
bool SetToolDir( const Vector3d& vtDir) ;
|
||||
bool SetCorrDir( const Vector3d& vtDir) ;
|
||||
bool SetAuxDir( const Vector3d& vtDir) ;
|
||||
@@ -78,6 +79,8 @@ class CamData : public IUserObj
|
||||
{ return ( m_nMove == 0 || m_nMove == 1) ; }
|
||||
bool IsArc( void) const
|
||||
{ return ( m_nMove == 2 || m_nMove == 3) ; }
|
||||
int GetCorrType( void) const
|
||||
{ return m_nCorre ; }
|
||||
const Vector3d& GetToolDir( void) const
|
||||
{ return m_vtTool ; }
|
||||
const Vector3d& GetCorrDir( void) const
|
||||
@@ -144,7 +147,7 @@ class CamData : public IUserObj
|
||||
int m_nOwnerId ;
|
||||
IGeomDB* m_pGeomDB ;
|
||||
int m_nMove ; // tipo movimento (0=rapido, 1=lineare, 2=arco CW, 3=arco CCW)
|
||||
int m_nCorre ; // tipo correzione (0, 41, 42, 141, 142, 40)
|
||||
int m_nCorre ; // tipo correzione (0, 41, 42, 140, 141, 142)
|
||||
bool m_bToolShow ; // flag per forzare la visualizzazione della direzione utensile in ogni caso
|
||||
Vector3d m_vtTool ; // versore fresa
|
||||
Vector3d m_vtCorr ; // versore correzione
|
||||
|
||||
+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">
|
||||
|
||||
+1
-1
@@ -730,7 +730,7 @@ FiveAxisMilling::Update( bool bPostApply)
|
||||
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
|
||||
if ( ! m_Params.m_sInitAngs.empty())
|
||||
sHint = m_Params.m_sInitAngs ;
|
||||
double dSingConeAng = 0.1 ;
|
||||
double dSingConeAng = SING_CONE_ANG_DFLT ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_SINGCONEANG, dSingConeAng) ;
|
||||
if ( ! CalculateAxesValues( sHint, false, dSingConeAng)) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
|
||||
+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 ;
|
||||
}
|
||||
|
||||
+25
@@ -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
|
||||
@@ -174,3 +190,12 @@ const double MIN_ZDIR_VERT_CHSAW = 0.7072 ;
|
||||
static const double ROT1_WEIGHT_DFLT = 1 ;
|
||||
// Valore di default per angolo di apertura del cono di direzioni coincidenti con singolarità
|
||||
static const double SING_CONE_ANG_DFLT = 0.01 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Compensazione Raggio Utensile in Macchina
|
||||
enum {
|
||||
TOOL_COMP_PROGRAM = 0, // Compensazione Utensile da Programma
|
||||
TOOL_COMP_LENGTH = 1, // Compensazione Lunghezza Utensile in Macchina
|
||||
TOOL_COMP_RADIUS = 2, // Compensazione Raggio Utensile in Macchina
|
||||
TOOL_COMP_LEN_AND_RAD = 3 // Compensazione Lunghezza e Raggio Utensile in Macchina
|
||||
} ;
|
||||
|
||||
@@ -123,6 +123,7 @@ class MachMgr : public IMachMgr
|
||||
bool IsRawPart( int nId) const override
|
||||
{ return VerifyRawPart( nId) ; }
|
||||
int AddRawPart( const Point3d& ptOrig, double dLen, double dWidth, double dHeight, Color cCol) override ;
|
||||
int AddRawPart( int nCrvSrfId, double dOverMat, Color cCol) override ;
|
||||
int AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color cCol) override ;
|
||||
bool ModifyRawPart( int nRawId, const Point3d& ptOrig, double dLen, double dWidth, double dHeight, Color cCol) override ;
|
||||
bool ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dHeight, Color cCol) override ;
|
||||
@@ -328,9 +329,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 ;
|
||||
@@ -537,6 +538,7 @@ class MachMgr : public IMachMgr
|
||||
int AddRawPart( int nSurfUpId, int nSurfDownId, double dHeight, Color cCol) ;
|
||||
bool SetRawPartCenter( int nRawId) ;
|
||||
bool ResetRawPartCenter( int nRawId) ;
|
||||
bool UpdateRawOutline( int nRawId) ;
|
||||
// Parts
|
||||
bool SwapParts( bool bToRawPart) ;
|
||||
bool SwapRawPartParts( int nRawId, bool bToRawPart) ;
|
||||
|
||||
+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
|
||||
|
||||
+206
-98
@@ -29,6 +29,7 @@
|
||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
||||
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
||||
#include "/EgtDev/Include/EGkSurfBezier.h"
|
||||
#include "/EgtDev/Include/EGkSurfLocal.h"
|
||||
#include "/EgtDev/Include/EGkCAvSilhouetteSurfTm.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
@@ -167,6 +168,88 @@ MachMgr::ModifyRawPart( int nRawId, const Point3d& ptOrig, double dLen, double d
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::AddRawPart( int nCrvSrfId, double dOverMat, Color cCol)
|
||||
{
|
||||
// verifico il gruppo dei grezzi nella macchinata corrente
|
||||
if ( GetCurrRawGroupId() == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il tipo di oggetto per definire il grezzo
|
||||
int nGtype = m_pGeomDB->GetGeoType( nCrvSrfId) ;
|
||||
// costruzione del grezzo
|
||||
int nRawId = GDB_ID_NULL ;
|
||||
// se grezzo da superficie (per ora senza possibilità di offset)
|
||||
if ( ( nGtype & GEO_SURF) != 0) {
|
||||
// inserisco il grezzo
|
||||
nRawId = AddRawPart( nCrvSrfId, cCol) ;
|
||||
}
|
||||
// se altrimenti grezzo da contorno
|
||||
else if ( ( nGtype & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( m_pGeomDB->GetGeoObj( nCrvSrfId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// copio la curva in una composita
|
||||
PtrOwner<ICurveComposite> pMyCrv( ConvertCurveToComposite( pCrv->Clone())) ;
|
||||
if ( IsNull( pMyCrv))
|
||||
return GDB_ID_NULL ;
|
||||
// se non è chiusa, la chiudo
|
||||
pMyCrv->Close() ;
|
||||
// recupero l'estrusione e lo spessore
|
||||
Vector3d vtExtr ;
|
||||
if ( ! pMyCrv->GetExtrusion( vtExtr) || vtExtr.IsSmall())
|
||||
vtExtr = Z_AX ;
|
||||
double dThick = 0 ;
|
||||
pMyCrv->GetThickness( dThick) ;
|
||||
if ( abs( dThick) + 2 * dOverMat < 10 *EPS_SMALL)
|
||||
dThick = 1 ;
|
||||
// la oriento in senso CCW
|
||||
Plane3d plPlane ;
|
||||
double dArea ;
|
||||
if ( ! pMyCrv->GetArea( plPlane, dArea))
|
||||
return GDB_ID_NULL ;
|
||||
if ( plPlane.GetVersN() * vtExtr * dArea < 0)
|
||||
pMyCrv->Invert() ;
|
||||
// ne eseguo l'offset
|
||||
OffsetCurve OffsCrv ;
|
||||
OffsCrv.Make( pMyCrv, dOverMat, ICurve::OFF_EXTEND) ;
|
||||
PtrOwner<ICurve> pOffsCrv( OffsCrv.GetLongerCurve()) ;
|
||||
if ( IsNull( pOffsCrv))
|
||||
return GDB_ID_NULL ;
|
||||
// aggiusto per sovramateriale lungo estrusione
|
||||
pMyCrv->Translate( vtExtr * -copysign( dOverMat, dThick)) ;
|
||||
// creo il solido
|
||||
double dH = dThick + 2 * copysign( dOverMat, dThick) ;
|
||||
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshByExtrusion( pOffsCrv, vtExtr * dH, true, 50 * EPS_SMALL)) ;
|
||||
if ( IsNull( pStm))
|
||||
return false ;
|
||||
// lo inserisco nel DB geometrico
|
||||
int nSrfId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, m_pGeomDB->GetParentId( nCrvSrfId), Release( pStm)) ;
|
||||
if ( nSrfId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// inserisco il grezzo
|
||||
nRawId = AddRawPart( nSrfId, cCol) ;
|
||||
// cancello la superficie
|
||||
m_pGeomDB->Erase( nSrfId) ;
|
||||
}
|
||||
// verifico costruzione grezzo
|
||||
if ( nRawId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// se definita tavola, aggiusto posizione del grezzo
|
||||
Point3d ptTabRef ;
|
||||
if ( GetTableRef( 1, ptTabRef)) {
|
||||
// recupero box del solido
|
||||
int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
|
||||
BBox3d b3RawSolid ;
|
||||
// lo porto nell'angolo in basso a sinistra della tavola
|
||||
if ( m_pGeomDB->GetGlobalBBox( nRawSolidId, b3RawSolid))
|
||||
m_pGeomDB->TranslateGlob( nRawId, ptTabRef - b3RawSolid.GetMin()) ;
|
||||
}
|
||||
|
||||
return nRawId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color cCol)
|
||||
@@ -187,6 +270,9 @@ MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color
|
||||
if ( ( nGtype & GEO_SURF) != 0) {
|
||||
// inserisco il grezzo
|
||||
nRawId = AddRawPart( nCrvSrfId, cCol) ;
|
||||
// se inserimento riuscito, nascondo la superficie originale
|
||||
if ( nRawId != GDB_ID_NULL)
|
||||
m_pGeomDB->SetStatus( nCrvSrfId, GDB_ST_OFF) ;
|
||||
// annullo il sovra-materiale
|
||||
dOverMat = 0 ;
|
||||
// calcolo il punto di inserimento nel grezzo
|
||||
@@ -421,109 +507,12 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
|
||||
// calcolo il punto centro del solido
|
||||
bOk = bOk && SetRawPartCenter( nRawId) ;
|
||||
// calcolo la curva di contorno
|
||||
if ( bOk) {
|
||||
// creo la curva
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvCompo))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero la superficie trimesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// recupero l'ingombro della superficie in locale
|
||||
BBox3d b3Srf ;
|
||||
pStm->GetLocalBBox( b3Srf) ;
|
||||
// ne calcolo la silhouette secondo Z+
|
||||
bool bSilh = false ;
|
||||
const int NUM_TRIA_LIM = 500 ;
|
||||
if ( pStm->GetTriangleCount() < NUM_TRIA_LIM) {
|
||||
POLYLINEVECTOR vPL ;
|
||||
if ( pStm->GetSilhouette( Z_AX, 10.0, vPL) && ! vPL.empty()) {
|
||||
// cerco il contorno esterno
|
||||
int nInd = - 1 ;
|
||||
double dMaxArea = 0 ;
|
||||
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
|
||||
double dArea ;
|
||||
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
|
||||
if ( dArea < 0)
|
||||
vPL[i].Invert() ;
|
||||
dMaxArea = abs( dArea) ;
|
||||
nInd = i ;
|
||||
}
|
||||
}
|
||||
// ne deduco la curva
|
||||
PtrOwner<ICurveComposite> pCrvSilh( CreateCurveComposite()) ;
|
||||
if ( nInd >= 0 && pCrvSilh->FromPolyLine( vPL[nInd])) {
|
||||
pCrvSilh->SetExtrusion( Z_AX) ;
|
||||
Plane3d plProj ;
|
||||
plProj.Set( b3Srf.GetMin(), Z_AX) ;
|
||||
pCrvCompo.Set( GetCurveComposite( ProjectCurveOnPlane( *pCrvSilh, plProj))) ;
|
||||
if ( ! IsNull( pCrvCompo)) {
|
||||
pCrvCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ;
|
||||
bSilh = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
PtrOwner<ICAvParSilhouettesSurfTm> pCavParSilh( CreateCAvParSilhouettesSurfTm()) ;
|
||||
if ( ! IsNull( pCavParSilh)) {
|
||||
Frame3d frSrf( b3Srf.GetMin()) ;
|
||||
const double SILH_TOL = 1.0 ;
|
||||
POLYLINEVECTOR vPL ;
|
||||
if ( pCavParSilh->SetData( { pStm}, frSrf, SILH_TOL) &&
|
||||
pCavParSilh->GetSilhouette( 0, vPL)) {
|
||||
// cerco il contorno esterno
|
||||
int nInd = - 1 ;
|
||||
double dMaxArea = 0 ;
|
||||
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
|
||||
double dArea ;
|
||||
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
|
||||
if ( dArea < 0)
|
||||
vPL[i].Invert() ;
|
||||
dMaxArea = abs( dArea) ;
|
||||
nInd = i ;
|
||||
}
|
||||
}
|
||||
// ne deduco la curva
|
||||
if ( nInd >= 0 && pCrvCompo->FromPolyLine( vPL[nInd])) {
|
||||
pCrvCompo->SetExtrusion( Z_AX) ;
|
||||
bSilh = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// non riuscita, la calcolo come contorno del box
|
||||
if ( ! bSilh) {
|
||||
Point3d ptMin ;
|
||||
double dDimX, dDimY, dDimZ ;
|
||||
b3Srf.GetMinDim( ptMin, dDimX, dDimY, dDimZ) ;
|
||||
PolyLine PL ;
|
||||
PL.AddUPoint( 0, ptMin) ;
|
||||
PL.AddUPoint( 1, ptMin + Vector3d( dDimX, 0,0)) ;
|
||||
PL.AddUPoint( 2, ptMin + Vector3d( dDimX, dDimY,0)) ;
|
||||
PL.AddUPoint( 3, ptMin + Vector3d( 0, dDimY,0)) ;
|
||||
PL.AddUPoint( 4, ptMin) ;
|
||||
if ( pCrvCompo->FromPolyLine( PL))
|
||||
pCrvCompo->SetExtrusion( Z_AX) ;
|
||||
else
|
||||
bOk = false ;
|
||||
}
|
||||
// inserisco la curva composita nel DB
|
||||
int nCrvId = ( bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pCrvCompo)) : GDB_ID_NULL) ;
|
||||
bOk = bOk && ( nCrvId != GDB_ID_NULL) ;
|
||||
// assegno il nome alla curva
|
||||
bOk = bOk && m_pGeomDB->SetName( nCrvId, MACH_RAW_OUTLINE) ;
|
||||
// assegno il colore alla curva
|
||||
bOk = bOk && m_pGeomDB->SetMaterial( nCrvId, cCol) ;
|
||||
}
|
||||
bOk = bOk && UpdateRawOutline( nRawId) ;
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
if ( ! bOk) {
|
||||
m_pGeomDB->Erase( nRawId) ;
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// nascondo la superficie originale
|
||||
m_pGeomDB->SetStatus( nSurfId, GDB_ST_OFF) ;
|
||||
// tutto ok
|
||||
return nRawId ;
|
||||
}
|
||||
@@ -918,6 +907,9 @@ MachMgr::RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg)
|
||||
LOG_ERROR( GetEMkLogger(), "Error on RotateRawPart") ;
|
||||
return false ;
|
||||
}
|
||||
// se rotazione non è attorno a Z, aggiorno la curva di outline
|
||||
if ( abs( dAngRotDeg) > EPS_ANG_ZERO && ! vtAx.IsZ())
|
||||
UpdateRawOutline( nRawId) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1056,6 +1048,122 @@ MachMgr::GetRawPartBBox( int nRawId, BBox3d& b3Raw)
|
||||
return m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::UpdateRawOutline( int nRawId)
|
||||
{
|
||||
// cerco il solido del grezzo
|
||||
int nSolId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
|
||||
if ( nSolId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// creo la curva
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvCompo))
|
||||
return false ;
|
||||
// recupero la superficie trimesh in globale
|
||||
SurfLocal pStmG( m_pGeomDB, nSolId, GLOB_FRM) ;
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pStmG) ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
// recupero l'ingombro della superficie
|
||||
BBox3d b3Srf ;
|
||||
pStm->GetLocalBBox( b3Srf) ;
|
||||
// ne calcolo la silhouette secondo Z+ globale
|
||||
bool bSilh = false ;
|
||||
const int NUM_TRIA_LIM = 500 ;
|
||||
if ( pStm->GetTriangleCount() < NUM_TRIA_LIM) {
|
||||
POLYLINEVECTOR vPL ;
|
||||
if ( pStm->GetSilhouette( Z_AX, 10.0, vPL) && ! vPL.empty()) {
|
||||
// cerco il contorno esterno
|
||||
int nInd = - 1 ;
|
||||
double dMaxArea = 0 ;
|
||||
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
|
||||
double dArea ;
|
||||
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
|
||||
if ( dArea < 0)
|
||||
vPL[i].Invert() ;
|
||||
dMaxArea = abs( dArea) ;
|
||||
nInd = i ;
|
||||
}
|
||||
}
|
||||
// ne deduco la curva
|
||||
PtrOwner<ICurveComposite> pCrvSilh( CreateCurveComposite()) ;
|
||||
if ( nInd >= 0 && pCrvSilh->FromPolyLine( vPL[nInd])) {
|
||||
pCrvSilh->SetExtrusion( Z_AX) ;
|
||||
Plane3d plProj ;
|
||||
plProj.Set( b3Srf.GetMin(), Z_AX) ;
|
||||
pCrvCompo.Set( GetCurveComposite( ProjectCurveOnPlane( *pCrvSilh, plProj))) ;
|
||||
if ( ! IsNull( pCrvCompo)) {
|
||||
pCrvCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ;
|
||||
bSilh = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
PtrOwner<ICAvParSilhouettesSurfTm> pCavParSilh( CreateCAvParSilhouettesSurfTm()) ;
|
||||
if ( ! IsNull( pCavParSilh)) {
|
||||
Frame3d frSrf( b3Srf.GetMin()) ;
|
||||
const double SILH_TOL = 1.0 ;
|
||||
POLYLINEVECTOR vPL ;
|
||||
if ( pCavParSilh->SetData( { pStm}, frSrf, SILH_TOL) &&
|
||||
pCavParSilh->GetSilhouette( 0, vPL)) {
|
||||
// cerco il contorno esterno
|
||||
int nInd = - 1 ;
|
||||
double dMaxArea = 0 ;
|
||||
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
|
||||
double dArea ;
|
||||
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
|
||||
if ( dArea < 0)
|
||||
vPL[i].Invert() ;
|
||||
dMaxArea = abs( dArea) ;
|
||||
nInd = i ;
|
||||
}
|
||||
}
|
||||
// ne deduco la curva
|
||||
if ( nInd >= 0 && pCrvCompo->FromPolyLine( vPL[nInd])) {
|
||||
pCrvCompo->SetExtrusion( Z_AX) ;
|
||||
bSilh = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// non riuscita, la calcolo come contorno del box
|
||||
if ( ! bSilh) {
|
||||
Point3d ptMin ;
|
||||
double dDimX, dDimY, dDimZ ;
|
||||
b3Srf.GetMinDim( ptMin, dDimX, dDimY, dDimZ) ;
|
||||
PolyLine PL ;
|
||||
PL.AddUPoint( 0, ptMin) ;
|
||||
PL.AddUPoint( 1, ptMin + Vector3d( dDimX, 0,0)) ;
|
||||
PL.AddUPoint( 2, ptMin + Vector3d( dDimX, dDimY,0)) ;
|
||||
PL.AddUPoint( 3, ptMin + Vector3d( 0, dDimY,0)) ;
|
||||
PL.AddUPoint( 4, ptMin) ;
|
||||
if ( pCrvCompo->FromPolyLine( PL))
|
||||
pCrvCompo->SetExtrusion( Z_AX) ;
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
// rimuovo eventuale vecchia curva
|
||||
int nOtlId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_OUTLINE) ;
|
||||
m_pGeomDB->Erase( nOtlId) ;
|
||||
// inserisco la curva composita nel DB
|
||||
Frame3d frRaw ;
|
||||
m_pGeomDB->GetGroupGlobFrame( nRawId, frRaw) ;
|
||||
pCrvCompo->ToLoc( frRaw) ;
|
||||
int nCrvId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pCrvCompo)) ;
|
||||
if ( nCrvId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// assegno il nome alla curva
|
||||
m_pGeomDB->SetName( nCrvId, MACH_RAW_OUTLINE) ;
|
||||
// assegno il colore alla curva
|
||||
Color cCol ;
|
||||
if ( m_pGeomDB->GetMaterial( nSolId, cCol))
|
||||
m_pGeomDB->SetMaterial( nCrvId, cCol) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
static bool
|
||||
AssociateSurfs( IGeomDB* pGeomDB, int nSurfUpId, int nSurfDownId, vector<pair<int,int>>& vRawSurfs)
|
||||
|
||||
@@ -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)
|
||||
|
||||
+85
-65
@@ -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"
|
||||
@@ -25,10 +26,9 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
#define DEBUG 0
|
||||
#define DEBUG_PRV 0
|
||||
|
||||
const string KEY_AXIS_GROUP = "PreviewAxisGroup" ;
|
||||
const string KEY_ROT_AXIS_VAL = "PreviewRotAxisVal" ; // salvata per ogni gruppo di Preview
|
||||
const string KEY_PRV_ROTAXIS_VAL = "PreviewRotAxisVal" ; // salvata per ogni gruppo di Preview
|
||||
|
||||
// struttura per informazioni sugli assi
|
||||
struct PreviewAxisInfo {
|
||||
@@ -325,13 +325,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 ;
|
||||
}
|
||||
|
||||
@@ -392,7 +394,7 @@ Machining::MyPrepareToolPreview( bool bDouble)
|
||||
m_pGeomDB->SetName( nNewTabRotAxisId, sName) ;
|
||||
double dAxisPos = 0. ;
|
||||
bOk = bOk && pMch->GetAxisPos( sName, dAxisPos) &&
|
||||
m_pGeomDB->SetInfo( nNewTabRotAxisId, KEY_ROT_AXIS_VAL, dAxisPos) ;
|
||||
m_pGeomDB->SetInfo( nNewTabRotAxisId, KEY_PRV_ROTAXIS_VAL, dAxisPos) ;
|
||||
if ( ! bOk)
|
||||
return false ;
|
||||
nCurrHierarchyId = nNewTabRotAxisId ;
|
||||
@@ -502,7 +504,7 @@ Machining::MyPrepareToolPreview( bool bDouble)
|
||||
// memorizzo la sua posizione iniziale
|
||||
double dAxisPos = 0. ;
|
||||
bOk = bOk && pMch->GetAxisPos( sParentName, dAxisPos) &&
|
||||
m_pGeomDB->SetInfo( nNewParentId, KEY_ROT_AXIS_VAL, dAxisPos) ;
|
||||
m_pGeomDB->SetInfo( nNewParentId, KEY_PRV_ROTAXIS_VAL, dAxisPos) ;
|
||||
}
|
||||
// scorro i suoi figli
|
||||
int nChildId = m_pGeomDB->GetFirstInGroup( nParentId) ;
|
||||
@@ -566,41 +568,33 @@ Machining::MyPrepareToolPreview( bool bDouble)
|
||||
|
||||
// recupero il punto Tip dell'utensile e lo inserisco dentro al gruppo testa corrente
|
||||
int nExitGrpId = ( ! bDouble ? pMch->GetCurrExit() : pMch->GetExitId( sHead, nExitDBLId)) ;
|
||||
bool bOk = ( nExitGrpId != GDB_ID_NULL) ;
|
||||
if ( nExitGrpId == GDB_ID_NULL)
|
||||
return false ;
|
||||
string sExitGrpName ;
|
||||
bOk = bOk && m_pGeomDB->GetName( nExitGrpId, sExitGrpName) ;
|
||||
int nFrId = GDB_ID_NULL ;
|
||||
if ( bOk) {
|
||||
if ( ! bDouble) {
|
||||
nFrId = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadId, "_" + sExitGrpName) ;
|
||||
m_nPreviewExitId = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadId, sExitGrpName) ;
|
||||
}
|
||||
else {
|
||||
nFrId = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadIdDBL, "_" + sExitGrpName) ;
|
||||
m_nPreviewExitIdDBL = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadIdDBL, sExitGrpName) ;
|
||||
}
|
||||
if ( ! m_pGeomDB->GetName( nExitGrpId, sExitGrpName))
|
||||
return false ;
|
||||
if ( ! bDouble)
|
||||
m_nPreviewExitId = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadId, sExitGrpName) ;
|
||||
else
|
||||
m_nPreviewExitIdDBL = m_pGeomDB->GetFirstNameInGroup( m_nPreviewHeadIdDBL, sExitGrpName) ;
|
||||
// determino le coordinate del Tip in locale
|
||||
const Frame3d* pfrExit = m_pGeomDB->GetGroupFrame( nExitGrpId) ;
|
||||
if ( pfrExit == nullptr)
|
||||
return false ;
|
||||
Point3d ptToolTip = pfrExit->Orig() - dTLen * pfrExit->VersZ() ;
|
||||
// creo l'oggetto punto nel DBG
|
||||
PtrOwner<IGeoPoint3d> ptGToolTip( CreateGeoPoint3d()) ;
|
||||
if ( IsNull( ptGToolTip) || ! ptGToolTip->Set( ptToolTip))
|
||||
return false ;
|
||||
if ( ! bDouble) {
|
||||
m_nPreviewToolTip = m_pGeomDB->AddGeoObj( GDB_ID_NULL, m_nPreviewHeadId, Release( ptGToolTip)) ;
|
||||
return ( m_nPreviewToolTip != GDB_ID_NULL) ;
|
||||
}
|
||||
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) ;
|
||||
bOk = bOk && ptToolTip.IsValid() ;
|
||||
if ( bOk) {
|
||||
PtrOwner<IGeoPoint3d> ptGToolTip( CreateGeoPoint3d()) ;
|
||||
bOk = ( ! IsNull( ptGToolTip) && ptGToolTip->Set( ptToolTip)) ;
|
||||
if ( bOk) {
|
||||
if ( ! bDouble) {
|
||||
m_nPreviewToolTip = m_pGeomDB->AddGeoObj( GDB_ID_NULL, m_nPreviewHeadId, Release( ptGToolTip)) ;
|
||||
bOk = bOk && ( m_nPreviewToolTip != GDB_ID_NULL) ;
|
||||
}
|
||||
else {
|
||||
m_nPreviewToolTipDBL = m_pGeomDB->AddGeoObj( GDB_ID_NULL, m_nPreviewHeadIdDBL, Release( ptGToolTip)) ;
|
||||
bOk = bOk && ( m_nPreviewToolTipDBL != GDB_ID_NULL) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_nPreviewToolTipDBL = m_pGeomDB->AddGeoObj( GDB_ID_NULL, m_nPreviewHeadIdDBL, Release( ptGToolTip)) ;
|
||||
return ( m_nPreviewToolTipDBL != GDB_ID_NULL) ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -692,15 +686,17 @@ Machining::RemoveToolPreview( void)
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
#if DEBUG
|
||||
#if DEBUG_PRV
|
||||
return true ;
|
||||
#endif
|
||||
// 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 ;
|
||||
@@ -896,7 +892,7 @@ Machining::MyToolPreview( int nEntId, bool bDouble) const
|
||||
return false ;
|
||||
// recupero il valore corrente dell'asse
|
||||
double dCurrAxisVal = 0. ;
|
||||
m_pGeomDB->GetInfo( nAxisId, KEY_ROT_AXIS_VAL, dCurrAxisVal) ;
|
||||
m_pGeomDB->GetInfo( nAxisId, KEY_PRV_ROTAXIS_VAL, dCurrAxisVal) ;
|
||||
// recupero il valore dell'asse
|
||||
bool bFound = false ;
|
||||
double dAxisVal = 0 ;
|
||||
@@ -917,7 +913,7 @@ Machining::MyToolPreview( int nEntId, bool bDouble) const
|
||||
Vector3d vtDir = pGV->GetVector() ;
|
||||
vtDir.Normalize() ;
|
||||
m_pGeomDB->RotateGroup( nAxisId, ptPos, vtDir, ( dAxisVal - dCurrAxisVal)) ;
|
||||
m_pGeomDB->SetInfo( nAxisId, KEY_ROT_AXIS_VAL, dAxisVal) ;
|
||||
m_pGeomDB->SetInfo( nAxisId, KEY_PRV_ROTAXIS_VAL, dAxisVal) ;
|
||||
}
|
||||
|
||||
// recupero la posizione del tip dell'utensile per movimento assi lineari
|
||||
@@ -1040,7 +1036,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 +1049,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 +1065,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 +1080,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 +1155,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 +1166,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 :
|
||||
|
||||
+407
-94
@@ -50,6 +50,7 @@ const double OSC_MIN_LEN = 0.1 ;
|
||||
const double LIM_DOWN_APPRZ = -0.5 ;
|
||||
const double DELTA_ELEV_RAD = 4.0 ;
|
||||
const double LIM_SIN_DIFF_DIR = 0.175 ;
|
||||
const Color TOOL_CORR_COLOR = Color( 0, 255, 255) ;
|
||||
|
||||
//------------------------------ Errors --------------------------------------
|
||||
// 2301 = "Error in Milling : UpdateToolData failed"
|
||||
@@ -92,6 +93,7 @@ const double LIM_SIN_DIFF_DIR = 0.175 ;
|
||||
// 2362 = "Warning in Milling : tabs incompatible with saw blade"
|
||||
// 2363 = "Warning in Milling : tabs impossible"
|
||||
// 2364 = "Warning in Milling : tabs number less than minimum"
|
||||
// 2365 = "Warning in Milling : No compensation in tool, so no compensation in machine"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
USEROBJ_REGISTER( GetOperationClass( OPER_MILLING), Milling) ;
|
||||
@@ -259,6 +261,7 @@ Milling::Milling( void)
|
||||
m_bAggrBottom = false ;
|
||||
m_dCurrOscillLen = 0 ;
|
||||
m_dCurrTabsLen = 0 ;
|
||||
m_bToolComp = false ;
|
||||
m_bStartOutRaw = false ;
|
||||
m_bEndOutRaw = false ;
|
||||
}
|
||||
@@ -835,6 +838,37 @@ Milling::Apply( bool bRecalc, bool bPostApply)
|
||||
CalcSurfAuxView( nAuxId, nAuxViewId) ;
|
||||
}
|
||||
|
||||
// recupero flag correzione raggio fresa
|
||||
int nToolComp = TOOL_COMP_PROGRAM ;
|
||||
m_bToolComp = ( GetValInNotes( m_Params.m_sUserNotes, UN_TOOL_COMPENSATION, nToolComp) &&
|
||||
( nToolComp == TOOL_COMP_RADIUS || nToolComp == TOOL_COMP_LEN_AND_RAD) &&
|
||||
m_Params.m_nWorkSide != MILL_WS_CENTER) ;
|
||||
// compensazione utensile non applicata nel caso di famiglie di lame
|
||||
if ( m_bToolComp && ( m_TParams.m_nType & TF_SAWBLADE) != 0)
|
||||
m_bToolComp = false ;
|
||||
// compensazione utensile non applicata nel caso di attacco a None, ZigZag e Tang+Perp
|
||||
if ( m_bToolComp) {
|
||||
int nLeadInType = GetLeadInType() ;
|
||||
if ( nLeadInType == MILL_LI_NONE || nLeadInType == MILL_LI_ZIGZAG || nLeadInType == MILL_LI_TG_PERP)
|
||||
m_bToolComp = false ;
|
||||
}
|
||||
// compensazione utensile non applicata nel caso di Step Type Spiral
|
||||
if ( m_bToolComp && m_Params.m_nStepType == MILL_ST_SPIRAL)
|
||||
m_bToolComp = false ;
|
||||
// se compensazione utensile, forzo la componente perpendicolare di LeadIn e LeadOut
|
||||
if ( m_bToolComp) {
|
||||
m_Params.m_dLiCompLen = GetToolCompPerpLen() ;
|
||||
m_Params.m_dLoCompLen = GetToolCompPerpLen() ;
|
||||
// l'uscita deve essere tra quelle ammesse
|
||||
int nLeadOutType = GetLeadOutType() ;
|
||||
if ( nLeadOutType == MILL_LO_NONE || nLeadOutType == MILL_LO_PERP_TG)
|
||||
m_Params.m_nLeadOutType = MILL_LO_AS_LI ;
|
||||
}
|
||||
if ( m_bToolComp && m_TParams.m_nCorr == 0) {
|
||||
m_bToolComp = false ;
|
||||
m_pMchMgr->SetWarning( 2365, "Warning in Milling : No compensation in tool, so no compensation in machine") ;
|
||||
}
|
||||
|
||||
// lavoro ogni singola catena
|
||||
bool bOk = true ;
|
||||
int nPathId = m_pGeomDB->GetFirstGroupInGroup( nAuxId) ;
|
||||
@@ -1795,7 +1829,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
double dOffs = 0.5 * m_TParams.m_dDiam + GetOffsR() ;
|
||||
if ( m_Params.m_nWorkSide != MILL_WS_CENTER && abs( dOffs) > EPS_SMALL) {
|
||||
// valore offset
|
||||
double dSignOffs = ( m_Params.m_nWorkSide == MILL_WS_RIGHT) ? dOffs : - dOffs ;
|
||||
double dSignOffs = (( m_Params.m_nWorkSide == MILL_WS_RIGHT) ? dOffs : - dOffs) ;
|
||||
// esecuzione offset
|
||||
if ( ! CalcOffset( pCompo, dSignOffs)) {
|
||||
m_pMchMgr->SetLastError( 2302, "Error in Milling : Offset not computable") ;
|
||||
@@ -2558,8 +2592,14 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
}
|
||||
else {
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( AddLinearMove( ptP3, bSplitArcs, GetCorrType( TOOL_CORR_PATH, false), nullptr, &TOOL_CORR_COLOR) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
@@ -2578,8 +2618,14 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
Point3d ptP3 ; pArc->GetEndPoint( ptP3) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN, GetCorrType( TOOL_CORR_PATH, false), nullptr, &TOOL_CORR_COLOR) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// se ultima entità, uscita e retrazione
|
||||
@@ -2922,10 +2968,17 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
if ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se attacco a zigzag o a spirale, non affondo
|
||||
// se attacco a zigzag o a spirale o a guida, non affondo
|
||||
else if ( IsLeadInHelixOrZigzagOrGlide()) {
|
||||
ptP1 += vtTool * ( dStElev + GetLeadInOutToler()) ;
|
||||
dStElev = - GetLeadInOutToler() ;
|
||||
if ( ! m_bToolComp || ( m_bToolComp && ! ( GetLeadInType() == MILL_LI_GLIDE && ! pCompo->IsClosed()))) {
|
||||
ptP1 += vtTool * ( dStElev + GetLeadInOutToler()) ;
|
||||
dStElev = - GetLeadInOutToler() ;
|
||||
}
|
||||
if ( m_bToolComp) {
|
||||
Point3d ptCurr ; GetCurrPos( ptCurr) ;
|
||||
if ( ! AreSamePointApprox( ptCurr, ptP1))
|
||||
AddLinearMove( ptP1, bSplitArcs, MCH_CL_SAFEIN) ;
|
||||
}
|
||||
}
|
||||
// altrimenti, affondo in feed opportuna
|
||||
else {
|
||||
@@ -2958,8 +3011,20 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
}
|
||||
else {
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
int nId = AddLinearMove( ptP3, bSplitArcs) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_PATH, bInvert)) ;
|
||||
m_pGeomDB->SetMaterial( nId, AQUA) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
@@ -2978,8 +3043,20 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
Point3d ptP3 ; pArc->GetEndPoint( ptP3) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
int nId = AddArcMove( ptP3, ptCen, dAngCen, vtN) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_PATH, bInvert)) ;
|
||||
m_pGeomDB->SetMaterial( nId, AQUA) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// se ultima entità, uscita e se ultimo step retrazione
|
||||
@@ -2995,9 +3072,11 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
// se non c'è attacco a zigzag o a spirale oppure ultimo step, aggiungo uscita
|
||||
Point3d ptP1 = ptEnd ;
|
||||
Vector3d vtDir1 ;
|
||||
if ( ! IsLeadInHelixOrZigzag() || k == nStep) {
|
||||
if ( ! IsLeadInHelixOrZigzag() || k == nStep || m_bToolComp) {
|
||||
if ( k != nStep && GetLeadInType() == MILL_LI_GLIDE)
|
||||
dEndElev = - GetLeadInOutToler() ;
|
||||
if ( k != nStep)
|
||||
dEndElev = 0. ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtTool, dEndElev, bInvert, pCompo, bSplitArcs, ptP1, vtDir1)) {
|
||||
m_pMchMgr->SetLastError( 2311, "Error in Milling : LeadOut not computable") ;
|
||||
@@ -3232,7 +3311,6 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
Point3d ptStart ;
|
||||
pCurve->GetStartPoint( ptStart) ;
|
||||
Vector3d vtStart = m_vtStartDir ;
|
||||
// pCurve->GetStartDir( vtStart) ;
|
||||
// imposto versore correzione e ausiliario sul punto di partenza
|
||||
CalcAndSetCorrAuxDir( pCompo, i, false, true) ;
|
||||
// punto inizio attacco
|
||||
@@ -3240,7 +3318,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
Vector3d vtDir1 ;
|
||||
double dCalcStElev = 0 ;
|
||||
// se speciale e step intermedio
|
||||
if ( bSpecial && k > 1) {
|
||||
if ( ! m_bToolComp && bSpecial && k > 1) {
|
||||
ptP1 = ptStart + dStep * vtTool ;
|
||||
}
|
||||
// altrimenti
|
||||
@@ -3291,19 +3369,25 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
dStElev = ( j - 1) * dStep ;
|
||||
}
|
||||
// approccio standard al punto iniziale
|
||||
if ( k == 1 || bMidRetract) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart,
|
||||
bAhAboveStartEnd || bUhBelowStartEnd, k == 1, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
if ( ! ( m_bToolComp && bSpecial && k > 1)) {
|
||||
if ( k == 1 || bMidRetract) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart,
|
||||
bAhAboveStartEnd || bUhBelowStartEnd, k == 1, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti approccio diretto al punto iniziale
|
||||
else {
|
||||
if ( ! AddDirectApproach( ptP1, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// altrimenti approccio diretto al punto iniziale
|
||||
else {
|
||||
if ( ! AddDirectApproach( ptP1, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
SetFeed( GetStartFeed()) ;
|
||||
AddLinearMove( ptP1) ;
|
||||
}
|
||||
}
|
||||
// altrimenti, approccio per lame e frese che non lavorano di testa
|
||||
@@ -3390,6 +3474,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// aggiungo attacco
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtTool, dCalcStElev, false, pCompo, bSplitArcs)) {
|
||||
@@ -3413,8 +3498,14 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
}
|
||||
else {
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( AddLinearMove( ptP3, bSplitArcs, GetCorrType( TOOL_CORR_PATH, false), nullptr, &TOOL_CORR_COLOR) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
@@ -3433,20 +3524,25 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
Point3d ptP3 ; pArc->GetEndPoint( ptP3) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN, GetCorrType( TOOL_CORR_PATH, false), nullptr, &TOOL_CORR_COLOR) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// se ultima entità, uscita e retrazione
|
||||
if ( i == nMaxInd) {
|
||||
// se speciale e step intermedio salto uscita e retrazione
|
||||
if ( bSpecial && k != nStep)
|
||||
if ( bSpecial && k != nStep && ! m_bToolComp)
|
||||
continue ;
|
||||
// dati fine entità
|
||||
Point3d ptEnd ;
|
||||
pCurve->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtEnd = m_vtEndDir ;
|
||||
// pCurve->GetEndDir( vtEnd) ;
|
||||
// elevazione sul punto finale
|
||||
double dEndElev ;
|
||||
if ( ! GetElevation( m_nPhase, ptEnd, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev))
|
||||
@@ -3461,8 +3557,11 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
m_pMchMgr->SetLastError( 2311, "Error in Milling : LeadOut not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// se tool compensation e speciale, allora salto uscita e retroazione
|
||||
if ( m_bToolComp && bSpecial && k != nStep)
|
||||
continue ;
|
||||
// se step finale o intermedi con retrazione
|
||||
if ( k == nStep || bMidRetract || ! bSafeDirLinkStartEnd) {
|
||||
if ( ( k == nStep || bMidRetract || ! bSafeDirLinkStartEnd)) {
|
||||
// determino se la fine dell'uscita è fuori dal grezzo
|
||||
Vector3d vtRetr( vtTool.x, vtTool.y, 0) ;
|
||||
if ( ! vtRetr.Normalize())
|
||||
@@ -4034,8 +4133,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 +4159,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) {
|
||||
@@ -4782,7 +4887,7 @@ Milling::GetLeadInType( void) const
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
|
||||
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) const
|
||||
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1)
|
||||
{
|
||||
// Assegno tipo e parametri
|
||||
int nType = GetLeadInType() ;
|
||||
@@ -4791,6 +4896,7 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
|
||||
double dElev = m_Params.m_dLiElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLiElev, dStElev + GetLeadInOutToler()) ;
|
||||
double dCompLen = m_Params.m_dLiCompLen ;
|
||||
// se step invertito
|
||||
if ( bInvert) {
|
||||
// va aggiustato se non zigzag o spirale
|
||||
@@ -4809,6 +4915,7 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
|
||||
dElev = m_Params.m_dLoElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLoElev, dStElev + GetLeadInOutToler()) ;
|
||||
dCompLen = m_Params.m_dLoCompLen ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4816,8 +4923,18 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
|
||||
bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) ||
|
||||
( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ;
|
||||
// verifico di poter fare l'ingresso a inseguimento
|
||||
if ( nType == MILL_LI_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL)
|
||||
nType = MILL_LI_NONE ;
|
||||
if ( nType == MILL_LI_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL) {
|
||||
if ( ! m_bToolComp)
|
||||
nType = MILL_LI_NONE ;
|
||||
else {
|
||||
Vector3d vtPerp = vtStart ;
|
||||
Vector3d vtRot = OrthoCompo( vtTool, vtStart) ;
|
||||
vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 = ptStart + vtPerp * GetToolCompPerpLen() ;
|
||||
vtDir1 = ptP1 - ptStart ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Calcolo punto iniziale
|
||||
switch ( nType) {
|
||||
case MILL_LI_NONE :
|
||||
@@ -4832,15 +4949,15 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
|
||||
vtDir1 = ptP1 - ptStart ;
|
||||
if ( ! vtDir1.Normalize())
|
||||
return false ;
|
||||
bool bOk = true ;
|
||||
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
|
||||
if ( m_Params.m_dLiCompLen > 10 * EPS_SMALL) {
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
vtDir1 = OrthoCompo( vtDir1, vtTool) ;
|
||||
bOk = bOk && vtDir1.Normalize() ;
|
||||
vtDir1.Rotate( vtRot, 0, ( bCcwRot ? -1 : 1)) ;
|
||||
ptP1 += vtDir1 * m_Params.m_dLiCompLen ;
|
||||
if ( ! vtDir1.Normalize())
|
||||
return false ;
|
||||
vtDir1.Rotate( vtTool, 0, ( bCcwRot ? -1 : 1)) ;
|
||||
ptP1 += vtDir1 * dCompLen ;
|
||||
}
|
||||
return bOk ;
|
||||
return true ;
|
||||
}
|
||||
case MILL_LI_TG_PERP : {
|
||||
Vector3d vtPerp = vtStart ;
|
||||
@@ -4858,17 +4975,18 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
|
||||
vtDir1 = ptP1 - ptStart ;
|
||||
if ( ! vtDir1.Normalize())
|
||||
return false ;
|
||||
bool bOk = true ;
|
||||
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
|
||||
if ( m_Params.m_dLiCompLen > 10 * EPS_SMALL) {
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
PtrOwner<ICurve> pCrv( GetArc2PVN( ptStart, ptP1, - vtStart, vtTool)) ;
|
||||
bOk = bOk && ! IsNull( pCrv) && pCrv->GetEndDir( vtDir1) ;
|
||||
if ( IsNull( pCrv) || ! pCrv->GetEndDir( vtDir1))
|
||||
return false ;
|
||||
vtDir1 = OrthoCompo( vtDir1, vtTool) ;
|
||||
bOk = bOk && vtDir1.Normalize() ;
|
||||
vtDir1.Rotate( vtRot, 0, ( bCcwRot ? -1 : 1)) ;
|
||||
ptP1 += vtDir1 * m_Params.m_dLiCompLen ;
|
||||
if ( ! vtDir1.Normalize())
|
||||
return false ;
|
||||
vtDir1.Rotate( vtTool, 0, ( bCcwRot ? -1 : 1)) ;
|
||||
ptP1 += vtDir1 * dCompLen ;
|
||||
}
|
||||
return bOk ;
|
||||
return true ;
|
||||
}
|
||||
case MILL_LI_GLIDE :
|
||||
{
|
||||
@@ -4890,15 +5008,36 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
|
||||
}
|
||||
ptP1 += vtTool * ( vtTool * ( ptStart - ptP1)) + vtTool * dElev ;
|
||||
vtDir1 = ptP1 - ptStart ;
|
||||
return vtDir1.Normalize() ;
|
||||
if ( ! vtDir1.Normalize())
|
||||
return false ;
|
||||
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
vtDir1 = OrthoCompo( vtDir1, vtTool) ;
|
||||
if ( ! vtDir1.Normalize())
|
||||
return false ;
|
||||
vtDir1.Rotate( vtTool, 0, ( bCcwRot ? -1 : 1)) ;
|
||||
ptP1 += vtDir1 * dCompLen ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
case MILL_LI_ZIGZAG :
|
||||
ptP1 = ptStart ;
|
||||
vtDir1 = -vtStart ;
|
||||
return true ;
|
||||
case MILL_LI_HELIX :
|
||||
ptP1 = ptStart ;
|
||||
vtDir1 = -vtStart ;
|
||||
if ( ! m_bToolComp) {
|
||||
ptP1 = ptStart ;
|
||||
vtDir1 = -vtStart ;
|
||||
}
|
||||
else {
|
||||
bool bAtLeft = ( bInvert != ( m_Params.m_nWorkSide != MILL_WS_RIGHT)) ;
|
||||
// vettore dal punto al centro elica
|
||||
Vector3d vtCen = vtStart ;
|
||||
vtCen.Rotate( vtTool, 0, ( bAtLeft ? 1 : - 1)) ;
|
||||
// estensione per componente perpendicolare
|
||||
ptP1 = ptStart + vtCen * m_Params.m_dLiCompLen ;
|
||||
vtDir1 = -vtStart ;
|
||||
}
|
||||
return true ;
|
||||
default :
|
||||
return false ;
|
||||
@@ -4917,6 +5056,7 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
double dElev = m_Params.m_dLiElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLiElev, dStElev + GetLeadInOutToler()) ;
|
||||
double dCompLen = m_Params.m_dLiCompLen ;
|
||||
// se step invertito
|
||||
if ( bInvert) {
|
||||
// va aggiustato se non zigzag o spirale
|
||||
@@ -4935,6 +5075,7 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
dElev = m_Params.m_dLoElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLoElev, dStElev + GetLeadInOutToler()) ;
|
||||
dCompLen = m_Params.m_dLoCompLen ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4942,8 +5083,12 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) ||
|
||||
( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ;
|
||||
// verifico di poter fare l'ingresso a inseguimento
|
||||
if ( nType == MILL_LI_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL)
|
||||
nType = MILL_LI_NONE ;
|
||||
if ( nType == MILL_LI_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL) {
|
||||
if ( ! m_bToolComp)
|
||||
nType = MILL_LI_NONE ;
|
||||
else
|
||||
return ( AddLinearMove( ptStart, bSplitArcs, GetCorrType( TOOL_CORR_IN, bInvert), &MCH_CL_LEADIN, &TOOL_CORR_COLOR) != GDB_ID_NULL) ;
|
||||
}
|
||||
// Eseguo a seconda del tipo
|
||||
switch ( nType) {
|
||||
case MILL_LI_NONE :
|
||||
@@ -4957,15 +5102,24 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
dElev = 0 ;
|
||||
}
|
||||
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
|
||||
if ( m_Params.m_dLiCompLen > 10 * EPS_SMALL) {
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
Vector3d vtPerp = vtStart ;
|
||||
Vector3d vtRot = OrthoCompo( vtTool, vtStart) ;
|
||||
vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
Point3d ptMid = ptStart - vtStart * dTang + vtPerp * dPerp + vtTool * dElev ;
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, GetCorrType( TOOL_CORR_IN, bInvert), &MCH_CL_LEADIN, &TOOL_CORR_COLOR) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
if ( ! m_bToolComp)
|
||||
return ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
else
|
||||
return ( AddLinearMove( ptStart, bSplitArcs, GetCorrType( TOOL_CORR_PATH, bInvert), &MCH_CL_LEADIN, &TOOL_CORR_COLOR) != GDB_ID_NULL) ;
|
||||
case MILL_LI_TG_PERP :
|
||||
{
|
||||
Vector3d vtPerp = vtStart ;
|
||||
@@ -4986,19 +5140,28 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
dElev = 0 ;
|
||||
}
|
||||
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
|
||||
if ( m_Params.m_dLiCompLen > 10 * EPS_SMALL) {
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
Vector3d vtPerp = vtStart ;
|
||||
Vector3d vtRot = OrthoCompo( vtTool, vtStart) ;
|
||||
vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptMid = ptStart - vtStart * dTang + vtPerp * dPerp + vtTool * dElev ;
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, GetCorrType( TOOL_CORR_IN, bInvert), &MCH_CL_LEADIN, &TOOL_CORR_COLOR) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
PtrOwner<ICurve> pCrv( GetArc2PVN( ptStart, ptMid, - vtStart, vtTool)) ;
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
pCrv->Invert() ;
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
if ( ! m_bToolComp)
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
else
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, GetCorrType( TOOL_CORR_PATH, bInvert), &MCH_CL_LEADIN, &TOOL_CORR_COLOR) != GDB_ID_NULL) ;
|
||||
}
|
||||
case MILL_LI_GLIDE :
|
||||
{
|
||||
@@ -5045,8 +5208,24 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
double dNini = ( ptP1 - ORIG) * vtTool ;
|
||||
double dNfin = ( ptStart - ORIG) * vtTool ;
|
||||
AdjustCurveSlope( pCrv, dNini, dNfin) ;
|
||||
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
Point3d ptMid ;
|
||||
pCrv->GetStartPoint( ptMid) ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, GetCorrType( TOOL_CORR_IN, bInvert), &MCH_CL_LEADIN, &TOOL_CORR_COLOR) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// emetto (con eventuale spezzatura)
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
if ( ! m_bToolComp)
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
else
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, GetCorrType( TOOL_CORR_PATH, bInvert), &MCH_CL_LEADIN, &TOOL_CORR_COLOR) != GDB_ID_NULL) ;
|
||||
}
|
||||
case MILL_LI_ZIGZAG :
|
||||
{
|
||||
@@ -5120,6 +5299,8 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
// dati dell'elica
|
||||
double dRad = 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
Point3d ptCen = ptP1 + vtCen * dRad ;
|
||||
if ( m_bToolComp)
|
||||
ptCen -= vtCen * GetToolCompPerpLen() ;
|
||||
double dDeltaN = ( ptStart - ptP1) * vtTool ;
|
||||
double dAngCen = ceil( - dDeltaN / ( m_Params.m_dLiElev + 10 * EPS_SMALL)) * ( bAtLeft ? ANG_FULL : - ANG_FULL) ;
|
||||
// creo l'elica
|
||||
@@ -5127,7 +5308,16 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
if ( IsNull( pArc) || ! pArc->Set( ptCen, vtTool, dRad, - vtCen, dAngCen, dDeltaN))
|
||||
return false ;
|
||||
// emetto l'elica (con eventuale spezzatura)
|
||||
return ( AddCurveMove( pArc, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
if ( ! m_bToolComp)
|
||||
return ( AddCurveMove( pArc, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
else {
|
||||
Point3d ptCorrE ; pArc->GetStartPoint( ptCorrE) ;
|
||||
Vector3d vtCorrDir = ptCorrE - ptCen ; vtCorrDir.Normalize() ;
|
||||
Point3d ptCorrS = ptCorrE - m_Params.m_dLiCompLen * vtCorrDir ;
|
||||
if ( AddLinearMove( ptCorrE, bSplitArcs, GetCorrType( TOOL_CORR_IN, bInvert), &MCH_CL_LEADIN, &TOOL_CORR_COLOR) == GDB_ID_NULL)
|
||||
return false ;
|
||||
return ( AddCurveMove( pArc, bSplitArcs, GetCorrType( TOOL_CORR_PATH, bInvert), &MCH_CL_LEADIN, &TOOL_CORR_COLOR) != GDB_ID_NULL) ;
|
||||
}
|
||||
}
|
||||
default :
|
||||
return false ;
|
||||
@@ -5159,6 +5349,7 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect
|
||||
double dElev = m_Params.m_dLoElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLoElev, dEndElev + GetLeadInOutToler()) ;
|
||||
double dCompLen = m_Params.m_dLoCompLen ;
|
||||
// se uscita come ingresso o step invertito
|
||||
if ( nType == MILL_LO_AS_LI || bInvert) {
|
||||
int nLiType = GetLeadInType() ;
|
||||
@@ -5180,10 +5371,11 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect
|
||||
dElev = m_Params.m_dLiElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLiElev, dEndElev + GetLeadInOutToler()) ;
|
||||
dCompLen = m_Params.m_dLiCompLen ;
|
||||
}
|
||||
// senso di rotazione da dir tg a dir esterna
|
||||
bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) ||
|
||||
( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ;
|
||||
( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ;
|
||||
// verifico di poter fare l'uscita a inseguimento
|
||||
if ( nType == MILL_LO_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL)
|
||||
nType = MILL_LO_NONE ;
|
||||
@@ -5198,11 +5390,11 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect
|
||||
Vector3d vtRot = OrthoCompo( vtTool, vtEnd) ;
|
||||
vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp + vtTool * dElev ;
|
||||
if ( m_Params.m_dLoCompLen > 10 * EPS_SMALL) {
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
Vector3d vtPerp2 = vtEnd * dTang + vtPerp * dPerp ;
|
||||
if ( vtPerp2.Normalize()) {
|
||||
vtPerp2.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 += vtPerp2 * m_Params.m_dLoCompLen ;
|
||||
ptP1 += vtPerp2 * dCompLen ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
@@ -5223,11 +5415,11 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect
|
||||
Vector3d vtRot = OrthoCompo( vtTool, vtEnd) ;
|
||||
vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp + vtTool * dElev ;
|
||||
if ( m_Params.m_dLoCompLen > 10 * EPS_SMALL) {
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
Vector3d vtPerp2 = vtEnd * dTang + vtPerp * dPerp ;
|
||||
if ( vtPerp2.Normalize()) {
|
||||
vtPerp2.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 += vtPerp2 * m_Params.m_dLoCompLen ;
|
||||
ptP1 += vtPerp2 * dCompLen ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
@@ -5275,6 +5467,15 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect
|
||||
AdjustCurveSlope( pCrv, dNini, dNini + dElev) ;
|
||||
// assegno punto finale dell'uscita
|
||||
pCrv->GetEndPoint( ptP1) ;
|
||||
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
Vector3d vtDir1 ;
|
||||
pCrv->GetEndDir( vtDir1) ;
|
||||
vtDir1 = OrthoCompo( vtDir1, vtTool) ;
|
||||
vtDir1.Normalize() ;
|
||||
vtDir1.Rotate( vtTool, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 += vtDir1 * dCompLen ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
default :
|
||||
@@ -5294,6 +5495,7 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
double dElev = m_Params.m_dLoElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLoElev, dEndElev + GetLeadInOutToler()) ;
|
||||
double dCompLen = m_Params.m_dLoCompLen ;
|
||||
// se uscita come ingresso o step invertito
|
||||
if ( nType == MILL_LO_AS_LI || bInvert) {
|
||||
int nLiType = GetLeadInType() ;
|
||||
@@ -5315,13 +5517,52 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
dElev = m_Params.m_dLiElev ;
|
||||
if ( m_TParams.m_nType != TT_MILL_POLISHING)
|
||||
dElev = min( m_Params.m_dLiElev, dEndElev + GetLeadInOutToler()) ;
|
||||
dCompLen = m_Params.m_dLiCompLen ;
|
||||
}
|
||||
// verifico in caso di tool compensation se richiesta uscita con 1/4 di elica
|
||||
if ( m_bToolComp && GetLeadInType() == MILL_LI_HELIX && GetLeadOutType() == MILL_LO_AS_LI) {
|
||||
bool bAtLeft = ( bInvert != ( m_Params.m_nWorkSide != MILL_WS_RIGHT)) ;
|
||||
// vettore dal punto al centro dell'elica
|
||||
Vector3d vtCen = vtEnd ;
|
||||
vtCen.Rotate( vtTool, 0, ( bAtLeft ? 1 : -1)) ;
|
||||
// dati dell'elica
|
||||
double dRad = 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
Point3d ptCen = ptEnd + vtCen * dRad ;
|
||||
double dDeltaN = ( ptEnd - ptP1) * vtTool ;
|
||||
double dAngCen = ( bAtLeft ? ANG_RIGHT : - ANG_RIGHT) ;
|
||||
// creo l'elica
|
||||
PtrOwner<ICurveArc> pArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pArc) || ! pArc->Set( ptCen, vtTool, dRad, - vtCen, dAngCen, 0.))
|
||||
return false ;
|
||||
// emetto l'elica (con eventuale spezzatura)
|
||||
if ( AddCurveMove( pArc, bSplitArcs, GetCorrType( TOOL_CORR_PATH, bInvert), &MCH_CL_LEADIN, &TOOL_CORR_COLOR) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// emetto il tratto perpendicolare
|
||||
Point3d ptCorrS ; pArc->GetEndPoint( ptCorrS) ;
|
||||
Vector3d vtCorrDir = ptCen - ptCorrS ; vtCorrDir.Normalize() ;
|
||||
Point3d ptCorrE = ptCorrS + m_Params.m_dLiCompLen * vtCorrDir ;
|
||||
if ( AddLinearMove( ptCorrE, bSplitArcs, GetCorrType( TOOL_CORR_OUT, bInvert), &MCH_CL_LEADIN, &TOOL_CORR_COLOR) == GDB_ID_NULL)
|
||||
return false ;
|
||||
ptP1 = ptCorrE ;
|
||||
vtDir1 = vtCorrDir ;
|
||||
return true ;
|
||||
}
|
||||
// senso di rotazione da dir tg a dir esterna
|
||||
bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) ||
|
||||
( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ;
|
||||
// verifico di poter fare l'uscita a inseguimento
|
||||
if ( nType == MILL_LO_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL)
|
||||
nType = MILL_LO_NONE ;
|
||||
if ( nType == MILL_LO_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL) {
|
||||
if ( ! m_bToolComp)
|
||||
nType = MILL_LO_NONE ;
|
||||
else {
|
||||
Vector3d vtPerp = vtEnd ;
|
||||
Vector3d vtRot = OrthoCompo( vtTool, vtEnd) ;
|
||||
vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 = ptEnd + vtPerp * GetToolCompPerpLen() ;
|
||||
vtDir1 = ptP1 - ptEnd ;
|
||||
return ( AddLinearMove( ptP1, bSplitArcs, GetCorrType( TOOL_CORR_IN, bInvert), &MCH_CL_LEADIN, &TOOL_CORR_COLOR) != GDB_ID_NULL) ;
|
||||
}
|
||||
}
|
||||
// eseguo a seconda del tipo
|
||||
switch ( nType) {
|
||||
case MILL_LO_NONE :
|
||||
@@ -5343,14 +5584,22 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
if ( ! vtDir1.Normalize())
|
||||
return false ;
|
||||
// inserisco movimento di uscita
|
||||
bool bOk = ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
bool bOk = true ;
|
||||
if ( ! m_bToolComp)
|
||||
bOk = ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
else {
|
||||
bOk = ( AddLinearMove( ptP1, bSplitArcs, GetCorrType( TOOL_CORR_PATH, bInvert), &MCH_CL_LEADOUT, &TOOL_CORR_COLOR) != GDB_ID_NULL) ;
|
||||
}
|
||||
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
|
||||
if ( m_Params.m_dLoCompLen > 10 * EPS_SMALL) {
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
vtDir1 = OrthoCompo( vtDir1, vtTool) ;
|
||||
bOk = bOk && vtDir1.Normalize() ;
|
||||
vtDir1.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 += vtDir1 * m_Params.m_dLoCompLen ;
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
vtDir1.Rotate( vtTool, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 += vtDir1 * dCompLen ;
|
||||
if ( ! m_bToolComp)
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
else
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, GetCorrType( TOOL_CORR_OUT, bInvert), &MCH_CL_LEADOUT, &TOOL_CORR_COLOR) != GDB_ID_NULL) ;
|
||||
}
|
||||
// eventuale movimento in elevazione per flottante
|
||||
if ( m_bTHoldFloating && dFloatElev > 10 * EPS_SMALL) {
|
||||
@@ -5392,14 +5641,20 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
if ( ! pCrv->GetEndDir( vtDirF))
|
||||
return false ;
|
||||
bool bOk = true ;
|
||||
bOk = ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
if ( ! m_bToolComp)
|
||||
bOk = ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
else
|
||||
bOk = ( AddCurveMove( pCrv, bSplitArcs, GetCorrType( TOOL_CORR_PATH, bInvert), &MCH_CL_LEADOUT, &TOOL_CORR_COLOR) != GDB_ID_NULL) ;
|
||||
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
|
||||
if ( m_Params.m_dLoCompLen > 10 * EPS_SMALL) {
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
vtDir1 = OrthoCompo( vtDirF, vtTool) ;
|
||||
bOk = bOk && vtDir1.Normalize() ;
|
||||
vtDir1.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 += vtDir1 * m_Params.m_dLoCompLen ;
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
vtDir1.Rotate( vtTool, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 += vtDir1 * dCompLen ;
|
||||
if ( ! m_bToolComp)
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
else
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, GetCorrType( TOOL_CORR_OUT, bInvert), &MCH_CL_LEADOUT, &TOOL_CORR_COLOR) != GDB_ID_NULL) ;
|
||||
}
|
||||
// eventuale movimento in elevazione per flottante
|
||||
if ( m_bTHoldFloating && dFloatElev > 10 * EPS_SMALL) {
|
||||
@@ -5449,12 +5704,27 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
// assegno la corretta pendenza
|
||||
double dNini = ( ptEnd - ORIG) * vtTool ;
|
||||
AdjustCurveSlope( pCrv, dNini, dNini + dElev) ;
|
||||
// emetto
|
||||
AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) ;
|
||||
// assegno punto e direzione finale dell'uscita
|
||||
pCrv->GetEndPoint( ptP1) ;
|
||||
pCrv->GetEndDir( vtDir1) ;
|
||||
return true ;
|
||||
// emetto
|
||||
bool bOk = true ;
|
||||
if ( ! m_bToolComp)
|
||||
bOk = ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
else
|
||||
bOk = ( AddCurveMove( pCrv, bSplitArcs, GetCorrType( TOOL_CORR_PATH, bInvert), &MCH_CL_LEADOUT, &TOOL_CORR_COLOR) != GDB_ID_NULL) ;
|
||||
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
vtDir1 = OrthoCompo( vtDir1, vtTool) ;
|
||||
bOk = bOk && vtDir1.Normalize() ;
|
||||
vtDir1.Rotate( vtTool, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 += vtDir1 * dCompLen ;
|
||||
if ( ! m_bToolComp)
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
else
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, GetCorrType( TOOL_CORR_OUT, bInvert), &MCH_CL_LEADOUT, &TOOL_CORR_COLOR) != GDB_ID_NULL) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
default :
|
||||
return false ;
|
||||
@@ -6510,11 +6780,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
|
||||
@@ -6634,8 +6904,18 @@ Milling::CalcOffset( ICurveComposite* pCompo, double dSignOffs) const
|
||||
// se curva piatta con estrusione non perpendicolare forzo offset avanzato
|
||||
bool bAdvOffs = ( bIsFlat && abs( vtExtr * plPlane.GetVersN()) < cos( 0.1 * DEGTORAD)) ;
|
||||
// eseguo offset semplice
|
||||
if ( ! bAdvOffs && pCompo->SimpleOffset( dSignOffs, nFlag))
|
||||
return true ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( ! bAdvOffs && pCompo->SimpleOffset( dSignOffs, nFlag))
|
||||
return true ;
|
||||
}
|
||||
else {
|
||||
if ( ! bAdvOffs && pCompo->SimpleOffset( dSignOffs, nFlag)) {
|
||||
int nSign = ( dSignOffs > 0.) - ( dSignOffs < 0.) ;
|
||||
pCompo->SimpleOffset( - nSign * GetToolCompMinRadOffset()) ;
|
||||
pCompo->SimpleOffset( nSign * GetToolCompMinRadOffset()) ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// eseguo offset avanzato
|
||||
if ( bIsFlat) {
|
||||
OffsetCurve OffsCrv ;
|
||||
@@ -6644,6 +6924,11 @@ Milling::CalcOffset( ICurveComposite* pCompo, double dSignOffs) const
|
||||
if ( pOffs != nullptr) {
|
||||
pCompo->Clear() ;
|
||||
pCompo->AddCurve( pOffs) ;
|
||||
if ( m_bToolComp) {
|
||||
int nSign = ( dSignOffs > 0.) - ( dSignOffs < 0.) ;
|
||||
pCompo->SimpleOffset( - nSign * GetToolCompMinRadOffset()) ;
|
||||
pCompo->SimpleOffset( nSign * GetToolCompMinRadOffset()) ;
|
||||
}
|
||||
pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ;
|
||||
return true ;
|
||||
}
|
||||
@@ -6751,3 +7036,31 @@ Milling::TrimExtendCurveToClosedStm( ICurveComposite* pCompo, int nCstmId, bool
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Milling::GetCorrType( int nToolCompEntity, bool bInvert) const
|
||||
{
|
||||
// verifica tipo di Entità
|
||||
if ( nToolCompEntity != TOOL_CORR_PATH && nToolCompEntity != TOOL_CORR_IN && nToolCompEntity != TOOL_CORR_OUT)
|
||||
return 0 ;
|
||||
// se entità di Uscita, allora valore 140
|
||||
if ( nToolCompEntity == TOOL_CORR_OUT)
|
||||
return 140 ;
|
||||
// Se lavorazione lato destro
|
||||
if ( m_Params.m_nWorkSide == MILL_WS_RIGHT) {
|
||||
if ( ! bInvert)
|
||||
return ( nToolCompEntity == TOOL_CORR_IN ? 141 : 41) ;
|
||||
else
|
||||
return ( nToolCompEntity == TOOL_CORR_IN ? 142 : 42) ;
|
||||
}
|
||||
// Se lavorazione lato sinistro
|
||||
else if ( m_Params.m_nWorkSide == MILL_WS_LEFT) {
|
||||
if ( ! bInvert)
|
||||
return ( nToolCompEntity == TOOL_CORR_IN ? 142 : 42) ;
|
||||
else
|
||||
return ( nToolCompEntity == TOOL_CORR_IN ? 141 : 41) ;
|
||||
}
|
||||
// per gli altri casi
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ class Milling : public Machining
|
||||
double m_dRampLen ;
|
||||
double m_dTopLen ;
|
||||
} ;
|
||||
enum ToolCorrEntity { TOOL_CORR_PATH = 0, TOOL_CORR_IN = 1, TOOL_CORR_OUT = 2 } ;
|
||||
|
||||
private :
|
||||
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
|
||||
@@ -115,7 +116,7 @@ class Milling : public Machining
|
||||
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool,
|
||||
double dSafeZ, double dSawEndElev, double dEndElev, double dAppr, bool bAddExtract = false) ;
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
|
||||
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) const ;
|
||||
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
|
||||
const Vector3d& vtTool, double dStElev, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs) ;
|
||||
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool,
|
||||
@@ -138,6 +139,7 @@ class Milling : public Machining
|
||||
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) const ;
|
||||
bool CalcOffset( ICurveComposite* pCompo, double dSignOffs) const ;
|
||||
bool TrimExtendCurveToClosedStm( ICurveComposite* pCompo, int nCstmId, bool bInvert) ;
|
||||
int GetCorrType( int nToolCompEntity, bool bInvert) const ;
|
||||
|
||||
private :
|
||||
double GetSpeed() const
|
||||
@@ -171,6 +173,10 @@ class Milling : public Machining
|
||||
m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
|
||||
double GetLeadInOutToler( void) const
|
||||
{ return ( m_bTHoldFloating ? LIO_ELEV_FLOAT : LIO_ELEV_TOL) ; }
|
||||
inline double GetToolCompMinRadOffset() const
|
||||
{ return 100. * EPS_SMALL ; }
|
||||
inline double GetToolCompPerpLen() const
|
||||
{ return 2.0 ; }
|
||||
friend class LeadIOStatus ;
|
||||
|
||||
private :
|
||||
@@ -194,6 +200,7 @@ class Milling : public Machining
|
||||
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
|
||||
double m_dCurrOscillLen ; // lunghezza corrente lungo il percorso per l'oscillazione
|
||||
double m_dCurrTabsLen ; // lunghezza corrente lungo il percorso per tabs
|
||||
bool m_bToolComp ; // correzione raggio utensile abilitata dai dati
|
||||
bool m_bStartOutRaw ; // flag forzatura inizio fuori dal grezzo
|
||||
bool m_bEndOutRaw ; // flag forzatura fine fuori dal grezzo
|
||||
Vector3d m_vtStartDir ; // direzione iniziale del percorso in elaborazione
|
||||
|
||||
+19
-31
@@ -1250,7 +1250,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
return false ;
|
||||
dLen += dStartAddLen ;
|
||||
}
|
||||
if (dEndAddLen > EPS_SMALL) {
|
||||
if ( dEndAddLen > EPS_SMALL) {
|
||||
if ( ! pCompo->ExtendEndByLen( dEndAddLen))
|
||||
return false ;
|
||||
dLen += dEndAddLen ;
|
||||
@@ -1330,7 +1330,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
|
||||
// calcolo l'elevazione massima
|
||||
double dElev ;
|
||||
if ( CalcPathElevation( pCompo, vtTool, dDepth, GetRadiusForStartEndElevation(), m_TParams.m_dThick, dElev)) {
|
||||
if ( CalcPathElevation( pCompo, vtTool, vtAux, dDepth, GetRadiusForStartEndElevation(), m_TParams.m_dThick, dElev)) {
|
||||
if ( dElev < EPS_SMALL && AreSameVectorApprox( vtExtr, Z_AX)) {
|
||||
BBox3d b3Crv ;
|
||||
pCompo->GetLocalBBox( b3Crv) ;
|
||||
@@ -1350,7 +1350,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
double dCosAng = min( abs( vtTg * vtExtr), cos( 30 * DEGTORAD)) ;
|
||||
double dAddEnc = m_TParams.m_dDiam / 2 * dCosAng / dSinAng ;
|
||||
|
||||
// affondamento speciale da note utente (!!! da trasformare in parametro come gli altri !!!)
|
||||
// affondamento speciale da note utente
|
||||
int nPlunge = 0 ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_PLUNGE, nPlunge) ;
|
||||
|
||||
@@ -1437,12 +1437,12 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dThick,
|
||||
double& dElev) const
|
||||
Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtAux,
|
||||
double dDepth, double dRad, double dThick, double& dElev) const
|
||||
{
|
||||
dElev = 0 ;
|
||||
int nMaxInd = pCompo->GetCurveCount() - 1 ;
|
||||
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
|
||||
const double DELTA_ELEV_RAD = 20.0 ;
|
||||
for ( int i = 0 ; i < pCompo->GetCurveCount() ; ++ i) {
|
||||
// curva corrente
|
||||
const ICurve* pCrvC = pCompo->GetCurve( i) ;
|
||||
// calcolo elevazione
|
||||
@@ -1451,17 +1451,16 @@ Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
pCrvC->GetStartPoint( ptStart) ;
|
||||
pCrvC->GetMidPoint( ptMid) ;
|
||||
pCrvC->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtStartPerp, vtEndPerp ;
|
||||
pCrvC->GetStartDir( vtStartPerp) ;
|
||||
vtStartPerp *= -dRad ;
|
||||
pCrvC->GetEndDir( vtEndPerp) ;
|
||||
vtEndPerp *= dRad ;
|
||||
Vector3d vtTg ; pCrvC->GetMidDir( vtTg) ;
|
||||
Vector3d vtOrtho = vtTool ^ vtTg ;
|
||||
vtOrtho.Normalize() ;
|
||||
vtOrtho *= dThick ;
|
||||
Vector3d vtStart, vtEnd ;
|
||||
pCrvC->GetStartDir( vtStart) ;
|
||||
pCrvC->GetEndDir( vtEnd) ;
|
||||
ptStart += -dRad * vtStart + 0.5 * dThick * vtAux ;
|
||||
ptMid += 0.5 * dThick * vtAux ;
|
||||
ptEnd += dRad * vtEnd + 0.5 * dThick * vtAux ;
|
||||
Vector3d vtOrtho = vtAux ;
|
||||
vtOrtho *= 0.5 * dThick + DELTA_ELEV_RAD ;
|
||||
Vector3d vtDepth = -vtTool * dDepth ;
|
||||
// linea centro utensile
|
||||
// in centro utensile
|
||||
if ( GetElevation( m_nPhase, ptStart + vtDepth, ptMid + vtDepth, ptEnd + vtDepth, vtTool, dCurrElev)) {
|
||||
if ( dCurrElev > dElev)
|
||||
dElev = dCurrElev ;
|
||||
@@ -1479,19 +1478,8 @@ Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
m_pMchMgr->SetLastError( 2505, "Error in Mortising : Entity GetElevation") ;
|
||||
return false ;
|
||||
}
|
||||
// da una parte
|
||||
if ( GetElevation( m_nPhase, ptStart + vtStartPerp + vtDepth, ptMid + vtDepth,
|
||||
ptEnd + vtEndPerp + vtDepth, vtTool, dCurrElev)) {
|
||||
if ( dCurrElev > dElev)
|
||||
dElev = dCurrElev ;
|
||||
}
|
||||
else {
|
||||
m_pMchMgr->SetLastError( 2505, "Error in Mortising : Entity GetElevation") ;
|
||||
return false ;
|
||||
}
|
||||
// dall'altra parte
|
||||
if ( GetElevation( m_nPhase, ptStart + vtStartPerp + vtDepth, ptMid + vtDepth,
|
||||
ptEnd + vtEndPerp + vtDepth, vtTool, dCurrElev)) {
|
||||
// sotto centro utensile
|
||||
if ( GetElevation( m_nPhase, ptStart + vtDepth - vtOrtho, ptMid + vtDepth - vtOrtho, ptEnd + vtDepth - vtOrtho, vtTool, dCurrElev)) {
|
||||
if ( dCurrElev > dElev)
|
||||
dElev = dCurrElev ;
|
||||
}
|
||||
@@ -1535,7 +1523,7 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se alrimenti affondamenti ripetuti da inizio a fine con ritorno basso
|
||||
// se altrimenti affondamenti ripetuti da inizio a fine con ritorno basso
|
||||
else if ( nPlunge == MORTISE_PLUNGE_START_TO_END) {
|
||||
// distanza e vettore spostamento laterale
|
||||
Vector3d vtDir = ptEnd - ptStart ;
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ class Mortising : public Machining
|
||||
bool Chain( int nGrpDestId) ;
|
||||
bool CalcSurfAuxView( int nAuxId, int nAuxViewId) ;
|
||||
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
|
||||
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dThick, double& dElev) const ;
|
||||
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtAux, double dDepth, double dRad, double dThick, double& dElev) const ;
|
||||
bool GenerateMortisingPv( int nPathId, const ICurveComposite* pCompo) ;
|
||||
bool GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep, int nPlunge) ;
|
||||
bool GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep,
|
||||
|
||||
@@ -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,8 @@ 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" ;
|
||||
static const std::string UN_TOOL_COMPENSATION = "ToolCompensation" ;
|
||||
|
||||
// Solo per Sawing
|
||||
static const std::string UN_DOWNSE = "DownSE" ;
|
||||
@@ -72,6 +75,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" ;
|
||||
|
||||
+133
-100
@@ -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,43 @@ 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) {
|
||||
if ( pMachine->IsKinematicRotAxisBlocked( i))
|
||||
continue ;
|
||||
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 +2402,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 +2429,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 +2453,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 +2480,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) ;
|
||||
}
|
||||
}
|
||||
@@ -2862,7 +2876,6 @@ Operation::CalculateRobotAxesValues( bool bFirst, const Point3d& ptP, const Vect
|
||||
if ( abs( vAng2[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
pMachine->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
|
||||
}
|
||||
bFirst = false ;
|
||||
}
|
||||
// altrimenti movimenti successivi
|
||||
else {
|
||||
@@ -2911,10 +2924,10 @@ Operation::CalculateRobotAxesValues( bool bFirst, const Point3d& ptP, const Vect
|
||||
// se esiste solo la prima
|
||||
if ( vAng2.empty())
|
||||
vAxVal = vAng1 ;
|
||||
// evito passaggio per lo zero di R5 (per evitare passaggio attraverso direzione singolare)
|
||||
else if ( vAng1[4] * vAxRotPrec[4] >= 0 && vAng2[4] * vAxRotPrec[4] < 0)
|
||||
// se non è inizio, evito passaggio per lo zero di R5 (per evitare passaggio attraverso direzione singolare)
|
||||
else if ( ! bFirst && vAng1[4] * vAxRotPrec[4] >= 0 && vAng2[4] * vAxRotPrec[4] < 0)
|
||||
vAxVal = vAng1 ;
|
||||
else if ( vAng1[4] * vAxRotPrec[4] < 0 && vAng2[4] * vAxRotPrec[4] >= 0)
|
||||
else if ( ! bFirst && vAng1[4] * vAxRotPrec[4] < 0 && vAng2[4] * vAxRotPrec[4] >= 0)
|
||||
vAxVal = vAng2 ;
|
||||
// minimizzo rotazione polso
|
||||
else if ( abs( vAng1[3] - vAxRotPrec[3]) < abs( vAng2[3] - vAxRotPrec[3]) + 10 * EPS_ANG_SMALL)
|
||||
@@ -3407,7 +3420,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 +3436,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 +3451,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 +3477,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 +3485,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 +3504,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 +3520,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 +3568,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 +3582,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 +3594,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 +3606,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 +3620,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 +3659,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 +3697,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 +3729,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 +3748,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 +3920,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 +3963,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 +4967,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 +4982,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 +5325,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 +5954,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 +5996,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) ;
|
||||
|
||||
+12
-7
@@ -181,8 +181,8 @@ class Operation : public IUserObj
|
||||
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
|
||||
std::string ExtractHint( const std::string& sNotes) const ;
|
||||
bool SetBlockedRotAxis( const std::string& sBlockedAxis, bool bToolSetOk = false) const ;
|
||||
bool CalculateAxesValues( const std::string& sHint, bool bSolChExact = false, double dSingConeAng = 0) ;
|
||||
bool CalculateDoubleAxesValues( const std::string& sHint, bool bSolChExact = false, double dSingConeAng = 0) ;
|
||||
bool CalculateAxesValues( const std::string& sHint, bool bSolChExact = false, double dSingConeAng = SING_CONE_ANG_DFLT) ;
|
||||
bool CalculateDoubleAxesValues( const std::string& sHint, bool bSolChExact = false, double dSingConeAng = SING_CONE_ANG_DFLT) ;
|
||||
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
|
||||
bool RemoveClimbRiseHome( bool bMain = true) ;
|
||||
double GetDeltaSafeZ( const Vector3d& vtTool) const ;
|
||||
@@ -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 :
|
||||
@@ -324,12 +325,16 @@ class Operation : public IUserObj
|
||||
int AddLinearMove( const Point3d& ptP, const std::string& sName) ;
|
||||
int AddLinearMove( const Point3d& ptP, bool bSplit) ;
|
||||
int AddLinearMove( const Point3d& ptP, bool bSplit, const std::string& sName) ;
|
||||
int AddLinearMove( const Point3d& ptP, bool bSplit, int nCorrType, const std::string* sName = nullptr, const Color* pColor = nullptr) ;
|
||||
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN) ;
|
||||
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, const std::string& sName) ;
|
||||
int AddArcMove ( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, int nCorrType,
|
||||
const std::string* psName = nullptr, const Color* pColor = nullptr) ;
|
||||
int AddCurveMove( const ICurve* pCrv) ;
|
||||
int AddCurveMove( const ICurve* pCrv, const std::string& sName) ;
|
||||
int AddCurveMove( const ICurve* pCrv, bool bSplit) ;
|
||||
int AddCurveMove( const ICurve* pCrv, bool bSplit, const std::string& sName) ;
|
||||
int AddCurveMove( const ICurve* pCrv, bool bSplit, int nCorrType, const std::string* psName = nullptr, const Color* pColor = nullptr) ;
|
||||
bool ResetMoveData( void) ;
|
||||
|
||||
protected :
|
||||
|
||||
@@ -348,6 +348,25 @@ Operation::AddLinearMove( const Point3d& ptP, bool bSplit, const string& sName)
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddLinearMove( const Point3d& ptP, bool bSplit, int nCorrType, const string* psName, const Color* pColor)
|
||||
{
|
||||
int nFirstId = AddLinearMove( ptP, bSplit) ;
|
||||
int nId = nFirstId ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
if ( psName != nullptr)
|
||||
m_pGeomDB->SetName( nId, *psName) ;
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
|
||||
if ( pCamData == nullptr || ! pCamData->SetCorrType( nCorrType))
|
||||
return GDB_ID_NULL ;
|
||||
if ( pColor != nullptr)
|
||||
m_pGeomDB->SetMaterial( nId, *pColor) ;
|
||||
nId = m_pGeomDB->GetNext( nId) ;
|
||||
}
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN)
|
||||
@@ -422,6 +441,24 @@ Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen,
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, int nCorrType,
|
||||
const string* psName, const Color* pColor)
|
||||
{
|
||||
int nId = AddArcMove( ptP, ptCen, dAngCen, vtN) ;
|
||||
if ( nId != GDB_ID_NULL) {
|
||||
if ( psName != nullptr)
|
||||
m_pGeomDB->SetName( nId, *psName) ;
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
|
||||
if ( pCamData == nullptr || ! pCamData->SetCorrType( nCorrType))
|
||||
return GDB_ID_NULL ;
|
||||
if ( pColor != nullptr)
|
||||
m_pGeomDB->SetMaterial( nId, *pColor) ;
|
||||
}
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddCurveMove( const ICurve* pCrv)
|
||||
@@ -530,6 +567,25 @@ Operation::AddCurveMove( const ICurve* pCrv, bool bSplit, const string& sName)
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddCurveMove( const ICurve* pCrv, bool bSplit, int nCorrType, const string* psName, const Color* pColor)
|
||||
{
|
||||
int nFirstId = AddCurveMove( pCrv, bSplit) ;
|
||||
int nId = nFirstId ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
if ( psName != nullptr)
|
||||
m_pGeomDB->SetName( nId, *psName) ;
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
|
||||
if ( pCamData == nullptr || ! pCamData->SetCorrType( nCorrType))
|
||||
return GDB_ID_NULL ;
|
||||
if ( pColor != nullptr)
|
||||
m_pGeomDB->SetMaterial( nId, *pColor) ;
|
||||
nId = m_pGeomDB->GetNext( nId) ;
|
||||
}
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::ResetMoveData( void)
|
||||
|
||||
@@ -174,6 +174,7 @@ static const std::string GVAR_MASK = ".MASK" ; // (int) mask asso
|
||||
static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento
|
||||
static const std::string GVAR_FLAG2 = ".FLAG2" ; // (int) secondo flag associato ad ogni movimento
|
||||
static const std::string GVAR_INDEX = ".IDX" ; // (int) indice associato ad ogni movimento
|
||||
static const std::string GVAR_CORR = ".CORR" ; // (int) tipo di correzione (0=no,41=sn,42=dx,140=out,141=in_sn,142=in_dx)
|
||||
static const std::string GVAR_TDIR = ".TDIR" ; // (Vector3d) versore utensile nel riferimento pezzo
|
||||
static const std::string GVAR_CDIR = ".CDIR" ; // (Vector3d) versore correzione nel riferimento pezzo
|
||||
static const std::string GVAR_ADIR = ".ADIR" ; // (Vector3d) versore ausiliario nel riferimento pezzo
|
||||
|
||||
+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 ;
|
||||
|
||||
+1457
-369
File diff suppressed because it is too large
Load Diff
+19
-6
@@ -30,9 +30,11 @@ struct PathInfoPO {
|
||||
bool bOptTrap ; // flag per casi ottimizzati a trapezio ( per Spiral)
|
||||
bool bOptCirle ; // flag per casi ottimizzati a Spirale ( per Spiral)
|
||||
bool bIsZigZagOneWayBorder ; // curve di bordo dei lati chiusi ( per ZigZag e OneWay)
|
||||
bool bToolCompensation ; // curva di bordo per compensazione utensile
|
||||
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 +131,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) ;
|
||||
const Vector3d& vtTool, bool bHolePocketing, const Point3d& ptHoleDest, bool bToolComp, 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 +153,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 +176,15 @@ 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) ;
|
||||
bool AddTangentLinesForToolCompensation( ICurveComposite* pCompoPath, const Vector3d& vtTool, const ISurfFlatRegion* pSfrLimit) const ;
|
||||
bool AssignPropsToCamDataForToolCompensation( int nId, bool bLineIn, bool bLineOut, bool bToolAtLeft) ;
|
||||
// debug
|
||||
void DebugDrawSfr( const ISurfFlatRegion* pSfr, bool bUniform, int nlayer = GDB_ID_ROOT) ;
|
||||
void DebugDrawLoop( const ICurveComposite* pCrvCompo, int nLayer, bool bUniform) ;
|
||||
|
||||
+26
-6
@@ -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 ;
|
||||
|
||||
@@ -501,7 +508,8 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
|
||||
case 1 : // linea
|
||||
if ( ! OnLinear( nEntId, nEntInd, nMove, AxesEnd,
|
||||
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
|
||||
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext))
|
||||
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(),
|
||||
pCamData->GetCorrType(), nMoveNext, AxesNext))
|
||||
return false ;
|
||||
break ;
|
||||
case 2 : // arco CW
|
||||
@@ -511,7 +519,8 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
|
||||
if ( ! OnArc( nEntId, nEntInd, nMove, AxesEnd,
|
||||
pCamData->GetAxesCen(), ptMid, pCamData->GetAxesRad(), pCamData->GetAxesAngCen(),
|
||||
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
|
||||
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext))
|
||||
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(),
|
||||
pCamData->GetCorrType(), nMoveNext, AxesNext))
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
@@ -963,18 +972,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
|
||||
@@ -1091,7 +1107,7 @@ Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd
|
||||
bool
|
||||
Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext)
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext)
|
||||
{
|
||||
// cancello variabili estranee
|
||||
ResetArcData() ;
|
||||
@@ -1123,6 +1139,8 @@ Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEn
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
|
||||
// assegno il valore dell'indice
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
|
||||
// assegno il tipo di correzione
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_CORR, nCorr) ;
|
||||
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
|
||||
if ( nMoveNext != -1) {
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
|
||||
@@ -1148,7 +1166,7 @@ bool
|
||||
Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
|
||||
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext)
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext)
|
||||
{
|
||||
// assegno Id e indice entità di movimento
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ;
|
||||
@@ -1190,6 +1208,8 @@ Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
|
||||
// assegno il valore dell'indice
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
|
||||
// assegno il tipo di correzione
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_CORR, nCorr) ;
|
||||
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
|
||||
if ( nMoveNext != -1) {
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
|
||||
|
||||
+3
-3
@@ -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) ;
|
||||
@@ -65,11 +65,11 @@ class Processor
|
||||
int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ;
|
||||
bool OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ;
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext) ;
|
||||
bool OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
|
||||
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ;
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext) ;
|
||||
bool ResetArcData( void) ;
|
||||
|
||||
protected :
|
||||
|
||||
+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
|
||||
|
||||
+516
-341
File diff suppressed because it is too large
Load Diff
+7
-3
@@ -21,6 +21,7 @@
|
||||
#include "GeoConst.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EGkSurfLocal.h"
|
||||
|
||||
@@ -177,8 +178,8 @@ class SurfFinishing : public Machining
|
||||
double dFrontTriaTolerAng, double& dMaxFrontTriaRad) const ;
|
||||
bool CalcOptimalZConstCurves( const ISurfFlatRegion* pSfrLoc, const SURFLOCALVECTOR& vSrfLoc,
|
||||
const Frame3d& frSurf, const Vector3d& vtTool, double dAngDegSplit,
|
||||
double dAngDegTol, double dDepth, ICAvToolSurfTm* pCAvTlStm, VECTORPATHS& vPaths, ISurfFlatRegion* pSfrProj) const ;
|
||||
bool CalcOptimalZigZagCurves( const ISurfFlatRegion* pSfrLoc, const Frame3d& frSurf,
|
||||
double dAngDegTol, double dDepth, ICAvToolSurfTm* pCAvTlStm, VECTORPATHS& vPaths) const ;
|
||||
bool CalcOptimalZigZagCurves( ISURFFRPOVECTOR& vSfrZigZagProj, const Frame3d& frSurf,
|
||||
const Vector3d& vtTool, double dDepth, ICAvToolSurfTm* pCAvTlStm, VECTORPATHS& vPaths) const ;
|
||||
bool GetOptimalSfr( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfrLoc, const Vector3d& vtTool,
|
||||
double dDepth, double dElev, ISurfFlatRegion* pSfrSpiral, ISurfFlatRegion* pSfrZConst) const ;
|
||||
@@ -213,6 +214,9 @@ class SurfFinishing : public Machining
|
||||
bool MarchingSquares( const VECTORCOLLISIONSFR& vPntM, int nType, double dOffsTol, int nStepX, int nStepY, double dClippingAngle,
|
||||
double dLimInfClippingAng, double dLimSupClippingAng, const Vector3d& vtAxL, const Vector3d& vtMoveL, ICAvToolSurfTm* pCAvTlStm,
|
||||
ICRVCOMPOPOVECTOR& vCrvCompo) const ;
|
||||
bool AreSameSfrChunkEpsilon( const ISurfFlatRegion* pSfrChunkA, const ISurfFlatRegion* pSfrChunkB, double dMaxDist) const ;
|
||||
bool CalcOptimalZigZagRegion( const ISurfFlatRegion* pSfrCntLoc, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
|
||||
const Vector3d& vtTool, double dDepth, double dSplitAngDeg, ISURFFRPOVECTOR& vpSfrZigZagProj) const ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
|
||||
@@ -235,7 +239,7 @@ class SurfFinishing : public Machining
|
||||
int GetLeadOutType( void) const ;
|
||||
|
||||
private :
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
SurfFinishingData m_Params ; // parametri lavorazione
|
||||
ToolData m_TParams ; // parametri utensile
|
||||
double m_dTHoldBase ; // posizione base del porta-utensile
|
||||
|
||||
+171
-75
@@ -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,9 +3043,9 @@ 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)) {
|
||||
false, 0., 0., false, vCrvPaths)) {
|
||||
if ( vStepInfo[nInd].bIsExtraStep) {
|
||||
string sWarn = "Warning in SurfRoughing : CalcPocketing failed with substep (" + ToString( vStepInfo[nInd].dDepth, 1) + ")" ;
|
||||
m_pMchMgr->SetWarning( 3055, sWarn) ;
|
||||
@@ -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