EgtMachKernel :

- al carico macchina correzione aggiustamento assi rotanti geometrici per simulazione quando angolo di rotazione da teorici è molto piccolo
- al carico macchina quando si ruotano assi rotanti e richiesto ora si ruota anche geometria ausiliaria.
This commit is contained in:
Dario Sassi
2026-08-18 13:33:41 +02:00
parent ff126a8877
commit 4957e09abe
2 changed files with 33 additions and 18 deletions
+27 -12
View File
@@ -385,6 +385,10 @@ Machine::AdjustAxis( int nLay, const string& sPart, const string& sName,
ptBase.ToGlob( frFrame) ;
vtAxis.ToGlob( frFrame) ;
// per assi rotanti
Vector3d vtRotAx ;
double dAngRot = 0 ;
// se asse lineare devo verificarne solo la direzione
if ( nType == MCH_AT_LINEAR) {
Vector3d vtDirN = vtDir ;
@@ -395,21 +399,28 @@ Machine::AdjustAxis( int nLay, const string& sPart, const string& sName,
}
}
// altrimenti asse rotante, devo verificarne direzione e coassialità (questa solo se non abilitato movimento)
// altrimenti asse rotante, devo verificarne direzione e coassialità (questa solo se non abilitato movimento)
else {
Vector3d vtDirN = vtDir ;
if ( ! vtDirN.Normalize() || ! AreSameVectorEpsilon( vtAxis, vtDirN, 10 * SIN_EPS_ANG_SMALL)) {
double dAngRot ;
if ( ! vtAxis.GetAngle( vtDirN, dAngRot) || abs( dAngRot) > m_dAxisMaxRotAdj) {
string sOut = " Wrong Axis Vector or Dir " + sPart ;
if ( ! vtDirN.Normalize() || ! AreSameVectorEpsilon( vtAxis, vtDirN, SIN_EPS_ANG_SMALL)) {
if ( ! vtAxis.GetAngle( vtDirN, dAngRot)) {
string sOut = " Wrong Axis Vector (" + ToString( vtDirN) + ")" + sPart ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
else if ( abs( dAngRot) > m_dAxisMaxRotAdj) {
string sOut = " Wrong Axis Dir (rotation =" + ToString( dAngRot) + ")" + sPart ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
else {
Vector3d vtRotAx = vtAxis ^ vtDirN ; vtRotAx.Normalize() ;
vtRotAx = vtAxis ^ vtDirN ; vtRotAx.Normalize( EPS_ZERO) ;
string sOut = " Axis " + sName + " rotation = (" + ToString( dAngRot) + "/" + ToString( vtRotAx) + ")" ;
if ( m_pGeomDB->RotateGlob( nId, ptBase, vtRotAx, dAngRot))
sOut += " OK" ;
else
sOut += " ERROR" ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
m_pGeomDB->RotateGlob( nId, ptBase, vtRotAx, dAngRot) ;
}
}
Vector3d vtDelta = ptPos - ptBase ;
@@ -427,13 +438,17 @@ Machine::AdjustAxis( int nLay, const string& sPart, const string& sName,
}
}
}
// se richiesto, muovo la geometria ausiliaria
if ( bAdjustAux) {
Vector3d vtDelta = ptPos - ptBase ;
int nIdAux = m_pGeomDB->GetFirstInGroup( nLay) ;
while ( nIdAux != GDB_ID_NULL) {
if ( nIdAux != nId)
if ( nIdAux != nId) {
if ( abs( dAngRot) > EPS_ANG_SMALL)
m_pGeomDB->RotateGlob( nIdAux, ptBase, vtRotAx, dAngRot) ;
m_pGeomDB->TranslateGlob( nIdAux, vtDelta) ;
}
nIdAux = m_pGeomDB->GetNext( nIdAux) ;
}
}
@@ -829,7 +844,7 @@ Machine::GetExit( int nGroup) const
bool
Machine::AddHeadToSet( const string& sHSet, const string& sName)
{
// se il capo-insieme coincide con la testa, non devo fare alcunchè
// se il capo-insieme coincide con la testa, non devo fare alcunchè
if ( sHSet == sName)
return true ;
// recupero la testa capo-insieme
@@ -854,7 +869,7 @@ Machine::GetHSet( const string& sHead) const
const STRVECTOR& vsTmp = pHead->GetHSet() ;
if ( vsTmp.empty())
return vsNull ;
// se il primo membro coincide con la testa, allora è già l'insieme di teste
// se il primo membro coincide con la testa, allora è già l'insieme di teste
if ( vsTmp[0] == sHead)
return vsTmp ;
// altrimenti cerco l'insieme della prima testa
@@ -899,7 +914,7 @@ Machine::ModifyMachineHeadAuxDirection( const string& sHead, const Vector3d& vtA
bool
Machine::AdjustExitFrames( int nLay, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir)
{
// se il versore ausiliario non è definito, non sono necessari controlli
// se il versore ausiliario non è definito, non sono necessari controlli
if ( vtADir.IsSmall())
return true ;
// riferimento globale del gruppo testa
@@ -1062,7 +1077,7 @@ Machine::ModifyMachineExitPosition( const string& sHead, int nExit, const Point3
bool
Machine::SetLook( int nFlag)
{
// verifico validità flag
// verifico validità flag
if ( nFlag < MCH_LOOK_TAB || nFlag > MCH_LOOK_ALL)
return false ;