EgtInterface 1.6c8 :

- gestione inserimento in testa ad un gruppo
- gestione Machinings.
This commit is contained in:
Dario Sassi
2015-03-25 14:34:53 +00:00
parent a7a5ed461c
commit 18bf9c19e1
15 changed files with 201 additions and 34 deletions
+3
View File
@@ -134,6 +134,9 @@ bool EgtMirror( INTVECTOR& vIds, const Point3d& ptP, const Vector3d& vtN, int nR
bool EgtShear( INTVECTOR& vIds, const Point3d& ptP, const Vector3d& vtN,
const Vector3d& vtDir, double dCoeff, int nRefType) ;
//--------------------------- Machining --------------------------------------
int EgtAddMachGroup( const std::string& sName, const std::string& sMachineName) ;
//--------------------------- Scene ------------------------------------------
bool EgtSetBackground( Color TopCol, Color BottomCol, bool bRedraw) ;
bool EgtSetMarkAttribs( Color MarkCol) ;
+9 -8
View File
@@ -15,6 +15,7 @@
#include "stdafx.h"
#include "API.h"
#include "API_Macro.h"
#include "AuxTools.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGnStringConverter.h"
@@ -231,14 +232,14 @@ __stdcall EgtCopy( int nSouId, int nRefId, int nSonBeforeAfter)
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua ;
if ( nSonBeforeAfter == GDB_SON)
if ( nSonBeforeAfter == GDB_LAST_SON)
sLua = "EgtCopy(" + ToString( nSouId) + "," +
ToString( nRefId) + ")" +
" -- Id=" + ToString( nNewId) ;
else
sLua = "EgtCopy(" + ToString( nSouId) + "," +
ToString( nRefId) + "," +
( nSonBeforeAfter == GDB_AFTER ? "'AFTER'" : "'BEFORE'") + ")" +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -258,14 +259,14 @@ __stdcall EgtCopyGlob( int nSouId, int nRefId, int nSonBeforeAfter)
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua ;
if ( nSonBeforeAfter == GDB_SON)
if ( nSonBeforeAfter == GDB_LAST_SON)
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
ToString( nRefId) + ")" +
" -- Id=" + ToString( nNewId) ;
else
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
ToString( nRefId) + "," +
( nSonBeforeAfter == GDB_AFTER ? "'AFTER'" : "'BEFORE'") + ")" +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -285,14 +286,14 @@ __stdcall EgtRelocate( int nSouId, int nRefId, int nSonBeforeAfter)
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua ;
if ( nSonBeforeAfter == GDB_SON)
if ( nSonBeforeAfter == GDB_LAST_SON)
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
ToString( nRefId) + ")" +
" -- Ok=" + ToString( bOk) ;
else
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
ToString( nRefId) + "," +
( nSonBeforeAfter == GDB_AFTER ? "'AFTER'" : "'BEFORE'") + ")" +
InsToString( nSonBeforeAfter) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -312,14 +313,14 @@ __stdcall EgtRelocateGlob( int nSouId, int nRefId, int nSonBeforeAfter)
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua ;
if ( nSonBeforeAfter == GDB_SON)
if ( nSonBeforeAfter == GDB_LAST_SON)
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
ToString( nRefId) + ")" +
" -- Ok=" + ToString( bOk) ;
else
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
ToString( nRefId) + "," +
( nSonBeforeAfter == GDB_AFTER ? "'AFTER'" : "'BEFORE'") + ")" +
InsToString( nSonBeforeAfter) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
+57
View File
@@ -0,0 +1,57 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : API_MachMgr.cpp Data : 23.03.15 Versione : 1.6c8
// Contenuto : Funzioni Machining Manager per API.
//
//
//
// Modifiche : 23.03.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "API.h"
#include "API_Macro.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EGnStringConverter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtInitMachMgr( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX( pGseCtx, FALSE)
// inizializzazione gestore lavorazioni
PtrOwner<IMachMgr> pMachMgr( CreateMachMgr()) ;
VERIFY_NULL( Get( pMachMgr), "Error in CreateMachMgr", FALSE)
pMachMgr->Init( pGseCtx->m_pGeomDB) ;
// assegno il gestore al contesto
pGseCtx->m_pMachMgr = Release( pMachMgr) ;
// log avvio Machining Manager
string sLog = "MachMgr started " ;
LOG_INFO( GetLogger(), sLog.c_str())
return TRUE ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtAddMachGroup( const wchar_t* wsName, const wchar_t* wsMachineName)
{
return EgtAddMachGroup( wstrztoA( wsName), wstrztoA( wsMachineName)) ;
}
//-----------------------------------------------------------------------------
int
EgtAddMachGroup( const string& sName, const string& sMachineName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// aggiungo la macchinata (gruppo di lavorazione)
return pMachMgr->AddMachGroup( sName, sMachineName) ;
}
+6
View File
@@ -35,6 +35,12 @@
//-----------------------------------------------------------------------------
#define VERIFY_CTX_GEOMDB( pC, Ret) VERIFY_2NULL( pC, pC->m_pGeomDB, "Context or GeomDB invalid", Ret)
//-----------------------------------------------------------------------------
#define VERIFY_MACHMGR( pM, Ret) VERIFY_NULL( pM, "MachMgr invalid", Ret)
//-----------------------------------------------------------------------------
#define VERIFY_CTX_MACHMGR( pC, Ret) VERIFY_2NULL( pC, pC->m_pMachMgr, "Context or MachMgr invalid", Ret)
//-----------------------------------------------------------------------------
#define VERIFY_SCENE( pS, Ret) VERIFY_NULL( pS, "Scene invalid", Ret)
+31
View File
@@ -78,6 +78,37 @@ StringToSep( const string& sSep)
return SEP_STD ;
}
//----------------------------------------------------------------------------
const char*
InsToString( int nIns)
{
switch ( nIns) {
default :
case GDB_LAST_SON : return "'LAST_SON'" ;
case GDB_FIRST_SON : return "'FIRST_SON'" ;
case GDB_BEFORE : return "'BEFORE'" ;
case GDB_AFTER : return "'AFTER'" ;
}
}
//----------------------------------------------------------------------------
int
StringToIns( const string& sIns)
{
string sTmp = sIns ;
ToUpper( sTmp) ;
if ( sTmp == "LAST_SON")
return GDB_LAST_SON ;
else if ( sTmp == "FIRST_SON")
return GDB_FIRST_SON ;
else if ( sTmp == "BEFORE")
return GDB_BEFORE ;
else if ( sTmp == "AFTER")
return GDB_AFTER ;
// default
return GDB_LAST_SON ;
}
//----------------------------------------------------------------------------
const char*
RefTypeToString( int nRefType)
+3
View File
@@ -23,6 +23,9 @@ int StringToNgeType( const std::string& sNgeType) ;
// Tipo punto per creazione rette e archi
const char* SepToString( int nSep) ;
int StringToSep( const std::string& sSep) ;
// Flag per posizione di inserimento nel DB geometrico
const char* InsToString( int nIns) ;
int StringToIns( const std::string& sIns) ;
// Tipo riferimento in cui sono espressi i dati geometrici
const char* RefTypeToString( int nRefType) ;
int StringToRefType( const std::string& sRefType) ;
BIN
View File
Binary file not shown.
+2
View File
@@ -237,6 +237,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="API_GeoSnap.cpp" />
<ClCompile Include="API_GeoTransform.cpp" />
<ClCompile Include="API_Lua.cpp" />
<ClCompile Include="API_MachMgr.cpp" />
<ClCompile Include="API_Messages.cpp" />
<ClCompile Include="API_Scene.cpp" />
<ClCompile Include="API_TscExec.cpp" />
@@ -262,6 +263,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="LUA_GeomDB.cpp" />
<ClCompile Include="LUA_GeoSnap.cpp" />
<ClCompile Include="LUA_GeoTransform.cpp" />
<ClCompile Include="LUA_MachMgr.cpp" />
<ClCompile Include="LUA_Scene.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+6
View File
@@ -206,6 +206,12 @@
<ClCompile Include="LUA_Base.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="API_MachMgr.cpp">
<Filter>File di origine\API</Filter>
</ClCompile>
<ClCompile Include="LUA_MachMgr.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtInterface.rc">
+9
View File
@@ -137,6 +137,15 @@ GetCurrGeomDB( void)
return ( s_GseCtx[s_nCurrGseCtx-1].m_pGeomDB) ;
}
//----------------------------------------------------------------------------
IMachMgr*
GetCurrMachMgr( void)
{
if ( s_nCurrGseCtx < 1 || s_nCurrGseCtx > MAX_CTX || ! s_GseOn[s_nCurrGseCtx-1])
return nullptr ;
return ( s_GseCtx[s_nCurrGseCtx-1].m_pMachMgr) ;
}
//----------------------------------------------------------------------------
IEGrScene*
GetCurrScene( void)
+9 -2
View File
@@ -16,6 +16,7 @@
#include "/EgtDev/Include/EGkGeomDB.h"
#include "/EgtDev/Include/EGrScene.h"
#include "/EgtDev/Include/EGnCmdParser.h"
#include "/EgtDev/Include/EMkMachMgr.h"
#define NOMINMAX
#include <windows.h>
@@ -25,6 +26,7 @@ class GseContext
public :
IGeomDB* m_pGeomDB ;
Color m_colDef ;
IMachMgr* m_pMachMgr ;
HWND m_hWnd ;
IEGrScene* m_pScene ;
ICmdParser* m_pTscExec ;
@@ -36,8 +38,8 @@ class GseContext
public :
GseContext( void)
: m_pGeomDB( nullptr), m_colDef( GRAY), m_hWnd( nullptr), m_pScene( nullptr), m_pTscExec( nullptr),
m_sFilePath(), m_bEnableModified( true), m_bModified( false),
: m_pGeomDB( nullptr), m_colDef( GRAY), m_pMachMgr( nullptr), m_hWnd( nullptr), m_pScene( nullptr),
m_pTscExec( nullptr), m_sFilePath(), m_bEnableModified( true), m_bModified( false),
m_nCurrPart( GDB_ID_NULL), m_nCurrLayer( GDB_ID_NULL)
{}
~GseContext( void)
@@ -54,6 +56,10 @@ class GseContext
m_pScene = nullptr ;
}
m_hWnd = nullptr ;
if ( m_pMachMgr != nullptr) {
delete m_pMachMgr ;
m_pMachMgr = nullptr ;
}
if ( m_pGeomDB != nullptr) {
delete m_pGeomDB ;
m_pGeomDB = nullptr ;
@@ -79,5 +85,6 @@ bool ResetCurrGseContext( void) ;
int GetIndCurrGseContext( void) ;
GseContext* GetCurrGseContext( void) ;
IGeomDB* GetCurrGeomDB( void) ;
IMachMgr* GetCurrMachMgr( void) ;
IEGrScene* GetCurrScene( void) ;
ICmdParser* GetCurrTscExecutor( void) ;
+3
View File
@@ -58,6 +58,9 @@ bool LuaInstallGeoSnap( void) ;
//-------------------------- GeoTransform ------------------------------------
bool LuaInstallGeoTransform( void) ;
//-------------------------- MachMgr -----------------------------------------
bool LuaInstallMachMgr( void) ;
//-------------------------- Scene -------------------------------------------
bool LuaInstallScene( void) ;
+4
View File
@@ -92,6 +92,10 @@ LuaInit( void)
LOG_ERROR( GetLogger(), "Error in LuaInstallGeoTransform (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallMachMgr()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallMachMgr (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallScene()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallScene (" __FUNCTION__ ")")
return false ;
+9 -24
View File
@@ -17,6 +17,7 @@
#include "LUA.h"
#include "LUA_Base.h"
#include "LUA_Aux.h"
#include "AuxTools.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EgnStringUtils.h"
@@ -174,15 +175,11 @@ LuaCopy( lua_State* L)
LuaCheckParam( L, 1, nSouId)
int nRefId ;
LuaCheckParam( L, 2, nRefId)
int nSonBeforeAfter = GDB_SON ;
int nSonBeforeAfter = GDB_LAST_SON ;
if ( lua_gettop( L) >= 3) {
string sSonBeforeAfter ;
LuaCheckParam( L, 3, sSonBeforeAfter) ;
ToUpper( sSonBeforeAfter) ;
if ( sSonBeforeAfter == "BEFORE")
nSonBeforeAfter = GDB_BEFORE ;
else if ( sSonBeforeAfter == "AFTER")
nSonBeforeAfter = GDB_AFTER ;
nSonBeforeAfter = StringToIns( sSonBeforeAfter) ;
}
LuaClearStack( L) ;
// eseguo la copia
@@ -204,15 +201,11 @@ LuaCopyGlob( lua_State* L)
LuaCheckParam( L, 1, nSouId)
int nRefId ;
LuaCheckParam( L, 2, nRefId)
int nSonBeforeAfter = GDB_SON ;
int nSonBeforeAfter = GDB_LAST_SON ;
if ( lua_gettop( L) >= 3) {
string sSonBeforeAfter ;
LuaCheckParam( L, 3, sSonBeforeAfter) ;
ToUpper( sSonBeforeAfter) ;
if ( sSonBeforeAfter == "BEFORE")
nSonBeforeAfter = GDB_BEFORE ;
else if ( sSonBeforeAfter == "AFTER")
nSonBeforeAfter = GDB_AFTER ;
nSonBeforeAfter = StringToIns( sSonBeforeAfter) ;
}
LuaClearStack( L) ;
// eseguo la copia
@@ -234,15 +227,11 @@ LuaRelocate( lua_State* L)
LuaCheckParam( L, 1, nSouId)
int nRefId ;
LuaCheckParam( L, 2, nRefId)
int nSonBeforeAfter = GDB_SON ;
int nSonBeforeAfter = GDB_LAST_SON ;
if ( lua_gettop( L) >= 3) {
string sSonBeforeAfter ;
LuaCheckParam( L, 3, sSonBeforeAfter) ;
ToUpper( sSonBeforeAfter) ;
if ( sSonBeforeAfter == "BEFORE")
nSonBeforeAfter = GDB_BEFORE ;
else if ( sSonBeforeAfter == "AFTER")
nSonBeforeAfter = GDB_AFTER ;
nSonBeforeAfter = StringToIns( sSonBeforeAfter) ;
}
LuaClearStack( L) ;
// eseguo la rilocazione
@@ -261,15 +250,11 @@ LuaRelocateGlob( lua_State* L)
LuaCheckParam( L, 1, nSouId)
int nRefId ;
LuaCheckParam( L, 2, nRefId)
int nSonBeforeAfter = GDB_SON ;
int nSonBeforeAfter = GDB_LAST_SON ;
if ( lua_gettop( L) >= 3) {
string sSonBeforeAfter ;
LuaCheckParam( L, 3, sSonBeforeAfter) ;
ToUpper( sSonBeforeAfter) ;
if ( sSonBeforeAfter == "BEFORE")
nSonBeforeAfter = GDB_BEFORE ;
else if ( sSonBeforeAfter == "AFTER")
nSonBeforeAfter = GDB_AFTER ;
nSonBeforeAfter = StringToIns( sSonBeforeAfter) ;
}
LuaClearStack( L) ;
// eseguo la rilocazione
+50
View File
@@ -0,0 +1,50 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : LUA_MachMgr.cpp Data : 24.03.15 Versione : 1.6c8
// Contenuto : Funzioni Machining Manager per LUA.
//
//
//
// Modifiche : 24.03.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "API.h"
#include "LUA.h"
#include "LUA_Base.h"
#include "LUA_Aux.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EgnStringUtils.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaAddMachGroup( lua_State* L)
{
// 2 parametri : nome del gruppo, nome della macchina da utilizzare
string sName ;
LuaCheckParam( L, 1, sName)
string sMachineName ;
LuaCheckParam( L, 2, sMachineName)
LuaClearStack( L) ;
// aggiungo la macchinata
int nId = EgtAddMachGroup( sName, sMachineName) ;
// restituisco il risultato
LuaSetReturn( L, nId) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallMachMgr( void)
{
bool bOk = true ;
bOk = bOk && LuaRegisterFunction( "EgtAddMachGroup", LuaAddMachGroup) ;
return bOk ;
}