Aggiunto utensile additivo generico

This commit is contained in:
LorenzoM
2022-01-14 13:19:06 +01:00
parent 1c8ee6a332
commit 78d4d79cbf
3 changed files with 638 additions and 162 deletions
+93 -15
View File
@@ -666,6 +666,92 @@ Tool::SetChiselTool( const string& sToolName, double dH, double dW, double dTh,
}
//----------------------------------------------------------------------------
//bool
//Tool::SetAdditiveTool( const std::string& sToolName, double dH, double dR, double dRC, int nToolNum)
//{
// // Impostazioni generali
// m_sName = sToolName ;
// m_nCurrentNum = nToolNum ;
// m_nType = UNDEF ;
// m_Outline.Clear() ;
// m_ArcLineApprox.Clear() ;
//
// // verifica sulle minime dimensioni globali
// if ( dH < EPS_SMALL || dR < EPS_SMALL || dRC < - EPS_SMALL)
// return false ;
//
// m_nType = ADDITIVE ;
// m_dHeight = dH ;
// m_dRadius = dR ;
// m_dRCorner = dRC ;
// m_dTipHeight = 0 ;
// m_dTipRadius = 0 ;
// m_dRefRadius = 0 ;
// m_dCutterHeight = dH ;
//
// double dSquareCornerRadProj = m_dRCorner * m_dRCorner - 0.25 * m_dHeight * m_dHeight ;
// // Utensile sfiancato
// if ( dSquareCornerRadProj > 0) {
// double dCenX = m_dRadius - m_dRCorner ;
// double dCylRad = dCenX + sqrt( dSquareCornerRadProj) ;
// // Utensile mal definito
// if ( dCylRad < EPS_SMALL)
// return false ;
// // Profilo
// m_Outline.AddPoint( Point3d( 0, 0, 0)) ;
// m_Outline.AddLine( Point3d( dCylRad, 0, 0)) ;
// m_Outline.SetCurveTempProp( 0, 1, 1) ;
// CurveArc cvArc ;
// cvArc.SetC2P( Point3d( dCenX, - 0.5 * m_dHeight, 0), Point3d( dCylRad, 0, 0), Point3d( dCylRad, - m_dHeight, 0)) ;
// m_Outline.AddCurve( cvArc) ;
// m_Outline.SetCurveTempProp( 1, 1, 1) ;
// m_Outline.AddLine( Point3d( 0, - m_dHeight, 0)) ;
// m_Outline.SetCurveTempProp( 2, 1, 1) ;
// m_Outline.SetTempProp( 1, 1) ;
// }
// // Utensile cilindrico con eventuale raggio corner
// else {
// // Utensile mal definito
// if ( m_dRadius - m_dRCorner < EPS_SMALL)
// return false ;
// // Raggio corner nullo
// if ( m_dRadius < EPS_SMALL) {
// // Profilo
// m_Outline.AddPoint( Point3d( 0, 0, 0)) ;
// m_Outline.AddLine( Point3d( m_dRadius, 0, 0)) ;
// m_Outline.SetCurveTempProp( 0, 1, 1) ;
// m_Outline.AddLine( Point3d( m_dRadius, - m_dHeight, 0)) ;
// m_Outline.SetCurveTempProp( 1, 1, 1) ;
// m_Outline.AddLine( Point3d( 0, - m_dHeight, 0)) ;
// m_Outline.SetCurveTempProp( 2, 1, 1) ;
// }
// else {
// // Profilo
// m_Outline.AddPoint( Point3d( 0, 0, 0)) ;
// m_Outline.AddLine( Point3d( m_dRadius - m_dRCorner, 0, 0)) ;
// m_Outline.SetCurveTempProp( 0, 1, 1) ;
// CurveArc cvArc ;
// cvArc.SetC2P( Point3d( m_dRadius - m_dRCorner, - m_dRCorner, 0), Point3d( m_dRadius - m_dRCorner, 0, 0), Point3d( m_dRadius, - m_dRCorner, 0)) ;
// m_Outline.SetCurveTempProp( 1, 1, 1) ;
// m_Outline.AddLine( Point3d( m_dRadius, - m_dHeight + m_dRCorner, 0)) ;
// m_Outline.SetCurveTempProp( 2, 1, 1) ;
// cvArc.SetC2P( Point3d( m_dRadius - m_dRCorner, - m_dHeight + m_dRCorner, 0), Point3d( m_dRadius, - m_dHeight + m_dRCorner, 0), Point3d( m_dRadius - m_dRCorner, - m_dHeight, 0)) ;
// m_Outline.AddCurve( cvArc) ;
// m_Outline.SetCurveTempProp( 3, 1, 1) ;
// m_Outline.AddLine( Point3d( 0, - m_dHeight, 0)) ;
// m_Outline.SetCurveTempProp( 4, 1, 1) ;
// m_Outline.SetTempProp( 1, 1) ;
// }
// }
//
// //return SetGenTool( sToolName, &m_Outline, nToolNum) ;
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////// Per test additivi //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// bool bOk = SetGenTool( sToolName, &m_Outline, nToolNum) ;
// m_nType = ADDITIVE ;
// return bOk ;
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//}
bool
Tool::SetAdditiveTool( const std::string& sToolName, double dH, double dR, double dRC, int nToolNum)
{
@@ -689,13 +775,15 @@ Tool::SetAdditiveTool( const std::string& sToolName, double dH, double dR, doubl
m_dRefRadius = 0 ;
m_dCutterHeight = dH ;
bool bToolDefined = true ;
double dSquareCornerRadProj = m_dRCorner * m_dRCorner - 0.25 * m_dHeight * m_dHeight ;
// Utensile sfiancato
if ( dSquareCornerRadProj > 0) {
double dCenX = m_dRadius - m_dRCorner ;
double dCylRad = dCenX + sqrt( dSquareCornerRadProj) ;
// Utensile mal definito
if ( dCylRad < 0)
if ( dCylRad < EPS_SMALL)
return false ;
// Profilo
m_Outline.AddPoint( Point3d( 0, 0, 0)) ;
@@ -708,6 +796,7 @@ Tool::SetAdditiveTool( const std::string& sToolName, double dH, double dR, doubl
m_Outline.AddLine( Point3d( 0, - m_dHeight, 0)) ;
m_Outline.SetCurveTempProp( 2, 1, 1) ;
m_Outline.SetTempProp( 1, 1) ;
bToolDefined = SetGenTool( sToolName, &m_Outline, nToolNum) ;
}
// Utensile cilindrico con eventuale raggio corner
else {
@@ -716,14 +805,7 @@ Tool::SetAdditiveTool( const std::string& sToolName, double dH, double dR, doubl
return false ;
// Raggio corner nullo
if ( m_dRadius < EPS_SMALL) {
// Profilo
m_Outline.AddPoint( Point3d( 0, 0, 0)) ;
m_Outline.AddLine( Point3d( m_dRadius, 0, 0)) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddLine( Point3d( m_dRadius, - m_dHeight, 0)) ;
m_Outline.SetCurveTempProp( 1, 1, 1) ;
m_Outline.AddLine( Point3d( 0, - m_dHeight, 0)) ;
m_Outline.SetCurveTempProp( 2, 1, 1) ;
;
}
else {
// Profilo
@@ -741,14 +823,10 @@ Tool::SetAdditiveTool( const std::string& sToolName, double dH, double dR, doubl
m_Outline.AddLine( Point3d( 0, - m_dHeight, 0)) ;
m_Outline.SetCurveTempProp( 4, 1, 1) ;
m_Outline.SetTempProp( 1, 1) ;
bToolDefined = SetGenTool( sToolName, &m_Outline, nToolNum) ;
}
}
//return SetGenTool( sToolName, &m_Outline, nToolNum) ;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// Per test additivi //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool bOk = SetGenTool( sToolName, &m_Outline, nToolNum) ;
m_nType = ADDITIVE ;
return bOk;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
return bToolDefined ;
}