EgtExecutor 2.2l2 :

- aggiunto nuovo tipo di file BTLx (FT_BTLX = 19)
- aggiunta funzione Exe e Lua ImportBtlx
- aggiunte funzioni Exe e Lua per BeamMgr creazione e modifica travi e pareti e aggiunta features.
This commit is contained in:
Dario Sassi
2020-12-14 11:37:43 +00:00
parent db726f6fd6
commit 45087f4e28
11 changed files with 456 additions and 4 deletions
+19 -2
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2019
// EgalTech 2015-2020
//----------------------------------------------------------------------------
// File : DllExchange.cpp Data : 15.09.19 Versione : 2.1h2
// File : DllExchange.cpp Data : 14.12.20 Versione : 2.2l2
// Contenuto : Funzioni di gestione della libreria opzionale EgtExchange.
//
//
@@ -9,6 +9,7 @@
// Modifiche : 27.03.15 DS Creazione modulo.
// 03.07.18 DS Aggiunto ImportPnt.
// 15.09.19 DS Aggiunto ExportSvg.
// 14.12.20 DS Aggiunto ImportBtlx.
//
//----------------------------------------------------------------------------
@@ -39,6 +40,7 @@ static const char* EEX_GETEEXVERSION = "GetEExVersion" ;
static const char* EEX_SETEEXKEY = "SetEExKey" ;
static const char* EEX_CREATEBEAMMGR = "CreateBeamMgr" ;
static const char* EEX_CREATEIMPORTBTL = "CreateImportBtl" ;
static const char* EEX_CREATEIMPORTBTLX = "CreateImportBtlx" ;
static const char* EEX_CREATEIMPORTCNC = "CreateImportCnc" ;
static const char* EEX_CREATEIMPORTCSF = "CreateImportCsf" ;
static const char* EEX_CREATEIMPORTDXF = "CreateImportDxf" ;
@@ -171,6 +173,21 @@ MyCreateImportBtl( void)
return pFun() ;
}
//-----------------------------------------------------------------------------
IImportBtlx*
MyCreateImportBtlx( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IImportBtlx* (* PF_CreateImportBtlx) ( void) ;
PF_CreateImportBtlx pFun = (PF_CreateImportBtlx)GetProcAddress( s_hEEx, EEX_CREATEIMPORTBTLX) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IImportCnc*
MyCreateImportCnc( void)
+3 -1
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2020
//----------------------------------------------------------------------------
// File : DllExchange.h Data : 30.08.20 Versione : 2.2i1
// File : DllExchange.h Data : 14.12.20 Versione : 2.2l2
// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtExchange.
//
//
@@ -18,6 +18,7 @@
class ILogger ;
class IBeamMgr ;
class IImportBtl ;
class IImportBtlx ;
class IImportCnc ;
class IImportCsf ;
class IImportDxf ;
@@ -37,6 +38,7 @@ void MySetEExKey( const std::string& sKey) ;
const char* MyGetEExVersion( void) ;
IBeamMgr* MyCreateBeamMgr( void) ;
IImportBtl* MyCreateImportBtl( void) ;
IImportBtlx* MyCreateImportBtlx( void) ;
IImportCnc* MyCreateImportCnc( void) ;
IImportCsf* MyCreateImportCsf( void) ;
IImportDxf* MyCreateImportDxf( void) ;
+111 -1
View File
@@ -40,6 +40,87 @@ ExeInitBeamMgr( int nFlag)
return bOk ;
}
//-----------------------------------------------------------------------------
int
ExeBeamCreatePart( void)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, GDB_ID_NULL)
// creo un pezzo (trave o parete) e lo rendo corrente
return pBeamMgr->CreatePart() ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamSetPart( int nPartId)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// rendo corrente un pezzo
return pBeamMgr->SetPart( nPartId) ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamErasePart( void)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// cancello il pezzo corrente
return pBeamMgr->ErasePart() ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamSetPartProdNbr( int nProdNbr)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// imposto il numero di produzione al pezzo corrente
return pBeamMgr->SetPartProdNbr( nProdNbr) ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamSetPartName( const string& sName)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// imposto il nome al pezzo corrente
return pBeamMgr->SetPartName( sName) ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamSetPartCount( int nCount)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// imposto il numero di parti da produrre al pezzo corrente
return pBeamMgr->SetPartCount( nCount) ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamSetPartBox( double dLength, double dHeight, double dWidth)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// imposto le dimensioni al pezzo corrente
return pBeamMgr->SetPartBox( dLength, dHeight, dWidth) ;
}
//-----------------------------------------------------------------------------
int
ExeBeamAddProcess( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// imposto le dimensioni al pezzo corrente
return pBeamMgr->AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vdPar, sPar) ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamCalcSolid( int nPartId, bool bRecalc)
@@ -55,7 +136,7 @@ int
ExeBeamGetSolid( int nPartId)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
VERIFY_BEAMMGR( pBeamMgr, GDB_ID_NULL)
// recupero l'identificativo del solido della trave
return pBeamMgr->GetSolid( nPartId) ;
}
@@ -69,3 +150,32 @@ ExeBeamShowSolid( int nPartId, bool bShow)
// aggiorno lo stato di visualizzazione della trave (solido e complementari)
return pBeamMgr->ShowSolid( nPartId, bShow) ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamGetBuildingIsOn( void)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// verifico se assemblaggio attivato
return pBeamMgr->GetBuildingIsOn() ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamShowBuilding( bool bShow)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// disabilito possibilità di alterare il flag di modifica
bool bOldEnabModif = ExeGetEnableModified() ;
if ( bOldEnabModif)
ExeDisableModified() ;
// attivo o disattivo la visualizzazione l'assemblaggio
bool bOk = pBeamMgr->ShowBuilding( bShow) ;
// ripristino possibilità di alterare il flag di modifica
if ( bOldEnabModif)
ExeEnableModified() ;
// risultato
return bOk ;
}
+31
View File
@@ -25,6 +25,7 @@
#include "/EgtDev/Include/EExImportCnc.h"
#include "/EgtDev/Include/EExImportCsf.h"
#include "/EgtDev/Include/EExImportBtl.h"
#include "/EgtDev/Include/EExImportBtlx.h"
#include "/EgtDev/Include/EExExportStl.h"
#include "/EgtDev/Include/EExExportSvg.h"
#include "/EgtDev/Include/EExExportDxf.h"
@@ -68,6 +69,8 @@ ExeGetFileType( const string& sFilePath)
return FT_CSF ;
else if ( sFileExt == "BTL")
return FT_BTL ;
else if ( sFileExt == "BTLX")
return FT_BTLX ;
else if ( sFileExt == "PNG" || sFileExt == "JPG" || sFileExt == "JPEG" || sFileExt == "BMP")
return FT_IMG ;
else if ( sFileExt == "PNT" || sFileExt == "XYZ")
@@ -128,6 +131,34 @@ ExeImportBtl( const string& sFilePath, int nFlag)
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeImportBtlx( const string& sFilePath, int nFlag)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// importo il file BTLx
// preparo l'importatore
PtrOwner<IImportBtlx> pImpBtlx( MyCreateImportBtlx()) ;
bOk = bOk && ! IsNull( pImpBtlx) ;
// eseguo l'importazione (direttamente nella radice)
bOk = bOk && pImpBtlx->Import( sFilePath, pGseCtx->m_pGeomDB, nFlag) ;
// aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtImportBtlx('" + StringToLuaString( sFilePath) + "'," +
ToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeImportCnc( const string& sFilePath, int nFlag)
BIN
View File
Binary file not shown.
+1
View File
@@ -292,6 +292,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="GenTools.cpp" />
<ClCompile Include="GeoTools.cpp" />
<ClCompile Include="GseContext.cpp" />
<ClCompile Include="LUA_BeamMgr.cpp" />
<ClCompile Include="LUA_CAvTool.cpp" />
<ClCompile Include="LUA_CDeObjSolid.cpp" />
<ClCompile Include="LUA_GdbGet.cpp" />
+3
View File
@@ -383,6 +383,9 @@
<ClCompile Include="LUA_MaxFiller.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="LUA_BeamMgr.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtExecutor.rc">
+3
View File
@@ -114,6 +114,9 @@ bool LuaInstallImage( LuaMgr& luaMgr) ;
//-------------------------- Exchange ----------------------------------------
bool LuaInstallExchange( LuaMgr& luaMgr) ;
//-------------------------- BeamMgr -----------------------------------------
bool LuaInstallBeamMgr( LuaMgr& luaMgr) ;
//-------------------------- Polynomial Roots --------------------------------
bool LuaInstallPolynomialRoots( LuaMgr& luaMgr) ;
+4
View File
@@ -158,6 +158,10 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
LOG_ERROR( GetLogger(), "Error in LuaInstallExchange (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallBeamMgr( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallBeamMgr (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallPolynomialRoots( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallPolynomialRoots (" __FUNCTION__ ")")
return false ;
+263
View File
@@ -0,0 +1,263 @@
//----------------------------------------------------------------------------
// EgalTech 2020-2020
//----------------------------------------------------------------------------
// File : LUA_BeamMgr.cpp Data : 12.12.20 Versione : 2.2l1
// Contenuto : Funzioni per evitare collisioni utensile-superfici.
//
//
//
// Modifiche : 12.12.20 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EgnStringUtils.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaBeamCreatePart( lua_State* L)
{
// Nessun parametro
LuaClearStack( L) ;
// creo un pezzo (trave o parete) e lo rendo corrente
int nPartId = ExeBeamCreatePart() ;
// restituisco il risultato
if ( nPartId != GDB_ID_NULL)
LuaSetParam( L, nPartId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamSetPart( lua_State* L)
{
// 1 parametro : nPartId
int nPartId ;
LuaCheckParam( L, 1, nPartId)
LuaClearStack( L) ;
// rendo corrente un pezzo
bool bOk = ExeBeamSetPart( nPartId) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamErasePart( lua_State* L)
{
// Nessun parametro
LuaClearStack( L) ;
// cancello il pezzo corrente
bool bOk = ExeBeamErasePart() ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamSetPartProdNbr( lua_State* L)
{
// 1 parametro : nProdNbr
int nProdNbr ;
LuaCheckParam( L, 1, nProdNbr)
LuaClearStack( L) ;
// imposto il numero di produzione al pezzo corrente
bool bOk = ExeBeamSetPartProdNbr( nProdNbr) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamSetPartName( lua_State* L)
{
// 1 parametro : sName
string sName ;
LuaCheckParam( L, 1, sName)
LuaClearStack( L) ;
// imposto il nome al pezzo corrente
bool bOk = ExeBeamSetPartName( sName) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamSetPartCount( lua_State* L)
{
// 1 parametro : nCount
int nCount ;
LuaCheckParam( L, 1, nCount)
LuaClearStack( L) ;
// imposto il numero di parti da produrre al pezzo corrente
bool bOk = ExeBeamSetPartCount( nCount) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamSetPartBox( lua_State* L)
{
// 3 parametri : dLength, dHeight, dWidth
double dLength ;
LuaCheckParam( L, 1, dLength)
double dHeight ;
LuaCheckParam( L, 2, dHeight)
double dWidth ;
LuaCheckParam( L, 3, dWidth)
LuaClearStack( L) ;
// imposto le dimensioni al pezzo corrente
bool bOk = ExeBeamSetPartBox( dLength, dHeight, dWidth) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamAddProcess( lua_State* L)
{
// 8 parametri : nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar
int nGroup ;
LuaCheckParam( L, 1, nGroup)
int nProc ;
LuaCheckParam( L, 2, nProc)
int nSide ;
LuaCheckParam( L, 3, nSide)
string sDes ;
LuaCheckParam( L, 4, sDes)
int nProcId ;
LuaCheckParam( L, 5, nProcId)
Frame3d frRef ;
LuaCheckParam( L, 6, frRef)
DBLVECTOR vdPar ;
LuaCheckParam( L, 7, vdPar)
string sPar ;
LuaCheckParam( L, 8, sPar)
LuaClearStack( L) ;
// aggiungo la feature indicata
int nNewId = ExeBeamAddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vdPar, sPar) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamCalcSolid( lua_State* L)
{
// 1 o 2 parametri : nPartId [, bRecalc]
int nPartId ;
LuaCheckParam( L, 1, nPartId)
bool bRecalc = false ;
LuaGetParam( L, 2, bRecalc) ;
LuaClearStack( L) ;
// eseguo calcolo del solido della trave
bool bOk = ExeBeamCalcSolid( nPartId, bRecalc) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamGetSolid( lua_State* L)
{
// 1 parametro : nPartIdo
int nPartId ;
LuaCheckParam( L, 1, nPartId)
LuaClearStack( L) ;
// restituisco identificativo del solido della trave
int nSolidId = ExeBeamGetSolid( nPartId) ;
// restituisco il risultato
if ( nSolidId != GDB_ID_NULL)
LuaSetParam( L, nSolidId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamShowSolid( lua_State* L)
{
// 2 parametri : nPartId, bShow
int nPartId ;
LuaCheckParam( L, 1, nPartId)
bool bShow ;
LuaGetParam( L, 2, bShow) ;
LuaClearStack( L) ;
// visualizzo o nascondo il solido della trave
bool bOk = ExeBeamShowSolid( nPartId, bShow) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamGetBuildingIsOn( lua_State* L)
{
// Nessun parametro
LuaClearStack( L) ;
// restituisco identificativo del solido della trave
bool bOk = ExeBeamGetBuildingIsOn() ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamShowBuilding( lua_State* L)
{
// 1 parametro : bShow
bool bShow ;
LuaCheckParam( L, 1, bShow)
LuaClearStack( L) ;
// attivo o disattivo la visualizzazione l'assemblaggio
bool bOk = ExeBeamShowBuilding( bShow) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallBeamMgr( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamCreatePart", LuaBeamCreatePart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamSetPart", LuaBeamSetPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamErasePart", LuaBeamErasePart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamSetPartProdNbr", LuaBeamSetPartProdNbr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamSetPartName", LuaBeamSetPartName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamSetPartCount", LuaBeamSetPartCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamSetPartBox", LuaBeamSetPartBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamAddProcess", LuaBeamAddProcess) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamCalcSolid", LuaBeamCalcSolid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamGetSolid", LuaBeamGetSolid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamShowSolid", LuaBeamShowSolid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamGetBuildingIsOn", LuaBeamGetBuildingIsOn) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamShowBuilding", LuaBeamShowBuilding) ;
return bOk ;
}
+18
View File
@@ -39,6 +39,23 @@ LuaImportBtl( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaImportBtlx( lua_State* L)
{
// 1 o 2 : FilePath [, Flag]
string sFilePath ;
LuaCheckParam( L, 1, sFilePath)
int nFlag = EIB_FLAG_NONE ;
LuaGetParam( L, 2, nFlag) ;
LuaClearStack( L) ;
// apro il file
bool bOk = ExeImportBtlx( sFilePath, nFlag) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaImportCnc( lua_State* L)
@@ -200,6 +217,7 @@ LuaInstallExchange( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportBtl", LuaImportBtl) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportBtlx", LuaImportBtlx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportCnc", LuaImportCnc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportCsf", LuaImportCsf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportDxf", LuaImportDxf) ;