EgtGeomKernel 1.8i1 :

- aggiunta a Zmap gestione utensili Chisel e Mortise.
This commit is contained in:
Dario Sassi
2017-09-07 09:15:55 +00:00
parent cb4512bda0
commit 6eecea859e
5 changed files with 1027 additions and 167 deletions
BIN
View File
Binary file not shown.
+5 -2
View File
@@ -493,12 +493,15 @@ VolZmap::CreateFromTriMesh( const ISurfTriMesh& Surf, double dPrec, bool bTriDex
// Determino il bounding box della TriMesh
BBox3d SurfBBox ;
Surf.GetLocalBBox( SurfBBox) ;
SurfBBox.Expand( 100 * EPS_SMALL, 100 * EPS_SMALL, 100 * EPS_SMALL) ;
// Determino i punti estremi del bounding box
Point3d ptMapOrig, ptMapEnd ;
SurfBBox.GetMinMax( ptMapOrig, ptMapEnd) ;
// Il dexel se parte da un triangolo della trimesh può non trovare l'intersezione,
// quindi espandiamo il bounding box per ovviare al problema.
SurfBBox.Expand( 100 * EPS_SMALL, 100 * EPS_SMALL, 100 * EPS_SMALL) ;
// Sistema di riferimento mappa
m_MapFrame[0].Set( ptMapOrig, Frame3d::TOP) ;
+910 -142
View File
File diff suppressed because it is too large Load Diff
+61 -16
View File
@@ -84,11 +84,14 @@ class VolZmap : public IVolZmap, public IGeoObjRW
bool GetTriangles( bool bAllBlocks, INTVECTOR& nModifiedBlocks, TRIA3DLISTVECTOR& vLstTria) const override ;
bool GetDexelLines( int nDir, int nPos1, int nPos2, POLYLINELIST& lstPL) const override ;
bool SetTolerances( double dLinTol, double dAngTolDeg = 90) override ;
bool SetStdTool( const std::string& pToolName, double dH, double dR, double dCornR) override ;
bool SetAdvTool( const std::string& pToolName,
double dH, double dR, double dTipH, double dTipR, double dCornR) override ;
bool SetGenTool( const std::string& pToolName, const ICurveComposite* pToolOutline) override ;
bool SetStdTool( const std::string& sToolName, double dH, double dR, double dCornR) override ;
bool SetAdvTool( const std::string& sToolName,
double dH, double dR, double dTipH, double dTipR, double dCornR) override ;
bool SetGenTool( const std::string& sToolName, const ICurveComposite* pToolOutline) override ;
bool SetMortiserTool( const std::string& sToolName, double dH, double dW, double dTh, double dRc) override ;
bool SetChiselTool( const std::string& sToolName, double dH, double dW, double dTh) override ;
bool MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Point3d& ptPe, const Vector3d& vtDe) override ;
bool MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d& vtAs, const Point3d& ptPe, const Vector3d& vtDe, const Vector3d& vtAe) override ;
bool GetDepth( const Point3d& ptP, const Vector3d& vtDir, double& dInLength, double& dOutLength) override ;
bool AvoidBox( const Frame3d& frBox, const Vector3d& vtDiag) override ;
@@ -108,11 +111,13 @@ class VolZmap : public IVolZmap, public IGeoObjRW
return *this ; }
private :
enum ToolType { GenericTool = 0, // generico da profilo -> usare SetTool
CylindricalMill = 1, // cilindrica
BallEndMill = 2, // sferica
BullNoseMill = 3, // naso di toro
ConusMill = 4} ; // con parte terminale conica
enum ToolType { GENTOOL = 0, // generico da profilo -> usare SetTool
CYLMILL = 1, // cilindrica
BALLMILL = 2, // sferica
BULLNOSEMILL = 3, // naso di toro
CONUSMILL = 4, // con parte terminale conica
MORTISER = 5, // mortasatrice
CHISEL = 6} ; // scalpello
private :
bool CopyFrom( const VolZmap& clSrc) ;
@@ -133,7 +138,7 @@ class VolZmap : public IVolZmap, public IGeoObjRW
bool IsPointInsideVoxel( int nI, int nJ, int nK, const Point3d& ptP) const ;
bool IsPointInsideVoxelApprox( int nI, int nJ, int nK, const Point3d& ptP, double dPrec = EPS_SMALL) const ;
bool GetPointVoxel( const Point3d& ptP, int& nVoxI, int& nVoxJ, int& nVoxK) const ;
// OPERAZIONI SU INTERVALLI
bool SubtractIntervals( unsigned int nGrid, unsigned int nI, unsigned int nJ,
double dMin, double dMax, const Vector3d& vtNMin, const Vector3d& vtNMax) ;
@@ -147,17 +152,26 @@ class VolZmap : public IVolZmap, public IGeoObjRW
// SOTTRAZIONI
// UTENSILI
// Asse di simmetria parallelo a Z
// Cilindro Sfera
bool CylBall_ZDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir) ;
bool CylBall_ZPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir) ;
bool CylBall_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir) ;
// Coni
bool Conus_ZDrilling( unsigned int nGrid, const Point3d & ptS, const Point3d& ptE, const Vector3d& vtToolDir) ;
bool Conus_ZPerp( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir) ;
bool Conus_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir) ;
bool Dr_ZMilling( unsigned int nGrid, const Point3d& ptLs, const Point3d& ptLe, const Vector3d & vtToolDir) ;
bool Sw_ZMilling( unsigned int nGrid, const Point3d& ptLs, const Point3d& ptLe, const Vector3d & vtToolDir) ;
// Mortasatrice
bool Mrt_ZDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ;
bool Mrt_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ;
// Chisel
bool Chs_ZDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ;
bool Chs_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ;
// Utensile generico
bool GenTool_ZDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir) ;
bool GenTool_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir) ;
@@ -171,12 +185,23 @@ class VolZmap : public IVolZmap, public IGeoObjRW
bool Conus_XYMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir) ;
// Asse di simmetria con orientazione generica
// Cilindro e sfera
bool CylBall_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir) ;
bool CylBall_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir) ;
// Coni
bool Conus_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir) ;
bool Conus_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir) ;
// Mortasatrice
bool Mrt_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ;
bool Mrt_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ; // E' in realtà un Perp
// Chisel
bool Chs_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ;
bool Chs_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) ; // E' in realtà un Perp
// Utensile generico
bool GenTool_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir) ;
bool GenTool_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir) ;
@@ -188,12 +213,19 @@ class VolZmap : public IVolZmap, public IGeoObjRW
double dHei, double dRad) ;
bool CompConus_ZDrilling( unsigned int nGrid, const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir,
double dHei, double dMaxRad, double dMinRad) ;
bool CompPar_ZDrilling( unsigned int nGrid, double dLenX, double dLenY, double dLenZ,
const Point3d& ptS, const Point3d& ptE,
const Vector3d& vtToolDir, const Vector3d& vtAux) ;
// Milling
bool CompCyl_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dRad) ;
bool CompConus_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dMaxRad, double dMinRad) ;
bool CompPar_ZMilling( unsigned int nGrid, double dLenX, double dLenY, double dLenZ,
const Point3d& ptS, const Point3d& ptE,
const Vector3d& vtToolDir, const Vector3d& vtAux) ; // E' in realtà MillingPerp
// Asse di simmetria con orientazione generica
@@ -202,22 +234,32 @@ class VolZmap : public IVolZmap, public IGeoObjRW
double dHei, double dRad, bool bTapB, bool bTapT) ;
bool CompConus_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dMaxRad, double dMinRad, bool bTapB, bool bTapT) ;
bool CompPar_Drilling( unsigned int nGrid, double dLenX, double dLenY, double dLenZ,
const Point3d& ptS, const Point3d& ptE,
const Vector3d& vtToolDir, const Vector3d& vtAux) ;
// Milling
bool CompCyl_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dRad, bool bTapB, bool bTapT) ;
bool CompConus_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dMaxRad, double dMinRad, bool bTapB, bool bTapT) ;
bool CompPar_Milling( unsigned int nGrid, double dLenX, double dLenY, double dLenZ,
const Point3d& ptS, const Point3d& ptE,
const Vector3d& vtToolDir, const Vector3d& vtAux) ; // E' in realtà MillingPerp
// Generica traslazione sfera
bool CompBall_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, double dRad) ;
// BBox per utensili e solidi semplici
inline bool BoundingBox( unsigned int nGrid, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV1, const Vector3d& vtV2,
// BBox per utensili e solidi semplici in movimenti di traslazione pura; in futuro si dovrà implementare le routine che prevedono rotazioni
inline bool BoundingBox( unsigned int nGrid, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV,
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ) ;
inline bool BBoxComponent( unsigned int nGrid, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV1, const Vector3d& vtV2,
inline bool BBoxComponent( unsigned int nGrid, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV,
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ,
double dRad, double dTipRad, double dHei) ;
inline bool BBoxParaComp( unsigned int nGrid, double dLenX, double dLenY, double dLenZ,
const Point3d& ptS, const Point3d& ptE, const Vector3d& vtD, const Vector3d& vtA,
unsigned int& nStI, unsigned int& nStJ, unsigned int& nEnI, unsigned int& nEnJ) ;
// Intersezioni
bool IntersLineBox( const Point3d& ptP, const Vector3d& vtV, const Point3d& ptMin, const Point3d& ptMax,
@@ -315,6 +357,9 @@ class VolZmap : public IVolZmap, public IGeoObjRW
double m_dRadius ;
double m_dRCorner ;
double m_dTipRadius ;
double m_dMrtChsWidth ;
double m_dMrtChsThickness ;
mutable TriaMatrix m_InterBlockTria ;
} ;
+51 -7
View File
@@ -44,7 +44,7 @@ VolZmap::SetStdTool( const string& sToolName, double dH, double dR, double dCorn
return false ;
// utensile cilindrico
if ( dCornR < EPS_SMALL) {
m_nToolType = CylindricalMill ;
m_nToolType = CYLMILL ;
m_dHeight = dH ;
m_dRadius = dR ;
m_dTipHeight = 0 ;
@@ -53,14 +53,14 @@ VolZmap::SetStdTool( const string& sToolName, double dH, double dR, double dCorn
}
// utensile naso di toro
else if ( dCornR < dR - EPS_SMALL) {
m_nToolType = BullNoseMill ;
m_nToolType = BULLNOSEMILL ;
m_dHeight = dH ;
m_dRadius = dR ;
m_dTipHeight = dCornR ;
m_dTipRadius = dR - dCornR ;
m_dRCorner = dCornR ;
// come profilo
m_nToolType = GenericTool ;
m_nToolType = GENTOOL ;
Point3d pt0( 0, 0, 0) ;
Point3d pt1( m_dRadius, 0, 0) ;
Point3d pt2( m_dRadius, - m_dHeight + m_dTipHeight, 0) ;
@@ -77,7 +77,7 @@ VolZmap::SetStdTool( const string& sToolName, double dH, double dR, double dCorn
}
// utensile sferico
else if ( dCornR < dR + EPS_SMALL) {
m_nToolType = BallEndMill ;
m_nToolType = BALLMILL ;
m_dHeight = dH ;
m_dRadius = dR ;
m_dTipHeight = m_dRadius ;
@@ -118,7 +118,7 @@ VolZmap::SetAdvTool( const string& sToolName, double dH, double dR,
// Se raggio corner nullo, allora utensile conico
if ( dCornR < EPS_SMALL) {
m_nToolType = ConusMill ;
m_nToolType = CONUSMILL ;
m_dRCorner = 0 ;
// assegno nome e identificativo
m_sToolName = sToolName ;
@@ -127,7 +127,7 @@ VolZmap::SetAdvTool( const string& sToolName, double dH, double dR,
}
// Altrimenti utensile generico.
m_nToolType = GenericTool ;
m_nToolType = GENTOOL ;
m_dRCorner = dCornR ;
m_ToolOutline.Clear() ;
@@ -219,7 +219,7 @@ VolZmap::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutlin
{
// Assegno nome, tipo e id dell'utensile
m_sToolName = sToolName ;
m_nToolType = GenericTool ;
m_nToolType = GENTOOL ;
m_nCurrentToolNum = 0 ;
// Copio il profilo e garantisco sia di soli archi e rette (converto eventuali curve di Bezier)
@@ -291,3 +291,47 @@ VolZmap::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutlin
return true ;
}
//----------------------------------------------------------------------------
bool
VolZmap::SetMortiserTool( const std::string& sToolName, double dH, double dW, double dTh, double dRc)
{
// Reset nome
m_sToolName.clear() ;
if ( dH < EPS_SMALL || dW < EPS_SMALL ||
dTh < EPS_SMALL || dRc < 0 || dW - 2 * dRc < 0)
return false ;
m_dHeight = dH ;
m_dRCorner = dRc ;
m_dMrtChsWidth = dW ;
m_dMrtChsThickness = dTh ;
m_sToolName = sToolName ;
m_nToolType = MORTISER ;
m_nCurrentToolNum = 0 ;
return true ;
}
//----------------------------------------------------------------------------
bool
VolZmap::SetChiselTool( const std::string& sToolName, double dH, double dW, double dTh) {
// Reset nome
m_sToolName.clear() ;
if ( dH < EPS_SMALL || dW < EPS_SMALL || dTh < 0)
return false ;
m_dHeight = dH ;
m_dMrtChsWidth = dW ;
m_dMrtChsThickness = dTh ;
m_sToolName = sToolName ;
m_nToolType = CHISEL ;
m_nCurrentToolNum = 0 ;
return true ;
}