diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc
index df97662..39b7b75 100644
Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ
diff --git a/EgtMachKernel.vcxproj b/EgtMachKernel.vcxproj
index 99991b8..a4c4f5d 100644
--- a/EgtMachKernel.vcxproj
+++ b/EgtMachKernel.vcxproj
@@ -212,6 +212,7 @@ copy $(TargetPath) \EgtProg\Dll64
+
diff --git a/EgtMachKernel.vcxproj.filters b/EgtMachKernel.vcxproj.filters
index cf0b85e..fa81ff8 100644
--- a/EgtMachKernel.vcxproj.filters
+++ b/EgtMachKernel.vcxproj.filters
@@ -60,6 +60,9 @@
Source Files
+
+ Source Files
+
diff --git a/MachConst.h b/MachConst.h
index 330d8f1..66e59b0 100644
--- a/MachConst.h
+++ b/MachConst.h
@@ -23,8 +23,8 @@ const std::string MACH_BASE = "MachBase" ;
const std::string MACH_AUX = "MachAux" ;
// Chiave per nome macchina in macchinata
const std::string MACH_MACHINE_KEY = "Machine" ;
-// Gruppo della macchina in una macchinata
-const std::string MACH_GEOM_GROUP = "MGeo" ;
+// Gruppo delle fixtures in una macchinata
+const std::string MACH_FIXT_GROUP = "Fixt" ;
// Gruppo dell'attrezzaggio in una macchinata
const std::string MACH_SETUP_GROUP = "Setup" ;
// Gruppo dei grezzi in una macchinata
@@ -38,6 +38,10 @@ const std::string MACH_RAW_SOLID = "RawSolid" ;
// Nome del punto che rappresenta il centro del grezzo
const std::string MACH_RAW_CENTER = "RawCenter" ;
+//----------------------------------------------------------------------------
+// Nome sottodirettorio delle fixtures
+const std::string FIXTURES_DIR = "Fixtures" ;
+
//----------------------------------------------------------------------------
// Nome sottodirettorio degli utensili
const std::string TOOLS_DIR = "Tools" ;
diff --git a/MachMgr.h b/MachMgr.h
index 6f9c76f..65928d3 100644
--- a/MachMgr.h
+++ b/MachMgr.h
@@ -23,13 +23,14 @@
struct MachGrp {
std::string MGeoName ;
int SetupGroupId ;
+ int FixtGroupId ;
int RawGroupId ;
int OperGroupId ;
MachGrp( void)
- : MGeoName(), SetupGroupId( GDB_ID_NULL),
+ : MGeoName(), SetupGroupId( GDB_ID_NULL), FixtGroupId( GDB_ID_NULL),
RawGroupId( GDB_ID_NULL), OperGroupId( GDB_ID_NULL) {}
- MachGrp( std::string MgName, int SgId, int RgId, int OgId)
- : MGeoName( MgName), SetupGroupId( SgId),
+ MachGrp( std::string MgName, int SgId, int FgId, int RgId, int OgId)
+ : MGeoName( MgName), SetupGroupId( SgId), FixtGroupId( FgId),
RawGroupId( RgId), OperGroupId( OgId) {}
} ;
@@ -77,6 +78,8 @@ class MachMgr : public IMachMgr
virtual bool RemovePartFromRawPart( int nPartId) ;
virtual bool TranslatePartInRawPart( int nPartId, const Vector3d& vtMove) ;
virtual bool RotatePartInRawPart( int nPartId, const Vector3d& vtAx, double dAngRotDeg) ;
+ // Fixtures
+ virtual int AddSubPiece( const std::string& sName, const Point3d& ptPos) ;
// Machine
virtual bool SetAxisPos( const std::string& sAxis, double dVal) ;
virtual bool GetAxisPos( const std::string& sAxis, double& dVal) ;
@@ -110,9 +113,12 @@ class MachMgr : public IMachMgr
std::string GetCurrMGeoName( void) const
{ return ( m_pGeomDB == nullptr) ? "" :
(( m_nCurrMGrpId == GDB_ID_NULL) ? "" : m_cCurrMGrp.MGeoName) ; }
- int GetCurrSetupId( void) const
+ int GetCurrSetupGroupId( void) const
{ return ( m_pGeomDB == nullptr) ? GDB_ID_NULL :
(( m_nCurrMGrpId == GDB_ID_NULL) ? GDB_ID_NULL : m_cCurrMGrp.SetupGroupId) ; }
+ int GetCurrFixtGroupId( void) const
+ { return ( m_pGeomDB == nullptr) ? GDB_ID_NULL :
+ (( m_nCurrMGrpId == GDB_ID_NULL) ? GDB_ID_NULL : m_cCurrMGrp.FixtGroupId) ; }
int GetCurrRawGroupId( void) const
{ return ( m_pGeomDB == nullptr) ? GDB_ID_NULL :
(( m_nCurrMGrpId == GDB_ID_NULL) ? GDB_ID_NULL : m_cCurrMGrp.RawGroupId) ; }
diff --git a/MachMgrFixtures.cpp b/MachMgrFixtures.cpp
new file mode 100644
index 0000000..4f1e224
--- /dev/null
+++ b/MachMgrFixtures.cpp
@@ -0,0 +1,47 @@
+//----------------------------------------------------------------------------
+// EgalTech 2015-2015
+//----------------------------------------------------------------------------
+// File : MachMgrFixtures.cpp Data : 13.05.15 Versione : 1.6e6
+// Contenuto : Implementazione gestione grezzi e pezzi della classe MachMgr.
+//
+//
+//
+// Modifiche : 16.04.15 DS Creazione modulo.
+//
+//
+//----------------------------------------------------------------------------
+
+//--------------------------- Include ----------------------------------------
+#include "stdafx.h"
+#include "DllMain.h"
+#include "MachMgr.h"
+#include "MachConst.h"
+#include "/EgtDev/Include/EGkGdbIterator.h"
+#include "/EgtDev/Include/EGnFileUtils.h"
+#include "/EgtDev/Include/EgtPointerOwner.h"
+
+using namespace std ;
+
+//----------------------------------------------------------------------------
+int
+MachMgr::AddSubPiece( const string& sName, const Point3d& ptPos)
+{
+ // recupero il gruppo delle fixtures nella macchinata corrente
+ int nFixtGrpId = GetCurrFixtGroupId() ;
+ if ( nFixtGrpId == GDB_ID_NULL)
+ return GDB_ID_NULL ;
+ // verifico esistenza file sottopezzo
+ string sFixtFile = m_sMachinesDir + "\\" + GetCurrMGeoName() + "\\" + FIXTURES_DIR + "\\" + sName + ".Nge" ;
+ if ( ! ExistsFile( sFixtFile))
+ return GDB_ID_NULL ;
+ // inserisco il sottopezzo nel gruppo
+ if ( ! m_pGeomDB->Load( sFixtFile, nFixtGrpId))
+ return GDB_ID_NULL ;
+ int nFixtId = m_pGeomDB->GetLastGroupInGroup( nFixtGrpId) ;
+ if ( nFixtId == GDB_ID_NULL)
+ return GDB_ID_NULL ;
+ // la muovo nella posizione voluta
+ Vector3d vtMove = ptPos - ORIG ;
+ m_pGeomDB->TranslateGlob( nFixtId, vtMove) ;
+ return nFixtId ;
+}
diff --git a/MachMgrMachGroups.cpp b/MachMgrMachGroups.cpp
index 2fef45c..f4fe3b9 100644
--- a/MachMgrMachGroups.cpp
+++ b/MachMgrMachGroups.cpp
@@ -107,6 +107,9 @@ MachMgr::AddMachGroup( const string& sName, const string& sMachineName)
// creo il sottogruppo per l'attrezzaggio
int nSetupId = m_pGeomDB->AddGroup( GDB_ID_NULL, nNewId, GLOB_FRM) ;
m_pGeomDB->SetName( nSetupId, MACH_SETUP_GROUP) ;
+ // creo il sottogruppo per i fissaggi
+ int nFixtId = m_pGeomDB->AddGroup( GDB_ID_NULL, nNewId, GLOB_FRM) ;
+ m_pGeomDB->SetName( nFixtId, MACH_FIXT_GROUP) ;
// creo il sottogruppo per i grezzi
int nRawGroupId = m_pGeomDB->AddGroup( GDB_ID_NULL, nNewId, GLOB_FRM) ;
m_pGeomDB->SetName( nRawGroupId, MACH_RAW_GROUP) ;
@@ -166,6 +169,7 @@ MachMgr::VerifyMachGroup( int nId, MachGrp& mgData) const
if ( IsNull( pIter))
return false ;
bool bSetup = false ;
+ bool bFixt = false ;
bool bRaw = false ;
bool bOper = false ;
bool bIter = pIter->GoToFirstGroupInGroup( nId) ;
@@ -177,6 +181,11 @@ MachMgr::VerifyMachGroup( int nId, MachGrp& mgData) const
mgData.SetupGroupId = pIter->GetId() ;
bSetup = true ;
}
+ else if ( sName == MACH_FIXT_GROUP) {
+ if ( ! bFixt)
+ mgData.FixtGroupId = pIter->GetId() ;
+ bFixt = true ;
+ }
else if ( sName == MACH_RAW_GROUP) {
if ( ! bRaw)
mgData.RawGroupId = pIter->GetId() ;
diff --git a/MachineCalc.cpp b/MachineCalc.cpp
index adaaf80..bb14bb5 100644
--- a/MachineCalc.cpp
+++ b/MachineCalc.cpp
@@ -331,32 +331,38 @@ Machine::VerifyOutOfStroke( double dX, double dY, double dZ, double dAngA, doubl
// default tutto ok
nStat = 0 ;
// primo lineare
- if ( dX < m_vCalcLinAx[0].stroke.Min)
- nStat += 1 ;
- else if( dX > m_vCalcLinAx[0].stroke.Max)
- nStat += 2 ;
+ if ( m_vCalcLinAx.size() >= 1) {
+ if ( dX < m_vCalcLinAx[0].stroke.Min)
+ nStat += 1 ;
+ else if( dX > m_vCalcLinAx[0].stroke.Max)
+ nStat += 2 ;
+ }
// secondo lineare
- if ( dY < m_vCalcLinAx[1].stroke.Min)
- nStat += 4 ;
- else if( dY > m_vCalcLinAx[1].stroke.Max)
- nStat += 8 ;
+ if ( m_vCalcLinAx.size() >= 2) {
+ if ( dY < m_vCalcLinAx[1].stroke.Min)
+ nStat += 4 ;
+ else if( dY > m_vCalcLinAx[1].stroke.Max)
+ nStat += 8 ;
+ }
// terzo lineare
- if ( dZ < m_vCalcLinAx[2].stroke.Min)
- nStat += 16 ;
- else if( dZ > m_vCalcLinAx[2].stroke.Max)
- nStat += 32 ;
+ if ( m_vCalcLinAx.size() >= 3) {
+ if ( dZ < m_vCalcLinAx[2].stroke.Min)
+ nStat += 16 ;
+ else if( dZ > m_vCalcLinAx[2].stroke.Max)
+ nStat += 32 ;
+ }
// eventuale primo rotante
- if ( abs( nStat) >= 1) {
+ if ( m_vCalcRotAx.size() >= 1) {
if ( dAngA < m_vCalcRotAx[0].stroke.Min)
nStat += 64 ;
else if( dAngA > m_vCalcRotAx[0].stroke.Max)
nStat += 128 ;
}
// eventuale secondo rotante
- if ( abs( nStat) >= 2) {
- if ( dAngB < m_vCalcLinAx[1].stroke.Min)
+ if ( m_vCalcRotAx.size() >= 2) {
+ if ( dAngB < m_vCalcRotAx[1].stroke.Min)
nStat += 256 ;
- else if( dAngB > m_vCalcLinAx[1].stroke.Max)
+ else if( dAngB > m_vCalcRotAx[1].stroke.Max)
nStat += 512 ;
}
return true ;