EgtGeomKernel 1.6v6 :
- miglioramenti a interfaccia Zmap.
This commit is contained in:
Binary file not shown.
+46
-50
@@ -2587,10 +2587,10 @@ GdbExecutor::ExecuteVolZmap(const string& sCmd2, const STRVECTOR& vsParams)
|
||||
return VolZmapMilling( vsParams) ;
|
||||
}
|
||||
else if ( sCmd2 == "SET") {
|
||||
return VolZmapSetTool( vsParams) ;
|
||||
return VolZmapSetGenTool( vsParams) ;
|
||||
}
|
||||
else if ( sCmd2 == "SETSTD") {
|
||||
return VolZmapSetStdTool( vsParams) ;
|
||||
return VolZmapSetAdvTool( vsParams) ;
|
||||
}
|
||||
else if ( sCmd2 == "MEASURE") {
|
||||
return VolZmapDeepnessMeasure( vsParams) ;
|
||||
@@ -2634,7 +2634,7 @@ GdbExecutor::VolZmapCreate( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
|
||||
PtrOwner<VolZmap> pZprova( new VolZmap) ;
|
||||
pZprova->CreateMap( ptO, dPrec, dLengthX, dLengthY, dLengthZ);
|
||||
pZprova->CreateMap( ptO, dLengthX, dLengthY, dLengthZ, dPrec);
|
||||
|
||||
// inserisco nel DB
|
||||
return AddGeoObj(vsParams[0], vsParams[1], Release( pZprova)) ;
|
||||
@@ -2745,12 +2745,52 @@ GdbExecutor::VolZmapMilling( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
// eseguo la lavorazione
|
||||
pZmap->SetTolerances( dLinTol, dAngTolDeg) ;
|
||||
return pZmap->MillingStep( ptPs, ptPe, vtDs, vtDe) ;
|
||||
return pZmap->MillingStep( ptPs, vtDs, ptPe, vtDe) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbExecutor::VolZmapSetTool( const STRVECTOR& vsParams)
|
||||
GdbExecutor::VolZmapSetAdvTool( const STRVECTOR& vsParams)
|
||||
{
|
||||
// parametri : ZmapId, sToolName, dH, dTipH, dR, dTipR, dRc
|
||||
if ( vsParams.size() != 7)
|
||||
return false ;
|
||||
// recupero lo Zmap
|
||||
int nZmapId = GetIdParam( vsParams[0]) ;
|
||||
VolZmap* pZmap = GetBasicVolZmap( m_pGDB->GetGeoObj( nZmapId)) ;
|
||||
if ( pZmap == nullptr)
|
||||
return false ;
|
||||
// recupero la stringa nome dell'utensile
|
||||
string sToolName ;
|
||||
sToolName = vsParams[1] ;
|
||||
// recupero altezza utensile
|
||||
double dH ;
|
||||
if ( ! FromString( vsParams[2], dH))
|
||||
return false ;
|
||||
// recupero altezza punta utensile
|
||||
double dTipH ;
|
||||
if ( ! FromString( vsParams[3], dTipH))
|
||||
return false ;
|
||||
// recupero raggio utensile
|
||||
double dR ;
|
||||
if ( ! FromString( vsParams[4], dR))
|
||||
return false ;
|
||||
// recupero raggio punta utensile
|
||||
double dTipR ;
|
||||
if ( ! FromString( vsParams[5], dTipR))
|
||||
return false ;
|
||||
// recupero raggio corner
|
||||
double dRc ;
|
||||
if ( ! FromString( vsParams[6], dRc))
|
||||
return false ;
|
||||
|
||||
// assegno utensile
|
||||
return pZmap->SetAdvTool( sToolName, dH, dR, dTipH, dTipR, dRc) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbExecutor::VolZmapSetGenTool( const STRVECTOR& vsParams)
|
||||
{
|
||||
// parametri : ZmapId, CrvId, sToolName
|
||||
if ( vsParams.size() != 3)
|
||||
@@ -2769,51 +2809,7 @@ GdbExecutor::VolZmapSetTool( const STRVECTOR& vsParams)
|
||||
string sToolName ;
|
||||
sToolName = vsParams[2] ;
|
||||
// assegno utensile
|
||||
return pZmap->SetTool( sToolName, pToolOutline) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbExecutor::VolZmapSetStdTool( const STRVECTOR& vsParams)
|
||||
{
|
||||
// parametri : ZmapId, sToolName, nToolType, dH, dTH, dR, dTR, dRc
|
||||
if ( vsParams.size() != 8)
|
||||
return false ;
|
||||
// recupero lo Zmap
|
||||
int nZmapId = GetIdParam( vsParams[0]) ;
|
||||
VolZmap* pZmap = GetBasicVolZmap( m_pGDB->GetGeoObj( nZmapId)) ;
|
||||
if ( pZmap == nullptr)
|
||||
return false ;
|
||||
// recupero la stringa nome dell'utensile
|
||||
string sToolName ;
|
||||
sToolName = vsParams[1] ;
|
||||
// recupero il tipo di utensile
|
||||
int nToolType ;
|
||||
if ( ! FromString( vsParams[2], nToolType))
|
||||
return false ;
|
||||
if (nToolType < 0 || nToolType > 4)
|
||||
return false ;
|
||||
// recupero altezza utensile
|
||||
double dH ;
|
||||
if ( ! FromString( vsParams[3], dH))
|
||||
return false ;
|
||||
// recupero raggio utensile
|
||||
double dTH ;
|
||||
if ( ! FromString( vsParams[4], dTH))
|
||||
return false ;
|
||||
// recupero raggio corner
|
||||
double dR ;
|
||||
if ( ! FromString( vsParams[5], dR))
|
||||
return false ;
|
||||
double dTR ;
|
||||
if ( ! FromString( vsParams[6], dTR))
|
||||
return false ;
|
||||
double dRc ;
|
||||
if ( ! FromString( vsParams[7], dRc))
|
||||
return false ;
|
||||
|
||||
// assegno utensile
|
||||
return pZmap->SetStdTool( sToolName, nToolType, dH, dTH, dR, dTR, dRc) ;
|
||||
return pZmap->SetGenTool( sToolName, pToolOutline) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+2
-2
@@ -118,8 +118,8 @@ class GdbExecutor : public IGdbExecutor
|
||||
bool VolZmapIntervalsSubtraction( const STRVECTOR& vsParams) ;
|
||||
bool VolZmapIntervalsAddiction( const STRVECTOR& vsParams) ;
|
||||
bool VolZmapMilling( const STRVECTOR& vsParams) ;
|
||||
bool VolZmapSetTool( const STRVECTOR& vsParams) ;
|
||||
bool VolZmapSetStdTool( const STRVECTOR& vsParams) ;
|
||||
bool VolZmapSetAdvTool( const STRVECTOR& vsParams) ;
|
||||
bool VolZmapSetGenTool( const STRVECTOR& vsParams) ;
|
||||
bool VolZmapDeepnessMeasure( const STRVECTOR& vsParams) ;
|
||||
bool VolZmapBBoxZmapIntersection( const STRVECTOR& vsParams) ;
|
||||
bool ExecuteText( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
|
||||
+111
-112
@@ -331,7 +331,10 @@ VolZmap::ToGlob( const Frame3d& frRef)
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
return false ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
// trasformo il riferimento
|
||||
return m_LocalFrame.ToGlob( frRef) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -341,7 +344,10 @@ VolZmap::ToLoc( const Frame3d& frRef)
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
return false ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
// trasformo il riferimento
|
||||
return m_LocalFrame.ToLoc( frRef) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -351,12 +357,15 @@ VolZmap::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
return false ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
// trasformo il riferimento
|
||||
return m_LocalFrame.LocToLoc( frOri, frDest) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::CreateMap( const Point3d& ptO, double dPrec, double dLengthX, double dLengthY, double dLengthZ)
|
||||
VolZmap::CreateMap( const Point3d& ptO, double dLengthX, double dLengthY, double dLengthZ, double dPrec)
|
||||
{
|
||||
// Controlli sui parametri
|
||||
if ( dPrec < EPS_SMALL || dLengthX < EPS_SMALL || dLengthY < EPS_SMALL || dLengthZ < EPS_SMALL)
|
||||
@@ -1061,7 +1070,100 @@ VolZmap::SetTolerances( double dLinTol, double dAngTolDeg)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::SetTool( const string& pToolName, const ICurveComposite* pToolOutline)
|
||||
VolZmap::SetStdTool( const string& sToolName, double dH, double dR, double dCornR)
|
||||
{
|
||||
// reset nome
|
||||
m_sToolName.clear() ;
|
||||
// verifica minime dimensioni globali
|
||||
if ( dH < EPS_SMALL || dR < EPS_SMALL)
|
||||
return false ;
|
||||
// utensile cilindrico
|
||||
if ( dCornR < EPS_SMALL) {
|
||||
m_nToolType = CylindricalMill ;
|
||||
m_dHeight = dH ;
|
||||
m_dRadius = dR ;
|
||||
m_dTipHeight = 0 ;
|
||||
m_dTipRadius = m_dRadius ;
|
||||
m_dRCorner = 0 ;
|
||||
}
|
||||
// utensile naso di toro
|
||||
else if ( dCornR < dR - EPS_SMALL) {
|
||||
m_nToolType = BullNoseMill ;
|
||||
m_dHeight = dH ;
|
||||
m_dRadius = dR ;
|
||||
m_dTipHeight = dCornR ;
|
||||
m_dTipRadius = m_dRadius ;
|
||||
m_dRCorner = dR - dCornR ;
|
||||
// come profilo
|
||||
m_nToolType = GenericTool ;
|
||||
Point3d pt0( 0, 0, 0) ;
|
||||
Point3d pt1( m_dRadius, 0, 0) ;
|
||||
Point3d pt2( m_dRadius, - m_dHeight + m_dTipHeight, 0) ;
|
||||
Point3d pt3( m_dTipRadius, - m_dHeight, 0) ;
|
||||
Point3d pt4( 0, - m_dHeight, 0) ;
|
||||
m_ToolOutline.Clear() ;
|
||||
CurveLine Line ;
|
||||
Line.Set( pt0, pt1) ;
|
||||
m_ToolOutline.AddCurve( Line) ;
|
||||
m_ToolOutline.AddLine( pt2);
|
||||
m_ToolOutline.AddArcTg( pt3) ;
|
||||
m_ToolOutline.AddLine( pt4) ;
|
||||
}
|
||||
// utensile sferico
|
||||
else if ( dCornR < dR + EPS_SMALL) {
|
||||
m_nToolType = BallEndMill ;
|
||||
m_dHeight = dH ;
|
||||
m_dRadius = dR ;
|
||||
m_dTipHeight = m_dRadius ;
|
||||
m_dTipRadius = 0 ;
|
||||
m_dRCorner = m_dRadius ;
|
||||
}
|
||||
// impossibile
|
||||
else
|
||||
return false ;
|
||||
// assegno il nome
|
||||
m_sToolName = sToolName ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::SetAdvTool( const string& sToolName, double dH, double dR,
|
||||
double dTipH, double dTipR, double dCornR)
|
||||
{
|
||||
// reset nome
|
||||
m_sToolName.clear() ;
|
||||
// verifica dimensioni globali
|
||||
if ( dH < EPS_SMALL || dR < EPS_SMALL)
|
||||
return false ;
|
||||
// se altezza punta nulla, ricado nel caso standard
|
||||
if ( dTipH < EPS_SMALL)
|
||||
return SetStdTool( sToolName, dH, dR, dCornR) ;
|
||||
// caso avanzato
|
||||
if ( abs( dTipR - dR) < EPS_SMALL) {
|
||||
m_nToolType = CylindricalMill ;
|
||||
m_dHeight = dH ;
|
||||
m_dRadius = dR ;
|
||||
m_dTipHeight = 0 ;
|
||||
m_dTipRadius = m_dRadius ;
|
||||
m_dRCorner = 0 ;
|
||||
}
|
||||
else {
|
||||
m_nToolType = ConusMill ;
|
||||
m_dHeight = dH ;
|
||||
m_dRadius = dR ;
|
||||
m_dTipHeight = dTipH ;
|
||||
m_dTipRadius = max( dTipR, 0.) ;
|
||||
m_dRCorner = dCornR ;
|
||||
}
|
||||
// assegno il nome
|
||||
m_sToolName = sToolName ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::SetGenTool( const string& pToolName, const ICurveComposite* pToolOutline)
|
||||
{
|
||||
m_sToolName = pToolName ;
|
||||
|
||||
@@ -1080,116 +1182,14 @@ VolZmap::SetTool( const string& pToolName, const ICurveComposite* pToolOutline)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::SetStdTool( const string& pToolName, unsigned int nToolType, double dH, double dTH, double dR, double dTR, double dRc)
|
||||
{
|
||||
// Controllo sull'ammissibilità del tipo di utensile
|
||||
if ( nToolType == GenericTool || nToolType > 4)
|
||||
|
||||
return false ;
|
||||
else {
|
||||
// Controllo sull'ammissibilità dei parametri geometrici dell'utensile
|
||||
if ( dH < EPS_SMALL || dR < EPS_SMALL)
|
||||
|
||||
return false ;
|
||||
|
||||
m_sToolName = pToolName ;
|
||||
m_nToolType = nToolType ;
|
||||
|
||||
m_dRadius = dR ;
|
||||
m_dHeight = dH ;
|
||||
|
||||
if ( nToolType == CylindricalMill) {
|
||||
|
||||
m_dTipHeight = 0 ;
|
||||
m_dTipRadius = m_dRadius ;
|
||||
}
|
||||
else if ( nToolType == BallEndMill) {
|
||||
|
||||
m_dTipHeight = m_dRadius ;
|
||||
m_dTipRadius = 0 ;
|
||||
}
|
||||
else if ( nToolType == BullNoseMill) {
|
||||
|
||||
if ( dR < dRc)
|
||||
|
||||
return false ;
|
||||
|
||||
else if ( dRc < EPS_SMALL) {
|
||||
|
||||
m_dRCorner = 0 ;
|
||||
m_dTipHeight = 0 ;
|
||||
m_dTipRadius = m_dRadius ;
|
||||
m_nToolType = CylindricalMill ;
|
||||
}
|
||||
else if ( dRc > dR - EPS_SMALL) {
|
||||
|
||||
m_dRCorner = m_dRadius ;
|
||||
m_dTipHeight = m_dRadius ;
|
||||
m_dTipRadius = 0 ;
|
||||
m_nToolType = BallEndMill ;
|
||||
}
|
||||
else {
|
||||
|
||||
m_dRCorner = dRc ;
|
||||
m_dTipHeight = dRc ;
|
||||
m_dTipRadius = dR - dRc ;
|
||||
|
||||
Point3d pt0( 0, 0, 0) ;
|
||||
Point3d pt1( m_dRadius, 0, 0) ;
|
||||
Point3d pt2( m_dRadius, - m_dHeight + m_dTipHeight, 0) ;
|
||||
Point3d pt3( m_dTipRadius, - m_dHeight, 0) ;
|
||||
Point3d pt4( 0, - m_dHeight, 0) ;
|
||||
Point3d ptO( m_dTipRadius, - m_dHeight + m_dTipHeight, 0) ;
|
||||
|
||||
CurveLine cvC1, cvC2, cvC4 ;
|
||||
CurveArc cvC3 ;
|
||||
|
||||
cvC1.Set( pt0, pt1) ;
|
||||
cvC2.Set( pt1, pt2) ;
|
||||
cvC3.SetC2P( ptO, pt2, pt3) ;
|
||||
cvC4.Set( pt3, pt4) ;
|
||||
|
||||
m_ToolOutline.Clear() ;
|
||||
|
||||
m_ToolOutline.AddCurve( cvC1) ;
|
||||
m_ToolOutline.AddCurve( cvC2) ;
|
||||
m_ToolOutline.AddCurve( cvC3) ;
|
||||
m_ToolOutline.AddCurve( cvC4) ;
|
||||
|
||||
m_nToolType = GenericTool ;
|
||||
}
|
||||
}
|
||||
else if ( nToolType == ConusMill) {
|
||||
|
||||
if ( dTH < 0 || dTR < 0) return false ;
|
||||
|
||||
if ( abs( dR - dTR) < EPS_SMALL) {
|
||||
|
||||
m_nToolType = CylindricalMill ;
|
||||
|
||||
m_dTipHeight = 0 ;
|
||||
m_dTipRadius = m_dRadius ;
|
||||
}
|
||||
else {
|
||||
|
||||
m_dTipHeight = dTH ;
|
||||
m_dTipRadius = dTR ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VolZmap::MillingStep( const Point3d& ptPs, const Point3d& ptPe, Vector3d& vtDs, Vector3d& vtDe)
|
||||
VolZmap::MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Point3d& ptPe, const Vector3d& vtDe)
|
||||
{
|
||||
|
||||
// Controllo sull'effettiva esisenza del movimento
|
||||
if ( AreSamePointApprox( ptPs, ptPe) && AreSameVectorApprox( vtDs, vtDe))
|
||||
// Controllo sull'effettiva esistenza del movimento
|
||||
if ( AreSamePointApprox( ptPs, ptPe) && AreSameVectorApprox( vtDs, vtDe))
|
||||
return true ;
|
||||
|
||||
// Porto i dati del movimento nel riferimento intrinseco; quest'oprazione è necessaria perché
|
||||
// Porto i dati del movimento nel riferimento intrinseco; quest'operazione è necessaria perché
|
||||
// viene chiamata la funzione di sottrazione che accetta come parametri gli indici,
|
||||
// non quella che chiede il punto, nella quale viene eseguita la trasformazione di coordinate.
|
||||
Point3d ptLs = ptPs ;
|
||||
@@ -1201,7 +1201,6 @@ VolZmap::MillingStep( const Point3d& ptPs, const Point3d& ptPe, Vector3d& vtDs,
|
||||
Vector3d vtLe = vtDe ;
|
||||
vtLe.ToLoc( m_LocalFrame) ;
|
||||
|
||||
|
||||
// Normalizzo i vettori
|
||||
vtLs.Normalize() ;
|
||||
vtLe.Normalize() ;
|
||||
|
||||
@@ -61,14 +61,15 @@ class VolZmap : public IVolZmap, public IGeoObjRW
|
||||
|
||||
public : // IVolZmap
|
||||
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
||||
bool CreateMap( const Point3d& ptO, double dPrec, double dLengthX, double dLengthY, double dLengthZ) ;
|
||||
bool CreateMap( const Point3d& ptO, double dLengthX, double dLengthY, double dLengthZ, double dPrec) ;
|
||||
bool GetAllTriangles( TRIA3DLIST& lstTria) const override ;
|
||||
bool GetDexelLines( int nDir, int nPos1, int nPos2, POLYLINELIST& lstPL) const override ;
|
||||
bool SetTolerances( double dLinTol, double dAngTolDeg = 90) override ;
|
||||
bool SetTool( const std::string& pToolName, const ICurveComposite* pToolOutline) override ;
|
||||
bool SetStdTool( const std::string& pToolName, unsigned int nToolType,
|
||||
double dH, double dTipH, double dR, double dTipR, double dRc = 0) override ;
|
||||
bool MillingStep( const Point3d& ptPs, const Point3d& ptPe, Vector3d& vtDs, Vector3d& vtDe) 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 MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Point3d& ptPe, const Vector3d& vtDe) override ;
|
||||
bool Deepness( const Point3d& ptP, const Vector3d& vtDir, double& dInLength, double& dOutLength) override ;
|
||||
bool BBoxZmapIntersection( const Frame3d& frBBox, const Point3d& ptMax) override ;
|
||||
|
||||
@@ -96,6 +97,13 @@ class VolZmap : public IVolZmap, public IGeoObjRW
|
||||
{ if ( ! CopyFrom( stSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "VolZmap : copy error")
|
||||
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
|
||||
|
||||
private :
|
||||
bool CopyFrom( const VolZmap& clSrc) ;
|
||||
|
||||
Reference in New Issue
Block a user