EgtMachKernel 1.6p4 :

- ampliata Disposizione con gestione movimenti di pezzi con la testa tramite SpecialApply (che richiama script)
- modifiche a Simulatore per gestire queste disposizioni e aggiunti richiami script su diversi eventi
- modifiche a Generatore per gestire queste disposizioni
- varie altre modifiche e migliorie.
This commit is contained in:
Dario Sassi
2016-05-05 07:31:35 +00:00
parent 06a8b15d99
commit b8965da858
37 changed files with 3234 additions and 1898 deletions
+61 -63
View File
@@ -16,6 +16,7 @@
#include "MachMgr.h"
#include "GeoCalc.h"
#include "DllMain.h"
#include "Table.h"
#include "Axis.h"
#include "Head.h"
#include "Exit.h"
@@ -59,7 +60,7 @@ Machine::SetCurrTable( const string& sTable)
//----------------------------------------------------------------------------
int
Machine::GetCurrTable( void)
Machine::GetCurrTable( void) const
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
@@ -70,7 +71,7 @@ Machine::GetCurrTable( void)
//----------------------------------------------------------------------------
bool
Machine::GetCurrTable( string& sTable)
Machine::GetCurrTable( string& sTable) const
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
@@ -79,6 +80,28 @@ Machine::GetCurrTable( string& sTable)
return m_pGeomDB->GetName( m_nCalcTabId, sTable) ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrTableRef1( Point3d& ptRef1) const
{
Table* pTab = GetTable( m_nCalcTabId) ;
if ( pTab == nullptr)
return false ;
ptRef1 = pTab->GetRef1() ;
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrTableArea1( BBox3d& b3Area1) const
{
Table* pTab = GetTable( m_nCalcTabId) ;
if ( pTab == nullptr)
return false ;
b3Area1 = pTab->GetArea1() ;
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
@@ -150,7 +173,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
//----------------------------------------------------------------------------
int
Machine::GetCurrTool( void)
Machine::GetCurrTool( void) const
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
@@ -161,7 +184,7 @@ Machine::GetCurrTool( void)
//----------------------------------------------------------------------------
bool
Machine::GetCurrTool( string& sTool)
Machine::GetCurrTool( string& sTool) const
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
@@ -172,7 +195,7 @@ Machine::GetCurrTool( string& sTool)
//----------------------------------------------------------------------------
double
Machine::GetCurrRot1W( void)
Machine::GetCurrRot1W( void) const
{
// restituisco il peso del primo asse rotante nei confronti di movimento
return m_dCalcRot1W ;
@@ -284,7 +307,7 @@ Machine::AddKinematicAxis( bool bOnHead, int nId)
//----------------------------------------------------------------------------
string
Machine::GetKinematicAxis( int nInd)
Machine::GetKinematicAxis( int nInd) const
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
@@ -306,7 +329,7 @@ Machine::GetKinematicAxis( int nInd)
//----------------------------------------------------------------------------
bool
Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2)
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const
{
// annullo tutti gli angoli
nStat = 0 ; dAngA1 = 0 ; dAngB1 = 0 ; dAngA2 = 0 ; dAngB2 = 0 ;
@@ -377,6 +400,7 @@ Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
if ( fabs( dCompTOrtAxR1 * dCompHSuAxR1 - dCompHOrtAxR1 * dCompTSuAxR1) < SIN_ANG_ERROR) {
nStat = 1 ;
vtDirH1 = vtDirH ;
vtDirI1 = vtDirI ;
// reset secondo angolo
dAngB1 = 0 ;
}
@@ -464,7 +488,7 @@ Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
//----------------------------------------------------------------------------
bool
Machine::GetPositions( const Point3d& ptP, double dAngA, double dAngB,
int& nStat, double& dX, double& dY, double& dZ)
int& nStat, double& dX, double& dY, double& dZ) const
{
// la posizione deve essere espressa rispetto allo ZERO MACCHINA
// per ora gestisco solo gli assi rotanti di testa
@@ -514,7 +538,7 @@ Machine::GetPositions( const Point3d& ptP, double dAngA, double dAngB,
//----------------------------------------------------------------------------
bool
Machine::GetDirection( const Vector3d& vtDir, double dAngA, double dAngB, Vector3d& vtNew)
Machine::GetDirection( const Vector3d& vtDir, double dAngA, double dAngB, Vector3d& vtNew) const
{
// per ora gestisco solo gli assi rotanti di testa
@@ -544,7 +568,7 @@ Machine::GetDirection( const Vector3d& vtDir, double dAngA, double dAngB, Vector
//----------------------------------------------------------------------------
bool
Machine::GetTipFromPositions( double dX, double dY, double dZ, double dAngA, double dAngB,
bool bBottom, Point3d& ptTip)
bool bBottom, Point3d& ptTip) const
{
// la posizione deve essere espressa rispetto allo ZERO MACCHINA
// per ora gestisco solo gli assi rotanti di testa
@@ -576,14 +600,14 @@ Machine::GetTipFromPositions( double dX, double dY, double dZ, double dAngA, dou
//----------------------------------------------------------------------------
bool
Machine::GetToolDirFromAngles( double dAngA, double dAngB, Vector3d& vtDir)
Machine::GetToolDirFromAngles( double dAngA, double dAngB, Vector3d& vtDir) const
{
return GetDirection( m_vtCalcDir, dAngA, dAngB, vtDir) ;
}
//----------------------------------------------------------------------------
bool
Machine::VerifyScc( const Vector3d& vtDirI, const Vector3d& vtDirA, int nSolCh)
Machine::VerifyScc( const Vector3d& vtDirI, const Vector3d& vtDirA, int nSolCh) const
{
switch ( nSolCh) {
default :
@@ -609,65 +633,39 @@ Machine::VerifyScc( const Vector3d& vtDirI, const Vector3d& vtDirA, int nSolCh)
//----------------------------------------------------------------------------
bool
Machine::AdjustAngleInStroke( int nId, double& dAng)
Machine::AdjustAngleInStroke( int nId, double& dAng) const
{
// se non ci sono assi rotanti, non c'è alcunchè da fare
if ( m_vCalcRotAx.size() == 0)
// se angolo fittizio (non esiste l'asse rotante corrispondente), non c'è alcunchè da fare
if ( nId <= 0 || nId > int( m_vCalcRotAx.size()))
return true ;
// se primo angolo ed esiste primo asse rotante
if ( nId == 1 && m_vCalcRotAx.size() >= 1) {
while ( dAng < m_vCalcRotAx[0].stroke.Min)
dAng += ANG_FULL ;
while ( dAng > m_vCalcRotAx[0].stroke.Max)
dAng -= ANG_FULL ;
return ( dAng >= m_vCalcRotAx[0].stroke.Min &&
dAng <= m_vCalcRotAx[0].stroke.Max) ;
}
// se secondo angolo ed esiste secondo asse rotante
if ( nId == 2 && m_vCalcRotAx.size() >= 2) {
while ( dAng < m_vCalcRotAx[1].stroke.Min)
dAng += ANG_FULL ;
while ( dAng > m_vCalcRotAx[1].stroke.Max)
dAng -= ANG_FULL ;
return ( dAng >= m_vCalcRotAx[1].stroke.Min &&
dAng <= m_vCalcRotAx[1].stroke.Max) ;
}
// errore
return false ;
// eseguo gli aggiustamenti
while ( dAng < m_vCalcRotAx[nId-1].stroke.Min)
dAng += ANG_FULL ;
while ( dAng > m_vCalcRotAx[nId-1].stroke.Max)
dAng -= ANG_FULL ;
return ( dAng >= m_vCalcRotAx[nId-1].stroke.Min &&
dAng <= m_vCalcRotAx[nId-1].stroke.Max) ;
}
//----------------------------------------------------------------------------
bool
Machine::GetNearestAngleInStroke( int nId, double dAngRef, double& dAng)
Machine::GetNearestAngleInStroke( int nId, double dAngRef, double& dAng) const
{
// se non ci sono assi rotanti, non c'è alcunchè da fare
if ( m_vCalcRotAx.size() == 0)
// se angolo fittizio (non esiste l'asse rotante corrispondente), non c'è alcunchè da fare
if ( nId <= 0 || nId > int( m_vCalcRotAx.size()))
return true ;
// se primo angolo ed esiste primo asse rotante
if ( nId == 1 && m_vCalcRotAx.size() >= 1) {
while ( dAng - dAngRef > ANG_STRAIGHT && dAng - ANG_FULL >= m_vCalcRotAx[0].stroke.Min)
dAng -= ANG_FULL ;
while ( dAng - dAngRef < - ANG_STRAIGHT && dAng + ANG_FULL <= m_vCalcRotAx[0].stroke.Max)
dAng += ANG_FULL ;
return ( dAng >= m_vCalcRotAx[0].stroke.Min &&
dAng <= m_vCalcRotAx[0].stroke.Max) ;
}
// se secondo angolo ed esiste secondo asse rotante
if ( nId == 2 && m_vCalcRotAx.size() >= 2) {
while ( dAng - dAngRef > ANG_STRAIGHT && dAng - ANG_FULL >= m_vCalcRotAx[1].stroke.Min)
dAng -= ANG_FULL ;
while ( dAng - dAngRef < - ANG_STRAIGHT && dAng + ANG_FULL <= m_vCalcRotAx[1].stroke.Max)
dAng += ANG_FULL ;
return ( dAng >= m_vCalcRotAx[1].stroke.Min &&
dAng <= m_vCalcRotAx[1].stroke.Max) ;
}
// errore
return false ;
// cerco l'angolo più vicino stando nella corsa
while ( dAng - dAngRef > ANG_STRAIGHT && dAng - ANG_FULL >= m_vCalcRotAx[nId-1].stroke.Min)
dAng -= ANG_FULL ;
while ( dAng - dAngRef < - ANG_STRAIGHT && dAng + ANG_FULL <= m_vCalcRotAx[nId-1].stroke.Max)
dAng += ANG_FULL ;
return ( dAng >= m_vCalcRotAx[nId-1].stroke.Min &&
dAng <= m_vCalcRotAx[nId-1].stroke.Max) ;
}
//----------------------------------------------------------------------------
bool
Machine::VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat)
Machine::VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) const
{
// default tutto ok
nStat = 0 ;
@@ -742,21 +740,21 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double
//----------------------------------------------------------------------------
int
Machine::GetCurrLinAxes( void)
Machine::GetCurrLinAxes( void) const
{
return int( m_vCalcLinAx.size()) ;
}
//----------------------------------------------------------------------------
int
Machine::GetCurrRotAxes( void)
Machine::GetCurrRotAxes( void) const
{
return int( m_vCalcRotAx.size()) ;
}
//----------------------------------------------------------------------------
bool
Machine::GetAllCurrAxesName( STRVECTOR& vAxName)
Machine::GetAllCurrAxesName( STRVECTOR& vAxName) const
{
vAxName.clear() ;
bool bOk = true ;
@@ -781,7 +779,7 @@ Machine::GetAllCurrAxesName( STRVECTOR& vAxName)
//----------------------------------------------------------------------------
bool
Machine::GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal)
Machine::GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const
{
vAxHomeVal.clear() ;
bool bOk = true ;