Files
Riccardo Elitropi e1ef39ad72 EgtMachKernel :
- in MachConst aggiunte Key per lettura da file .ini della macchina per Drilling in doppio in parallelo e per calcolo Feeds in PocketingNT
- in Drilling migliorate le considerazioni per lavorazioni in Doppio con possibilità di movimenti in parallelo per gli utensili
- in Preview Utensile corretta la posizione del secondo Tool in caso di lavorazioni in doppio con utensili di lunghezza differente
- in Machining aggiunta la funzione per calcolare il piano di Mirroring
- in PocketingNT aggiunta la lettura dal file .ini della macchina per calcolo delle Feeds.
2026-04-22 13:16:17 +02:00

169 lines
9.7 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : Drilling.h Data : 21.05.15 Versione : 1.6e7
// Contenuto : Dichiarazione della classe Drilling.
//
//
//
// Modifiche : 21.05.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Machining.h"
#include "DrillingData.h"
#include "ToolData.h"
#include "MachiningConst.h"
//----------------------------------------------------------------------------
// definizione strutture e vettori per fori, utensili e maschere
struct Hole ;
struct MHDrill ;
struct HoleInfo ;
struct ToolInfo ;
class ICurve ;
typedef std::vector<MHDrill> TABMHDRILL ;
typedef std::vector<HoleInfo> VECTORHOLE ;
typedef std::vector<ToolInfo> VECTORTOOL ;
//----------------------------------------------------------------------------
// definizione tipologia foratura
const int DRILL_TYPE_ERR = 0 ;
const int DRILL_TYPE_STD = 1 ; // 1 tool
const int DRILL_TYPE_MULTI_FIXED = 2 ; // più utensili fissi
const int DRILL_TYPE_MULTI_SEL = 3 ; // più utensili selezionabili
//----------------------------------------------------------------------------
class Drilling : public Machining
{
public : // IUserObj
Drilling* Clone( void) const override ;
const std::string& GetClassName( void) const override ;
bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
bool ToSave( void) const override
{ return true ; }
bool Save( int nBaseId, STRVECTOR& vString) const override ;
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
public : // Operation
int GetType( void) const override
{ return OPER_DRILLING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nDrillings == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
protected : // Operation
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
public : // Machining
bool Prepare( const std::string& sDriName) override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool SetGeometry( const SELVECTOR& vIds) override ;
bool Preview( bool bRecalc) override ;
bool Apply( bool bRecalc, bool bPostApply) override ;
bool Update( bool bPostApply) override ;
bool GetParam( int nType, bool& bVal) const override ;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
bool GetSkippedGeometry( SELVECTOR& vIds) const override ;
public :
Drilling( void) ;
private :
bool GetHoleData( SelData Id, Hole& hole) ;
bool StandardProcess( bool bRecalc, int nPvId, int nClId) ;
bool AlongCurveProcess( bool bRecalc, int nPvId, int nClId) ;
bool Chain( int nGrpDestId) ;
ICurve* GetCurve( SelData Id) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool GenerateHolePv( int nInd, const SelData& nCircId, const std::string& sPName, int nPvId) ;
bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId,
double dMHOff = 0, const Vector3d& vtAux = V_NULL, int nDrillType = DRILL_TYPE_STD,
INTVECTOR* pvActiveExit = nullptr, ToolInfo* currToolData = nullptr) ;
bool AdapthPathToMainTool( int nInd, const SelData& nCircId, const std::string& sPName, int nClId,
double dMHOff, const Vector3d& vtAux, int nDrillType,
INTVECTOR* pvActiveExit, ToolData* currToolData) ;
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) ;
bool CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux) ;
bool CalcMaskSel( VECTORHOLE& vHoles, const VECTORTOOL& vTools, const Vector3d& vtTool, const Vector3d& vtAux) ;
bool CalcDrilledHolesByConfig( VECTORHOLE& vHoles, int nMyInd, int nIndConfig, INTVECTOR& vIndDrilled) ;
bool EraseDuplicatedConfigs( VECTORHOLE& vHoles) ;
bool KeepMinRotatedConfigs( VECTORHOLE& vHoles, const Vector3d& vtAux, const Vector3d& vtTool) ;
bool CalcMultiHeadUndrilledHoles( const VECTORHOLE& vHoles, INTVECTOR& vIdUndrilledHoles) ;
bool CalcMultiHeadPartialDrilledHoles( const TABMHDRILL& vDrills, const VECTORHOLE& vHoles, const VECTORTOOL& vTools,
const INTVECTOR& vIdUndrilledHoles, INTDBLVECTOR& vIdPartialdrilledHoles) ;
bool CheckBasedConfig( const VECTORHOLE& vHoles, int nHoleInd, int& nValidConfig, bool& bBaseCase) ;
bool GetClosestHolesToHole( const VECTORHOLE& vHoles, int nMyInd, bool bDrilled, INTVECTOR& vInds) ;
bool OrderConfigsForSelectableTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndToolMain, TABMHDRILL& vDrills) ;
bool GetConfigsWithMoreDrilledHoles( const VECTORHOLE& vHoles, INTVECTOR& vInds) ;
bool ChooseBestConfigForSelectableTools( const VECTORHOLE& vHoles, int nIndToolMain, INTVECTOR& vConfInds, int& nBestConf) ;
bool CheckOtherHolesWithTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP,
const Frame3d& frHTM, const Frame3d& frHMTOP, double dDiamToler, int& nDrills) ;
bool GetHoleBestConfig( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nInd, TABMHDRILL& tabDrills, const Vector3d& vtAux, const Vector3d& vtTool, int& nOkHole) ;
bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id) ;
bool MultiHeadOrderConfig( TABMHDRILL& tabDrills, const VECTORHOLE& vHoles, const Vector3d& vtTool, const Vector3d& vtAux) ;
bool MultiHeadHoleToolsConfig( const VECTORHOLE& vHoles, int nConfig, INTINTVECTOR& vConfMask) ;
int VerifyMultiParallelDrills( void) ;
double GetDoubleLastStep( void) ;
/* debug functions */
void PrintConfigs( const VECTORHOLE& vHoles) ;
void PrintDescent( const MHDrill& myMHDescent) ;
/* end debug functions */
private :
double GetSpeed() const
{ return ( IsNullAngValue( m_Params.m_dSpeed) ? m_TParams.m_dSpeed : m_Params.m_dSpeed) ; }
double GetFeed() const
{ return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
double GetStartFeed() const
{ return ( IsNullLenValue( m_Params.m_dStartFeed) ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
double GetEndFeed() const
{ return ( IsNullLenValue( m_Params.m_dEndFeed) ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
double GetTipFeed() const
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
DrillingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nDrillings ; // numero di fori generati
bool m_bTiltingTab ; // flag utilizzo tavola basculante
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
bool m_bAboveHead ; // flag utilizzo testa da sopra
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
double m_dDistBottom ; // distanza del foro dal bordo del grezzo
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
INTVECTOR m_vUndrilledId ; // vettore degli identificativi dei fori non svuotati
INTDBLVECTOR m_vPartialDrilledId ; // vettore degli identificatii dei fori lavorati parzialmente
// con profodnità mancante
} ;