EgtExecutor 1.6e2 :
- primo rilascio (esecutore e lua da EgtInterface).
This commit is contained in:
+141
@@ -0,0 +1,141 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : AuxTools.cpp Data : 07.01.15 Versione : 1.6a1
|
||||
// Contenuto : Funzioni ausiliarie.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 07.01.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "AuxTools.h"
|
||||
#include "/EgtDev/Include/EGkExtText.h"
|
||||
#include "/EgtDev/Include/EMkMachMgr.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const string
|
||||
IdListToString( const INTVECTOR& vIds)
|
||||
{
|
||||
string sIds ;
|
||||
sIds.reserve( 6 * vIds.size()) ;
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i)
|
||||
sIds += ( vIds[i] != GDB_ID_SEL ? ToString( vIds[i]) : "GDB_ID.SEL") + "," ;
|
||||
if ( ! sIds.empty())
|
||||
sIds.pop_back() ;
|
||||
return sIds ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const char*
|
||||
NgeTypeToString( int nNgeType)
|
||||
{
|
||||
switch ( nNgeType) {
|
||||
case GDB_SV_TXT : return "GDB_NT.TXT" ;
|
||||
case GDB_SV_BIN : return "GDB_NT.BIN" ;
|
||||
default :
|
||||
case GDB_SV_CMPTXT : return "GDB_NT.CMPTXT" ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const char*
|
||||
SepToString( int nSep)
|
||||
{
|
||||
switch ( nSep) {
|
||||
default :
|
||||
case SEP_STD : return "GDB_PT.STD" ;
|
||||
case SEP_TG : return "GDB_PT.TG" ;
|
||||
case SEP_PERP : return "GDB_PT.PERP" ;
|
||||
case SEP_MINDIST : return "GDB_PT.MIND" ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const char*
|
||||
InsToString( int nIns)
|
||||
{
|
||||
switch ( nIns) {
|
||||
case GDB_FIRST_SON : return "GDB_IN.FIRST_SON" ;
|
||||
default :
|
||||
case GDB_LAST_SON : return "GDB_IN.LAST_SON" ;
|
||||
case GDB_BEFORE : return "GDB_IN.BEFORE" ;
|
||||
case GDB_AFTER : return "GDB_IN.AFTER" ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const char*
|
||||
RefTypeToString( int nRefType)
|
||||
{
|
||||
switch ( nRefType) {
|
||||
case RTY_GLOB : return "GDB_RT.GLOB" ;
|
||||
default :
|
||||
case RTY_LOC : return "GDB_RT.LOC" ;
|
||||
case RTY_GRID : return "GDB_RT.GRID" ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const char*
|
||||
ETxtInsPosToString( int nETxtInsPos)
|
||||
{
|
||||
switch ( nETxtInsPos) {
|
||||
case ETXT_IPTL : return "GDB_TI.TL" ;
|
||||
case ETXT_IPTC : return "GDB_TI.TC" ;
|
||||
case ETXT_IPTR : return "GDB_TI.TR" ;
|
||||
case ETXT_IPML : return "GDB_TI.ML" ;
|
||||
case ETXT_IPMC : return "GDB_TI.MC" ;
|
||||
case ETXT_IPMR : return "GDB_TI.MR" ;
|
||||
default :
|
||||
case ETXT_IPBL : return "GDB_TI.BL" ;
|
||||
case ETXT_IPBC : return "GDB_TI.BC" ;
|
||||
case ETXT_IPBR : return "GDB_TI.BR" ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const char*
|
||||
OffsTypeToString( int nOffsType)
|
||||
{
|
||||
switch ( nOffsType) {
|
||||
default :
|
||||
case ICurve::OFF_FILLET : return "GDB_OT.FILLET" ;
|
||||
case ICurve::OFF_CHAMFER : return "GDB_OT.CHAMFER" ;
|
||||
case ICurve::OFF_EXTEND : return "GDB_OT.EXTEND" ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const char*
|
||||
RawPartCornerPosToString( int nFlag)
|
||||
{
|
||||
switch ( nFlag) {
|
||||
case RPCR_TL : return "MCH_CR.TL" ;
|
||||
case RPCR_TR : return "MCH_CR.TR" ;
|
||||
default :
|
||||
case RPCR_BL : return "MCH_CR.BL" ;
|
||||
case RPCR_BR : return "MCH_CR.BR" ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const char*
|
||||
RawPartCenterPosToString( int nFlag)
|
||||
{
|
||||
switch ( nFlag) {
|
||||
case RPCE_TC : return "MCH_CE.TC" ;
|
||||
default :
|
||||
case RPCE_ML : return "MCH_CE.ML" ;
|
||||
case RPCE_MR : return "MCH_CE.MR" ;
|
||||
case RPCE_BC : return "MCH_CE.BC" ;
|
||||
case RPCE_MC : return "MCH_CE.MC" ;
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : AuxTools.h Data : 07.01.15 Versione : 1.6a1
|
||||
// Contenuto : Prototipi funzioni ausiliarie.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 07.01.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
#include <string>
|
||||
|
||||
class IGeomDB ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Lista di Id completa (parametro per lua)
|
||||
const std::string IdListToString( const INTVECTOR& vIds) ;
|
||||
// Tipo del file Nge
|
||||
const char* NgeTypeToString( int nNgeType) ;
|
||||
// Tipo punto per creazione rette e archi
|
||||
const char* SepToString( int nSep) ;
|
||||
// Flag per posizione di inserimento nel DB geometrico
|
||||
const char* InsToString( int nIns) ;
|
||||
// Tipo riferimento in cui sono espressi i dati geometrici
|
||||
const char* RefTypeToString( int nRefType) ;
|
||||
// Posizione inserimento testo
|
||||
const char* ETxtInsPosToString( int nETxtInsPos) ;
|
||||
// tipo di offset di curva
|
||||
const char* OffsTypeToString( int nOffsType) ;
|
||||
// Flag per posizione corner rispetto a grezzo
|
||||
const char* RawPartCornerPosToString( int nFlag) ;
|
||||
// Flag per posizione center rispetto a grezzo
|
||||
const char* RawPartCenterPosToString( int nFlag) ;
|
||||
+213
@@ -0,0 +1,213 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DllExchange.cpp Data : 27.03.15 Versione : 1.6c9
|
||||
// Contenuto : Funzioni di gestione della libreria opzionale EgtExchange.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 27.03.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "DllExchange.h"
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Nome della libreria
|
||||
#if defined( _WIN64) && defined( _DEBUG)
|
||||
static const wchar_t* EEX_NAME = L"EgtExchangeD64.dll" ;
|
||||
#elif defined( _WIN64)
|
||||
static const wchar_t* EEX_NAME = L"EgtExchangeR64.dll" ;
|
||||
#elif defined( _WIN32) && defined( _DEBUG)
|
||||
static const wchar_t* EEX_NAME = L"EgtExchangeD32.dll" ;
|
||||
#else
|
||||
static const wchar_t* EEX_NAME = L"EgtExchangeR32.dll" ;
|
||||
#endif
|
||||
// Nome delle funzioni caricate
|
||||
static const char* EEX_SETEEXLOGGER = "SetEExLogger" ;
|
||||
static const char* EEX_GETEEXVERSION = "GetEExVersion" ;
|
||||
static const char* EEX_SETEEXKEY = "SetEExKey" ;
|
||||
static const char* EEX_CREATEIMPORTCNC = "CreateImportCnc" ;
|
||||
static const char* EEX_CREATEIMPORTDXF = "CreateImportDxf" ;
|
||||
static const char* EEX_CREATEIMPORTSTL = "CreateImportStl" ;
|
||||
static const char* EEX_CREATEEXPORTDXF = "CreateExportDxf" ;
|
||||
static const char* EEX_CREATEEXPORTSTL = "CreateExportStl" ;
|
||||
static const char* EEX_CREATEEEXEXECUTOR = "CreateExcExecutor" ;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HMODULE s_hEEx = nullptr ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
LoadExchangeDll( void)
|
||||
{
|
||||
// se già caricata
|
||||
if ( s_hEEx != nullptr)
|
||||
return true ;
|
||||
// carico la libreria EgtExchange
|
||||
s_hEEx = LoadLibrary( EEX_NAME) ;
|
||||
return ( s_hEEx != nullptr) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
FreeExchangeDll( void)
|
||||
{
|
||||
// se non è già caricata
|
||||
if ( s_hEEx == nullptr)
|
||||
return true ;
|
||||
// libero la libreria EgtExchange
|
||||
FreeLibrary( s_hEEx) ;
|
||||
s_hEEx = nullptr ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
IsLoadedExchangeDll( void)
|
||||
{
|
||||
return ( s_hEEx != nullptr) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
MySetEExLogger( ILogger* pLogger)
|
||||
{
|
||||
// verifico caricamento libreria EgtExchange
|
||||
if ( s_hEEx == nullptr)
|
||||
return ;
|
||||
// recupero funzione che imposta il logger
|
||||
typedef void (* PF_SetEExLogger) ( ILogger* pLogger) ;
|
||||
PF_SetEExLogger pFun = (PF_SetEExLogger)GetProcAddress( s_hEEx, EEX_SETEEXLOGGER) ;
|
||||
if ( pFun == nullptr)
|
||||
return ;
|
||||
pFun( pLogger) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const char*
|
||||
MyGetEExVersion( void)
|
||||
{
|
||||
// verifico caricamento libreria EgtExchange
|
||||
if ( s_hEEx == nullptr)
|
||||
return "" ;
|
||||
// recupero funzione che restituisce la versione della libreria
|
||||
typedef const char* (* PF_GetEExVersion) ( void) ;
|
||||
PF_GetEExVersion pFun = (PF_GetEExVersion)GetProcAddress( s_hEEx, EEX_GETEEXVERSION) ;
|
||||
if ( pFun == nullptr)
|
||||
return "" ;
|
||||
return pFun() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
MySetEExKey( const string& sKey)
|
||||
{
|
||||
// verifico caricamento libreria EgtExchange
|
||||
if ( s_hEEx == nullptr)
|
||||
return ;
|
||||
// recupero funzione che imposta i codici di protezione
|
||||
typedef void (* PF_SetEExKey) ( const string& sKey) ;
|
||||
PF_SetEExKey pFun = (PF_SetEExKey)GetProcAddress( s_hEEx, EEX_SETEEXKEY) ;
|
||||
if ( pFun == nullptr)
|
||||
return ;
|
||||
pFun( sKey) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IImportCnc*
|
||||
MyCreateImportCnc( void)
|
||||
{
|
||||
// verifico caricamento libreria EgtExchange
|
||||
if ( s_hEEx == nullptr)
|
||||
return nullptr ;
|
||||
// recupero funzione creazione oggetto
|
||||
typedef IImportCnc* (* PF_CreateImportCnc) ( void) ;
|
||||
PF_CreateImportCnc pFun = (PF_CreateImportCnc)GetProcAddress( s_hEEx, EEX_CREATEIMPORTCNC) ;
|
||||
if ( pFun == nullptr)
|
||||
return nullptr ;
|
||||
return pFun() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IImportDxf*
|
||||
MyCreateImportDxf( void)
|
||||
{
|
||||
// verifico caricamento libreria EgtExchange
|
||||
if ( s_hEEx == nullptr)
|
||||
return nullptr ;
|
||||
// recupero funzione creazione oggetto
|
||||
typedef IImportDxf* (* PF_CreateImportDxf) ( void) ;
|
||||
PF_CreateImportDxf pFun = (PF_CreateImportDxf)GetProcAddress( s_hEEx, EEX_CREATEIMPORTDXF) ;
|
||||
if ( pFun == nullptr)
|
||||
return nullptr ;
|
||||
return pFun() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IImportStl*
|
||||
MyCreateImportStl( void)
|
||||
{
|
||||
// verifico caricamento libreria EgtExchange
|
||||
if ( s_hEEx == nullptr)
|
||||
return nullptr ;
|
||||
// recupero funzione creazione oggetto
|
||||
typedef IImportStl* (* PF_CreateImportStl) ( void) ;
|
||||
PF_CreateImportStl pFun = (PF_CreateImportStl)GetProcAddress( s_hEEx, EEX_CREATEIMPORTSTL) ;
|
||||
if ( pFun == nullptr)
|
||||
return nullptr ;
|
||||
return pFun() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IExportDxf*
|
||||
MyCreateExportDxf( void)
|
||||
{
|
||||
// verifico caricamento libreria EgtExchange
|
||||
if ( s_hEEx == nullptr)
|
||||
return nullptr ;
|
||||
// recupero funzione creazione oggetto
|
||||
typedef IExportDxf* (* PF_CreateExportDxf) ( void) ;
|
||||
PF_CreateExportDxf pFun = (PF_CreateExportDxf)GetProcAddress( s_hEEx, EEX_CREATEEXPORTDXF) ;
|
||||
if ( pFun == nullptr)
|
||||
return nullptr ;
|
||||
return pFun() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IExportStl*
|
||||
MyCreateExportStl( void)
|
||||
{
|
||||
// verifico caricamento libreria EgtExchange
|
||||
if ( s_hEEx == nullptr)
|
||||
return nullptr ;
|
||||
// recupero funzione creazione oggetto
|
||||
typedef IExportStl* (* PF_CreateExportStl) ( void) ;
|
||||
PF_CreateExportStl pFun = (PF_CreateExportStl)GetProcAddress( s_hEEx, EEX_CREATEEXPORTSTL) ;
|
||||
if ( pFun == nullptr)
|
||||
return nullptr ;
|
||||
return pFun() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IExcExecutor*
|
||||
MyCreateExcExecutor( void)
|
||||
{
|
||||
// verifico caricamento libreria EgtExchange
|
||||
if ( s_hEEx == nullptr)
|
||||
return nullptr ;
|
||||
// recupero funzione creazione oggetto
|
||||
typedef IExcExecutor* (* PF_CreateExcExecutor) ( void) ;
|
||||
PF_CreateExcExecutor pFun = (PF_CreateExcExecutor)GetProcAddress( s_hEEx, EEX_CREATEEEXEXECUTOR) ;
|
||||
if ( pFun == nullptr)
|
||||
return nullptr ;
|
||||
return pFun() ;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DllGraphics.h Data : 27.03.15 Versione : 1.6c9
|
||||
// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtGraphics.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 27.03.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class ILogger ;
|
||||
class IImportCnc ;
|
||||
class IImportDxf ;
|
||||
class IImportStl ;
|
||||
class IExportDxf ;
|
||||
class IExportStl ;
|
||||
class IExcExecutor ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool LoadExchangeDll( void) ;
|
||||
bool FreeExchangeDll( void) ;
|
||||
bool IsLoadedExchangeDll( void) ;
|
||||
void MySetEExLogger( ILogger* pLogger) ;
|
||||
void MySetEExKey( const std::string& sKey) ;
|
||||
const char* MyGetEExVersion( void) ;
|
||||
IImportCnc* MyCreateImportCnc( void) ;
|
||||
IImportDxf* MyCreateImportDxf( void) ;
|
||||
IImportStl* MyCreateImportStl( void) ;
|
||||
IExportDxf* MyCreateExportDxf( void) ;
|
||||
IExportStl* MyCreateExportStl( void) ;
|
||||
IExcExecutor* MyCreateExcExecutor(void) ;
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DllGraphics.cpp Data : 27.03.15 Versione : 1.6c9
|
||||
// Contenuto : Funzioni di gestione della libreria opzionale EgtGraphics.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 27.03.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "DllGraphics.h"
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Nome della libreria
|
||||
#if defined( _WIN64) && defined( _DEBUG)
|
||||
static const wchar_t* EGR_NAME = L"EgtGraphicsD64.dll" ;
|
||||
#elif defined( _WIN64)
|
||||
static const wchar_t* EGR_NAME = L"EgtGraphicsR64.dll" ;
|
||||
#elif defined( _WIN32) && defined( _DEBUG)
|
||||
static const wchar_t* EGR_NAME = L"EgtGraphicsD32.dll" ;
|
||||
#else
|
||||
static const wchar_t* EGR_NAME = L"EgtGraphicsR32.dll" ;
|
||||
#endif
|
||||
// Nome delle funzioni caricate
|
||||
static const char* EGR_SETEGRLOGGER = "SetEGrLogger" ;
|
||||
static const char* EGR_GETEGRVERSION = "GetEGrVersion" ;
|
||||
static const char* EGR_SETEGRKEY = "SetEGrKey" ;
|
||||
static const char* EGR_CREATEEGRSCENE = "CreateEGrScene" ;
|
||||
static const char* EGR_CREATESCEEXECUTOR = "CreateSceExecutor" ;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HMODULE s_hEGr = nullptr ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
LoadGraphicsDll( void)
|
||||
{
|
||||
// se già caricata
|
||||
if ( s_hEGr != nullptr)
|
||||
return true ;
|
||||
// carico la libreria EgtGraphics
|
||||
s_hEGr = LoadLibrary( EGR_NAME) ;
|
||||
return ( s_hEGr != nullptr) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
FreeGraphicsDll( void)
|
||||
{
|
||||
// se non è già caricata
|
||||
if ( s_hEGr == nullptr)
|
||||
return true ;
|
||||
// libero la libreria EgtGraphics
|
||||
FreeLibrary( s_hEGr) ;
|
||||
s_hEGr = nullptr ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
IsLoadedGraphicsDll( void)
|
||||
{
|
||||
return ( s_hEGr != nullptr) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
MySetEGrLogger( ILogger* pLogger)
|
||||
{
|
||||
// verifico caricamento libreria MachMgr
|
||||
if ( s_hEGr == nullptr)
|
||||
return ;
|
||||
// recupero funzione che imposta il logger
|
||||
typedef void (* PF_SetEMkLogger) ( ILogger* pLogger) ;
|
||||
PF_SetEMkLogger pFun = (PF_SetEMkLogger)GetProcAddress( s_hEGr, EGR_SETEGRLOGGER) ;
|
||||
if ( pFun == nullptr)
|
||||
return ;
|
||||
pFun( pLogger) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const char*
|
||||
MyGetEGrVersion( void)
|
||||
{
|
||||
// verifico caricamento libreria MachMgr
|
||||
if ( s_hEGr == nullptr)
|
||||
return "" ;
|
||||
// recupero funzione che restituisce la versione della libreria
|
||||
typedef const char* (* PF_GetEGrVersion) ( void) ;
|
||||
PF_GetEGrVersion pFun = (PF_GetEGrVersion)GetProcAddress( s_hEGr, EGR_GETEGRVERSION) ;
|
||||
if ( pFun == nullptr)
|
||||
return "" ;
|
||||
return pFun() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
MySetEGrKey( const string& sKey)
|
||||
{
|
||||
// verifico caricamento libreria MachMgr
|
||||
if ( s_hEGr == nullptr)
|
||||
return ;
|
||||
// recupero funzione che imposta i codici di protezione
|
||||
typedef void (* PF_SetEGrKey) ( const string& sKey) ;
|
||||
PF_SetEGrKey pFun = (PF_SetEGrKey)GetProcAddress( s_hEGr, EGR_SETEGRKEY) ;
|
||||
if ( pFun == nullptr)
|
||||
return ;
|
||||
pFun( sKey) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IEGrScene*
|
||||
MyCreateEGrScene( void)
|
||||
{
|
||||
// verifico caricamento libreria MachMgr
|
||||
if ( s_hEGr == nullptr)
|
||||
return nullptr ;
|
||||
// recupero funzione creazione oggetto
|
||||
typedef IEGrScene* (* PF_CreateEGrScene) ( void) ;
|
||||
PF_CreateEGrScene pFun = (PF_CreateEGrScene)GetProcAddress( s_hEGr, EGR_CREATEEGRSCENE) ;
|
||||
if ( pFun == nullptr)
|
||||
return nullptr ;
|
||||
return pFun() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ISceExecutor*
|
||||
MyCreateSceExecutor( void)
|
||||
{
|
||||
// verifico caricamento libreria MachMgr
|
||||
if ( s_hEGr == nullptr)
|
||||
return nullptr ;
|
||||
// recupero funzione creazione oggetto
|
||||
typedef ISceExecutor* (* PF_CreateSceExecutor) ( void) ;
|
||||
PF_CreateSceExecutor pFun = (PF_CreateSceExecutor)GetProcAddress( s_hEGr, EGR_CREATESCEEXECUTOR) ;
|
||||
if ( pFun == nullptr)
|
||||
return nullptr ;
|
||||
return pFun() ;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DllGraphics.h Data : 27.03.15 Versione : 1.6c9
|
||||
// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtGraphics.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 27.03.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class ILogger ;
|
||||
class IEGrScene ;
|
||||
class ISceExecutor ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool LoadGraphicsDll( void) ;
|
||||
bool FreeGraphicsDll( void) ;
|
||||
bool IsLoadedGraphicsDll( void) ;
|
||||
void MySetEGrLogger( ILogger* pLogger) ;
|
||||
void MySetEGrKey( const std::string& sKey) ;
|
||||
const char* MyGetEGrVersion( void) ;
|
||||
IEGrScene* MyCreateEGrScene( void) ;
|
||||
ISceExecutor* MyCreateSceExecutor(void) ;
|
||||
@@ -0,0 +1,133 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DllMachKernel.cpp Data : 27.03.15 Versione : 1.6c9
|
||||
// Contenuto : Funzioni di gestione della libreria opzionale EgtMachKernel.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 27.03.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "DllMachKernel.h"
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Nome della libreria
|
||||
#if defined( _WIN64) && defined( _DEBUG)
|
||||
static const wchar_t* EMK_NAME = L"EgtMachKernelD64.dll" ;
|
||||
#elif defined( _WIN64)
|
||||
static const wchar_t* EMK_NAME = L"EgtMachKernelR64.dll" ;
|
||||
#elif defined( _WIN32) && defined( _DEBUG)
|
||||
static const wchar_t* EMK_NAME = L"EgtMachKernelD32.dll" ;
|
||||
#else
|
||||
static const wchar_t* EMK_NAME = L"EgtMachKernelR32.dll" ;
|
||||
#endif
|
||||
// Nome delle funzioni caricate
|
||||
static const char* EMK_SETEMKLOGGER = "SetEMkLogger" ;
|
||||
static const char* EMK_GETEMKVERSION = "GetEMkVersion" ;
|
||||
static const char* EMK_SETEMKKEY = "SetEMkKey" ;
|
||||
static const char* EMK_CREATEMACHMGR = "CreateMachMgr" ;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HMODULE s_hEMk = nullptr ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
LoadMachKernelDll( void)
|
||||
{
|
||||
// se già caricata
|
||||
if ( s_hEMk != nullptr)
|
||||
return true ;
|
||||
// carico la libreria EgtMachKernel
|
||||
s_hEMk = LoadLibrary( EMK_NAME) ;
|
||||
return ( s_hEMk != nullptr) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
FreeMachKernelDll( void)
|
||||
{
|
||||
// se non è già caricata
|
||||
if ( s_hEMk == nullptr)
|
||||
return true ;
|
||||
// libero la libreria EgtMachKernel
|
||||
FreeLibrary( s_hEMk) ;
|
||||
s_hEMk = nullptr ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
IsLoadedMachKernelDll( void)
|
||||
{
|
||||
return ( s_hEMk != nullptr) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
MySetEMkLogger( ILogger* pLogger)
|
||||
{
|
||||
// verifico caricamento libreria MachMgr
|
||||
if ( s_hEMk == nullptr)
|
||||
return ;
|
||||
// recupero funzione che imposta il logger
|
||||
typedef void (* PF_SetEMkLogger) ( ILogger* pLogger) ;
|
||||
PF_SetEMkLogger pFun = (PF_SetEMkLogger)GetProcAddress( s_hEMk, EMK_SETEMKLOGGER) ;
|
||||
if ( pFun == nullptr)
|
||||
return ;
|
||||
pFun( pLogger) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const char*
|
||||
MyGetEMkVersion( void)
|
||||
{
|
||||
// verifico caricamento libreria MachMgr
|
||||
if ( s_hEMk == nullptr)
|
||||
return "" ;
|
||||
// recupero funzione che restituisce la versione della libreria
|
||||
typedef const char* (* PF_GetEMkVersion) ( void) ;
|
||||
PF_GetEMkVersion pFun = (PF_GetEMkVersion)GetProcAddress( s_hEMk, EMK_GETEMKVERSION) ;
|
||||
if ( pFun == nullptr)
|
||||
return "" ;
|
||||
return pFun() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
MySetEMkKey( const string& sKey)
|
||||
{
|
||||
// verifico caricamento libreria MachMgr
|
||||
if ( s_hEMk == nullptr)
|
||||
return ;
|
||||
// recupero funzione che imposta i codici di protezione
|
||||
typedef void (* PF_SetEMkKey) ( const string& sKey) ;
|
||||
PF_SetEMkKey pFun = (PF_SetEMkKey)GetProcAddress( s_hEMk, EMK_SETEMKKEY) ;
|
||||
if ( pFun == nullptr)
|
||||
return ;
|
||||
pFun( sKey) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IMachMgr*
|
||||
MyCreateMachMgr( void)
|
||||
{
|
||||
// verifico caricamento libreria MachMgr
|
||||
if ( s_hEMk == nullptr)
|
||||
return nullptr ;
|
||||
// recupero funzione creazione oggetto
|
||||
typedef IMachMgr* (* PF_CreateMachMgr) ( void) ;
|
||||
PF_CreateMachMgr pFun = (PF_CreateMachMgr)GetProcAddress( s_hEMk, EMK_CREATEMACHMGR) ;
|
||||
if ( pFun == nullptr)
|
||||
return nullptr ;
|
||||
return pFun() ;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DllMachKernel.h Data : 27.03.15 Versione : 1.6c9
|
||||
// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtMachKernel.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 27.03.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class ILogger ;
|
||||
class IMachMgr ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool LoadMachKernelDll( void) ;
|
||||
bool FreeMachKernelDll( void) ;
|
||||
bool IsLoadedMachKernelDll( void) ;
|
||||
void MySetEMkLogger( ILogger* pLogger) ;
|
||||
void MySetEMkKey( const std::string& sKey) ;
|
||||
const char* MyGetEMkVersion( void) ;
|
||||
IMachMgr* MyCreateMachMgr( void) ;
|
||||
@@ -0,0 +1,23 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE.h Data : 05.05.15 Versione : 1.6e2
|
||||
// Contenuto : Dichiarazioni locali per moduli EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 01.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GseContext.h"
|
||||
#include "/EgtDev/Include/EgtILogger.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ILogger* GetLogger( void) ;
|
||||
ILogger* GetCmdLogger( void) ;
|
||||
bool SetCmdLog( bool bVal) ;
|
||||
bool IsCmdLog( void) ;
|
||||
@@ -0,0 +1,209 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_Exchange.cpp Data : 20.09.14 Versione : 1.6e1
|
||||
// Contenuto : Funzioni import/export per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 20.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "DllExchange.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EExImportStl.h"
|
||||
#include "/EgtDev/Include/EExImportDxf.h"
|
||||
#include "/EgtDev/Include/EExImportCnc.h"
|
||||
#include "/EgtDev/Include/EExExportStl.h"
|
||||
#include "/EgtDev/Include/EExExportDxf.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetFileType( const string& sFilePath)
|
||||
{
|
||||
// divido in nome e direttorio
|
||||
string sFileDir, sFileName ;
|
||||
SplitLast( sFilePath, "\\", sFileDir, sFileName) ;
|
||||
|
||||
// recupero l'estensione
|
||||
string sFileTitle, sFileExt ;
|
||||
SplitLast( sFileName, ".", sFileTitle, sFileExt) ;
|
||||
ToUpper( sFileExt) ;
|
||||
|
||||
if ( sFileExt == "NGE")
|
||||
return 1 ;
|
||||
else if ( sFileExt == "NFE")
|
||||
return 2 ;
|
||||
else if ( sFileExt == "DXF")
|
||||
return 11 ;
|
||||
else if ( sFileExt == "STL")
|
||||
return 12 ;
|
||||
else if ( sFileExt == "CNC")
|
||||
return 13 ;
|
||||
else if ( sFileExt == "TSC")
|
||||
return 101 ;
|
||||
else if ( sFileExt == "LUA")
|
||||
return 102 ;
|
||||
else {
|
||||
// emetto info
|
||||
string sInfo = "File type (" + sFileExt + ") not recognized" ;
|
||||
LOG_INFO( GetLogger(), sInfo.c_str())
|
||||
return 0 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeImportDxf( const string& sFilePath, double dScaleFactor)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
bool bOk = true ;
|
||||
// importo il file DXF
|
||||
// aggiungo un gruppo pezzo
|
||||
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
|
||||
// preparo l'importatore
|
||||
PtrOwner<IImportDxf> pImpDxf( MyCreateImportDxf()) ;
|
||||
bOk = bOk && ! IsNull( pImpDxf) ;
|
||||
// eseguo l'importazione
|
||||
bOk = bOk && pImpDxf->Import( sFilePath, pGseCtx->m_pGeomDB, nPartId, dScaleFactor) ;
|
||||
// aggiorno stato file corrente
|
||||
pGseCtx->m_sFilePath = sFilePath ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLuaPath = sFilePath ;
|
||||
ReplaceString( sLuaPath, "\\", "\\\\") ;
|
||||
string sLua = "EgtImportDxf('" + sLuaPath + "'," +
|
||||
ToString( dScaleFactor) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeImportStl( const string& sFilePath, double dScaleFactor)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
bool bOk = true ;
|
||||
// importo il file STL
|
||||
// aggiungo un gruppo pezzo e un gruppo layer
|
||||
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
|
||||
int nLayerId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
|
||||
// preparo l'importatore
|
||||
PtrOwner<IImportStl> pImpStl( MyCreateImportStl()) ;
|
||||
bOk = bOk && ! IsNull( pImpStl) ;
|
||||
// eseguo l'importazione
|
||||
bOk = bOk && pImpStl->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ;
|
||||
// aggiorno stato file corrente
|
||||
pGseCtx->m_sFilePath = sFilePath ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLuaPath = sFilePath ;
|
||||
ReplaceString( sLuaPath, "\\", "\\\\") ;
|
||||
string sLua = "EgtImportStl('" + sLuaPath + "'," +
|
||||
ToString( dScaleFactor) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeImportCnc( const string& sFilePath)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
bool bOk = true ;
|
||||
// importo il file CNC
|
||||
// aggiungo un gruppo pezzo
|
||||
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
|
||||
// preparo l'importatore
|
||||
PtrOwner<IImportCnc> pImpCnc( MyCreateImportCnc()) ;
|
||||
bOk = bOk && ! IsNull( pImpCnc) ;
|
||||
// eseguo l'importazione
|
||||
bOk = bOk && pImpCnc->Import( sFilePath, pGseCtx->m_pGeomDB, nPartId) ;
|
||||
// aggiorno stato file corrente
|
||||
pGseCtx->m_sFilePath = sFilePath ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLuaPath = sFilePath ;
|
||||
ReplaceString( sLuaPath, "\\", "\\\\") ;
|
||||
string sLua = "EgtImportCnc('" + sLuaPath + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeExportDxf( int nId, const string& sFilePath)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// esporto il file DXF
|
||||
// preparo l'esportatore
|
||||
PtrOwner<IExportDxf> pExpDxf( MyCreateExportDxf()) ;
|
||||
bOk = bOk && ! IsNull( pExpDxf) ;
|
||||
// eseguo l'esportazione
|
||||
bOk = bOk && pExpDxf->Export( pGeomDB, nId, sFilePath) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLuaPath = sFilePath ;
|
||||
ReplaceString( sLuaPath, "\\", "\\\\") ;
|
||||
string sLua = "EgtExportDxf(" + ToString( nId) + ",'" +
|
||||
sLuaPath + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeExportStl( int nId, const string& sFilePath)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// esporto il file STL
|
||||
// preparo l'esportatore
|
||||
PtrOwner<IExportStl> pExpStl( MyCreateExportStl()) ;
|
||||
bOk = bOk && ! IsNull( pExpStl) ;
|
||||
// eseguo l'esportazione
|
||||
bOk = bOk && pExpStl->Export( pGeomDB, nId, sFilePath) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLuaPath = sFilePath ;
|
||||
ReplaceString( sLuaPath, "\\", "\\\\") ;
|
||||
string sLua = "EgtExportStl(" + ToString( nId) + ",'" +
|
||||
sLuaPath + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_GdbCreate.cpp Data : 04.05.15 Versione : 1.6e1
|
||||
// Contenuto : Funzioni di creazione oggetti del DB geometrico per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 30.09.14 DS Creazione modulo.
|
||||
// 07.01.15 DS Agg. scrittura comandi Lua.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "GeoTools.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EgkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EgkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EgkExtText.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateGroup( int nParentId, const Frame3d& frFrame, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale l'origine e i versori
|
||||
Point3d ptOrigL = GetPointLocal( pGeomDB, frFrame.Orig(), nRefType, frLoc) ;
|
||||
Vector3d vtXL = GetVectorLocal( pGeomDB, frFrame.VersX(), nRefType, frLoc) ;
|
||||
Vector3d vtYL = GetVectorLocal( pGeomDB, frFrame.VersY(), nRefType, frLoc) ;
|
||||
Vector3d vtZL = GetVectorLocal( pGeomDB, frFrame.VersZ(), nRefType, frLoc) ;
|
||||
// costruisco il riferimento
|
||||
Frame3d frFrameL ;
|
||||
bOk = bOk && frFrameL.Set( ptOrigL, vtXL, vtYL, vtZL) ;
|
||||
// creo il gruppo
|
||||
int nId = ( bOk ? pGeomDB->AddGroup( GDB_ID_NULL, nParentId, frFrameL) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( AreSameFrame( frFrame, GLOB_FRM))
|
||||
sLua = "EgtGroup(" + ToString( nParentId) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
else
|
||||
sLua = "EgtGroup(" + ToString( nParentId) + ",{{" +
|
||||
ToString( frFrame.Orig()) + "},{" +
|
||||
ToString( frFrame.VersX()) + "},{" +
|
||||
ToString( frFrame.VersY()) + "},{" +
|
||||
ToString( frFrame.VersZ()) + "}}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo del nuovo gruppo
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateGeoPoint( int nParentId, const Point3d& ptP, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale il punto
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; ;
|
||||
// creo il punto
|
||||
PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ;
|
||||
bOk = bOk && ! IsNull( pGeoPnt) ;
|
||||
// setto il punto
|
||||
bOk = bOk && pGeoPnt->Set( ptPL) ;
|
||||
// inserisco il punto nel DB
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoPnt)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtPoint(" + ToString( nParentId) + ",{" +
|
||||
ToString( ptP) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateGeoVector( int nParentId, const Vector3d& vtV, const Point3d& ptB, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale il vettore e il punto
|
||||
Vector3d vtVL = GetVectorLocal( pGeomDB, vtV, nRefType, frLoc) ; ;
|
||||
Point3d ptBL = GetPointLocal( pGeomDB, ptB, nRefType, frLoc) ; ;
|
||||
// creo il vettore
|
||||
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
|
||||
bOk = bOk && ! IsNull( pGeoVct) ;
|
||||
// setto il vettore (con il punto base)
|
||||
bOk = bOk && pGeoVct->Set( vtVL, ptBL) ;
|
||||
// inserisco il vettore nel DB
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoVct)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( ptB.IsSmall())
|
||||
sLua = "EgtVector(" + ToString( nParentId) + ",{" +
|
||||
ToString( vtV) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
else
|
||||
sLua = "EgtVector(" + ToString( nParentId) + ",{" +
|
||||
ToString( vtV) + "},{" +
|
||||
ToString( ptB) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateGeoFrame( int nParentId, const Frame3d& frFrame, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale l'origine e i versori
|
||||
Point3d ptOrigL = GetPointLocal( pGeomDB, frFrame.Orig(), nRefType, frLoc) ; ;
|
||||
Vector3d vtXL = GetVectorLocal( pGeomDB, frFrame.VersX(), nRefType, frLoc) ; ;
|
||||
Vector3d vtYL = GetVectorLocal( pGeomDB, frFrame.VersY(), nRefType, frLoc) ; ;
|
||||
Vector3d vtZL = GetVectorLocal( pGeomDB, frFrame.VersZ(), nRefType, frLoc) ; ;
|
||||
// creo e setto il riferimento
|
||||
PtrOwner<IGeoFrame3d> pGeoFrm( CreateGeoFrame3d()) ;
|
||||
bOk = bOk & ! IsNull( pGeoFrm) ;
|
||||
bOk = bOk & pGeoFrm->Set( ptOrigL, vtXL, vtYL, vtZL) ;
|
||||
// inserisco il riferimento nel DB
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoFrm)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtFrame(" + ToString( nParentId) + ",{{" +
|
||||
ToString( frFrame.Orig()) + "},{" +
|
||||
ToString( frFrame.VersX()) + "},{" +
|
||||
ToString( frFrame.VersY()) + "},{" +
|
||||
ToString( frFrame.VersZ()) + "}}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo del nuovo gruppo
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateText( int nParentId, const Point3d& ptP, double dAngRotDeg,
|
||||
const string& sText, double dH, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale l'origine e i versori
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; ;
|
||||
Vector3d vtDL = GetVectorLocal( pGeomDB, X_AX, nRefType, frLoc) ; ;
|
||||
// creo il testo e lo riempio
|
||||
PtrOwner<IExtText> pTXT( CreateExtText()) ;
|
||||
bOk = bOk && ! IsNull( pTXT) ;
|
||||
bOk = bOk && pTXT->Set( ptPL, vtNL, vtDL, sText, "", false, dH) ;
|
||||
// inserisco il testo nel DB
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtText(" + ToString( nParentId) + ",{" +
|
||||
ToString( ptP) + "}," +
|
||||
ToString( dAngRotDeg) + ",'" +
|
||||
sText + "','" +
|
||||
ToString( dH) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo del oggetto
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateTextEx( int nParentId, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
|
||||
const string& sText, const string& sFont, bool bItalic, double dH, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale l'origine e i versori
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ; ;
|
||||
Vector3d vtDL = GetVectorLocal( pGeomDB, vtD, nRefType, frLoc) ; ;
|
||||
// creo il testo e lo riempio
|
||||
PtrOwner<IExtText> pTXT( CreateExtText()) ;
|
||||
bOk = bOk && ! IsNull( pTXT) ;
|
||||
bOk = bOk && pTXT->Set( ptPL, vtNL, vtDL, sText, sFont, bItalic, dH) ;
|
||||
// inserisco il testo nel DB
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTextEx(" + ToString( nParentId) + ",{" +
|
||||
ToString( ptP) + "},{" +
|
||||
ToString( vtN) + "},{" +
|
||||
ToString( vtD) + "},'" +
|
||||
sText + "','" +
|
||||
sFont + "'," +
|
||||
( bItalic ? "'I'" : "'S'") + "," +
|
||||
ToString( dH) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo del oggetto
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateTextAdv( int nParentId, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
|
||||
const string& sText, const string& sFont,
|
||||
int nW, bool bItalic, double dH, double dRat, double dAddAdv, int nInsPos, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale l'origine e i versori
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ; ;
|
||||
Vector3d vtDL = GetVectorLocal( pGeomDB, vtD, nRefType, frLoc) ; ;
|
||||
// creo il testo e lo imposto
|
||||
PtrOwner<IExtText> pTXT( CreateExtText()) ;
|
||||
bOk = bOk && ! IsNull( pTXT) ;
|
||||
bOk = bOk && pTXT->Set( ptPL, vtNL, vtDL, sText, sFont, nW, bItalic, dH, dRat, dAddAdv, nInsPos) ;
|
||||
// inserisco il testo nel DB
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTextAdv(" + ToString( nParentId) + ",{" +
|
||||
ToString( ptP) + "},{" +
|
||||
ToString( vtN) + "},{" +
|
||||
ToString( vtD) + "},'" +
|
||||
sText + "','" +
|
||||
sFont + "'," +
|
||||
ToString( nW) + "," +
|
||||
( bItalic ? "'I'" : "'S'") + "," +
|
||||
ToString( dH) + "," +
|
||||
ToString( dRat) + "," +
|
||||
ToString( dAddAdv) + "," +
|
||||
ETxtInsPosToString( nInsPos) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo del oggetto
|
||||
return nId ;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,757 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_GdbCreateSurf.cpp Data : 04.05.15 Versione : 1.6e1
|
||||
// Contenuto : Funzioni di creazione superfici del DB geometrico per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 02.11.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "GeoTools.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
||||
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDev/Include/EgkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EgkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EgkCurveLocal.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmBBox( int nParentId, const BBox3d& b3Box, int nRefType)
|
||||
{
|
||||
// bounding box orientato come gli assi del riferimento
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// ricavo i punti standard e le dimensioni
|
||||
Point3d ptIni ;
|
||||
double dWidth = 0, dLen = 0, dHeight = 0 ;
|
||||
bOk = bOk && b3Box.GetMinDim( ptIni, dWidth, dLen, dHeight) ;
|
||||
dWidth = max( dWidth, 10 * EPS_SMALL) ;
|
||||
dLen = max( dLen, 10 * EPS_SMALL) ;
|
||||
dHeight = max( dHeight, 10 * EPS_SMALL) ;
|
||||
Point3d ptCross = ptIni + Vector3d( dWidth, dLen) ;
|
||||
Point3d ptDir = ptIni + Vector3d( dWidth, 0) ;
|
||||
// porto in locale i punti
|
||||
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
|
||||
Point3d ptCrossL = GetPointLocal( pGeomDB, ptCross, nRefType, frLoc) ;
|
||||
Point3d ptDirL = GetPointLocal( pGeomDB, ptDir, nRefType, frLoc) ;
|
||||
// ne ricavo un riferimento intrinseco
|
||||
Frame3d frBox ;
|
||||
bOk = bOk && frBox.Set( ptIniL, ptDirL, ptCrossL) ;
|
||||
// creo il box nel suo riferimento intrinseco
|
||||
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshBox( dWidth, dLen, dHeight)) ;
|
||||
bOk = bOk && ! IsNull( pSTM) ;
|
||||
// porto il box nel riferimento locale
|
||||
bOk = bOk && pSTM->ToGlob( frBox) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmBBox(" + ToString( nParentId) + ",{{" +
|
||||
ToString( b3Box.GetMin()) + "},{" +
|
||||
ToString( b3Box.GetMax()) + "}}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmBox( int nParentId, const Point3d& ptIni, const Point3d& ptCross,
|
||||
const Point3d& ptDir, double dHeight, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale i punti
|
||||
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
|
||||
Point3d ptCrossL = GetPointLocal( pGeomDB, ptCross, nRefType, frLoc) ;
|
||||
Point3d ptDirL = GetPointLocal( pGeomDB, ptDir, nRefType, frLoc) ;
|
||||
// ne ricavo un riferimento intrinseco
|
||||
Frame3d frBox ;
|
||||
bOk = bOk && frBox.Set( ptIniL, ptDirL, ptCrossL) ;
|
||||
// ricavo le dimensioni della base
|
||||
Point3d ptCrossI = ptCrossL ;
|
||||
ptCrossI.ToLoc( frBox) ;
|
||||
double dWidth = ptCrossI.x ;
|
||||
double dLen = ptCrossI.y ;
|
||||
// creo il box nel suo riferimento intrinseco
|
||||
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshBox( fabs( dWidth), dLen, dHeight)) ;
|
||||
bOk = bOk && ! IsNull( pSTM) ;
|
||||
// eventuale traslazione per larghezza negativa
|
||||
if ( dWidth < 0)
|
||||
pSTM->Translate( Vector3d( dWidth, 0, 0)) ;
|
||||
// porto il box nel riferimento locale
|
||||
bOk = bOk && pSTM->ToGlob( frBox) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmBox(" + ToString( nParentId) + ",{" +
|
||||
ToString( ptIni) + "},{" +
|
||||
ToString( ptCross) + "},{" +
|
||||
ToString( ptDir) + "}," +
|
||||
ToString( dHeight) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmPyramid( int nParentId, const Point3d& ptIni, const Point3d& ptCross,
|
||||
const Point3d& ptDir, double dHeight, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti
|
||||
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
|
||||
Point3d ptCrossL = GetPointLocal( pGeomDB, ptCross, nRefType, frLoc) ;
|
||||
Point3d ptDirL = GetPointLocal( pGeomDB, ptDir, nRefType, frLoc) ;
|
||||
// ne ricavo un riferimento intrinseco
|
||||
Frame3d frBox ;
|
||||
bOk = bOk && frBox.Set( ptIniL, ptDirL, ptCrossL) ;
|
||||
// ricavo le dimensioni della base
|
||||
Point3d ptCrossI = ptCrossL ;
|
||||
ptCrossI.ToLoc( frBox) ;
|
||||
double dWidth = ptCrossI.x ;
|
||||
double dLen = ptCrossI.y ;
|
||||
// creo la piramide nel suo riferimento intrinseco
|
||||
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshPyramid( fabs( dWidth), dLen, dHeight)) ;
|
||||
bOk = bOk && ! IsNull( pSTM) ;
|
||||
// eventuale traslazione per larghezza negativa
|
||||
if ( dWidth < 0)
|
||||
pSTM->Translate( Vector3d( dWidth, 0, 0)) ;
|
||||
// porto la piramide nel riferimento locale
|
||||
bOk = bOk && pSTM->ToGlob( frBox) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmPyramid(" + ToString( nParentId) + ",{" +
|
||||
ToString( ptIni) + "},{" +
|
||||
ToString( ptCross) + "},{" +
|
||||
ToString( ptDir) + "}," +
|
||||
ToString( dHeight) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmCylinder( int nParentId, const Point3d& ptOrig, const Vector3d& vtN,
|
||||
double dRad, double dHeight, double dLinTol, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale il punto e il versore
|
||||
Point3d ptOrigL = GetPointLocal( pGeomDB, ptOrig, nRefType, frLoc) ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
|
||||
// calcolo riferimento OCS a partire da questo punto e versore
|
||||
Frame3d frCyl ;
|
||||
bOk = bOk && frCyl.Set( ptOrigL, vtNL) ;
|
||||
// creo il cilindro nel suo riferimento intrinseco
|
||||
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshCylinder( dRad, dHeight, dLinTol)) ;
|
||||
bOk = bOk && ! IsNull( pSTM) ;
|
||||
// porto il cilindro nel riferimento locale
|
||||
bOk = bOk && pSTM->ToGlob( frCyl) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmCylinder(" + ToString( nParentId) + ",{" +
|
||||
ToString( ptOrig) + "},{" +
|
||||
ToString( vtN) + "}," +
|
||||
ToString( dRad) + "," +
|
||||
ToString( dHeight) + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmCone( int nParentId, const Point3d& ptOrig, const Vector3d& vtN,
|
||||
double dRad, double dHeight, double dLinTol, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale il punto e il versore
|
||||
Point3d ptOrigL = GetPointLocal( pGeomDB, ptOrig, nRefType, frLoc) ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
|
||||
// calcolo riferimento OCS a partire da questo punto e versore
|
||||
Frame3d frCyl ;
|
||||
bOk = bOk && frCyl.Set( ptOrigL, vtNL) ;
|
||||
// creo il cono nel suo riferimento intrinseco
|
||||
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshCone( dRad, dHeight, dLinTol)) ;
|
||||
bOk = bOk && ! IsNull( pSTM) ;
|
||||
// porto il cono nel riferimento locale
|
||||
bOk = bOk && pSTM->ToGlob( frCyl) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmCone(" + ToString( nParentId) + ",{" +
|
||||
ToString( ptOrig) + "},{" +
|
||||
ToString( vtN) + "}," +
|
||||
ToString( dRad) + "," +
|
||||
ToString( dHeight) + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmSphere( int nParentId, const Point3d& ptOrig,
|
||||
double dRad, double dLinTol, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale il punto
|
||||
Point3d ptOrigL = GetPointLocal( pGeomDB, ptOrig, nRefType, frLoc) ;
|
||||
// creo la sfera
|
||||
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshSphere( dRad, dLinTol)) ;
|
||||
bOk = bOk && ! IsNull( pSTM) ;
|
||||
// porto la sfera nella sua origine
|
||||
bOk = bOk && pSTM->Translate( ptOrig - ORIG) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmSphere(" + ToString( nParentId) + ",{" +
|
||||
ToString( ptOrig) + "}," +
|
||||
ToString( dRad) + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmByFlatContour( int nParentId, int nCrvId, double dLinTol)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// recupero la curva in locale
|
||||
CurveLocal CrvLoc( pGeomDB, nCrvId, frLoc) ;
|
||||
bOk = bOk && ( CrvLoc.Get() != nullptr) ;
|
||||
// calcolo la superficie
|
||||
ISurfTriMesh* pSTM = ( bOk ? GetSurfTriMeshByFlatContour( CrvLoc.Get(), dLinTol) : nullptr) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmByFlatContour(" + ToString( nParentId) + "," +
|
||||
ToString( nCrvId) + "," +
|
||||
ToString( dLinTol) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmByRegion( int nParentId, INTVECTOR& vCrvIds, double dLinTol)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// recupero le curve in locale
|
||||
CURVELOCALVECTOR vCrvLoc ;
|
||||
vCrvLoc.reserve( vCrvIds.size()) ;
|
||||
ICURVEPVECTOR vCrvP ;
|
||||
vCrvP.reserve( vCrvIds.size()) ;
|
||||
for ( size_t i = 0 ; i < vCrvIds.size() ; ++ i) {
|
||||
vCrvLoc.emplace_back( pGeomDB, vCrvIds[i], frLoc) ;
|
||||
vCrvP.push_back( const_cast<ICurve*>( vCrvLoc[i].Get())) ;
|
||||
bOk = bOk && ( vCrvLoc[i].Get() != nullptr) ;
|
||||
}
|
||||
// calcolo la superficie
|
||||
ISurfTriMesh* pSTM = ( bOk ? GetSurfTriMeshByRegion( vCrvP, dLinTol) : nullptr) ;
|
||||
bOk = bOk && ( pSTM != nullptr) ;
|
||||
// elimino punti ripetuti
|
||||
bOk = bOk && pSTM->DoCompacting() ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sIds ;
|
||||
for ( size_t i = 0 ; i < vCrvIds.size() ; ++ i)
|
||||
sIds += ToString( vCrvIds[i]) + "," ;
|
||||
sIds.pop_back() ;
|
||||
string sLua = "EgtSurfTmByRegion(" + ToString( nParentId) + ",{" +
|
||||
sIds + "}," +
|
||||
ToString( dLinTol) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmByExtrusion( int nParentId, INTVECTOR& vCrvIds, const Vector3d& vtExtr,
|
||||
double dLinTol, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// recupero le curve in locale
|
||||
CURVELOCALVECTOR vCrvLoc ;
|
||||
vCrvLoc.reserve( vCrvIds.size()) ;
|
||||
ICURVEPVECTOR vCrvP ;
|
||||
vCrvP.reserve( vCrvIds.size()) ;
|
||||
for ( size_t i = 0 ; i < vCrvIds.size() ; ++ i) {
|
||||
vCrvLoc.emplace_back( pGeomDB, vCrvIds[i], frLoc) ;
|
||||
vCrvP.push_back( const_cast<ICurve*>( vCrvLoc[i].Get())) ;
|
||||
bOk = bOk && ( vCrvLoc[i].Get() != nullptr) ;
|
||||
}
|
||||
// porto in locale il vettore estrusione
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, vtExtr, nRefType, frLoc) ;
|
||||
// creo le superfici e le inserisco nel DB
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
for ( int i = 0 ; i < int( vCrvP.size()) ; ++ i) {
|
||||
// calcolo la superficie
|
||||
ISurfTriMesh* pSTM = ( bOk ? GetSurfTriMeshByExtrusion( vCrvP[i], vtExtrL, false, dLinTol) : nullptr) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
||||
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
|
||||
if ( bOk && nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nNewId ;
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sIds ;
|
||||
for ( size_t i = 0 ; i < vCrvIds.size() ; ++ i)
|
||||
sIds += ToString( vCrvIds[i]) + "," ;
|
||||
sIds.pop_back() ;
|
||||
string sLua = "EgtSurfTmByExtrusion(" + ToString( nParentId) + ",{" +
|
||||
sIds + "},{" +
|
||||
ToString( vtExtr) + "}," +
|
||||
ToString( dLinTol) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nFirstId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmByRegionExtrusion( int nParentId, INTVECTOR& vCrvIds, const Vector3d& vtExtr,
|
||||
double dLinTol, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// recupero le curve in locale
|
||||
CURVELOCALVECTOR vCrvLoc ;
|
||||
vCrvLoc.reserve( vCrvIds.size()) ;
|
||||
ICURVEPVECTOR vCrvP ;
|
||||
vCrvP.reserve( vCrvIds.size()) ;
|
||||
for ( size_t i = 0 ; i < vCrvIds.size() ; ++ i) {
|
||||
vCrvLoc.emplace_back( pGeomDB, vCrvIds[i], frLoc) ;
|
||||
vCrvP.push_back( const_cast<ICurve*>( vCrvLoc[i].Get())) ;
|
||||
bOk = bOk && ( vCrvLoc[i].Get() != nullptr) ;
|
||||
}
|
||||
// porto in locale il vettore estrusione
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, vtExtr, nRefType, frLoc) ;
|
||||
int nNewId = GDB_ID_NULL ;
|
||||
// creo la superficie
|
||||
ISurfTriMesh* pSTM = ( bOk ? GetSurfTriMeshByRegionExtrusion( vCrvP, vtExtrL, dLinTol) : nullptr) ;
|
||||
// inserisco la superficie nel DB
|
||||
nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sIds ;
|
||||
for ( size_t i = 0 ; i < vCrvIds.size() ; ++ i)
|
||||
sIds += ToString( vCrvIds[i]) + "," ;
|
||||
sIds.pop_back() ;
|
||||
string sLua = "EgtSurfTmByRegionExtrusion(" + ToString( nParentId) + ",{" +
|
||||
sIds + "},{" +
|
||||
ToString( vtExtr) + "}," +
|
||||
ToString( dLinTol) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmByRevolve( int nParentId, int nCrvId,
|
||||
const Point3d& ptAx, const Vector3d& vtAx,
|
||||
bool bCapEnds, double dLinTol, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// recupero la curva in locale
|
||||
CurveLocal CrvLoc( pGeomDB, nCrvId, frLoc) ;
|
||||
bOk = bOk && ( CrvLoc.Get() != nullptr) ;
|
||||
// porto in locale punto e vettore asse
|
||||
Point3d ptAxL = GetPointLocal( pGeomDB, ptAx, nRefType, frLoc) ;
|
||||
Vector3d vtAxL = GetVectorLocal( pGeomDB, vtAx, nRefType, frLoc) ;
|
||||
// calcolo la superficie
|
||||
ISurfTriMesh* pSTM = ( bOk ? GetSurfTriMeshByRevolve( CrvLoc.Get(), ptAxL, vtAxL, bCapEnds, dLinTol) : nullptr) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmByRevolve(" + ToString( nParentId) + "," +
|
||||
ToString( nCrvId) + ",{" +
|
||||
ToString( ptAx) + "},{" +
|
||||
ToString( vtAx) + "}," +
|
||||
( bCapEnds ? "true" : "false") + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmByScrewing( int nParentId, int nCrvId,
|
||||
const Point3d& ptAx, const Vector3d& vtAx,
|
||||
double dAngRotDeg, double dMove, double dLinTol, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// recupero la curva in locale
|
||||
CurveLocal CrvLoc( pGeomDB, nCrvId, frLoc) ;
|
||||
bOk = bOk && ( CrvLoc.Get() != nullptr) ;
|
||||
// porto in locale punto e vettore asse
|
||||
Point3d ptAxL = GetPointLocal( pGeomDB, ptAx, nRefType, frLoc) ;
|
||||
Vector3d vtAxL = GetVectorLocal( pGeomDB, vtAx, nRefType, frLoc) ;
|
||||
// calcolo la superficie
|
||||
ISurfTriMesh* pSTM = ( bOk ? GetSurfTriMeshByScrewing( CrvLoc.Get(), ptAxL, vtAxL, dAngRotDeg, dMove, dLinTol) : nullptr) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmByScrewing(" + ToString( nParentId) + "," +
|
||||
ToString( nCrvId) + ",{" +
|
||||
ToString( ptAx) + "},{" +
|
||||
ToString( vtAx) + "}," +
|
||||
ToString( dAngRotDeg) + "," +
|
||||
ToString( dMove) + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, double dLinTol)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// creo la superficie trimesh
|
||||
ISurfTriMesh* pSTM = nullptr ;
|
||||
// se la prima entità è un punto e la seconda una curva
|
||||
if ( pGeomDB->GetGeoType( nPtOrCrvId1) == GEO_PNT3D &&
|
||||
( pGeomDB->GetGeoType( nPtOrCrvId2) & GEO_CURVE) != 0) {
|
||||
// recupero il punto in locale
|
||||
// recupero riferimento del punto
|
||||
Frame3d frPnt ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nPtOrCrvId1, frPnt) ;
|
||||
// porto il punto in locale
|
||||
Point3d ptP = GetGeoPoint3d( pGeomDB->GetGeoObj( nPtOrCrvId1))->GetPoint() ;
|
||||
bOk = bOk && ptP.LocToLoc( frPnt, frLoc) ;
|
||||
// recupero la curva in locale
|
||||
CurveLocal CrvLoc( pGeomDB, nPtOrCrvId2, frLoc) ;
|
||||
bOk = bOk && ( CrvLoc.Get() != nullptr) ;
|
||||
// calcolo la superficie
|
||||
pSTM = ( bOk ? GetSurfTriMeshRuled( ptP, CrvLoc.Get(), dLinTol) : nullptr) ;
|
||||
}
|
||||
// se la prima entità è una curva e la seconda un punto
|
||||
else if ( ( pGeomDB->GetGeoType( nPtOrCrvId1) & GEO_CURVE) != 0 &&
|
||||
pGeomDB->GetGeoType( nPtOrCrvId2) == GEO_PNT3D) {
|
||||
// recupero la curva in locale
|
||||
CurveLocal CrvLoc( pGeomDB, nPtOrCrvId1, frLoc) ;
|
||||
bOk = bOk && ( CrvLoc.Get() != nullptr) ;
|
||||
// recupero il punto in locale
|
||||
// recupero riferimento del punto
|
||||
Frame3d frPnt ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nPtOrCrvId2, frPnt) ;
|
||||
// porto il punto in locale
|
||||
Point3d ptP = GetGeoPoint3d( pGeomDB->GetGeoObj( nPtOrCrvId2))->GetPoint() ;
|
||||
bOk = bOk && ptP.LocToLoc( frPnt, frLoc) ;
|
||||
// calcolo la superficie
|
||||
pSTM = ( bOk ? GetSurfTriMeshRuled( ptP, CrvLoc.Get(), dLinTol) : nullptr) ;
|
||||
}
|
||||
// se entrambe curve
|
||||
else if ( ( pGeomDB->GetGeoType( nPtOrCrvId1) & GEO_CURVE) != 0 &&
|
||||
( pGeomDB->GetGeoType( nPtOrCrvId2) & GEO_CURVE) != 0) {
|
||||
// recupero la prima curva in locale
|
||||
CurveLocal CrvLoc1( pGeomDB, nPtOrCrvId1, frLoc) ;
|
||||
bOk = bOk && ( CrvLoc1.Get() != nullptr) ;
|
||||
// recupero la seconda curva in locale
|
||||
CurveLocal CrvLoc2( pGeomDB, nPtOrCrvId2, frLoc) ;
|
||||
bOk = bOk && ( CrvLoc2.Get() != nullptr) ;
|
||||
// calcolo la superficie
|
||||
pSTM = ( bOk ? GetSurfTriMeshRuled( CrvLoc1.Get(), CrvLoc2.Get(), dLinTol) : nullptr) ;
|
||||
}
|
||||
// altrimenti errore
|
||||
else
|
||||
bOk = false ;
|
||||
// inserisco la superficie trimesh nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmRuled(" + ToString( nParentId) + "," +
|
||||
ToString( nPtOrCrvId1) + "," +
|
||||
ToString( nPtOrCrvId2) + "," +
|
||||
ToString( dLinTol) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmByTriangles( int nParentId, const INTVECTOR& vIds, bool bErase)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// almeno un oggetto nell'elenco
|
||||
bool bOk = ( vIds.size() > 0) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// Costruttore di trimesh da insieme disordinato di triangoli
|
||||
StmFromTriangleSoup StmFts ;
|
||||
bOk = bOk && StmFts.Start() ;
|
||||
// Recupero tutti i triangoli delle superfici sorgenti e li inserisco nella nuova
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// recupero la superficie sorgente
|
||||
const ISurfTriMesh* pStmS = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
bOk = bOk && ( pStmS != nullptr) ;
|
||||
// recupero il riferimento della superficie sorgente
|
||||
Frame3d frSou ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSou) ;
|
||||
// recupero tutti i triangoli
|
||||
Triangle3d Tria ;
|
||||
int nT = ( bOk ? pStmS->GetFirstTriangle( Tria) : SVT_NULL) ;
|
||||
while ( nT != SVT_NULL) {
|
||||
// aggiusto per i sistemi di riferimento
|
||||
Tria.LocToLoc( frSou, frLoc) ;
|
||||
// inserisco il triangolo nella nuova superficie
|
||||
if ( ! StmFts.AddTriangle( Tria))
|
||||
return false ;
|
||||
// passo al triangolo successivo
|
||||
nT = pStmS->GetNextTriangle( nT, Tria) ;
|
||||
}
|
||||
// passo al successivo
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
// valido la superficie e calcolo le adiacenze
|
||||
bOk = bOk && StmFts.End() ;
|
||||
// inserisco la superficie trimesh nel DB
|
||||
PtrOwner<ISurfTriMesh> pStm( StmFts.GetSurf()) ;
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
|
||||
// se richiesto, cancello le superfici originali
|
||||
if ( nNewId != GDB_ID_NULL && bErase) {
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
pGeomDB->Erase( nId) ;
|
||||
// passo al successivo
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetFirstSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmByTriangles(" + ToString( nParentId) + ",{" +
|
||||
IdListToString( vIds) + "}," +
|
||||
( bErase ? "true" : "false") + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmBySewing( int nParentId, const INTVECTOR& vIds, bool bErase)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// almeno un oggetto nell'elenco
|
||||
bool bOk = ( vIds.size() > 0) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// puntatore alla nuova superficie
|
||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
||||
bOk = bOk && ! IsNull( pStm) ;
|
||||
// esecuzione
|
||||
bool bFirst = true ;
|
||||
for ( size_t i = 0 ; bOk && i < vIds.size() ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// recupero la superficie da cucire
|
||||
const ISurfTriMesh* pStmS = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
bOk = bOk && ( pStmS != nullptr) ;
|
||||
// recupero il riferimento
|
||||
Frame3d frStmS ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStmS) ;
|
||||
// lo esprimo rispetto a quello della prima superficie
|
||||
frStmS.ToLoc( frLoc) ;
|
||||
// se è la prima, copio
|
||||
if ( bFirst) {
|
||||
bOk = bOk && pStm->CopyFrom( pStmS) ;
|
||||
bOk = bOk && pStm->ToGlob( frStmS) ;
|
||||
bFirst = false ;
|
||||
}
|
||||
// altrimenti eseguo la cucitura
|
||||
else
|
||||
bOk = bOk && pStm->DoSewing( *pStmS, frStmS) ;
|
||||
// passo alla successiva
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
// compatto
|
||||
bOk = bOk && pStm->DoCompacting() ;
|
||||
// inserisco la superficie trimesh nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
|
||||
// se richiesto, cancello le superfici originali
|
||||
if ( nNewId != GDB_ID_NULL && bErase) {
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
pGeomDB->Erase( nId) ;
|
||||
// passo al successivo
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetFirstSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmBySewing(" + ToString( nParentId) + ",{" +
|
||||
IdListToString( vIds) + "}," +
|
||||
( bErase ? "true" : "false") + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return nNewId ;
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : API_GdbModify.cpp Data : 06.10.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni di modifica geometrica per API.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 06.10.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "GeoTools.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EgkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EgkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EgkExtText.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeChangeGroupFrame( int nId, const Frame3d& frNewRef, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento del gruppo
|
||||
Frame3d* pFrame = pGeomDB->GetGroupFrame( nId) ;
|
||||
bOk = bOk && ( pFrame != nullptr) ;
|
||||
// porto il nuovo riferimento in locale
|
||||
Frame3d frNewL = frNewRef ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
if ( nRefType == RTY_GLOB)
|
||||
frNewL.ToLoc( frLoc) ;
|
||||
else /* RTY_GRID */
|
||||
frNewL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
// aggiorno il gruppo
|
||||
if ( bOk)
|
||||
*pFrame = frNewL ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtChangeGroupFrame(" + ToString( nId) + ",{{" +
|
||||
ToString( frNewRef.Orig()) + "},{" +
|
||||
ToString( frNewRef.VersX()) + "},{" +
|
||||
ToString( frNewRef.VersY()) + "},{" +
|
||||
ToString( frNewRef.VersZ()) + "}}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeChangeVectorBase( int nId, const Point3d& ptB, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// recupero il vettore
|
||||
IGeoVector3d* pGVect = GetGeoVector3d( pGeomDB->GetGeoObj( nId)) ;
|
||||
bOk = bOk && ( pGVect != nullptr) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// porto il nuovo punto base in locale
|
||||
Point3d ptBL = GetPointLocal( pGeomDB, ptB, nRefType, frLoc) ;
|
||||
// imposto il nuovo punto di base
|
||||
bOk = bOk && pGVect->ChangeBase( ptBL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtChangeVectorBase(" + ToString( nId) + ",{" +
|
||||
ToString( ptB) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeModifyText( int nId, const string& sNewText)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il testo
|
||||
IExtText* pTXT = GetExtText( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pTXT == nullptr)
|
||||
return false ;
|
||||
// eseguo l'operazione
|
||||
ExeSetModified() ;
|
||||
return pTXT->ModifyText( sNewText) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeChangeTextFont( int nId, const string& sNewFont)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il testo
|
||||
IExtText* pTXT = GetExtText( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pTXT == nullptr)
|
||||
return false ;
|
||||
// eseguo l'operazione
|
||||
ExeSetModified() ;
|
||||
return pTXT->ChangeFont( sNewFont) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeFlipText( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il testo
|
||||
IExtText* pTXT = GetExtText( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pTXT == nullptr)
|
||||
return false ;
|
||||
// eseguo l'operazione
|
||||
ExeSetModified() ;
|
||||
return pTXT->Flip() ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeMirrorText( int nId, bool bOnL)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il testo
|
||||
IExtText* pTXT = GetExtText( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pTXT == nullptr)
|
||||
return false ;
|
||||
// eseguo l'operazione
|
||||
ExeSetModified() ;
|
||||
return pTXT->Mir( bOnL) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeExplodeText( int nId, int* pnCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il testo
|
||||
IExtText* pTXT = GetExtText( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pTXT != nullptr) ;
|
||||
// recupero l'outline del testo
|
||||
ICURVEPLIST lstPCRV ;
|
||||
bOk = bOk && pTXT->GetOutline( lstPCRV) ;
|
||||
// inserisco le curve nella stessa posizione del testo
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
for ( ICURVEPLIST::iterator iIter = lstPCRV.begin() ; iIter != lstPCRV.end() ; ++ iIter) {
|
||||
// inserisco la curva nello stesso gruppo e nello stesso posto del GeomDB
|
||||
int nCrvId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, (*iIter)) ;
|
||||
bOk = bOk && ( nCrvId != GDB_ID_NULL) ;
|
||||
// copio gli attributi
|
||||
bOk = bOk && pGeomDB->CopyAttributes( nId, nCrvId) ;
|
||||
// aggiorno contatori
|
||||
if ( bOk) {
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nCrvId ;
|
||||
++ nCount ;
|
||||
}
|
||||
}
|
||||
nFirstId = ( bOk ? nFirstId : GDB_ID_NULL) ;
|
||||
// elimino il testo originale
|
||||
bOk = bOk && pGeomDB->Erase( nId) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtExplodeText(" + ToString( nId) + ")" +
|
||||
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultati
|
||||
if ( pnCount != nullptr)
|
||||
*pnCount = nCount ;
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeSplitText( int nId, int* pnCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il testo
|
||||
IExtText* pTXT = GetExtText( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pTXT != nullptr) ;
|
||||
// recupero l'esplosione del testo in linee singole
|
||||
IEXTTEXTPVECTOR vTxt ;
|
||||
bOk = bOk && pTXT->SplitOnLineBreak( vTxt) ;
|
||||
// inserisco i nuovi testi nella stessa posizione del testo
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
for ( int i = 0 ; i < int( vTxt.size()) ; ++ i) {
|
||||
// inserimento
|
||||
int nCrvId = ( bOk ? pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, vTxt[i]) : GDB_ID_NULL) ;
|
||||
if ( nCrvId != GDB_ID_NULL) {
|
||||
// copio gli attributi
|
||||
bOk = bOk && pGeomDB->CopyAttributes( nId, nCrvId) ;
|
||||
// aggiorno contatori
|
||||
if ( bOk) {
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nCrvId ;
|
||||
++ nCount ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
bOk = false ;
|
||||
delete vTxt[i] ;
|
||||
}
|
||||
}
|
||||
nFirstId = ( bOk ? nFirstId : GDB_ID_NULL) ;
|
||||
// elimino il testo originale
|
||||
bOk = bOk && pGeomDB->Erase( nId) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSplitText(" + ToString( nId) + ")" +
|
||||
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultati
|
||||
if ( pnCount != nullptr)
|
||||
*pnCount = nCount ;
|
||||
return nFirstId ;
|
||||
}
|
||||
@@ -0,0 +1,822 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : API_ModifyCurve.cpp Data : 03.10.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni di modifica delle curve per API.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 03.10.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "GeoTools.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkExtTExt.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeInvertCurve( const INTVECTOR& vIds)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// eseguo inversione
|
||||
bool bOk = true ;
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL && bOk) {
|
||||
// recupero la curva e la inverto
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve != nullptr && ! pCurve->Invert())
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtInvertCurve({" + IdListToString( vIds) + "})" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeOffsetCurve( int nId, double dDist, int nType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
// eseguo l'offset
|
||||
bool bOk = ( pCurve != nullptr) && pCurve->SimpleOffset( dDist, nType) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
sLua = "EgtOffsetCurve(" + ToString( nId) + "," +
|
||||
ToString( dDist) + "," +
|
||||
OffsTypeToString( nType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeChangeClosedCurveStartPoint( int nId, const Point3d& ptP, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
bOk = bOk && ( pCurve != nullptr) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// porto in locale il punto vicino ad iniziale
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
|
||||
// recupero la posizione parametrica della proiezione di questo punto sulla curva
|
||||
DistPointCurve distPC( ptPL, *pCurve) ;
|
||||
double dPar ;
|
||||
int nFlag ;
|
||||
bOk = bOk && distPC.GetParamAtMinDistPoint( 0, dPar, nFlag) ;
|
||||
// cambio il punto iniziale
|
||||
if ( bOk && pCurve->GetType() == CRV_ARC)
|
||||
bOk = bOk && dynamic_cast<ICurveArc*>(pCurve)->ChangeStartPoint(dPar) ;
|
||||
else if ( bOk && pCurve->GetType() == CRV_COMPO)
|
||||
bOk = bOk && dynamic_cast<ICurveComposite*>(pCurve)->ChangeStartPoint(dPar) ;
|
||||
else
|
||||
bOk = false ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtChangeClosedCurveStartPoint(" + ToString( nId) + ",{" +
|
||||
ToString( ptP) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeModifyCurveStartPoint( int nId, const Point3d& ptP, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
bOk = bOk && ( pCurve != nullptr) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// porto in locale il nuovo punto iniziale
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
|
||||
// ne modifico il punto iniziale
|
||||
bOk = bOk && pCurve->ModifyStart( ptPL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtModifyCurveStartPoint(" + ToString( nId) + ",{" +
|
||||
ToString( ptP) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeModifyCurveEndPoint( int nId, const Point3d& ptP, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
bOk = bOk && ( pCurve != nullptr) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// porto in locale il nuovo punto finale
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
|
||||
// ne modifico il punto finale
|
||||
bOk = bOk && pCurve->ModifyEnd( ptPL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtModifyCurveEndPoint(" + ToString( nId) + ",{" +
|
||||
ToString( ptP) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
ModifyOneCurveExtrusion( IGeomDB* pGeomDB, int nId, const Vector3d& vtExtr, int nRefType)
|
||||
{
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nId, frLoc) &&
|
||||
! pGeomDB->GetGlobFrame( nId, frLoc))
|
||||
return false ;
|
||||
// porto in locale il versore estrusione
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, vtExtr, nRefType, frLoc) ;
|
||||
// se gruppo, agisco sulle sole curve componenti
|
||||
if ( pGeomDB->GetGdbType( nId) == GDB_TY_GROUP) {
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( pGeomDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
for ( bool bFound = pIter->GoToFirstInGroup( nId) ;
|
||||
bFound ;
|
||||
bFound = pIter->GoToNext()) {
|
||||
// recupero la curva e ne modifico il vettore estrusione
|
||||
ICurve* pCurve = GetCurve( pIter->GetGeoObj()) ;
|
||||
if ( pCurve != nullptr && ! pCurve->SetExtrusion( vtExtrL))
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
// se oggetto geometrico
|
||||
else {
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
// ne modifico il vettore estrusione
|
||||
return ( pCurve == nullptr || pCurve->SetExtrusion( vtExtrL)) ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeModifyCurveExtrusion( const INTVECTOR& vIds, const Vector3d& vtExtr, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// se estrusione espressa in locale, verifico che tutte le curve siano nello stesso riferimento
|
||||
if ( nRefType == RTY_LOC)
|
||||
bOk = bOk && VerifySameFrame( pGeomDB, vIds) ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
// impostazione estrusione singola
|
||||
if ( vIds[i] != GDB_ID_SEL) {
|
||||
bOk = bOk && ModifyOneCurveExtrusion( pGeomDB, vIds[i], vtExtr, nRefType) ;
|
||||
}
|
||||
// impostazione estrusione dei selezionati
|
||||
else {
|
||||
int nI = pGeomDB->GetFirstSelectedObj() ;
|
||||
while ( nI != GDB_ID_NULL && bOk) {
|
||||
if ( ! ModifyOneCurveExtrusion( pGeomDB, nI, vtExtr, nRefType))
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nI = pGeomDB->GetNextSelectedObj() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtModifyCurveExtrusion({" + IdListToString( vIds) + "},{" +
|
||||
ToString( Vector3d( vtExtr)) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
ModifyOneCurveThickness( IGeomDB* pGeomDB, int nId, double dThick)
|
||||
{
|
||||
// se gruppo, agisco sulle sole curve componenti
|
||||
if ( pGeomDB->GetGdbType( nId) == GDB_TY_GROUP) {
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( pGeomDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
bool bOk = true ;
|
||||
for ( bool bFound = pIter->GoToFirstInGroup( nId) ;
|
||||
bFound ;
|
||||
bFound = pIter->GoToNext()) {
|
||||
// recupero la curva e ne modifico lo spessore
|
||||
ICurve* pCurve = GetCurve( pIter->GetGeoObj()) ;
|
||||
if ( pCurve != nullptr && ! pCurve->SetThickness( dThick))
|
||||
bOk = false ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
// se oggetto geometrico
|
||||
else {
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
// ne modifico lo spessore, se curva
|
||||
return ( pCurve == nullptr || pCurve->SetThickness( dThick)) ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeModifyCurveThickness( const INTVECTOR& vIds, double dThick)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
// eseguo impostazione spessore singola
|
||||
if ( vIds[i] != GDB_ID_SEL) {
|
||||
bOk = bOk && ModifyOneCurveThickness( pGeomDB, vIds[i], dThick) ;
|
||||
}
|
||||
// eseguo impostazione spessore dei selezionati
|
||||
else {
|
||||
int nI = pGeomDB->GetFirstSelectedObj() ;
|
||||
while ( nI != GDB_ID_NULL && bOk) {
|
||||
if ( ! ModifyOneCurveThickness( pGeomDB, nI, dThick))
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nI = pGeomDB->GetNextSelectedObj() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtModifyCurveThickness({" + IdListToString( vIds) + "}," +
|
||||
ToString( dThick) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTrimCurveStartAtLen( int nId, double dLen)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
// taglio la curva all'inizio
|
||||
bool bOk = pCurve->TrimStartAtLen( dLen) ;
|
||||
ExeSetModified() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTrimCurveEndAtLen( int nId, double dLen)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
// taglio la curva alla fine
|
||||
bool bOk = pCurve->TrimEndAtLen( dLen) ;
|
||||
ExeSetModified() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTrimCurveStartAtParam( int nId, double dPar)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
// taglio la curva all'inizio
|
||||
bool bOk = pCurve->TrimStartAtParam( dPar) ;
|
||||
ExeSetModified() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTrimCurveEndAtParam( int nId, double dPar)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
// taglio la curva alla fine
|
||||
bool bOk = pCurve->TrimEndAtParam( dPar) ;
|
||||
ExeSetModified() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTrimCurveStartEndAtParam( int nId, double dParS, double dParE)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
// taglio la curva agli estremi
|
||||
bool bOk = pCurve->TrimStartEndAtParam( dParS, dParE) ;
|
||||
ExeSetModified() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeExtendCurveStartByLen( int nId, double dLen)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
// estendo la curva all'inizio
|
||||
bool bOk = pCurve->ExtendStartByLen( dLen) ;
|
||||
ExeSetModified() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeExtendCurveEndByLen( int nId, double dLen)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
// estendo la curva alla fine
|
||||
bool bOk = pCurve->ExtendEndByLen( dLen) ;
|
||||
ExeSetModified() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTrimExtendCurveByLen( int nId, double dLen, const Point3d& ptNear, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pCurve != nullptr) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// porto in locale il punto
|
||||
Point3d ptNearL = GetPointLocal( pGeomDB, ptNear, nRefType, frLoc) ;
|
||||
// cerco l'estremo più vicino al punto passato
|
||||
Point3d ptStart, ptEnd ;
|
||||
if ( bOk && pCurve->GetStartPoint( ptStart) && pCurve->GetEndPoint( ptEnd)) {
|
||||
if ( SqDist( ptStart, ptNearL) < SqDist( ptEnd, ptNearL)) {
|
||||
if ( dLen < - EPS_SMALL)
|
||||
bOk = pCurve->TrimStartAtLen( - dLen) ;
|
||||
else if ( dLen > EPS_SMALL)
|
||||
bOk = pCurve->ExtendStartByLen( dLen) ;
|
||||
}
|
||||
else {
|
||||
if ( dLen < - EPS_SMALL) {
|
||||
double dCrvLen ;
|
||||
bOk = pCurve->GetLength( dCrvLen) && pCurve->TrimEndAtLen( dCrvLen + dLen) ;
|
||||
}
|
||||
else if ( dLen > EPS_SMALL)
|
||||
bOk = pCurve->ExtendEndByLen( dLen) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
bOk = false ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTrimExtendCurveByLen(" + ToString( nId) + "," +
|
||||
ToString( dLen) + ",{" +
|
||||
ToString( ptNear) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeSplitCurve( int nId, int nParts)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pCurve != nullptr) ;
|
||||
// il numero di parti non può essere inferiore a 1
|
||||
nParts = max( nParts, 1) ;
|
||||
// lunghezza totale della curva
|
||||
double dLenTot = 0 ;
|
||||
bOk = bOk && pCurve->GetLength( dLenTot) ;
|
||||
// lunghezza di una parte
|
||||
double dLen = dLenTot / nParts ;
|
||||
// eseguo la divisione
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCurrId = nId ;
|
||||
for ( int i = 1; i < nParts ; ++ i) {
|
||||
// copio la curva
|
||||
int nCopyId = pGeomDB->Copy( nCurrId, GDB_ID_NULL, nCurrId, GDB_AFTER) ;
|
||||
ICurve* pCopyCrv = GetCurve( pGeomDB->GetGeoObj( nCopyId)) ;
|
||||
bOk = bOk && ( pCopyCrv != nullptr) ;
|
||||
// tengo la prima parte dell'originale e la seconda parte della copia
|
||||
bOk = bOk && pCurve->TrimEndAtLen( dLen) ;
|
||||
bOk = bOk && pCopyCrv->TrimStartAtLen( dLen) ;
|
||||
// la copia diventa il nuovo corrente
|
||||
nCurrId = nCopyId ;
|
||||
pCurve = pCopyCrv ;
|
||||
// salvo identificativo prima copia
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nCopyId ;
|
||||
}
|
||||
nFirstId = ( bOk ? nFirstId : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSplitCurve(" + ToString( nId) + "," +
|
||||
ToString( nParts) + ")" +
|
||||
" -- Id1=" + ToString( nFirstId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeSplitCurveAtPoint( int nId, const Point3d& ptOn, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pCurve != nullptr) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// porto in locale il punto
|
||||
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ;
|
||||
// determino la posizione parametrica del punto sulla curva (con tolleranza)
|
||||
double dU = 0 ;
|
||||
if ( bOk) {
|
||||
DistPointCurve dstPC( ptOnL, *pCurve) ;
|
||||
int nFlag ;
|
||||
if ( ! dstPC.GetParamAtMinDistPoint( 0, dU, nFlag) || nFlag != MDPCI_NORMAL)
|
||||
bOk = false ;
|
||||
}
|
||||
// verifico che il punto di taglio sia interno alla curva
|
||||
bool bIsInside = false ;
|
||||
if ( bOk) {
|
||||
Point3d ptStart ;
|
||||
Point3d ptEnd ;
|
||||
Point3d ptBreak ;
|
||||
if ( pCurve->GetStartPoint( ptStart) &&
|
||||
pCurve->GetEndPoint( ptEnd) &&
|
||||
pCurve->GetPointD1D2( dU, ICurve::FROM_MINUS, ptBreak)) {
|
||||
bIsInside = ! AreSamePointApprox( ptBreak, ptStart) &&
|
||||
! AreSamePointApprox( ptBreak, ptEnd) ;
|
||||
}
|
||||
}
|
||||
// se il punto di taglio è interno, devo realmente tagliare
|
||||
int nNewId = GDB_ID_NULL ;
|
||||
if ( bIsInside) {
|
||||
// copio la curva
|
||||
nNewId = pGeomDB->Copy( nId, GDB_ID_NULL, nId, GDB_AFTER) ;
|
||||
ICurve* pCopyCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
||||
bOk = bOk && ( pCopyCrv != nullptr) ;
|
||||
// tengo la prima parte dell'originale e la seconda parte della copia
|
||||
bOk = bOk && pCurve->TrimEndAtParam( dU) ;
|
||||
bOk = bOk && pCopyCrv->TrimStartAtParam( dU) ;
|
||||
}
|
||||
nNewId = ( bOk ? nNewId : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSplitCurveAtPoint(" + ToString( nId) + ",{" +
|
||||
ToString( ptOn) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeModifyCurveCircleCPN( int nId, const Point3d& ptOn, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero l'arco e i suoi dati
|
||||
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pArc == nullptr)
|
||||
return false ;
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
double dOldRad = pArc->GetRadius() ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frLoc))
|
||||
return false ;
|
||||
// porto in locale il nuovo punto
|
||||
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ;
|
||||
// calcolo il nuovo raggio
|
||||
double dRad = (( ptOnL - ptCen) ^ vtN).Len() ;
|
||||
// imposto il nuovo raggio
|
||||
if ( pArc->Set( ptCen, vtN, dRad))
|
||||
return true ;
|
||||
// in caso di errore, ripristino i vecchi dati
|
||||
else {
|
||||
pArc->Set( ptCen, vtN, dOldRad) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeModifyCurveArcRadius( int nId, double dRad)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero l'arco e i suoi dati
|
||||
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pArc == nullptr)
|
||||
return false ;
|
||||
double dOldRad = pArc->GetRadius() ;
|
||||
// imposto il nuovo raggio
|
||||
if ( pArc->ChangeRadius( dRad))
|
||||
return true ;
|
||||
// in caso di errore, ripristino i vecchi dati
|
||||
else {
|
||||
pArc->ChangeRadius( dOldRad) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeModifyCurveArcC2PN( int nId, const Point3d& ptEnd, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero l'arco e i suoi dati
|
||||
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pArc == nullptr)
|
||||
return false ;
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
Point3d ptStart, ptOldEnd ;
|
||||
if ( ! pArc->GetStartPoint( ptStart) || ! pArc->GetEndPoint( ptOldEnd))
|
||||
return false ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frLoc))
|
||||
return false ;
|
||||
// porto in locale il nuovo punto finale
|
||||
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
|
||||
// imposto il nuovo punto finale
|
||||
if ( pArc->SetC2PN( ptCen, ptStart, ptEndL, vtN))
|
||||
return true ;
|
||||
// in caso di errore, ripristino i vecchi dati
|
||||
else {
|
||||
pArc->SetC2PN( ptCen, ptStart, ptOldEnd, vtN) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeModifyCurveArc3P( int nId, const Point3d& ptMid, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero l'arco e i suoi punti notevoli
|
||||
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pArc == nullptr)
|
||||
return false ;
|
||||
Point3d ptStart, ptOldMid, ptEnd ;
|
||||
if ( ! pArc->GetStartPoint( ptStart) || ! pArc->GetMidPoint( ptOldMid) || ! pArc->GetEndPoint( ptEnd))
|
||||
return false ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frLoc))
|
||||
return false ;
|
||||
// porto in locale il nuovo punto medio
|
||||
Point3d ptMidL = GetPointLocal( pGeomDB, ptMid, nRefType, frLoc) ;
|
||||
// imposto il nuovo punto medio
|
||||
if ( pArc->Set3P( ptStart, ptMidL, ptEnd))
|
||||
return true ;
|
||||
// in caso di errore, ripristino i vecchi dati
|
||||
else {
|
||||
pArc->Set3P( ptStart, ptOldMid, ptEnd) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeExplodeCurveCompo( int nId, int* pnCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la curva composita
|
||||
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pCompo != nullptr) ;
|
||||
// estraggo tutte le curve
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
ICurve* pCrv ;
|
||||
while ( bOk && ( pCrv = pCompo->RemoveFirstOrLastCurve( false)) != nullptr) {
|
||||
// inserisco la curva nello stesso gruppo e nello stesso posto del GeomDB
|
||||
int nCrvId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, pCrv) ;
|
||||
bOk = bOk && ( nCrvId != GDB_ID_NULL) ;
|
||||
// copio gli attributi
|
||||
bOk = bOk && pGeomDB->CopyAttributes( nId, nCrvId) ;
|
||||
// aggiorno contatori
|
||||
if ( bOk) {
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nCrvId ;
|
||||
++ nCount ;
|
||||
}
|
||||
}
|
||||
nFirstId = ( bOk ? nFirstId : GDB_ID_NULL) ;
|
||||
// elimino la curva composita ormai vuota
|
||||
bOk = bOk && pGeomDB->Erase( nId) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtExplodeCurveCompo(" + ToString( nId) + ")" +
|
||||
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultati
|
||||
if ( pnCount != nullptr)
|
||||
*pnCount = nCount ;
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeApproxCurveArc( int nId, double dLinTol)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero l'arco
|
||||
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pArc != nullptr) ;
|
||||
// eseguo l'approssimazione con segmenti di linea
|
||||
const double ANG_TOL_STD_DEG = 15 ;
|
||||
PtrOwner<ICurveComposite> pCC( CreateCurveComposite()) ;
|
||||
bOk = bOk && ! IsNull( pCC) ;
|
||||
PolyLine PL ;
|
||||
bOk = bOk && pArc->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, PL) && pCC->FromPolyLine( PL) ;
|
||||
// inserisco la curva composita nello stesso posto del GeomDB
|
||||
int nCrvId = ( bOk ? pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, Release( pCC)) : GDB_ID_NULL) ;
|
||||
bOk = bOk && ( nCrvId != GDB_ID_NULL) ;
|
||||
// copio gli attributi
|
||||
bOk = bOk && pGeomDB->CopyAttributes( nId, nCrvId) ;
|
||||
// elimino l'arco
|
||||
bOk = bOk && pGeomDB->Erase( nId) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtApproxCurveArc(" + ToString( nId) + "," +
|
||||
ToString( dLinTol) + ")" +
|
||||
" -- Id=" + ToString( nCrvId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return nCrvId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeApproxCurveBezier( int nId, bool bArcsVsLines, double dLinTol)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la curva di Bezier
|
||||
ICurveBezier* pCBezier = GetCurveBezier( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pCBezier != nullptr) ;
|
||||
// eseguo l'approssimazione
|
||||
const double ANG_TOL_STD_DEG = 15 ;
|
||||
PtrOwner<ICurveComposite> pCC( CreateCurveComposite()) ;
|
||||
bOk = bOk && ! IsNull( pCC) ;
|
||||
if ( bArcsVsLines) { // con bi-archi
|
||||
PolyArc PA ;
|
||||
bOk = bOk && pCBezier->ApproxWithArcs( dLinTol, ANG_TOL_STD_DEG, PA) && pCC->FromPolyArc( PA) ;
|
||||
}
|
||||
else { // con linee
|
||||
PolyLine PL ;
|
||||
bOk = bOk && pCBezier->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, PL) && pCC->FromPolyLine( PL) ;
|
||||
}
|
||||
// inserisco la curva composita nello stesso posto del GeomDB
|
||||
int nCrvId = ( bOk ? pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, Release( pCC)) : GDB_ID_NULL) ;
|
||||
bOk = bOk && ( nCrvId != GDB_ID_NULL) ;
|
||||
// copio gli attributi
|
||||
bOk = bOk && pGeomDB->CopyAttributes( nId, nCrvId) ;
|
||||
// elimino la curva di Bezier
|
||||
bOk = bOk && pGeomDB->Erase( nId) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtApproxCurveBezier(" + ToString( nId) + "," +
|
||||
( bArcsVsLines ? "GDB_CA.ARCS" : "GDB_CA.LINES") + "," +
|
||||
ToString( dLinTol) + ")" +
|
||||
" -- Id=" + ToString( nCrvId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return nCrvId ;
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_ModifySurf.cpp Data : 04.05.15 Versione : 1.6e1
|
||||
// Contenuto : Funzioni di modifica delle superfici per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 09.03.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "GeoTools.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EgkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EgkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeInvertSurface( const INTVECTOR& vIds)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// eseguo inversione
|
||||
bool bOk = true ;
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL && bOk) {
|
||||
// recupero la superficie e la inverto
|
||||
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pSurf != nullptr && ! pSurf->Invert())
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtInvertSurf({" + IdListToString( vIds) + "})" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeExtractSurfTmFacetLoops( int nId, int nFacet, int nDestGrpId, int* pnCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la superficie TriMesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pStm != nullptr) ;
|
||||
// recupero il riferimento della superficie
|
||||
Frame3d frSurf ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
|
||||
// recupero il riferimento di destinazione
|
||||
Frame3d frDest ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
|
||||
// recupero i loop come polilinee
|
||||
POLYLINEVECTOR vPL ;
|
||||
bOk = bOk && pStm->GetFacetLoops( nFacet, vPL) ;
|
||||
// dalle polilinee creo le curve e le inserisco nel DB
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
for ( size_t i = 0 ; i < vPL.size() ; ++ i) {
|
||||
// creo la curva
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
bOk = bOk && pCrvCompo->FromPolyLine( vPL[i]) ;
|
||||
// la porto nel riferimento destinazione
|
||||
bOk = bOk && pCrvCompo->LocToLoc( frSurf, frDest) ;
|
||||
// la inserisco nel DB geometrico
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCrvCompo)) : GDB_ID_NULL) ;
|
||||
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
|
||||
if ( bOk && nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nNewId ;
|
||||
if ( bOk)
|
||||
++ nCount ;
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtExtractSurfTmFacetLoops(" + ToString( nId) + ",{" +
|
||||
ToString( nFacet) + "," +
|
||||
ToString( nDestGrpId) + ")" +
|
||||
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultati
|
||||
if ( pnCount != nullptr)
|
||||
*pnCount = nCount ;
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeExplodeSurfTm( int nId, int* pnCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la superficie TriMesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pStm != nullptr) ;
|
||||
// copio tutte le facce
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
int nFacet = pStm->GetFacetNum() ;
|
||||
for ( int i = 0 ; i < nFacet ; ++ i) {
|
||||
ISurfTriMesh* pFac = pStm->CloneFacet( i) ;
|
||||
if ( pFac == nullptr)
|
||||
continue ;
|
||||
// inserisco la superficie nello stesso gruppo e nello stesso posto del GeomDB
|
||||
int nFacId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, pFac) ;
|
||||
bOk = bOk && ( nFacId != GDB_ID_NULL) ;
|
||||
// copio gli attributi
|
||||
bOk = bOk && pGeomDB->CopyAttributes( nId, nFacId) ;
|
||||
// aggiorno contatori
|
||||
if ( bOk) {
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nFacId ;
|
||||
++ nCount ;
|
||||
}
|
||||
}
|
||||
nFirstId = ( bOk ? nFirstId : GDB_ID_NULL) ;
|
||||
// elimino la superficie
|
||||
bOk = bOk && pGeomDB->Erase( nId) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtExplodeSurfTm(" + ToString( nId) + ")" +
|
||||
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultati
|
||||
if ( pnCount != nullptr)
|
||||
*pnCount = nCount ;
|
||||
return nFirstId ;
|
||||
}
|
||||
@@ -0,0 +1,538 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_GdbObjAttribs.cpp Data : 04.05.15 Versione : 1.6e1
|
||||
// Contenuto : Funzioni sugli attributi degli oggetti di GeomDB per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 03.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetLevel( int nId, int nLevel)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// imposto il livello
|
||||
bool bOk = pGeomDB->SetLevel( nId, nLevel) ;
|
||||
ExeSetModified() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRevertLevel( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// porto il livello allo stato precedente
|
||||
bool bOk = pGeomDB->RevertLevel( nId) ;
|
||||
ExeSetModified() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetLevel( int nId, int* pnLevel)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( pnLevel == nullptr)
|
||||
return false ;
|
||||
// recupero il livello
|
||||
return pGeomDB->GetLevel( nId, *pnLevel) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetCalcLevel( int nId, int* pnLevel)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( pnLevel == nullptr)
|
||||
return false ;
|
||||
// recupero il modo
|
||||
return pGeomDB->GetCalcLevel( nId, *pnLevel) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetMode( int nId, int nMode)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// imposto il modo
|
||||
bool bOk = pGeomDB->SetMode( nId, nMode) ;
|
||||
ExeSetModified() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRevertMode( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// porto il modo allo stato precedente
|
||||
bool bOk = pGeomDB->RevertMode( nId) ;
|
||||
ExeSetModified() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetMode( int nId, int* pnMode)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( pnMode == nullptr)
|
||||
return false ;
|
||||
// recupero il modo
|
||||
return pGeomDB->GetMode( nId, *pnMode) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetCalcMode( int nId, int* pnMode)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( pnMode == nullptr)
|
||||
return false ;
|
||||
// recupero il modo
|
||||
return pGeomDB->GetCalcMode( nId, *pnMode) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetStatus( const INTVECTOR& vIds, int nStat)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero pezzo e layer correnti
|
||||
bool bCurrPartOff = false ;
|
||||
bool bCurrLayerOff = false ;
|
||||
int nCurrPartId = ExeGetCurrPart() ;
|
||||
int nCurrLayerId = ExeGetCurrLayer() ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
bool bOk = true ;
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
// impostazione stato
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// imposto il modo
|
||||
if ( ! pGeomDB->SetStatus( nId, nStat))
|
||||
bOk = false ;
|
||||
// se nascosto pezzo corrente o layer corrente
|
||||
if ( nStat == GDB_ST_OFF) {
|
||||
if ( nId == nCurrPartId)
|
||||
bCurrPartOff = true ;
|
||||
else if ( nId == nCurrLayerId)
|
||||
bCurrLayerOff = true ;
|
||||
}
|
||||
// passo al successivo
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
// se pezzo o layer correnti da rideterminare
|
||||
if ( bCurrPartOff)
|
||||
ExeResetCurrPartLayer() ;
|
||||
else if ( bCurrLayerOff)
|
||||
ExeSetCurrPartLayer( nCurrPartId, ExeGetFirstLayer( nCurrPartId, true)) ;
|
||||
// dichiaro progetto modificato
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sStat = "GDB_ST.ON" ;
|
||||
if ( nStat == GDB_ST_SEL)
|
||||
sStat = "GDB_ST.SEL" ;
|
||||
else if ( nStat == GDB_ST_OFF)
|
||||
sStat = "GDB_ST.OFF" ;
|
||||
string sLua = "EgtSetStatus({" + IdListToString( vIds) + "}," +
|
||||
sStat + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRevertStatus( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// porto lo stato al valore precedente
|
||||
bool bOk = pGeomDB->RevertStatus( nId) ;
|
||||
ExeSetModified() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetStatus( int nId, int* pnStat)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( pnStat == nullptr)
|
||||
return false ;
|
||||
// recupero lo stato
|
||||
return pGeomDB->GetStatus( nId, *pnStat) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetCalcStatus( int nId, int* pnStat)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( pnStat == nullptr)
|
||||
return false ;
|
||||
// recupero lo stato
|
||||
return pGeomDB->GetCalcStatus( nId, *pnStat) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetMark( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// imposto l'evidenziazione
|
||||
bool bOk = pGeomDB->SetMark( nId) ;
|
||||
// non produce modifica perchè mark ignorato in salvataggio
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeResetMark( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// cancello l'evidenziazione
|
||||
bool bOk = pGeomDB->ResetMark( nId) ;
|
||||
// non produce modifica perchè mark ignorato in salvataggio
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetMark( int nId, int* pnMark)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( pnMark == nullptr)
|
||||
return false ;
|
||||
// recupero l'evidenziazione
|
||||
return pGeomDB->GetMark( nId, *pnMark) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetCalcMark( int nId, int* pnMark)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( pnMark == nullptr)
|
||||
return false ;
|
||||
// recupero il modo
|
||||
return pGeomDB->GetCalcMark( nId, *pnMark) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeStdColor( const string& sName, Color& ColStd)
|
||||
{
|
||||
return GetStdColor( sName, ColStd) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetColor( const INTVECTOR& vIds, const Color& cCol, bool bSetAlpha)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// assegno il colore
|
||||
bool bOk = true ;
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
Color cNew = cCol ;
|
||||
// se richiesto, recupero alpha originale
|
||||
if ( ! bSetAlpha) {
|
||||
Color cOri ;
|
||||
if ( pGeomDB->GetCalcMaterial( nId, cOri))
|
||||
cNew.SetAlpha( cOri.GetIntAlpha()) ;
|
||||
}
|
||||
// eseguo assegnazione
|
||||
if ( ! pGeomDB->SetMaterial( nId, cNew))
|
||||
bOk = false ;
|
||||
// passo al successivo
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sIds ;
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i)
|
||||
sIds += ( vIds[i] != GDB_ID_SEL ? ToString( vIds[i]) : "GDB_ID_SEL") + "," ;
|
||||
sIds.pop_back() ;
|
||||
string sLua = "EgtSetColor({" + sIds + "},{" +
|
||||
ToString( cCol) + "}," +
|
||||
( bSetAlpha ? "true" : "false") + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetAlpha( const INTVECTOR& vIds, int nAlpha)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// assegno la trasparenza
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// recupero il colore originale
|
||||
Color cCol ;
|
||||
bOk = bOk && pGeomDB->GetCalcMaterial( nId, cCol) ;
|
||||
cCol.SetAlpha( nAlpha) ;
|
||||
// eseguo assegnazione
|
||||
bOk = bOk && pGeomDB->SetMaterial( nId, cCol) ;
|
||||
// passo al successivo
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSetAlpha({" + IdListToString( vIds) + "}," +
|
||||
ToString( nAlpha) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeResetColor( const INTVECTOR& vIds)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// tolgo il colore
|
||||
bool bOk = true ;
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
if ( ! pGeomDB->SetMaterial( nId, GDB_MT_PARENT))
|
||||
bOk = false ;
|
||||
// passo al successivo
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtResetColor({" + IdListToString( vIds) + "})" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetColor( int nId, Color& cCol)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il colore
|
||||
return pGeomDB->GetMaterial( nId, cCol) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetCalcColor( int nId, Color& cCol)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il colore
|
||||
return pGeomDB->GetCalcMaterial( nId, cCol) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetName( int nId, const string& sName)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// assegno il nome
|
||||
bool bOk = pGeomDB->SetName( nId, sName) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSetName(" + ToString( nId) + ",'" +
|
||||
sName + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetName( int nId, string& sName)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il nome
|
||||
return pGeomDB->GetName( nId, sName) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeExistsName( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico esistenza del nome
|
||||
return pGeomDB->ExistsName( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRemoveName( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// rimuovo il nome
|
||||
bool bOk = pGeomDB->RemoveName( nId) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtRemoveName(" + ToString( nId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetInfo( int nId, const string& sKey, const string& sInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// assegno la info
|
||||
bool bOk = pGeomDB->SetInfo( nId, sKey, sInfo) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSetInfo(" + ToString( nId) + ",'" +
|
||||
sKey + "','" +
|
||||
sInfo + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetInfo( int nId, const string& sKey, int nInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// assegno la info
|
||||
bool bOk = pGeomDB->SetInfo( nId, sKey, nInfo) ;
|
||||
ExeSetModified() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetInfo( int nId, const string& sKey, string& sInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero info
|
||||
return pGeomDB->GetInfo( nId, sKey, sInfo) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetInfo( int nId, const string& sKey, int& nInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la info
|
||||
return pGeomDB->GetInfo( nId, sKey, nInfo) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeExistsInfo( int nId, const string& sKey)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico esistenza info
|
||||
return pGeomDB->ExistsInfo( nId, sKey) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRemoveInfo( int nId, const string& sKey)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// rimuovo la info
|
||||
bool bOk = pGeomDB->RemoveInfo( nId, sKey) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtRemoveInfo(" + ToString( nId) + ",'" +
|
||||
sKey + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : API_GdbObjects.cpp Data : 02.09.14 Versione : 1.5i1
|
||||
// Contenuto : Funzioni iterazione di DB geometrico per API.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 02.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSelectObj( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// seleziono l'oggetto
|
||||
bool bOk = pGeomDB->SelectObj( nId) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSelectObj(" + ToString( nId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeDeselectObj( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// deseleziono l'oggetto
|
||||
bool bOk = pGeomDB->DeselectObj( nId) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtDeselectObj(" + ToString( nId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSelectAll( bool bOnlyIfVisible)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// seleziono tutto
|
||||
int nId1 = ExeGetFirstPart( bOnlyIfVisible) ;
|
||||
while ( nId1 != GDB_ID_NULL) {
|
||||
// ciclo sugli oggetti del pezzo
|
||||
int nId2 = pGeomDB->GetFirstInGroup( nId1) ;
|
||||
while ( nId2 != GDB_ID_NULL) {
|
||||
// se è gruppo seleziono i suoi componenti
|
||||
if ( pGeomDB->GetGdbType( nId2) == GDB_TY_GROUP)
|
||||
pGeomDB->SelectGroupObjs( nId2, 0, bOnlyIfVisible) ;
|
||||
// altrimenti lo seleziono direttamente
|
||||
else
|
||||
pGeomDB->SelectObj( nId2, bOnlyIfVisible) ;
|
||||
// passo al successivo
|
||||
nId2 = pGeomDB->GetNext( nId2) ;
|
||||
}
|
||||
// passo al successivo
|
||||
nId1 = ExeGetNextPart( nId1, bOnlyIfVisible) ;
|
||||
}
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSelectAll(" + string( bOnlyIfVisible ? "true" : "false") + ")" +
|
||||
" -- bOk=1" ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeDeselectAll( void)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// deseleziono tutto
|
||||
bool bOk = pGeomDB->ClearSelection() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtDeselectAll()"
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSelectGroupObjs( int nGroupId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// verifico sia un gruppo
|
||||
if ( pGeomDB->GetGdbType( nGroupId) == GDB_TY_GROUP) {
|
||||
bOk = pGeomDB->SelectGroupObjs( nGroupId) ;
|
||||
}
|
||||
else
|
||||
bOk = false ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSelectGroupObjs(" + ToString( nGroupId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeDeselectGroupObjs( int nGroupId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// verifico sia un gruppo
|
||||
if ( pGeomDB->GetGdbType( nGroupId) == GDB_TY_GROUP) {
|
||||
bOk = pGeomDB->DeselectGroupObjs( nGroupId) ;
|
||||
}
|
||||
else
|
||||
bOk = false ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtDeselectGroupObjs(" + ToString( nGroupId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeIsSelectedObj( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico se l'oggetto è selezionato
|
||||
return pGeomDB->IsSelectedObj( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetSelectedObjNbr( void)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, 0)
|
||||
// restituisco il numero di oggetti selezionati
|
||||
return pGeomDB->GetSelectedObjNbr() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetFirstSelectedObj( void)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il primo oggetto selezionato
|
||||
return pGeomDB->GetFirstSelectedObj() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetNextSelectedObj( void)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il successivo oggetto selezionato
|
||||
return pGeomDB->GetNextSelectedObj() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetLastSelectedObj( void)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero l'ultimo oggetto selezionato
|
||||
return pGeomDB->GetLastSelectedObj() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetPrevSelectedObj( void)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il precedente oggetto selezionato
|
||||
return pGeomDB->GetPrevSelectedObj() ;
|
||||
}
|
||||
@@ -0,0 +1,512 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_GdbObjects.cpp Data : 04.05.15 Versione : 1.6e1
|
||||
// Contenuto : Funzioni iterazione di DB geometrico per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 02.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeExistsObj( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico se esiste l'oggetto
|
||||
return pGeomDB->ExistsObj( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetParent( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// verifico se esiste l'oggetto
|
||||
return pGeomDB->GetParentId( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetGroupGlobFrame( int nId, Frame3d& frGlob)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il riferimento globale del gruppo
|
||||
return pGeomDB->GetGroupGlobFrame( nId, frGlob) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetGroupObjs( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, 0)
|
||||
// recupero il numero di oggetti nel gruppo
|
||||
return pGeomDB->GetGroupObjs( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetFirstInGroup( int nGroupId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il primo oggetto nel gruppo
|
||||
return pGeomDB->GetFirstInGroup( nGroupId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetNext( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il prossimo oggetto nello stesso gruppo
|
||||
return pGeomDB->GetNext( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetLastInGroup( int nGroupId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero l'ultimo oggetto nel gruppo
|
||||
return pGeomDB->GetLastInGroup( nGroupId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetPrev( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il precedente oggetto nello stesso gruppo
|
||||
return pGeomDB->GetPrev( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetFirstGroupInGroup( int nGroupId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il primo gruppo nel gruppo
|
||||
return pGeomDB->GetFirstGroupInGroup( nGroupId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetNextGroup( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il prossimo gruppo nello stesso gruppo
|
||||
return pGeomDB->GetNextGroup( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetLastGroupInGroup( int nGroupId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero l'ultimo gruppo nel gruppo
|
||||
return pGeomDB->GetLastGroupInGroup( nGroupId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetPrevGroup( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il precedente gruppo nello stesso gruppo
|
||||
return pGeomDB->GetPrevGroup( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetFirstNameInGroup( int nGroupId, const string& sName)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il primo oggetto con il nome desiderato nel gruppo
|
||||
return pGeomDB->GetFirstNameInGroup( nGroupId, sName) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetNextName( int nId, const string& sName)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il prossimo oggetto nello stesso gruppo con il nome voluto
|
||||
return pGeomDB->GetNextName( nId, sName) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetLastNameInGroup( int nGroupId, const string& sName)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero l'ultimo oggetto con il nome desiderato nel gruppo
|
||||
return pGeomDB->GetLastNameInGroup( nGroupId, sName) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetPrevName( int nId, const string& sName)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il precedente oggetto nello stesso gruppo con il nome voluto
|
||||
return pGeomDB->GetPrevName( nId, sName) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetBBox( int nId, int nFlag, BBox3d& b3Box)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il bounding box dell'oggetto in locale
|
||||
return pGeomDB->GetLocalBBox( nId, b3Box, nFlag) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetBBoxGlob( int nId, int nFlag, BBox3d& b3Box)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il bounding box dell'oggetto in globale
|
||||
return pGeomDB->GetGlobalBBox( nId, b3Box, nFlag) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetBBoxRef( int nId, int nFlag, const Frame3d& frRef, BBox3d& b3Box)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il bounding box dell'oggetto nel riferimento
|
||||
return pGeomDB->GetRefBBox( nId, frRef, b3Box, nFlag) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeCopy( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// eseguo la copia
|
||||
int nNewId = pGeomDB->Copy( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtCopy(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
else
|
||||
sLua = "EgtCopy(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeCopyGlob( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// eseguo la copia mantenendo la posizione in globale
|
||||
int nNewId = pGeomDB->CopyGlob( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
else
|
||||
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRelocate( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// eseguo la rilocazione
|
||||
bool bOk = pGeomDB->Relocate( nSouId, nRefId, nSonBeforeAfter) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
else
|
||||
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRelocateGlob( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// eseguo la rilocazione mantenendo la posizione in globale
|
||||
bool bOk = pGeomDB->RelocateGlob( nSouId, nRefId, nSonBeforeAfter) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
else
|
||||
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeChangeId( int nId, int nNewId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// eseguo cambio di Id
|
||||
bool bOk = pGeomDB->ChangeId( nId, nNewId) ;
|
||||
// se pezzo corrente o layer corrente
|
||||
if ( bOk) {
|
||||
if ( nId == ExeGetCurrPart())
|
||||
ExeSetCurrPartLayer( nNewId, ExeGetCurrLayer()) ;
|
||||
else if ( nId == ExeGetCurrLayer())
|
||||
ExeSetCurrPartLayer( ExeGetCurrPart(), nNewId) ;
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtChangeId(" + ToString( nId) + "," +
|
||||
ToString( nNewId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeErase( const INTVECTOR& vIds)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// eseguo cancellazione
|
||||
bool bOk = true ;
|
||||
bool bErasedCurrPart = false ;
|
||||
bool bErasedCurrLayer = false ;
|
||||
int nCurrPartId = ExeGetCurrPart() ;
|
||||
int nCurrLayerId = ExeGetCurrLayer() ;
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// cancello
|
||||
if ( ! pGeomDB->Erase( nId))
|
||||
bOk = false ;
|
||||
// verifico se cancellato pezzo corrente o layer corrente
|
||||
if ( nId == nCurrPartId)
|
||||
bErasedCurrPart = true ;
|
||||
else if ( nId == nCurrLayerId)
|
||||
bErasedCurrLayer = true ;
|
||||
// passo al successivo
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetFirstSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtErase({" + IdListToString( vIds) + "})" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// se cancellato pezzo corrente o layer corrente (va qui perchè salva altro comando che è successivo)
|
||||
if ( bErasedCurrPart)
|
||||
ExeResetCurrPartLayer() ;
|
||||
else if ( bErasedCurrLayer)
|
||||
ExeSetCurrPartLayer( nCurrPartId, ExeGetFirstLayer( nCurrPartId, true)) ;
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeEmptyGroup( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// svuoto il gruppo
|
||||
bool bOk = pGeomDB->EmptyGroup( nId) ;
|
||||
// se cancellato pezzo corrente o layer corrente
|
||||
int nCurrPartId = ExeGetCurrPart() ;
|
||||
int nCurrLayerId = ExeGetCurrLayer() ;
|
||||
if ( ! pGeomDB->ExistsObj( nCurrPartId))
|
||||
ExeResetCurrPartLayer() ;
|
||||
else if ( ! pGeomDB->ExistsObj( nCurrLayerId))
|
||||
ExeSetCurrPartLayer( nCurrPartId, ExeGetFirstLayer( nCurrPartId, true)) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtEmptyGroup(" + ToString( nId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetType( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_TY_NONE)
|
||||
// recupero il tipo GDB
|
||||
int nType = pGeomDB->GetGdbType( nId) ;
|
||||
if ( nType == GDB_TY_GEO) {
|
||||
// recupero il tipo Geo
|
||||
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nId) ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return GDB_TY_NONE ;
|
||||
else
|
||||
return pGeoObj->GetType() ;
|
||||
}
|
||||
else if ( nType == GDB_TY_GROUP)
|
||||
return GDB_TY_GROUP ;
|
||||
else
|
||||
return GDB_TY_NONE ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetTitle( int nId, string& sTitle)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nId) ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return false ;
|
||||
// recupero la stringa del titolo
|
||||
sTitle = pGeoObj->GetTitle() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGroupDump( int nId, string& sDump)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// preparo l'intestazione
|
||||
sDump = "Group " + ToString( nId) + "\r\n" ;
|
||||
// preparo gli attributi
|
||||
pGeomDB->DumpAttributes( nId, sDump, "\r\n") ;
|
||||
// numero di nodi (figli)
|
||||
int nNodes = pGeomDB->GetGroupObjs( nId) ;
|
||||
sDump += "Nodes : " + ToString( nNodes) + "\r\n" ;
|
||||
// riferimento in globale
|
||||
Frame3d frGlob ;
|
||||
if ( pGeomDB->GetGroupGlobFrame( nId, frGlob)) {
|
||||
sDump += "GlobFrame :\r\n" ;
|
||||
sDump += " O(" + ToString( frGlob.Orig()) + ")\r\n" ;
|
||||
sDump += " X(" + ToString( frGlob.VersX()) + ")\r\n" ;
|
||||
sDump += " Y(" + ToString( frGlob.VersY()) + ")\r\n" ;
|
||||
sDump += " Z(" + ToString( frGlob.VersZ()) + ")\r\n" ;
|
||||
}
|
||||
// ingombro in globale
|
||||
BBox3d b3Glob ;
|
||||
if ( pGeomDB->GetGlobalBBox( nId, b3Glob, BBF_EXACT)) {
|
||||
sDump += "GlobBBox :\r\n" ;
|
||||
Point3d ptMin, ptMax ;
|
||||
if ( b3Glob.GetMinMax( ptMin, ptMax)) {
|
||||
sDump += " m(" + ToString( ptMin) + ")\r\n" ;
|
||||
sDump += " M(" + ToString( ptMax) + ")\r\n" ;
|
||||
}
|
||||
else {
|
||||
sDump += " Empty\r\n" ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGeoObjDump( int nId, string& sDump)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nId) ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return false ;
|
||||
// preparo l'intestazione
|
||||
sDump = pGeoObj->GetTitle() + " " + ToString( nId) + "\r\n" ;
|
||||
// preparo gli attributi
|
||||
pGeomDB->DumpAttributes( nId, sDump, "\r\n") ;
|
||||
// recupero i dati geometrici
|
||||
if ( ! pGeoObj->Dump( sDump, "\r\n"))
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
@@ -0,0 +1,451 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_GdbPartLayers.cpp Data : 04.05.15 Versione : 1.6e1
|
||||
// Contenuto : Funzioni di gestione pezzi e layer relativi per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 29.01.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EgkCurve.h"
|
||||
#include "/EgtDev/Include/EgkChainCurves.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static bool
|
||||
ExeIsUserObj( IGeomDB* pGeomDB, int nId)
|
||||
{
|
||||
int nLev ;
|
||||
return ( pGeomDB->GetCalcLevel( nId, nLev) && nLev == GDB_LV_USER) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static bool
|
||||
ExeIsVisibleObj( IGeomDB* pGeomDB, int nId)
|
||||
{
|
||||
int nStat ;
|
||||
return ( pGeomDB->GetCalcStatus( nId, nStat) && nStat != GDB_ST_OFF) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
ExeVerifyOrNext( IGeomDB* pGeomDB, int nId, bool bOnlyVisible)
|
||||
{
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
if ( ExeIsUserObj( pGeomDB, nId) &&
|
||||
( ! bOnlyVisible || ExeIsVisibleObj( pGeomDB, nId)))
|
||||
return nId ;
|
||||
nId = pGeomDB->GetNextGroup( nId) ;
|
||||
}
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeIsPart( int nPartId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico sia un pezzo (gruppo sotto la radice con livello utente)
|
||||
if ( pGeomDB->GetGdbType( nPartId) == GDB_TY_GROUP &&
|
||||
pGeomDB->GetParentId( nPartId) == GDB_ID_ROOT &&
|
||||
ExeIsUserObj( pGeomDB, nPartId))
|
||||
return true ;
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeIsLayer( int nLayerId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico sia un layer (gruppo sotto un pezzo con livello utente)
|
||||
if ( pGeomDB->GetGdbType( nLayerId) == GDB_TY_GROUP &&
|
||||
ExeIsPart( pGeomDB->GetParentId( nLayerId)) &&
|
||||
ExeIsUserObj( pGeomDB, nLayerId))
|
||||
return true ;
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetCurrPart( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, GDB_ID_NULL)
|
||||
// recupero il pezzo corrente
|
||||
return pGseCtx->m_nCurrPart ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetCurrLayer( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, GDB_ID_NULL)
|
||||
// recupero il pezzo corrente
|
||||
return pGseCtx->m_nCurrLayer ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetCurrPartLayer( int nPartId, int nLayerId)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
IGeomDB* pGeomDB = pGseCtx->m_pGeomDB ;
|
||||
bool bOk = true ;
|
||||
// verifico validità e visibilità pezzo
|
||||
if ( pGeomDB->GetParentId( nPartId) == GDB_ID_ROOT &&
|
||||
ExeIsUserObj( pGeomDB, nPartId) &&
|
||||
ExeIsVisibleObj( pGeomDB, nPartId)) {
|
||||
if ( nPartId != pGseCtx->m_nCurrPart)
|
||||
pGseCtx->m_nCurrLayer = GDB_ID_NULL ;
|
||||
pGseCtx->m_nCurrPart = nPartId ;
|
||||
}
|
||||
else {
|
||||
if ( nPartId == pGseCtx->m_nCurrPart || nPartId == GDB_ID_NULL) {
|
||||
pGseCtx->m_nCurrPart = GDB_ID_NULL ;
|
||||
pGseCtx->m_nCurrLayer = GDB_ID_NULL ;
|
||||
}
|
||||
bOk = false ;
|
||||
}
|
||||
// verifico validità e visibilità layer
|
||||
if ( pGeomDB->GetParentId( nLayerId) == nPartId &&
|
||||
ExeIsUserObj( pGeomDB, nLayerId) &&
|
||||
ExeIsVisibleObj( pGeomDB, nLayerId)) {
|
||||
pGseCtx->m_nCurrLayer = nLayerId ;
|
||||
}
|
||||
else {
|
||||
if ( nLayerId == pGseCtx->m_nCurrLayer || nLayerId == GDB_ID_NULL)
|
||||
pGseCtx->m_nCurrLayer = GDB_ID_NULL ;
|
||||
bOk = false ;
|
||||
}
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSetCurrPartLayer(" + ToString( nPartId) + "," +
|
||||
ToString( nLayerId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeResetCurrPartLayer( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
IGeomDB* pGeomDB = pGseCtx->m_pGeomDB ;
|
||||
// reset
|
||||
pGseCtx->m_nCurrPart = GDB_ID_NULL ;
|
||||
pGseCtx->m_nCurrLayer = GDB_ID_NULL ;
|
||||
// cerco il primo pezzo con un layer visibile
|
||||
int nPartId = ExeGetFirstPart( true) ;
|
||||
while ( nPartId != GDB_ID_NULL) {
|
||||
// cerco il primo layer visibile del pezzo
|
||||
int nLayerId = ExeGetFirstLayer( nPartId, true) ;
|
||||
if ( nLayerId != GDB_ID_NULL) {
|
||||
// assegno il pezzo corrente
|
||||
pGseCtx->m_nCurrPart = nPartId ;
|
||||
// assegno il layer corrente
|
||||
pGseCtx->m_nCurrLayer = nLayerId ;
|
||||
// esco dal ciclo di ricerca
|
||||
break ;
|
||||
}
|
||||
nPartId = ExeGetNextPart( nPartId, true) ;
|
||||
}
|
||||
// se non ho trovato layer visibile mi accontento del primo pezzo visibile
|
||||
if ( pGseCtx->m_nCurrPart == GDB_ID_NULL)
|
||||
pGseCtx->m_nCurrPart = ExeGetFirstPart( true) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtResetCurrPartLayer()"
|
||||
" -- Ids=" + ToString( pGseCtx->m_nCurrPart) + "," + ToString( pGseCtx->m_nCurrLayer) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetPartNbr( bool bOnlyVisible)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, 0)
|
||||
// conto i pezzi, considerando richiesta di visibilità
|
||||
int nCount = 0 ;
|
||||
int nPartId = ExeGetFirstPart( bOnlyVisible) ;
|
||||
while ( nPartId != GDB_ID_NULL) {
|
||||
++ nCount ;
|
||||
nPartId = ExeGetNextPart( nPartId, bOnlyVisible) ;
|
||||
}
|
||||
return nCount ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetFirstPart( bool bOnlyVisible)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il primo gruppo sotto la radice
|
||||
int nPartId = pGeomDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
|
||||
// verifico oppure passo al primo successivo valido
|
||||
return ExeVerifyOrNext( pGeomDB, nPartId, bOnlyVisible) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetNextPart( int nId, bool bOnlyVisible)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il successivo gruppo
|
||||
int nPartId = pGeomDB->GetNextGroup( nId) ;
|
||||
// verifico oppure passo al primo successivo valido
|
||||
return ExeVerifyOrNext( pGeomDB, nPartId, bOnlyVisible) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetFirstLayer( int nPartId, bool bOnlyVisible)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// verifico il pezzo (livello utente e se richiesto visibile)
|
||||
if ( ! ExeIsUserObj( pGeomDB, nPartId) ||
|
||||
( bOnlyVisible && ! ExeIsVisibleObj( pGeomDB, nPartId)))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il primo layer nel pezzo
|
||||
int nLayerId = pGeomDB->GetFirstGroupInGroup( nPartId) ;
|
||||
// verifico oppure passo al primo successivo valido
|
||||
return ExeVerifyOrNext( pGeomDB, nLayerId, bOnlyVisible) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetNextLayer( int nId, bool bOnlyVisible)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il successivo gruppo
|
||||
int nLayerId = pGeomDB->GetNextGroup( nId) ;
|
||||
// verifico sia visibile oppure passo al primo successivo visibile
|
||||
return ExeVerifyOrNext( pGeomDB, nLayerId, bOnlyVisible) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSelectPartObjs( int nPartId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// verifico sia veramente un pezzo
|
||||
if ( ExeIsPart( nPartId)) {
|
||||
// ciclo sugli oggetti del pezzo
|
||||
int nId = pGeomDB->GetFirstInGroup( nPartId) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// se è gruppo seleziono i suoi componenti
|
||||
if ( pGeomDB->GetGdbType( nId) == GDB_TY_GROUP)
|
||||
pGeomDB->SelectGroupObjs( nId) ;
|
||||
// altrimenti lo seleziono direttamente
|
||||
else
|
||||
pGeomDB->SelectObj( nId) ;
|
||||
// passo al successivo
|
||||
nId = pGeomDB->GetNext( nId) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
bOk = false ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSelectPartObjs(" + ToString( nPartId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeDeselectPartObjs( int nPartId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// verifico sia veramente un pezzo
|
||||
if ( ExeIsPart( nPartId)) {
|
||||
// ciclo sugli oggetti del pezzo
|
||||
int nId = pGeomDB->GetFirstInGroup( nPartId) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// se è gruppo deseleziono i suoi componenti
|
||||
if ( pGeomDB->GetGdbType( nId) == GDB_TY_GROUP)
|
||||
pGeomDB->DeselectGroupObjs( nId) ;
|
||||
// altrimenti lo deseleziono direttamente
|
||||
else
|
||||
pGeomDB->DeselectObj( nId) ;
|
||||
// passo al successivo
|
||||
nId = pGeomDB->GetNext( nId) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
bOk = false ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtDeselectPartObjs(" + ToString( nPartId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSelectLayerObjs( int nLayerId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// verifico sia veramente un layer
|
||||
if ( ExeIsLayer( nLayerId)) {
|
||||
// ciclo sugli oggetti del layer
|
||||
int nId = pGeomDB->GetFirstInGroup( nLayerId) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// seleziono
|
||||
pGeomDB->SelectObj( nId) ;
|
||||
// passo al successivo
|
||||
nId = pGeomDB->GetNext( nId) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
bOk = false ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSelectLayerObjs(" + ToString( nLayerId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeDeselectLayerObjs( int nLayerId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// verifico sia veramente un layer
|
||||
if ( ExeIsLayer( nLayerId)) {
|
||||
// ciclo sugli oggetti del layer
|
||||
int nId = pGeomDB->GetFirstInGroup( nLayerId) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// deseleziono
|
||||
pGeomDB->DeselectObj( nId) ;
|
||||
// passo al successivo
|
||||
nId = pGeomDB->GetNext( nId) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
bOk = false ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtDeselectLayerObjs(" + ToString( nLayerId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSelectPathObjs( int nId, bool bHaltOnFork)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico appartenga ad un layer
|
||||
int nIdLayer = pGeomDB->GetParentId( nId) ;
|
||||
int nIdPart = pGeomDB->GetParentId( nIdLayer) ;
|
||||
bool bOk = ( nIdLayer != GDB_ID_NULL && nIdPart != GDB_ID_NULL && ExeIsLayer( nIdLayer)) ;
|
||||
// seleziono percorso a partire da entità indicata usando tutte le curve del pezzo
|
||||
const int CHAIN_SIZE = 1000 ;
|
||||
const double CHAIN_TOLER = 10 * EPS_SMALL ;
|
||||
Point3d ptNear ;
|
||||
ChainCurves chainC ;
|
||||
bOk = bOk && chainC.Init( true, CHAIN_TOLER, CHAIN_SIZE) ;
|
||||
// ciclo sui layer del pezzo
|
||||
for ( int nLayId = pGeomDB->GetFirstGroupInGroup( nIdPart) ;
|
||||
nLayId != GDB_ID_NULL ;
|
||||
nLayId = pGeomDB->GetNextGroup( nLayId)) {
|
||||
// ciclo sulle entità del layer
|
||||
for ( int nEntId = pGeomDB->GetFirstInGroup( nLayId) ;
|
||||
nEntId != GDB_ID_NULL ;
|
||||
nEntId = pGeomDB->GetNext( nEntId)) {
|
||||
// non deve essere nascosta
|
||||
int nEntStat ;
|
||||
pGeomDB->GetCalcStatus( nEntId, nEntStat) ;
|
||||
if ( nEntStat == GDB_ST_OFF)
|
||||
continue ;
|
||||
// recupero la curva e il suo riferimento
|
||||
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nEntId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
continue ;
|
||||
Frame3d frCrv ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nEntId, frCrv))
|
||||
continue ;
|
||||
// recupero i dati della curva necessari al concatenamento e li assegno
|
||||
Point3d ptStart, ptEnd ;
|
||||
Vector3d vtStart, vtEnd ;
|
||||
if ( ! pCrv->GetStartPoint( ptStart) || ! pCrv->GetStartDir( vtStart) ||
|
||||
! pCrv->GetEndPoint( ptEnd) || ! pCrv->GetEndDir( vtEnd))
|
||||
return GDB_ID_NULL ;
|
||||
ptStart.ToGlob( frCrv) ;
|
||||
vtStart.ToGlob( frCrv) ;
|
||||
ptEnd.ToGlob( frCrv) ;
|
||||
vtEnd.ToGlob( frCrv) ;
|
||||
if ( nEntId == nId)
|
||||
ptNear = ptStart + vtStart ;
|
||||
if ( ! chainC.AddCurve( nEntId, ptStart, vtStart, ptEnd, vtEnd))
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
// recupero il primo percorso concatenato
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
INTVECTOR vId2s ;
|
||||
bOk = bOk && chainC.GetChainFromNear( ptNear, ( bHaltOnFork != FALSE), vId2s) ;
|
||||
for ( size_t i = 0 ; i < vId2s.size() ; ++i) {
|
||||
pGeomDB->SetStatus( abs( vId2s[i]), GDB_ST_SEL) ;
|
||||
}
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSelectPathObjs(" + ToString( nId) + "," +
|
||||
( bHaltOnFork ? "true" : "false") + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
+304
@@ -0,0 +1,304 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : API_General.cpp Data : 01.09.14 Versione : 1.5i1
|
||||
// Contenuto : Funzioni generali per API.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 01.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "LUA_Base.h"
|
||||
#include "DllGraphics.h"
|
||||
#include "DllExchange.h"
|
||||
#include "DllMachKernel.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeDllMain.h"
|
||||
#include "/EgtDev/Include/EGnDllMain.h"
|
||||
#include "/EgtDev/Include/ENkDllMain.h"
|
||||
#include "/EgtDev/Include/EGkDllMain.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EGnPcInfo.h"
|
||||
#include "/EgtDev/Include/EgtLogger.h"
|
||||
#include <fstream>
|
||||
|
||||
using namespace std ;
|
||||
using namespace egtlogger ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static Logger* s_pGenLog = nullptr ;
|
||||
static bool s_bCmdLog = false ;
|
||||
static Logger* s_pCmdLog = nullptr ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeInit( int nDebug, const string& sLogFile, const string& sLogMsg)
|
||||
{
|
||||
// cancello eventuali vecchi contesti
|
||||
ClearAllGseContexts() ;
|
||||
// cancello eventuale vecchio logger
|
||||
if ( s_pGenLog != nullptr)
|
||||
delete s_pGenLog ;
|
||||
|
||||
// creo il logger generale
|
||||
s_pGenLog = new Logger( ( nDebug > 0 ? LL_DEBUG : LL_INFO), "EgtInterface") ;
|
||||
if ( s_pGenLog == nullptr)
|
||||
return false ;
|
||||
// assegno il file
|
||||
s_pGenLog->AddOutputStream( new ofstream( stringtoW( sLogFile)), true) ;
|
||||
// lo passo alle DLL
|
||||
SetEGnLogger( s_pGenLog) ;
|
||||
SetENkLogger( s_pGenLog) ;
|
||||
SetEGkLogger( s_pGenLog) ;
|
||||
|
||||
// carico librerie opzionali
|
||||
LoadGraphicsDll() ;
|
||||
MySetEGrLogger( s_pGenLog) ;
|
||||
LoadExchangeDll() ;
|
||||
MySetEExLogger( s_pGenLog) ;
|
||||
LoadMachKernelDll() ;
|
||||
MySetEMkLogger( s_pGenLog) ;
|
||||
|
||||
// dichiaro inizio programma
|
||||
LOG_DATETIME( s_pGenLog, " Init")
|
||||
// eventuale messaggio dall'applicazione
|
||||
if ( &sLogMsg != nullptr && ! sLogMsg.empty())
|
||||
LOG_INFO( s_pGenLog, sLogMsg.c_str())
|
||||
// versione di interfaccia e componenti
|
||||
string sVer ;
|
||||
ExeGetVersionInfo( sVer, "\n") ;
|
||||
LOG_INFO( s_pGenLog, sVer.c_str())
|
||||
// Info sul sistema
|
||||
string sTmp ;
|
||||
if ( GetOsInfo( sTmp))
|
||||
LOG_INFO( s_pGenLog, sTmp.c_str())
|
||||
if ( GetCpuInfo( sTmp))
|
||||
LOG_INFO( s_pGenLog, sTmp.c_str())
|
||||
if ( GetMemoryInfo( sTmp))
|
||||
LOG_INFO( s_pGenLog, sTmp.c_str())
|
||||
|
||||
// inizializzo l'interprete LUA
|
||||
LuaInit() ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeExit( void)
|
||||
{
|
||||
// cancello tutti i contesti
|
||||
ClearAllGseContexts() ;
|
||||
|
||||
// termino l'interprete LUA
|
||||
LuaExit() ;
|
||||
|
||||
// libero le librerie opzionali
|
||||
FreeMachKernelDll() ;
|
||||
FreeExchangeDll() ;
|
||||
FreeGraphicsDll() ;
|
||||
|
||||
// fine programma
|
||||
LOG_DATETIME( s_pGenLog, " Exit")
|
||||
|
||||
// cancello il logger dei comandi
|
||||
if ( s_pCmdLog != nullptr) {
|
||||
delete s_pCmdLog ;
|
||||
s_pCmdLog = nullptr ;
|
||||
}
|
||||
|
||||
// cancello il logger generale
|
||||
if ( s_pGenLog != nullptr) {
|
||||
delete s_pGenLog ;
|
||||
s_pGenLog = nullptr ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetKey( const string& sKey)
|
||||
{
|
||||
SetEGkKey( sKey) ;
|
||||
MySetEGrKey( sKey) ;
|
||||
MySetEExKey( sKey) ;
|
||||
MySetEMkKey( sKey) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetFont( const string& sNfeFontDir, const string& sDefaultFont)
|
||||
{
|
||||
// inizializzazioni gestore font Nfe
|
||||
InitFontManager( sNfeFontDir, sDefaultFont) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetNfeFontDir( string& sNfeFontDir)
|
||||
{
|
||||
if ( &sNfeFontDir == nullptr)
|
||||
return false ;
|
||||
// recupero il nome del font di default
|
||||
sNfeFontDir = GetNfeFontDir() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetDefaultFont( string& sDefaultFont)
|
||||
{
|
||||
if ( &sDefaultFont == nullptr)
|
||||
return false ;
|
||||
// recupero il nome del font di default
|
||||
sDefaultFont = GetDefaultFont() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetLuaLibs( const string& sLuaLibsDir)
|
||||
{
|
||||
return LuaSetLuaLibsDir( sLuaLibsDir) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetCommandLogger( const string& sLogFile)
|
||||
{
|
||||
// cancello eventuale vecchio logger e disabilito output
|
||||
if ( s_pCmdLog != nullptr)
|
||||
delete s_pCmdLog ;
|
||||
s_bCmdLog = false ;
|
||||
// creo il logger dei comandi
|
||||
s_pCmdLog = new Logger( LL_INFO, "EgtCommandLog") ;
|
||||
if ( s_pCmdLog == nullptr)
|
||||
return false ;
|
||||
// assegno il file
|
||||
ofstream* pLogFile = new ofstream( stringtoW( sLogFile)) ;
|
||||
if ( pLogFile == nullptr || pLogFile->bad())
|
||||
return false ;
|
||||
s_pCmdLog->AddOutputStream( pLogFile, true) ;
|
||||
// scrivo intestazione
|
||||
string sOut = "-- " + CurrDateTime() + " EgtCommandLog" ;
|
||||
LOG_INFO( s_pCmdLog, sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
ExeEnableCommandLogger( void)
|
||||
{
|
||||
SetCmdLog( true) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
ExeDisableCommandLogger( void)
|
||||
{
|
||||
SetCmdLog( false) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetVersionInfo( string& sVer, const char* szNewLine)
|
||||
{
|
||||
// verifico il parametro
|
||||
if ( &sVer == nullptr)
|
||||
return false ;
|
||||
// recupero le informazioni sulle DLL sempre presenti
|
||||
sVer += GetEXeVersion() ;
|
||||
sVer += szNewLine ;
|
||||
sVer += GetEGnVersion() ;
|
||||
sVer += szNewLine ;
|
||||
sVer += GetENkVersion() ;
|
||||
sVer += szNewLine ;
|
||||
sVer += GetEGkVersion() ;
|
||||
// recupero le informazioni sulle DLL opzionali
|
||||
if ( IsLoadedGraphicsDll()) {
|
||||
sVer += szNewLine ;
|
||||
sVer += MyGetEGrVersion() ;
|
||||
}
|
||||
if ( IsLoadedExchangeDll()) {
|
||||
sVer += szNewLine ;
|
||||
sVer += MyGetEExVersion() ;
|
||||
}
|
||||
if ( IsLoadedMachKernelDll()) {
|
||||
sVer += szNewLine ;
|
||||
sVer += MyGetEMkVersion() ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetOsInfo( string& sOs)
|
||||
{
|
||||
// recupero le informazioni sul sistema operativo
|
||||
return GetOsInfo( sOs) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetCpuInfo( string& sCpu)
|
||||
{
|
||||
// recupero le informazioni sulla Cpu
|
||||
return GetCpuInfo( sCpu) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetMemoryInfo( string& sMem)
|
||||
{
|
||||
// recupero le informazioni sulla memoria presente
|
||||
return GetMemoryInfo( sMem) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtOutLog( const wchar_t* sMsg)
|
||||
{
|
||||
LOG_INFO( s_pGenLog, LPSTR( WtoA( sMsg)))
|
||||
return ( s_pGenLog != nullptr) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
ILogger*
|
||||
GetLogger( void)
|
||||
{
|
||||
return s_pGenLog ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ILogger*
|
||||
GetCmdLogger( void)
|
||||
{
|
||||
return s_pCmdLog ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
SetCmdLog( bool bVal)
|
||||
{
|
||||
swap( bVal, s_bCmdLog) ;
|
||||
return bVal ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
IsCmdLog( void)
|
||||
{
|
||||
return s_bCmdLog ;
|
||||
}
|
||||
+958
@@ -0,0 +1,958 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_GeoSnap.cpp Data : 05.05.15 Versione : 1.6e1
|
||||
// Contenuto : Funzioni di snap ad oggetti del DB geometrico per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 02.10.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EgkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EgkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EgkCurve.h"
|
||||
#include "/EgtDev/Include/EgkCurveArc.h"
|
||||
#include "/EgtDev/Include/EgkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EgkSurf.h"
|
||||
#include "/EgtDev/Include/EgkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EgkExtText.h"
|
||||
#include "/EgtDev/Include/EgkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EgkIntersCurveCurve.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
TrasformPoint( IGeomDB* pGeomDB, int nId, int nRefId, Point3d& ptP)
|
||||
{
|
||||
// se non va trasformato, esco
|
||||
if ( nRefId == nId)
|
||||
return true ;
|
||||
// recupero il riferimento in cui è espresso il punto (quello dell'entità da cui deriva)
|
||||
Frame3d frSou ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frSou))
|
||||
return false ;
|
||||
// se va portato in globale, trasformo ed esco
|
||||
if ( nRefId == GDB_ID_ROOT)
|
||||
return ptP.ToGlob( frSou) ;
|
||||
// recupero il riferimento destinazione
|
||||
Frame3d frDest ;
|
||||
if ( nRefId == GDB_ID_GRID)
|
||||
frDest = pGeomDB->GetGridFrame() ;
|
||||
else {
|
||||
// nRefId può essere un gruppo o una entità
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nRefId, frDest) &&
|
||||
! pGeomDB->GetGlobFrame( nRefId, frDest))
|
||||
return false ;
|
||||
}
|
||||
// eseguo la trasformazione
|
||||
return ptP.LocToLoc( frSou, frDest) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
InvTrasformPoint( IGeomDB* pGeomDB, int nId, int nRefId, Point3d& ptP)
|
||||
{
|
||||
// se non va trasformato, esco
|
||||
if ( nRefId == nId)
|
||||
return true ;
|
||||
// recupero il riferimento in cui va espresso il punto (quello dell'entità a cui va riferito)
|
||||
Frame3d frSou ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frSou))
|
||||
return false ;
|
||||
// se viene da globale, trasformo ed esco
|
||||
if ( nRefId == GDB_ID_ROOT)
|
||||
return ptP.ToLoc( frSou) ;
|
||||
// recupero il riferimento da cui proviene
|
||||
Frame3d frDest ;
|
||||
if ( nRefId == GDB_ID_GRID)
|
||||
frDest = pGeomDB->GetGridFrame() ;
|
||||
else {
|
||||
// nRefId può essere un gruppo o una entità
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nRefId, frDest) &&
|
||||
! pGeomDB->GetGlobFrame( nRefId, frDest))
|
||||
return false ;
|
||||
}
|
||||
// eseguo la trasformazione inversa
|
||||
return ptP.LocToLoc( frDest, frSou) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
TrasformVector( IGeomDB* pGeomDB, int nId, int nRefId, Vector3d& vtV)
|
||||
{
|
||||
// se non va trasformato, esco
|
||||
if ( nRefId == nId)
|
||||
return true ;
|
||||
// recupero il riferimento in cui è espresso il punto (quello dell'entità da cui deriva)
|
||||
Frame3d frSou ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frSou))
|
||||
return false ;
|
||||
// se va portato in globale, trasformo ed esco
|
||||
if ( nRefId == GDB_ID_ROOT)
|
||||
return vtV.ToGlob( frSou) ;
|
||||
// recupero il riferimento destinazione
|
||||
Frame3d frDest ;
|
||||
if ( nRefId == GDB_ID_GRID)
|
||||
frDest = pGeomDB->GetGridFrame() ;
|
||||
else {
|
||||
// nRefId può essere un gruppo o una entità
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nRefId, frDest) &&
|
||||
! pGeomDB->GetGlobFrame( nRefId, frDest))
|
||||
return false ;
|
||||
}
|
||||
// eseguo la trasformazione
|
||||
return vtV.LocToLoc( frSou, frDest) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
TrasformFrame( IGeomDB* pGeomDB, int nId, int nRefId, Frame3d& frF)
|
||||
{
|
||||
// se non va trasformato, esco
|
||||
if ( nRefId == nId)
|
||||
return true ;
|
||||
// recupero il riferimento in cui è espresso il punto (quello dell'entità da cui deriva)
|
||||
Frame3d frSou ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frSou))
|
||||
return false ;
|
||||
// se va portato in globale, trasformo ed esco
|
||||
if ( nRefId == GDB_ID_ROOT)
|
||||
return frF.ToGlob( frSou) ;
|
||||
// recupero il riferimento destinazione
|
||||
Frame3d frDest ;
|
||||
if ( nRefId == GDB_ID_GRID)
|
||||
frDest = pGeomDB->GetGridFrame() ;
|
||||
else {
|
||||
// nRefId può essere un gruppo o una entità
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nRefId, frDest) &&
|
||||
! pGeomDB->GetGlobFrame( nRefId, frDest))
|
||||
return false ;
|
||||
}
|
||||
// eseguo la trasformazione
|
||||
return frF.LocToLoc( frSou, frDest) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeStartPoint( int nId, int nRefId, Point3d& ptP)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// se punto
|
||||
if ( pGObj->GetType() == GEO_PNT3D) {
|
||||
// recupero il geo-punto
|
||||
const IGeoPoint3d* pGP = GetGeoPoint3d( pGObj) ;
|
||||
// assegno il punto
|
||||
ptP = pGP->GetPoint() ;
|
||||
}
|
||||
// se vettore
|
||||
else if ( pGObj->GetType() == GEO_VECT3D) {
|
||||
// recupero il geo-vettore
|
||||
const IGeoVector3d* pGV = GetGeoVector3d( pGObj) ;
|
||||
// assegno il punto
|
||||
ptP = pGV->GetBase() ;
|
||||
}
|
||||
// se frame
|
||||
else if ( pGObj->GetType() == GEO_FRAME3D) {
|
||||
// recupero il frame
|
||||
const IGeoFrame3d* pGF = GetGeoFrame3d( pGObj) ;
|
||||
// assegno il punto
|
||||
ptP = pGF->GetFrame().Orig() ;
|
||||
}
|
||||
// se curva
|
||||
else if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
// assegno il punto
|
||||
if ( pCrv == nullptr || ! pCrv->GetStartPoint( ptP))
|
||||
return false ;
|
||||
}
|
||||
// se testo
|
||||
else if ( pGObj->GetType() == EXT_TEXT) {
|
||||
// recupero il testo
|
||||
const IExtText* pTxt = GetExtText( pGObj) ;
|
||||
// assegno il punto
|
||||
if ( pTxt == nullptr || ! pTxt->GetStartPoint( ptP))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformPoint( pGeomDB, nId, nRefId, ptP) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeEndPoint( int nId, int nRefId, Point3d& ptP)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
if ( pCrv == nullptr || ! pCrv->GetEndPoint( ptP))
|
||||
return false ;
|
||||
}
|
||||
// se testo
|
||||
else if ( pGObj->GetType() == EXT_TEXT) {
|
||||
// recupero il testo
|
||||
const IExtText* pTxt = GetExtText( pGObj) ;
|
||||
if ( pTxt == nullptr || ! pTxt->GetEndPoint( ptP))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformPoint( pGeomDB, nId, nRefId, ptP) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeMidPoint( int nId, int nRefId, Point3d& ptP)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
// assegno il punto
|
||||
if ( pCrv == nullptr || ! pCrv->GetMidPoint( ptP))
|
||||
return false ;
|
||||
}
|
||||
// se testo
|
||||
else if ( pGObj->GetType() == EXT_TEXT) {
|
||||
// recupero il testo
|
||||
const IExtText* pTxt = GetExtText( pGObj) ;
|
||||
// assegno il punto
|
||||
if ( pTxt == nullptr || ! pTxt->GetMidPoint( ptP))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformPoint( pGeomDB, nId, nRefId, ptP) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCenterPoint( int nId, int nRefId, Point3d& ptP)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
// assegno il punto
|
||||
if ( pCrv == nullptr || ! pCrv->GetCenterPoint( ptP))
|
||||
return false ;
|
||||
}
|
||||
// se testo
|
||||
else if ( pGObj->GetType() == EXT_TEXT) {
|
||||
// recupero il testo
|
||||
const IExtText* pTxt = GetExtText( pGObj) ;
|
||||
// assegno il punto
|
||||
if ( pTxt == nullptr || ! pTxt->GetCenterPoint( ptP))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformPoint( pGeomDB, nId, nRefId, ptP) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCentroid( int nId, int nRefId, Point3d& ptP)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
// assegno il punto
|
||||
if ( pCrv == nullptr || ! pCrv->GetCentroid( ptP))
|
||||
return false ;
|
||||
}
|
||||
// se superficie
|
||||
else if ( ( pGObj->GetType() & GEO_SURF) != 0) {
|
||||
// recupero la superficie
|
||||
const ISurf* pSrf = GetSurf( pGObj) ;
|
||||
// assegno il punto
|
||||
if ( pSrf == nullptr || ! pSrf->GetCentroid( ptP))
|
||||
return false ;
|
||||
}
|
||||
// se testo
|
||||
else if ( pGObj->GetType() == EXT_TEXT) {
|
||||
// recupero il testo
|
||||
const IExtText* pTxt = GetExtText( pGObj) ;
|
||||
// assegno il punto
|
||||
if ( pTxt == nullptr || ! pTxt->GetCenterPoint( ptP))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformPoint( pGeomDB, nId, nRefId, ptP) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeAtParamPoint( int nId, double dU, int nRefId, Point3d& ptP)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
if ( pCrv == nullptr || ! pCrv->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformPoint( pGeomDB, nId, nRefId, ptP) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeNearPoint( int nId, const Point3d& ptNear, int nRefId, Point3d& ptP)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ;
|
||||
if ( pGObj == nullptr)
|
||||
return false ;
|
||||
// porto il punto near nel riferimento dell'entità
|
||||
Point3d ptNearL = ptNear ;
|
||||
if ( ! InvTrasformPoint( pGeomDB, nId, nRefId, ptNearL))
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
// calcolo il punto della curva più vicino al punto di riferimento
|
||||
DistPointCurve dstPC( ptNearL, *pCrv) ;
|
||||
int nFlag ;
|
||||
if ( ! dstPC.GetMinDistPoint( 0, ptP, nFlag))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformPoint( pGeomDB, nId, nRefId, ptP) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Point3d& ptP)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// devono essere entità geometriche
|
||||
const IGeoObj* pGObj1 ;
|
||||
if ( ( pGObj1 = pGeomDB->GetGeoObj( nId1)) == nullptr)
|
||||
return false ;
|
||||
const IGeoObj* pGObj2 ;
|
||||
if ( ( pGObj2 = pGeomDB->GetGeoObj( nId2)) == nullptr)
|
||||
return false ;
|
||||
// se curve
|
||||
if ( ( pGObj1->GetType() & GEO_CURVE) != 0 && ( pGObj2->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero le curve
|
||||
const ICurve* pCrv1 = GetCurve( pGObj1) ;
|
||||
const ICurve* pCrv2 = GetCurve( pGObj2) ;
|
||||
// recupero i riferimenti in cui sono immerse
|
||||
Frame3d frEnt1 ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId1, frEnt1))
|
||||
return false ;
|
||||
Frame3d frEnt2 ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId2, frEnt2))
|
||||
return false ;
|
||||
// se il riferimento della seconda curva è diverso da quello della prima entità, devo trasformarla
|
||||
PtrOwner<ICurve> crvTrans( nullptr) ;
|
||||
if ( ! AreSameFrame( frEnt1, frEnt2)) {
|
||||
crvTrans.Set( pCrv2->Clone()) ;
|
||||
if ( IsNull( crvTrans))
|
||||
return false ;
|
||||
crvTrans->LocToLoc( frEnt2, frEnt1) ;
|
||||
pCrv2 = ::Get( crvTrans) ;
|
||||
}
|
||||
// porto il punto Near nel riferimento della prima entità
|
||||
Point3d ptNearL = ptNear ;
|
||||
if ( ! InvTrasformPoint( pGeomDB, nId1, nRefId, ptNearL))
|
||||
return false ;
|
||||
// calcolo il punto di intersezione sulla prima curva più vicino al punto di riferimento
|
||||
IntersCurveCurve intCC( *pCrv1, *pCrv2, true) ;
|
||||
if ( ! intCC.GetIntersPointNearTo( 0, ptNearL, ptP))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformPoint( pGeomDB, nId1, nRefId, ptP) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeStartVector( int nId, int nRefId, Vector3d& vtV)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ;
|
||||
if ( pGObj == nullptr)
|
||||
return false ;
|
||||
// se vettore
|
||||
if ( pGObj->GetType() == GEO_VECT3D) {
|
||||
// recupero il geo-vettore
|
||||
const IGeoVector3d* pGV = GetGeoVector3d( pGObj) ;
|
||||
// assegno il vettore
|
||||
vtV = pGV->GetVector() ;
|
||||
}
|
||||
// se curva
|
||||
else if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
// assegno il vettore
|
||||
if ( ! pCrv->GetStartDir( vtV))
|
||||
return false ;
|
||||
}
|
||||
// se testo
|
||||
else if ( pGObj->GetType() == EXT_TEXT) {
|
||||
// recupero il testo
|
||||
const IExtText* pTxt = GetExtText( pGObj) ;
|
||||
// assegno il vettore
|
||||
vtV = pTxt->GetDirVersor() ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformVector( pGeomDB, nId, nRefId, vtV) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeEndVector( int nId, int nRefId, Vector3d& vtV)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ;
|
||||
if ( pGObj == nullptr)
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
// assegno il vettore
|
||||
if ( ! pCrv->GetEndDir( vtV))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformVector( pGeomDB, nId, nRefId, vtV) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeMidVector( int nId, int nRefId, Vector3d& vtV)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
// assegno il vettore
|
||||
if ( ! pCrv->GetMidDir( vtV))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformVector( pGeomDB, nId, nRefId, vtV) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeAtParamVector( int nId, double dU, int nSide, int nRefId, Vector3d& vtV)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
// assegno il lato di approccio
|
||||
ICurve::Side nSide = ICurve::FROM_MINUS ;
|
||||
if ( nSide > 0)
|
||||
nSide = ICurve::FROM_PLUS ;
|
||||
// recupero la direzione
|
||||
Point3d ptP ;
|
||||
if ( ! pCrv->GetPointTang( dU, nSide, ptP, vtV))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformVector( pGeomDB, nId, nRefId, vtV) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeFrame( int nId, int nRefId, Frame3d& frFrame)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se gruppo
|
||||
if ( pGeomDB->GetGroupFrame( nId, frFrame))
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformFrame( pGeomDB, nId, nRefId, frFrame) ;
|
||||
// se geo frame
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) != nullptr &&
|
||||
pGObj->GetType() == GEO_FRAME3D) {
|
||||
frFrame = GetGeoFrame3d( pGObj)->GetFrame() ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformFrame( pGeomDB, nId, nRefId, frFrame) ;
|
||||
}
|
||||
// errore
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCurveLength( int nId, double* pdLen)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( pdLen == nullptr)
|
||||
return false ;
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
// recupero la lunghezza
|
||||
return pCurve->GetLength( *pdLen) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCurveLengthAtPoint( int nId, const Point3d& ptOn, double dExtend, double* pdLen)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( pdLen == nullptr)
|
||||
return false ;
|
||||
// recupero la curva
|
||||
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
// determino la posizione parametrica del punto sulla curva (con tolleranza)
|
||||
int nFlag ;
|
||||
double dU ;
|
||||
if ( ! DistPointCurve( ptOn, *pCurve).GetParamAtMinDistPoint( 0, dU, nFlag) || nFlag != MDPCI_NORMAL)
|
||||
return false ;
|
||||
// se non richiesta estensione o punto interno alla curva, recupero la lunghezza alla posizione parametrica
|
||||
if ( dExtend < EPS_SMALL ||
|
||||
( ! pCurve->IsStartParam( dU) && ! pCurve->IsEndParam( dU)))
|
||||
return ( pCurve->GetLengthAtParam( dU, *pdLen) ? true : false) ;
|
||||
// allungo la curva dalla parte del punto
|
||||
PtrOwner<ICurve> pCopy( pCurve->Clone()) ;
|
||||
if ( IsNull( pCopy))
|
||||
return false ;
|
||||
double dDeltaIni ;
|
||||
if ( pCopy->IsStartParam( dU)) {
|
||||
pCopy->ExtendStartByLen( dExtend) ;
|
||||
dDeltaIni = dExtend ;
|
||||
}
|
||||
else {
|
||||
pCopy->ExtendEndByLen( dExtend) ;
|
||||
dDeltaIni = 0 ;
|
||||
}
|
||||
if ( ! DistPointCurve( ptOn, *pCopy).GetParamAtMinDistPoint( 0, dU, nFlag) || nFlag != MDPCI_NORMAL)
|
||||
return false ;
|
||||
if ( pCopy->GetLengthAtParam( dU, *pdLen)) {
|
||||
*pdLen -= dDeltaIni ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCurveExtrusion( int nId, int nRefId, Vector3d& vtExtr)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
// ne ricavo il vettore estrusione
|
||||
if ( pCurve == nullptr || ! pCurve->GetExtrusion( vtExtr))
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformVector( pGeomDB, nId, nRefId, vtExtr) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCurveThickness( int nId, double* pdThick)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( pdThick == nullptr)
|
||||
return false ;
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
// recupero lo spessore
|
||||
return ( pCurve != nullptr && pCurve->GetThickness( *pdThick)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetMinDistPointCurve( const Point3d& ptP, int nId, double* pdDist)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico i parametri
|
||||
if ( pdDist == nullptr)
|
||||
return false ;
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
// calcolo la minima distanza
|
||||
DistPointCurve distPC( ptP, *pCurve) ;
|
||||
return distPC.GetDist( *pdDist) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetMinDistPntSidePointCurve( const Point3d& ptP, int nId, const Vector3d& vtN,
|
||||
double* pdDist, Point3d& ptMin, int* pnSide)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico i parametri
|
||||
if ( pdDist == nullptr || pnSide == nullptr || &ptMin == nullptr)
|
||||
return false ;
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
// calcolo la minima distanza
|
||||
DistPointCurve distPC( ptP, *pCurve) ;
|
||||
// recupero i risultati
|
||||
int nFlag ;
|
||||
return ( distPC.GetDist( *pdDist) &&
|
||||
distPC.GetMinDistPoint( 0, ptMin, nFlag) &&
|
||||
distPC.GetSideAtMinDistPoint( 0, vtN, *pnSide)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCurveArcRadius( int nId, double* pdRad)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( pdRad == nullptr)
|
||||
return false ;
|
||||
// recupero l'arco
|
||||
const ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pArc == nullptr)
|
||||
return false ;
|
||||
*pdRad = pArc->GetRadius() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCurveArcNormVersor( int nId, int nRefId, Vector3d& vtNorm)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero l'arco
|
||||
const ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pArc == nullptr)
|
||||
return false ;
|
||||
// recupero la normale
|
||||
vtNorm = pArc->GetNormVersor() ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformVector( pGeomDB, nId, nRefId, vtNorm) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCurveCompoCenter( int nId, int nSimpCrv, int nRefId, Point3d& ptCen)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva composita
|
||||
const ICurveComposite* pCompoCrv = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCompoCrv == nullptr)
|
||||
return false ;
|
||||
// recupero la curva semplice di indice richiesto
|
||||
const ICurve* pSimpCrv = pCompoCrv->GetCurve( nSimpCrv) ;
|
||||
if ( pSimpCrv == nullptr)
|
||||
return false ;
|
||||
// recupero il centro
|
||||
if ( ! pSimpCrv->GetCenterPoint( ptCen))
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformPoint( pGeomDB, nId, nRefId, ptCen) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeSurfTmFacetNbr( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, 0)
|
||||
// recupero la superficie trimesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return 0 ;
|
||||
// recupero il numero delle facce
|
||||
return pStm->GetFacetNum() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeSurfTmFacetFromTria( int nId, int nT)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, SVT_NULL)
|
||||
// recupero la superficie trimesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return SVT_NULL ;
|
||||
// recupero il numero della faccia da quello di un suo triangolo
|
||||
return pStm->GetFacetFromTria( nT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmFacetNearestEndPoint( int nId, int nFacet, const Point3d& ptNear, int nRefId,
|
||||
Point3d& ptEnd, Vector3d& vtN)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie trimesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
// porto il punto Near nel riferimento dell'entità
|
||||
Point3d ptNearL = ptNear ;
|
||||
if ( ! InvTrasformPoint( pGeomDB, nId, nRefId, ptNearL))
|
||||
return false ;
|
||||
// recupero il punto End più vicino della faccia
|
||||
if ( ! pStm->GetFacetNearestEndPoint( nFacet, ptNearL, ptEnd, vtN))
|
||||
return false ;
|
||||
// gestione trasformazioni ( eventuali)
|
||||
return TrasformPoint( pGeomDB, nId, nRefId, ptEnd) && TrasformVector( pGeomDB, nId, nRefId, vtN) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmFacetNearestMidPoint( int nId, int nFacet, const Point3d& ptNear, int nRefId,
|
||||
Point3d& ptMid, Vector3d& vtN)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie trimesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
// porto il punto Near nel riferimento dell'entità
|
||||
Point3d ptNearL = ptNear ;
|
||||
if ( ! InvTrasformPoint( pGeomDB, nId, nRefId, ptNearL))
|
||||
return false ;
|
||||
// recupero il punto Mid più vicino della faccia
|
||||
if ( ! pStm->GetFacetNearestMidPoint( nFacet, ptNearL, ptMid, vtN))
|
||||
return false ;
|
||||
// gestione trasformazioni ( eventuali)
|
||||
return TrasformPoint( pGeomDB, nId, nRefId, ptMid) && TrasformVector( pGeomDB, nId, nRefId, vtN) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmFacetCenter( int nId, int nFacet, int nRefId, Point3d& ptCen, Vector3d& vtN)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie trimesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
// recupero il centro della faccia
|
||||
if ( ! pStm->GetFacetCenter( nFacet, ptCen, vtN))
|
||||
return false ;
|
||||
// gestione trasformazioni ( eventuali)
|
||||
return TrasformPoint( pGeomDB, nId, nRefId, ptCen) && TrasformVector( pGeomDB, nId, nRefId, vtN) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmFacetNormVersor( int nId, int nFacet, int nRefId, Vector3d& vtNorm)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie trimesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
// recupero il centro della faccia
|
||||
if ( ! pStm->GetFacetNormal( nFacet, vtNorm))
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformVector( pGeomDB, nId, nRefId, vtNorm) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeExtTextNormVersor( int nId, int nRefId, Vector3d& vtNorm)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il testo
|
||||
const IExtText* pTxt = GetExtText( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pTxt == nullptr)
|
||||
return false ;
|
||||
// recupero la normale
|
||||
vtNorm = pTxt->GetNormVersor() ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TrasformVector( pGeomDB, nId, nRefId, vtNorm) ;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
// Geo Transforms
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExePointToIdGlob( Point3d& ptP, int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se griglia
|
||||
if ( nId == GDB_ID_GRID)
|
||||
return ptP.ToGlob( pGeomDB->GetGridFrame()) ;
|
||||
// recupero il riferimento
|
||||
// se gruppo -> il suo proprio espresso in globale
|
||||
// se oggetto -> quello del gruppo cui appartiene in globale
|
||||
Frame3d frRef ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nId, frRef) &&
|
||||
! pGeomDB->GetGlobFrame( nId, frRef))
|
||||
return false ;
|
||||
// eseguo la trasformazione
|
||||
return ptP.ToGlob( frRef) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExePointToIdLoc( Point3d& ptP, int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se griglia
|
||||
if ( nId == GDB_ID_GRID)
|
||||
return ptP.ToLoc( pGeomDB->GetGridFrame()) ;
|
||||
// recupero il riferimento
|
||||
// se gruppo -> il suo proprio espresso in globale
|
||||
// se oggetto -> quello del gruppo cui appartiene in globale
|
||||
Frame3d frRef ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nId, frRef) &&
|
||||
! pGeomDB->GetGlobFrame( nId, frRef))
|
||||
return false ;
|
||||
// eseguo la trasformazione
|
||||
return ptP.ToLoc( frRef) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeVectorToIdGlob( Vector3d& vtV, int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se griglia
|
||||
if ( nId == GDB_ID_GRID)
|
||||
return vtV.ToGlob( pGeomDB->GetGridFrame()) ;
|
||||
// recupero il riferimento
|
||||
// se gruppo -> il suo proprio espresso in globale
|
||||
// se oggetto -> quello del gruppo cui appartiene in globale
|
||||
Frame3d frRef ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nId, frRef) &&
|
||||
! pGeomDB->GetGlobFrame( nId, frRef))
|
||||
return false ;
|
||||
// eseguo la trasformazione
|
||||
return vtV.ToGlob( frRef) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeVectorToIdLoc( Vector3d& vtV, int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se griglia
|
||||
if ( nId == GDB_ID_GRID)
|
||||
return vtV.ToLoc( pGeomDB->GetGridFrame()) ;
|
||||
// recupero il riferimento
|
||||
// se gruppo -> il suo proprio espresso in globale
|
||||
// se oggetto -> quello del gruppo cui appartiene in globale
|
||||
Frame3d frRef ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nId, frRef) &&
|
||||
! pGeomDB->GetGlobFrame( nId, frRef))
|
||||
return false ;
|
||||
// eseguo la trasformazione
|
||||
return vtV.ToLoc( frRef) ;
|
||||
}
|
||||
@@ -0,0 +1,384 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_GeoTransform.cpp Data : 04.05.15 Versione : 1.6e1
|
||||
// Contenuto : Funzioni di trasformazione geometrica per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 30.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "GeoTools.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeMove( INTVECTOR& vIds, const Vector3d& vtMove, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// se traslazione espressa in locale
|
||||
if ( nRefType == RTY_LOC) {
|
||||
// verifico che tutti gli oggetti siano nello stesso riferimento
|
||||
bOk = bOk && VerifySameFrame( pGeomDB, vIds) ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// eseguo traslazione
|
||||
if ( ! pGeomDB->Translate( nId, vtMove))
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// altrimenti in globale o in griglia
|
||||
else {
|
||||
Vector3d vtMoveG = vtMove ;
|
||||
// se griglia, porto il vettore in globale
|
||||
if ( nRefType == RTY_GRID)
|
||||
vtMoveG.ToGlob( pGeomDB->GetGridFrame()) ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// eseguo traslazione
|
||||
if ( ! pGeomDB->TranslateGlob( nId, vtMoveG))
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtMove({" + IdListToString( vIds) + "},{" +
|
||||
ToString( vtMove) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRotate( INTVECTOR& vIds, const Point3d& ptAx, const Vector3d& vtAx, double dAngRotDeg, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// se rotazione espressa in locale
|
||||
if ( nRefType == RTY_LOC) {
|
||||
// verifico che tutti gli oggetti siano nello stesso riferimento
|
||||
bOk = bOk && VerifySameFrame( pGeomDB, vIds) ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// eseguo rotazione
|
||||
if ( ! pGeomDB->Rotate( nId, ptAx, vtAx, dAngRotDeg))
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// altrimenti in globale o in griglia
|
||||
else {
|
||||
Point3d ptAxG = ptAx ;
|
||||
Vector3d vtAxG = vtAx ;
|
||||
// se griglia, porto punto e vettore in globale
|
||||
if ( nRefType == RTY_GRID) {
|
||||
ptAxG.ToGlob( pGeomDB->GetGridFrame()) ;
|
||||
vtAxG.ToGlob( pGeomDB->GetGridFrame()) ;
|
||||
}
|
||||
// ciclo sul vettore degli identificativi
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// eseguo rotazione
|
||||
if ( ! pGeomDB->RotateGlob( nId, ptAxG, vtAxG, dAngRotDeg))
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtRotate({" + IdListToString( vIds) + "},{" +
|
||||
ToString( ptAx) + "},{" +
|
||||
ToString( vtAx) + "}," +
|
||||
ToString( dAngRotDeg) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeScale( INTVECTOR& vIds, const Frame3d& frRef,
|
||||
double dCoeffX, double dCoeffY, double dCoeffZ, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// se scalatura espressa in locale
|
||||
if ( nRefType == RTY_LOC) {
|
||||
// verifico che tutti gli oggetti siano nello stesso riferimento
|
||||
bOk = bOk && VerifySameFrame( pGeomDB, vIds) ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// eseguo scalature
|
||||
if ( ! pGeomDB->Scale( nId, frRef, dCoeffX, dCoeffY, dCoeffZ))
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// altrimenti in globale o in griglia
|
||||
else {
|
||||
Frame3d frRefG = frRef ;
|
||||
// se griglia, porto riferimento in globale
|
||||
if ( nRefType == RTY_GRID)
|
||||
frRefG.ToGlob( pGeomDB->GetGridFrame()) ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// eseguo scalature
|
||||
if ( ! pGeomDB->ScaleGlob( nId, frRefG, dCoeffX, dCoeffY, dCoeffZ))
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtScale({" + IdListToString( vIds) + "},{{" +
|
||||
ToString( frRef.Orig()) + "},{" +
|
||||
ToString( frRef.VersX()) + "},{" +
|
||||
ToString( frRef.VersY()) + "},{" +
|
||||
ToString( frRef.VersZ()) + "}}," +
|
||||
ToString( dCoeffX) + "," +
|
||||
ToString( dCoeffY) + "," +
|
||||
ToString( dCoeffZ) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeMirror( INTVECTOR& vIds, const Point3d& ptP, const Vector3d& vtN, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
bool bOk = true ;
|
||||
// se specularità espressa in locale
|
||||
if ( nRefType == RTY_LOC) {
|
||||
// verifico che tutti gli oggetti siano nello stesso riferimento
|
||||
bOk = bOk && VerifySameFrame( pGeomDB, vIds) ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// eseguo riflessione
|
||||
if ( ! pGeomDB->Mirror( nId, ptP, vtN))
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// altrimenti in globale o in griglia
|
||||
else {
|
||||
Point3d ptPG = ptP ;
|
||||
Vector3d vtNG = vtN ;
|
||||
// se griglia, porto riferimento in globale
|
||||
if ( nRefType == RTY_GRID) {
|
||||
ptPG.ToGlob( pGeomDB->GetGridFrame()) ;
|
||||
vtNG.ToGlob( pGeomDB->GetGridFrame()) ;
|
||||
}
|
||||
// ciclo sul vettore degli identificativi
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// eseguo riflessione
|
||||
if ( ! pGeomDB->MirrorGlob( nId, ptPG, vtNG))
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtMirror({" + IdListToString( vIds) + "},{" +
|
||||
ToString( ptP) + "},{" +
|
||||
ToString( vtN) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeShear( INTVECTOR& vIds, const Point3d& ptP, const Vector3d& vtN,
|
||||
const Vector3d& vtDir, double dCoeff, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
bool bOk = true ;
|
||||
// se stiramento espresso in locale
|
||||
if ( nRefType == RTY_LOC) {
|
||||
// verifico che tutti gli oggetti siano nello stesso riferimento
|
||||
bOk = bOk && VerifySameFrame( pGeomDB, vIds) ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// eseguo stiramento
|
||||
if ( ! pGeomDB->Shear( nId, ptP, vtN, vtDir, dCoeff))
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// altrimenti in globale o in griglia
|
||||
else {
|
||||
Point3d ptPG = ptP ;
|
||||
Vector3d vtNG = vtN ;
|
||||
Vector3d vtDirG = vtDir ;
|
||||
// se griglia, porto riferimento in globale
|
||||
if ( nRefType == RTY_GRID) {
|
||||
ptPG.ToGlob( pGeomDB->GetGridFrame()) ;
|
||||
vtNG.ToGlob( pGeomDB->GetGridFrame()) ;
|
||||
vtDirG.ToGlob( pGeomDB->GetGridFrame()) ;
|
||||
}
|
||||
// ciclo sul vettore degli identificativi
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// eseguo stiramento
|
||||
if ( ! pGeomDB->ShearGlob( nId, ptPG, vtNG, vtDirG, dCoeff))
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtShear({" + IdListToString( vIds) + "},{" +
|
||||
ToString( ptP) + "},{" +
|
||||
ToString( vtN) + "},{" +
|
||||
ToString( vtDir) + "}," +
|
||||
ToString( dCoeff) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeMoveGroup( int nId, const Vector3d& vtMove)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// eseguo traslazione ( solo singola)
|
||||
bool bOk = pGeomDB->TranslateGroup( nId, vtMove) ;
|
||||
ExeSetModified() ;
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRotateGroup( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dAngRotDeg)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// eseguo rotazione ( solo singola)
|
||||
bool bOk = pGeomDB->RotateGroup( nId, ptAx, vtAx, dAngRotDeg) ;
|
||||
ExeSetModified() ;
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeScaleGroup( int nId, const Frame3d& frFrame, double dCoeffX, double dCoeffY, double dCoeffZ)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// eseguo scalatura ( solo singola)
|
||||
bool bOk = pGeomDB->ScaleGroup( nId, frFrame, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
ExeSetModified() ;
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeMirrorGroup( int nId, const Point3d& ptP, const Vector3d& vtN)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// eseguo riflessione ( solo singola)
|
||||
bool bOk = pGeomDB->MirrorGroup( nId, ptP, vtN) ;
|
||||
ExeSetModified() ;
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeShearGroup( int nId, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtDir, double dCoeff)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// eseguo stiramento ( solo singolo)
|
||||
bool bOk = pGeomDB->ShearGroup( nId, ptP, vtN, vtDir, dCoeff) ;
|
||||
ExeSetModified() ;
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
+379
@@ -0,0 +1,379 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_GeomDB.cpp Data : 04.05.15 Versione : 1.6e1
|
||||
// Contenuto : Funzioni DB geometrico per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 01.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeInitGeomDB( void)
|
||||
{
|
||||
// creo e recupero un contesto libero
|
||||
int nGseCtx = CreateGseContext() ;
|
||||
if ( nGseCtx == 0) {
|
||||
ResetCurrGseContext() ;
|
||||
LOG_ERROR( GetLogger(), "Error in CreateGseContext (" __FUNCTION__ ")")
|
||||
return 0 ;
|
||||
}
|
||||
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
|
||||
// inizializzazioni DB geometrico
|
||||
PtrOwner<IGeomDB> pGeomDB( CreateGeomDB()) ;
|
||||
VERIFY_NULL( Get( pGeomDB), "Error in CreateGeomDB", nGseCtx)
|
||||
// inserisco il GeomDB nel contesto
|
||||
pGseCtx->m_pGeomDB = Release( pGeomDB) ;
|
||||
pGseCtx->m_pGeomDB->Init() ;
|
||||
pGseCtx->m_pGeomDB->SetDefaultMaterial( pGseCtx->m_colDef) ;
|
||||
// rendo corrente il contesto
|
||||
SetCurrGseContext( nGseCtx) ;
|
||||
// log avvio DB geometrico
|
||||
string sLog = "GeomDB started " + ToString( nGseCtx) ;
|
||||
LOG_INFO( GetLogger(), sLog.c_str())
|
||||
|
||||
return nGseCtx ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetCurrentContext( int nGseCtx)
|
||||
{
|
||||
return SetCurrGseContext( nGseCtx) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeResetCurrentContext( void)
|
||||
{
|
||||
return ResetCurrGseContext() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetCurrentContext( void)
|
||||
{
|
||||
return GetIndCurrGseContext() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetDefaultMaterial( Color ColDef)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
// imposto il materiale di default
|
||||
pGseCtx->m_colDef = ColDef ;
|
||||
pGseCtx->m_pGeomDB->SetDefaultMaterial( pGseCtx->m_colDef) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetGridFrame( const Frame3d& frFrame)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// imposto il riferimento della griglia
|
||||
bool bOk = pGeomDB->SetGridFrame( frFrame) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSetGridFrame({{" + ToString( frFrame.Orig()) + "},{" +
|
||||
ToString( frFrame.VersX()) + "},{" +
|
||||
ToString( frFrame.VersY()) + "},{" +
|
||||
ToString( frFrame.VersZ()) + "}})" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetGridFrame( int nRefId, Frame3d& frFrame)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il riferimento della griglia
|
||||
frFrame = pGeomDB->GetGridFrame() ;
|
||||
// se richiesto nel riferimento globale, esco subito
|
||||
if ( nRefId == GDB_ID_ROOT)
|
||||
return true ;
|
||||
// recupero il riferimento destinazione (nRefId può essere un gruppo o una entità)
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nRefId, frDest) &&
|
||||
! pGeomDB->GetGlobFrame( nRefId, frDest))
|
||||
return false ;
|
||||
// eseguo la trasformazione
|
||||
return frFrame.ToLoc( frDest) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetGridVersZ( int nRefId, Vector3d& vtVersZ)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il versore Z della griglia
|
||||
vtVersZ = pGeomDB->GetGridFrame().VersZ() ;
|
||||
// se richiesto nel riferimento globale, esco subito
|
||||
if ( nRefId == GDB_ID_ROOT)
|
||||
return true ;
|
||||
// recupero il riferimento destinazione (nRefId può essere un gruppo o una entità)
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nRefId, frDest) &&
|
||||
! pGeomDB->GetGlobFrame( nRefId, frDest))
|
||||
return false ;
|
||||
// eseguo la trasformazione
|
||||
return vtVersZ.ToLoc( frDest) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetCurrFilePath( const string& sFilePath)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
// assegno la path
|
||||
pGseCtx->m_sFilePath = sFilePath ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetCurrFilePath( string& sFilePath)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
// restituisco la path
|
||||
sFilePath = pGseCtx->m_sFilePath ;
|
||||
return ( ! sFilePath.empty()) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeEnableModified( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
// abilito possibilità di alterare il flag di modifica
|
||||
pGseCtx->m_bEnableModified = true ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeDisableModified( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
// disabilito possibilità di alterare il flag di modifica
|
||||
pGseCtx->m_bEnableModified = false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetModified( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
// se consentito, imposto il flag
|
||||
if ( pGseCtx->m_bEnableModified)
|
||||
pGseCtx->m_bModified = true ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeResetModified( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
// se consentito, cancello il flag
|
||||
if ( pGseCtx->m_bEnableModified)
|
||||
pGseCtx->m_bModified = false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetModified( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
// imposto il flag
|
||||
return pGseCtx->m_bModified ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeNewFile( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
bool bOk = true ;
|
||||
// reinizializzazione (con pulizia) del DB geometrico
|
||||
bOk = bOk && pGseCtx->m_pGeomDB->Init() ;
|
||||
bOk = bOk && pGseCtx->m_pGeomDB->SetDefaultMaterial( pGseCtx->m_colDef) ;
|
||||
// aggiorno stato file corrente
|
||||
pGseCtx->m_sFilePath.clear() ;
|
||||
pGseCtx->m_bModified = false ;
|
||||
// aggiornamento gestore lavorazioni
|
||||
ExeUpdateMachMgr() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtNewFile()"
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeOpenFile( const string& sFilePath)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
bool bOk = true ;
|
||||
// reinizializzazione (con pulizia) del DB geometrico
|
||||
bOk = bOk && pGseCtx->m_pGeomDB->Init() ;
|
||||
bOk = bOk && pGseCtx->m_pGeomDB->SetDefaultMaterial( pGseCtx->m_colDef) ;
|
||||
// carico il file
|
||||
bOk = bOk && pGseCtx->m_pGeomDB->Load( sFilePath) ;
|
||||
// aggiorno stato file corrente
|
||||
pGseCtx->m_sFilePath = sFilePath ;
|
||||
pGseCtx->m_bModified = false ;
|
||||
// aggiornamento gestore lavorazioni
|
||||
ExeUpdateMachMgr() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLuaPath = sFilePath ;
|
||||
ReplaceString( sLuaPath, "\\", "\\\\") ;
|
||||
string sLua = "EgtOpenFile('" + sLuaPath + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeInsertFile( const string& sFilePath)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
IGeomDB* pGeomDB = pGseCtx->m_pGeomDB ;
|
||||
// creo gruppo temporaneo di parcheggio
|
||||
int nGrp = pGeomDB->InsertGroup( GDB_ID_NULL, GDB_ID_ROOT, GDB_FIRST_SON, GLOB_FRM) ;
|
||||
bool bOk = ( nGrp != GDB_ID_NULL) ;
|
||||
bOk = bOk && pGeomDB->SetLevel( nGrp, GDB_LV_TEMP) ;
|
||||
// carico il file
|
||||
bOk = bOk && pGeomDB->Load( sFilePath, nGrp) ;
|
||||
// sposto i pezzi sotto la radice
|
||||
int nId = pGeomDB->GetFirstGroupInGroup( nGrp) ;
|
||||
while ( bOk && nId != GDB_ID_NULL) {
|
||||
// prossimo gruppo
|
||||
int nNextId = pGeomDB->GetNextGroup( nId) ;
|
||||
// se il gruppo corrente è un pezzo, lo sposto
|
||||
int nLevel ;
|
||||
if ( ! pGeomDB->GetLevel( nId, nLevel) || nLevel == GDB_LV_USER)
|
||||
bOk = pGeomDB->Relocate( nId, GDB_ID_ROOT, GDB_LAST_SON) ;
|
||||
// passo al prossimo
|
||||
nId = nNextId ;
|
||||
}
|
||||
// sistemo le lavorazioni
|
||||
bOk = bOk && ExeInsertMachMgr( nGrp) ;
|
||||
// cancello il gruppo temporaneo
|
||||
pGeomDB->Erase( nGrp) ;
|
||||
// aggiorno stato file corrente
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLuaPath = sFilePath ;
|
||||
ReplaceString( sLuaPath, "\\", "\\\\") ;
|
||||
string sLua = "EgtInsertFile('" + sLuaPath + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSaveFile( const string& sFilePath, int nFlag)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
// se ero in CAM, esco
|
||||
int nCurrMachGroup = ExeGetCurrMachGroup() ;
|
||||
ExeResetCurrMachGroup() ;
|
||||
// salvo il file
|
||||
bool bOk = pGseCtx->m_pGeomDB->Save( GDB_ID_ROOT, sFilePath, nFlag) ;
|
||||
// eventuale ripristino precedente CAM
|
||||
if ( nCurrMachGroup != GDB_ID_NULL)
|
||||
ExeSetCurrMachGroup( nCurrMachGroup) ;
|
||||
// aggiorno stato file corrente
|
||||
pGseCtx->m_sFilePath = sFilePath ;
|
||||
if ( bOk)
|
||||
pGseCtx->m_bModified = false ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLuaPath = sFilePath ;
|
||||
ReplaceString( sLuaPath, "\\", "\\\\") ;
|
||||
string sLua = "EgtSaveFile('" + sLuaPath + "'," +
|
||||
NgeTypeToString( nFlag) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSaveObjToFile( int nId, const string& sFilePath, int nFlag)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se ero in CAM, esco
|
||||
int nCurrMachGroup = ExeGetCurrMachGroup() ;
|
||||
ExeResetCurrMachGroup() ;
|
||||
// copio l'oggetto nel file
|
||||
bool bOk = pGeomDB->Save( nId, sFilePath, nFlag) ;
|
||||
// ripristino eventuale precedente CAM
|
||||
if ( nCurrMachGroup != GDB_ID_NULL)
|
||||
ExeSetCurrMachGroup( nCurrMachGroup) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLuaPath = sFilePath ;
|
||||
ReplaceString( sLuaPath, "\\", "\\\\") ;
|
||||
string sLua = "EgtSaveObjToFile('" + sLuaPath + "'," +
|
||||
ToString( nId) + "," +
|
||||
NgeTypeToString( nFlag) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_LUA.cpp Data : 05.05.15 Versione : 1.6e1
|
||||
// Contenuto : Funzioni esecuzione LUA per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 28.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "LUA_Base.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeLuaEvalNumExpr( const string& sExpr, double* pdVal)
|
||||
{
|
||||
// verifico parametro di ritorno
|
||||
if ( pdVal == nullptr)
|
||||
return false ;
|
||||
// valuto l'espressione
|
||||
return LuaEvalNumExpr( sExpr, *pdVal) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeLuaEvalStringExpr( const string& sExpr, string& sVal)
|
||||
{
|
||||
// verifico parametro di ritorno
|
||||
if ( &sVal == nullptr)
|
||||
return false ;
|
||||
// valuto l'espressione
|
||||
return LuaEvalStringExpr( sExpr, sVal) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeLuaExecLine( const string& sLine)
|
||||
{
|
||||
// disabilito log dei comandi e salvo stato precedente
|
||||
bool bPrevCmdLog = SetCmdLog( false) ;
|
||||
// eseguo il comando
|
||||
bool bOk = LuaExecLine( sLine) ;
|
||||
// ripristino lo stato originale del log dei comandi
|
||||
SetCmdLog( bPrevCmdLog) ;
|
||||
// se richiesto, salvo il comando Lua
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = sLine +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeLuaExecFile( const string& sFilePath)
|
||||
{
|
||||
// emetto info
|
||||
string sInfo = "Exec File = " + sFilePath ;
|
||||
LOG_INFO( GetLogger(), sInfo.c_str())
|
||||
// disabilito il log dei comandi
|
||||
bool bPrevCmdLog = IsCmdLog() ;
|
||||
ExeDisableCommandLogger() ;
|
||||
// esecuzione script
|
||||
bool bOk = LuaExecFile( sFilePath) ;
|
||||
// ripristino lo stato originale del log dei comandi
|
||||
if ( bPrevCmdLog)
|
||||
ExeEnableCommandLogger() ;
|
||||
// se richiesto, salvo il comando Lua
|
||||
if ( IsCmdLog()) {
|
||||
string sLuaPath = sFilePath ;
|
||||
ReplaceString( sLuaPath, "\\", "\\\\") ;
|
||||
string sLua = "dofile('" + sLuaPath + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeLuaRequire( const string& sFilePath)
|
||||
{
|
||||
// emetto info
|
||||
string sInfo = "Require Library = " + sFilePath ;
|
||||
LOG_INFO( GetLogger(), sInfo.c_str())
|
||||
// eseguo il comando
|
||||
return LuaRequire( sFilePath) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeLuaGetLastError( string& sError)
|
||||
{
|
||||
// verifico parametro di ritorno
|
||||
if ( &sError == nullptr)
|
||||
return false ;
|
||||
sError = LuaGetLastError() ;
|
||||
return true ;
|
||||
}
|
||||
+511
@@ -0,0 +1,511 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_MachMgr.cpp Data : 05.05.15 Versione : 1.6e1
|
||||
// Contenuto : Funzioni Machining Manager per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 23.03.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "DllMachKernel.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeInitMachMgr( const string& sMachinesDir)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX( pGseCtx, false)
|
||||
// inizializzazione gestore lavorazioni
|
||||
PtrOwner<IMachMgr> pMachMgr( MyCreateMachMgr()) ;
|
||||
VERIFY_NULL( Get( pMachMgr), "Error in CreateMachMgr", false)
|
||||
bool bOk = pMachMgr->Init( pGseCtx->m_pGeomDB, sMachinesDir) ;
|
||||
// assegno il gestore al contesto
|
||||
pGseCtx->m_pMachMgr = ( bOk ? Release( pMachMgr) : nullptr) ;
|
||||
// log avvio Machining Manager
|
||||
string sLog = "MachMgr " ;
|
||||
sLog += ( bOk ? " started" : " error") ;
|
||||
sLog += " (" + sMachinesDir + ")" ;
|
||||
LOG_INFO( GetLogger(), sLog.c_str())
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeUpdateMachMgr( void)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// aggiornamento gestore lavorazioni
|
||||
return pMachMgr->Update() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeInsertMachMgr( int nInsGrp)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// sposto le macchinate dal gruppo di inserimento alla base macchinate
|
||||
return pMachMgr->Insert( nInsGrp) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetMachGroupNbr( void)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, 0)
|
||||
// recupero il numero di macchinate
|
||||
return pMachMgr->GetMachGroupNbr() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetFirstMachGroup( void)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
||||
// recupero la prima macchinata
|
||||
return pMachMgr->GetFirstMachGroup() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetNextMachGroup( int nId)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
||||
// recupero la successiva macchinata
|
||||
return pMachMgr->GetNextMachGroup( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeAddMachGroup( const string& sName, const string& sMachineName)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, GDB_ID_NULL)
|
||||
// aggiungo la macchinata (gruppo di lavorazione)
|
||||
int nId = pGseCtx->m_pMachMgr->AddMachGroup( sName, sMachineName) ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtAddMachGroup('" + sName + "','" +
|
||||
sMachineName + "')" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRemoveMachGroup( int nMGroupId)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// rimuovo la macchinata (gruppo di lavorazione)
|
||||
bool bOk = pGseCtx->m_pMachMgr->RemoveMachGroup( nMGroupId) ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtRemoveMachGroup(" + ToString( nMGroupId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetMachGroupName( int nId, string& sName)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// recupero il nome della macchinata
|
||||
sName = pMachMgr->GetMachGroupName( nId) ;
|
||||
return ( ! sName.empty()) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetMachGroupId( const string& sName)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// recupero l'indice della macchinata
|
||||
return pMachMgr->GetMachGroupId( sName) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetCurrMachGroup( int nMGroupId)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// imposto la macchinata corrente
|
||||
bool bOk = pGseCtx->m_pMachMgr->SetCurrMachGroup( nMGroupId) ;
|
||||
// non cambia lo stato di modificato del progetto
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSetCurrMachGroup(" + ToString( nMGroupId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeResetCurrMachGroup( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// reset macchinata corrente
|
||||
bool bOk = pGseCtx->m_pMachMgr->ResetCurrMachGroup() ;
|
||||
// non cambia lo stato di modificato del progetto
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtResetCurrMachGroup()"
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetCurrMachGroup( void)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
||||
// restituisco identificativo macchinata corrente
|
||||
return pMachMgr->GetCurrMachGroup() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetRawPartNbr( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// recupero il numero di grezzi nella macchinata corrente
|
||||
return pGseCtx->m_pMachMgr->GetRawPartNbr() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetFirstRawPart( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// recupero identificativo primo grezzo nella macchinata corrente
|
||||
return pGseCtx->m_pMachMgr->GetFirstRawPart() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetNextRawPart( int nRawId)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// recupero identificativo successivo grezzo nella macchinata corrente
|
||||
return pGseCtx->m_pMachMgr->GetNextRawPart( nRawId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeAddRawPart( Point3d ptOrig, double dWidth, double dLength, double dHeight, Color cCol)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, GDB_ID_NULL)
|
||||
// inserisco grezzo nella macchinata corrente
|
||||
int nId = pGseCtx->m_pMachMgr->AddRawPart( ptOrig, dWidth, dLength, dHeight, cCol) ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtAddRawPart({" + ToString( ptOrig) + "}," +
|
||||
ToString( dWidth) + "," +
|
||||
ToString( dLength) + "," +
|
||||
ToString( dHeight) + ",{" +
|
||||
ToString( cCol) + "})" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeAddRawPartWithPart( int nPartId, int nCrvId, double dOverMat, Color cCol)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, GDB_ID_NULL)
|
||||
// inserisco grezzo con pezzo nella macchinata corrente
|
||||
int nId = pGseCtx->m_pMachMgr->AddRawPartWithPart( nPartId, nCrvId, dOverMat, cCol) ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtAddRawPartWithPart(" + ToString( nPartId) + "," +
|
||||
ToString( nCrvId) + "," +
|
||||
ToString( dOverMat) + ",{" +
|
||||
ToString( cCol) + "})" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeModifyRawPartHeight( int nRawId, double dHeight)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// modifico lo spessore del grezzo
|
||||
bool bOk = pGseCtx->m_pMachMgr->ModifyRawPartHeight( nRawId, dHeight) ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtModifyRawPartHeight(" + ToString( nRawId) + "," +
|
||||
ToString( dHeight) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRemoveRawPart( int nRawId)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// elimino grezzo dalla macchinata corrente
|
||||
bool bOk = pGseCtx->m_pMachMgr->RemoveRawPart( nRawId) ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtRemoveRawPart(" + ToString( nRawId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTranslateRawPart( int nRawId, const Vector3d& vtMove)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// traslo il grezzo
|
||||
bool bOk = pGseCtx->m_pMachMgr->TranslateRawPart( nRawId, vtMove) ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtMoveRawPart(" + ToString( nRawId) + ",{" +
|
||||
ToString( vtMove) + "})" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// ruoto il grezzo
|
||||
bool bOk = pGseCtx->m_pMachMgr->RotateRawPart( nRawId, vtAx, dAngRotDeg) ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtRotateRawPart(" + ToString( nRawId) + ",{" +
|
||||
ToString( vtAx) + "}," +
|
||||
ToString( dAngRotDeg) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeMoveToCornerRawPart( int nRawId, const Point3d& ptCorner, int nFlag)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// mando il grezzo nel corner
|
||||
bool bOk = pGseCtx->m_pMachMgr->MoveToCornerRawPart( nRawId, ptCorner, nFlag) ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtMoveToCornerRawPart(" + ToString( nRawId) + ",{" +
|
||||
ToString( ptCorner) + "}," +
|
||||
RawPartCornerPosToString( nFlag) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeMoveToCenterRawPart( int nRawId, const Point3d& ptCenter, int nFlag)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// mando il grezzo nel corner
|
||||
bool bOk = pGseCtx->m_pMachMgr->MoveToCenterRawPart( nRawId, ptCenter, nFlag) ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtMoveToCenterRawPart(" + ToString( nRawId) + ",{" +
|
||||
ToString( ptCenter) + "}," +
|
||||
RawPartCenterPosToString( nFlag) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetPartInRawPartNbr( int nRawId)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// recupero il numero di pezzi nel grezzo
|
||||
return pGseCtx->m_pMachMgr->GetPartInRawPartNbr( nRawId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetFirstPartInRawPart( int nRawId)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// recupero identificativo primo pezzo nel grezzo
|
||||
return pGseCtx->m_pMachMgr->GetFirstPartInRawPart( nRawId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetNextPartInRawPart( int nPartId)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// recupero identificativo successivo pezzo nello stesso grezzo
|
||||
return pGseCtx->m_pMachMgr->GetNextPartInRawPart( nPartId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeAddPartToRawPart( int nPartId, const Point3d& ptPos, int nRawId)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// inserisco pezzo in un grezzo della macchinata corrente
|
||||
bool bOk = pGseCtx->m_pMachMgr->AddPartToRawPart( nPartId, ptPos, nRawId) ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtAddPartToRawPart(" + ToString( nPartId) + ",{" +
|
||||
ToString( ptPos) + "}," +
|
||||
ToString( nRawId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRemovePartFromRawPart( int nPartId)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// elimino pezzo da grezzo della macchinata corrente
|
||||
bool bOk = pGseCtx->m_pMachMgr->RemovePartFromRawPart( nPartId) ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtRemovePartFromRawPart(" + ToString( nPartId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTranslatePartInRawPart( int nPartId, const Vector3d& vtMove)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// traslo il pezzo nel grezzo
|
||||
bool bOk = pGseCtx->m_pMachMgr->TranslatePartInRawPart( nPartId, vtMove) ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtMovePartInRawPart(" + ToString( nPartId) + ",{" +
|
||||
ToString( vtMove) + "})" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRotatePartInRawPart( int nPartId, const Vector3d& vtAx, double dAngRotDeg)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// ruoto il pezzo nel grezzo
|
||||
bool bOk = pGseCtx->m_pMachMgr->RotatePartInRawPart( nPartId, vtAx, dAngRotDeg) ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtRotatePartInRawPart(" + ToString( nPartId) + ",{" +
|
||||
ToString( vtAx) + "}," +
|
||||
ToString( dAngRotDeg) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_Macro Data : 05.05.15 Versione : 1.6e2
|
||||
// Contenuto : Macro locali per moduli EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 03.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#define VERIFY_NULL( pO, Msg, Ret) if ( pO == nullptr) { \
|
||||
LOG_ERROR( GetLogger(), Msg " (" __FUNCTION__ ")") \
|
||||
return Ret ; \
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#define VERIFY_2NULL( pO, pQ, Msg, Ret) if ( pO == nullptr || pQ == nullptr) { \
|
||||
LOG_ERROR( GetLogger(), Msg " (" __FUNCTION__ ")") \
|
||||
return Ret ; \
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#define VERIFY_CTX( pC, Ret) VERIFY_NULL( pC, "Context invalid", Ret)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#define VERIFY_GEOMDB( pG, Ret) VERIFY_NULL( pG, "GeomDB invalid", Ret)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#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)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#define VERIFY_CTX_SCENE( pC, Ret) VERIFY_2NULL( pC, pC->m_pScene, "Context or Scene invalid", Ret)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#define VERIFY_TSCEXEC( pT, Ret) VERIFY_NULL( pT, "TscExecutor invalid", Ret)
|
||||
@@ -0,0 +1,94 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_Messages.cpp Data : 05.05.15 Versione : 1.6e1
|
||||
// Contenuto : Funzioni per gestione messaggi.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 12.02.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDEv/Include/EGnScan.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtLogger.h"
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
typedef unordered_map< int, string> INTSTR_UMAP ;
|
||||
static INTSTR_UMAP s_IdStringMap ;
|
||||
static string s_sMsg ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeLoadMessages( const string& sMsgFilePath)
|
||||
{
|
||||
// inizializzo lo scanner
|
||||
Scanner scan ;
|
||||
if ( ! scan.Init( sMsgFilePath))
|
||||
return false ;
|
||||
// pulisco la memoria
|
||||
s_IdStringMap.clear() ;
|
||||
s_sMsg.clear() ;
|
||||
// riservo spazio
|
||||
s_IdStringMap.rehash( 1000) ;
|
||||
s_sMsg.reserve( 128) ;
|
||||
// leggo le linee
|
||||
string sLine ;
|
||||
sLine.reserve( 128) ;
|
||||
string sNum ;
|
||||
sNum.reserve( 16) ;
|
||||
string sMsg ;
|
||||
sMsg.reserve( 128) ;
|
||||
int nNum ;
|
||||
int nCurrNum = - 1 ;
|
||||
while ( scan.GetLine( sLine)) {
|
||||
// divido la linea in due parti sul token '='
|
||||
Split( sLine, "=", true, sNum, sMsg) ;
|
||||
// la prima parte deve essere numerica
|
||||
if ( sNum.empty() || ! FromString( sNum, nNum)) {
|
||||
string sOut ;
|
||||
sOut = "Problem in " + sMsgFilePath + " at line " + ToString( scan.GetCurrLineNbr()) + " : " + sLine ;
|
||||
LOG_WARN( GetLogger(), sOut.c_str())
|
||||
continue ;
|
||||
}
|
||||
// la numerazione deve essere crescente
|
||||
if ( nNum <= nCurrNum) {
|
||||
string sOut ;
|
||||
sOut = "Error in " + sMsgFilePath + " at message " + sNum + " : " + sLine ;
|
||||
LOG_ERROR( GetLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
nCurrNum = nNum ;
|
||||
// converto i caratteri speciali
|
||||
ReplaceString( sMsg, "<br/>", "\n") ;
|
||||
// inserisco il messaggio in tabella
|
||||
if ( ! s_IdStringMap.emplace( nNum, sMsg).second)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// termino lo scanner
|
||||
return scan.Terminate() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const string&
|
||||
ExeGetMsg( int nMsg)
|
||||
{
|
||||
// recupero il messaggio
|
||||
INTSTR_UMAP::iterator Iter = s_IdStringMap.find( nMsg) ;
|
||||
if ( Iter != s_IdStringMap.end())
|
||||
s_sMsg = Iter->second ;
|
||||
else
|
||||
s_sMsg = "Msg" + ToString( nMsg) ;
|
||||
return s_sMsg ;
|
||||
}
|
||||
+663
@@ -0,0 +1,663 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_Scene.cpp Data : 05.05.15 Versione : 1.6e1
|
||||
// Contenuto : Funzioni Scene per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 01.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "DllGraphics.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeInitScene( HWND hWnd, int nDriver, bool b2Buff, int nColorBits, int nDepthBits)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX( pGseCtx, false)
|
||||
// inizializzazione scena OpenGL
|
||||
PtrOwner<IEGrScene> pScene( MyCreateEGrScene()) ;
|
||||
VERIFY_NULL( Get( pScene), "Error in CreateEGrScene", false)
|
||||
HDC hdc = GetDC( hWnd) ;
|
||||
if ( ! pScene->CreateContext( hdc, nDriver, b2Buff, nColorBits, nDepthBits))
|
||||
return false ;
|
||||
pScene->SetBackground( WHITE, WHITE) ;
|
||||
pScene->SetShowMode( SM_SHADING) ;
|
||||
pScene->SetShowCurveDirection( false) ;
|
||||
pScene->SetCamera( CT_TOP) ;
|
||||
pScene->ZoomAll() ;
|
||||
pScene->SetWinRectAttribs( true, BLACK) ;
|
||||
pScene->SetMark( YELLOW) ;
|
||||
pScene->Init( pGseCtx->m_pGeomDB) ;
|
||||
// assegno la scena al contesto
|
||||
pGseCtx->m_hWnd = hWnd ;
|
||||
pGseCtx->m_pScene = Release( pScene) ;
|
||||
// log con info sulla scena
|
||||
string sSceneInfo = pGseCtx->m_pScene->GetOpenGLInfo() + '\n' +
|
||||
pGseCtx->m_pScene->GetGLSLInfo() + '\n' +
|
||||
pGseCtx->m_pScene->GetPixelFormatInfo() ;
|
||||
LOG_INFO( GetLogger(), sSceneInfo.c_str())
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetSceneInfo( string& sInfo)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// verifico parametro di ritorno
|
||||
if ( &sInfo == nullptr)
|
||||
return false ;
|
||||
// recupero le informazioni sulla scena
|
||||
sInfo += pGseCtx->m_pScene->GetOpenGLInfo() ;
|
||||
sInfo += "\r\n" ;
|
||||
sInfo += pGseCtx->m_pScene->GetGLSLInfo() ;
|
||||
sInfo += "\r\n" ;
|
||||
sInfo += pGseCtx->m_pScene->GetPixelFormatInfo() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetBackground( Color TopCol, Color BottomCol, bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto lo sfondo
|
||||
pGseCtx->m_pScene->SetBackground( TopCol, BottomCol) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetMarkAttribs( Color MarkCol)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto il colore del Mark
|
||||
return pGseCtx->m_pScene->SetMark( MarkCol) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetSelSurfAttribs( Color SelSurfCol)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto il colore del Mark
|
||||
return pGseCtx->m_pScene->SetSelSurf( SelSurfCol) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetGeoLineAttribs( Color GlCol)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto il colore della linea geometrica gestita direttamente dalla scena
|
||||
return pGseCtx->m_pScene->SetGeoLineAttribs( GlCol) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetGeoTriaAttribs( Color GtCol)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto il colore del triangolo immediato
|
||||
return pGseCtx->m_pScene->SetGeoTriaAttribs( GtCol) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetWinRectAttribs( bool bOutline, Color WrCol)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto il colore della linea geometrica gestita direttamente dalla scena
|
||||
return pGseCtx->m_pScene->SetWinRectAttribs( bOutline, WrCol) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetGlobFrameShow( bool bShow)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto stato visualizzazione griglia
|
||||
return pGseCtx->m_pScene->SetGlobFrameShow( bShow) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetGridShow( bool bShowGrid, bool bShowFrame)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto stato visualizzazione griglia
|
||||
return pGseCtx->m_pScene->SetGridShow( bShowGrid, bShowFrame) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetGridGeo( double dSnapStep, int nMinLineSstep, int nMajLineSstep, int nExtSstep)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto i parametri geometrici di griglia
|
||||
return pGseCtx->m_pScene->SetGridGeo( dSnapStep, nMinLineSstep, nMajLineSstep, nExtSstep) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetGridColor( Color colMin, Color colMaj)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto i colori di griglia
|
||||
return pGseCtx->m_pScene->SetGridColor( colMin, colMaj) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeResize( int nW, int nH)
|
||||
{
|
||||
IEGrScene* pScene = GetCurrScene() ;
|
||||
VERIFY_SCENE( pScene, false)
|
||||
// eseguo resize
|
||||
pScene->Resize( nW, nH) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeDraw( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// eseguo disegno
|
||||
pGseCtx->m_pScene->Draw() ;
|
||||
// valido la finestra disegnata
|
||||
ValidateRgn( pGseCtx->m_hWnd, NULL) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSelect( int nWinX, int nWinY, int nSelW, int nSelH, int* pnSel)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// verifico parametro di ritorno
|
||||
if ( pnSel == nullptr)
|
||||
return false ;
|
||||
// eseguo la selezione
|
||||
return pGseCtx->m_pScene->Select( Point3d( nWinX, nWinY), nSelW, nSelH, *pnSel) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetObjFilterForSelect( bool bZerodim, bool bCurve, bool bSurf, bool bVolume, bool bExtra)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto il filtro
|
||||
return pGseCtx->m_pScene->SetObjFilterForSelect( bZerodim, bCurve, bSurf, bVolume, bExtra) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeUnselectableRemove( int nId)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// tolgo dai non selezionabili
|
||||
return pGseCtx->m_pScene->UnselectableRemove( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeUnselectableAdd( int nId)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// aggiungo ai non selezionabili
|
||||
return pGseCtx->m_pScene->UnselectableAdd( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeUnselectableClearAll( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// cancello tutti i non selezionabili
|
||||
return pGseCtx->m_pScene->UnselectableClearAll() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetFirstObjInSelWin( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, GDB_ID_NULL)
|
||||
// restituisco il primo oggetto selezionato
|
||||
return pGseCtx->m_pScene->GetFirstSelectedObj() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetNextObjInSelWin( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, GDB_ID_NULL)
|
||||
// restituisco il successivo oggetto selezionato
|
||||
return pGseCtx->m_pScene->GetNextSelectedObj() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetPointFromSelect( int nSelId, int nWinX, int nWinY, Point3d& ptSel, int* pnAux)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// trovo il punto usato in selezione
|
||||
if ( &ptSel == nullptr || pnAux == nullptr)
|
||||
return false ;
|
||||
return pGseCtx->m_pScene->GetPointFromSelect( nSelId, Point3d( nWinX, nWinY), ptSel, *pnAux) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetGraphicSnapPoint( int nSnap, int nWinX, int nWinY, int nSelW, int nSelH, Point3d& ptP)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// trovo il punto snap da selezione
|
||||
if ( &ptP == nullptr)
|
||||
return false ;
|
||||
return pGseCtx->m_pScene->GetGraphicSnapPoint( nSnap, Point3d( nWinX, nWinY), nSelW, nSelH, ptP) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetGridSnapPointZ( bool bSketch, int nWinX, int nWinY, const Point3d& ptGrid, Point3d& ptP)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// trovo il punto snap da griglia con elevazione in Z
|
||||
if ( &ptP == nullptr)
|
||||
return false ;
|
||||
return pGseCtx->m_pScene->GetGridSnapPointZ( bSketch, Point3d( nWinX, nWinY), ptGrid, ptP) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetLastSnapId( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, GDB_ID_NULL)
|
||||
// restituisco Id di ultima entità generatrice di punto snap
|
||||
return pGseCtx->m_pScene->GetLastSnapId() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetLastSnapDir( Vector3d& vtV)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, FALSE)
|
||||
// restituisco, se definita, direzione associata ad ultimo punto di snap
|
||||
if ( &vtV == nullptr)
|
||||
return false ;
|
||||
return pGseCtx->m_pScene->GetLastSnapDir( vtV) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetShowMode( int nShowMode, bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto il modo di visualizzazione
|
||||
if ( nShowMode >= SM_WIREFRAME && nShowMode <= SM_SHADING) {
|
||||
pGseCtx->m_pScene->SetShowMode( nShowMode) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetShowMode( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, SM_WIREFRAME)
|
||||
// recupero il modo di visualizzazione
|
||||
return pGseCtx->m_pScene->GetShowMode() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetShowCurveDirection( bool bShow, bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto stato
|
||||
pGseCtx->m_pScene->SetShowCurveDirection( bShow) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetShowCurveDirection( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// recupero lo stato
|
||||
return pGseCtx->m_pScene->GetShowCurveDirection() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetShowTriaAdv( bool bAdvanced, bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto stato
|
||||
pGseCtx->m_pScene->SetShowTriaAdvanced( bAdvanced) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetShowTriaAdv( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// recupero lo stato
|
||||
return pGseCtx->m_pScene->GetShowTriaAdvanced() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeZoom( int nZoom, bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
|
||||
const double COEFF_IN = 0.9 ;
|
||||
const double COEFF_OUT = 1 / COEFF_IN ;
|
||||
|
||||
switch ( nZoom) {
|
||||
case 1 :
|
||||
pGseCtx->m_pScene->ZoomAll() ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
break ;
|
||||
case 2 :
|
||||
pGseCtx->m_pScene->ZoomChange( COEFF_IN) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
break ;
|
||||
case 3 :
|
||||
pGseCtx->m_pScene->ZoomChange( COEFF_OUT) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
break ;
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeZoomOnPoint( int nWinX, int nWinY, double dCoeff, bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// eseguo zoom
|
||||
pGseCtx->m_pScene->ZoomOnPoint( Point3d( nWinX, nWinY), dCoeff) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetGeoLine( const Point3d& ptP1, const Point3d& ptP2, bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// disegno linea per distanza o similari
|
||||
pGseCtx->m_pScene->SetGeoLine( ptP1, ptP2) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeResetGeoLine( bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// cancello linea per distanza o similari
|
||||
pGseCtx->m_pScene->ResetGeoLine() ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetGeoTria( const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3, bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// disegno triangolo immediato
|
||||
pGseCtx->m_pScene->SetGeoTria( ptP1, ptP2, ptP3) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeResetGeoTria( bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// cancello triangolo immediato
|
||||
pGseCtx->m_pScene->ResetGeoTria() ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetWinRect( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// disegno finestra per zoom
|
||||
pGseCtx->m_pScene->SetWinRect( Point3d( nPrevX, nPrevY), Point3d( nCurrX, nCurrY)) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeResetWinRect( bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// cancello finestra per zoom
|
||||
pGseCtx->m_pScene->ResetWinRect() ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeZoomWin( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// eseguo zoom su finestra
|
||||
pGseCtx->m_pScene->ZoomWin( Point3d( nPrevX, nPrevY), Point3d( nCurrX, nCurrY)) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetView( int nDir, bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto vista
|
||||
if ( nDir >= CT_TOP && nDir <= CT_CPLANE) {
|
||||
pGseCtx->m_pScene->SetCamera( nDir) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetGenericView( double dAngVertDeg, double dAngHorizDeg, bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto vista
|
||||
pGseCtx->m_pScene->SetCamera( dAngVertDeg, dAngHorizDeg, 0) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetViewCenter( const Point3d& ptP, bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// imposto vista
|
||||
pGseCtx->m_pScene->SetCenter( ptP) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExePanView( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// eseguo panoramica
|
||||
pGseCtx->m_pScene->PanCamera( Point3d( nPrevX, nPrevY), Point3d( nCurrX, nCurrY)) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRotateView( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// eseguo rotazione camera
|
||||
pGseCtx->m_pScene->RotateCamera( Point3d( nPrevX, nPrevY), Point3d( nCurrX, nCurrY)) ;
|
||||
if ( bRedraw)
|
||||
pGseCtx->m_pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetView( int* pnDir)
|
||||
{
|
||||
IEGrScene* pScene = GetCurrScene() ;
|
||||
VERIFY_SCENE( pScene, false)
|
||||
// recupero direzione di vista
|
||||
if ( pnDir == nullptr)
|
||||
return false ;
|
||||
*pnDir = pScene->GetCameraDir() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetGenericView( double* pdAngVertDeg, double* pdAngHorizDeg)
|
||||
{
|
||||
IEGrScene* pScene = GetCurrScene() ;
|
||||
VERIFY_SCENE( pScene, false)
|
||||
// recupero direzione di vista
|
||||
if ( pdAngVertDeg == nullptr || pdAngHorizDeg == nullptr)
|
||||
return false ;
|
||||
pScene->GetCamera( pdAngVertDeg, pdAngHorizDeg) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeProjectPoint( const Point3d& ptP, Point3d& ptWin)
|
||||
{
|
||||
IEGrScene* pScene = GetCurrScene() ;
|
||||
VERIFY_SCENE( pScene, false)
|
||||
// eseguo la proiezione
|
||||
if ( &ptWin == nullptr)
|
||||
return false ;
|
||||
Point3d ptView ;
|
||||
return pScene->Project( ptP, ptView) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeUnProjectPoint( int nWinX, int nWinY, Point3d& ptP)
|
||||
{
|
||||
IEGrScene* pScene = GetCurrScene() ;
|
||||
VERIFY_SCENE( pScene, false)
|
||||
// eseguo l'inverso della proiezione (considero Z punto su centro)
|
||||
if ( &ptP == nullptr)
|
||||
return false ;
|
||||
Point3d ptView( nWinX, nWinY, pScene->GetProjectedCenter().z) ;
|
||||
return pScene->UnProject( ptView, ptP) ;
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_TscExec.cpp Data : 05.05.15 Versione : 1.6e1
|
||||
// Contenuto : Funzioni esecuzione TSC per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 01.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "DllGraphics.h"
|
||||
#include "DllExchange.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkGdbExecutor.h"
|
||||
#include "/EgtDev/Include/EExExcExecutor.h"
|
||||
#include "/EgtDev/Include/EGrSceExecutor.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <string>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeInitTscExec( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
|
||||
// eventuale pulizia esecutore e suoi oggetti
|
||||
if ( pGseCtx->m_pTscExec != nullptr) {
|
||||
delete pGseCtx->m_pTscExec ;
|
||||
pGseCtx->m_pTscExec = nullptr ;
|
||||
}
|
||||
|
||||
// creo esecutore
|
||||
PtrOwner<ICmdParser> pCmdParser( CreateCmdParser()) ;
|
||||
VERIFY_NULL( Get( pCmdParser), "Error in CreateCmdParser", false)
|
||||
|
||||
// creo oggetto per esecuzione funzioni di GeomKernel
|
||||
PtrOwner<IGdbExecutor> pGdbExec( CreateGdbExecutor()) ;
|
||||
VERIFY_NULL( Get( pGdbExec), "Error in CreateGdbExecutor", false)
|
||||
pGdbExec->SetGeomDB( pGseCtx->m_pGeomDB) ;
|
||||
pCmdParser->SetExecutor( Release( pGdbExec)) ;
|
||||
|
||||
// eventuale creazione oggetto per esecuzione funzioni di Scene
|
||||
if ( pGseCtx->m_pScene != nullptr && IsLoadedGraphicsDll()) {
|
||||
PtrOwner<ISceExecutor> pSceExec( MyCreateSceExecutor()) ;
|
||||
VERIFY_NULL( Get( pSceExec), "Error in CreateSceExecutor", false)
|
||||
pSceExec->SetScene( pGseCtx->m_pScene) ;
|
||||
pCmdParser->AddExecutor( Release( pSceExec)) ;
|
||||
}
|
||||
|
||||
// eventuale creazione oggetto per esecuzione funzioni di Exchange
|
||||
if ( IsLoadedExchangeDll()) {
|
||||
PtrOwner<IExcExecutor> pExcExec( MyCreateExcExecutor()) ;
|
||||
VERIFY_NULL( Get( pExcExec), "Error in CreateExcExecutor", false)
|
||||
pExcExec->SetGeomDB( pGseCtx->m_pGeomDB) ;
|
||||
pCmdParser->AddExecutor( Release( pExcExec)) ;
|
||||
}
|
||||
|
||||
// completo inizializzazioni
|
||||
pCmdParser->Init() ;
|
||||
pGseCtx->m_pTscExec = Release( pCmdParser) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTscExecFile( const string& sFilePath)
|
||||
{
|
||||
ICmdParser* pTscExec = GetCurrTscExecutor() ;
|
||||
VERIFY_TSCEXEC( pTscExec, false)
|
||||
|
||||
// emetto info
|
||||
string sInfo = "Exec File = " + sFilePath ;
|
||||
LOG_INFO( GetLogger(), sInfo.c_str())
|
||||
|
||||
// imposto il direttorio dello script
|
||||
string sFileDir, sFileName ;
|
||||
SplitLast( sFilePath, "\\", sFileDir, sFileName) ;
|
||||
pTscExec->SetDirReplace( "<TSCDIR>", sFileDir) ;
|
||||
|
||||
// esecuzione script
|
||||
return pTscExec->Run( sFilePath) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTscExecLine( const string& sLine)
|
||||
{
|
||||
ICmdParser* pTscExec = GetCurrTscExecutor() ;
|
||||
VERIFY_TSCEXEC( pTscExec, false)
|
||||
// eseguo il comando
|
||||
return pTscExec->ExecLine( sLine) ;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXcDllMain.cpp Data : 04.05.15 Versione : 1.6e11
|
||||
// Contenuto : Inizializzazione della DLL.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 04.05.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "/EgtDev/Include/EXeDllMain.h"
|
||||
#include "/EgtDev/Include/EGnGetModuleVer.h"
|
||||
#include "/EgtDev/Include/EgtTrace.h"
|
||||
|
||||
//--------------------------- Costanti ----------------------------------------
|
||||
#if defined( _WIN64)
|
||||
#if defined( _DEBUG)
|
||||
const char* EXE_STR = "EgtExecutorD64.dll ver. " ;
|
||||
#else
|
||||
const char* EXE_STR = "EgtExecutorR64.dll ver. " ;
|
||||
#endif
|
||||
#elif defined( _WIN32)
|
||||
#if defined( _DEBUG)
|
||||
const char* EXE_STR = "EgtExecutorD32.dll ver. " ;
|
||||
#else
|
||||
const char* EXE_STR = "EgtExecutorR32.dll ver. " ;
|
||||
#endif
|
||||
#endif
|
||||
const int STR_DIM = 50 ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static HINSTANCE s_hModule = NULL ;
|
||||
static char s_szEXeNameVer[STR_DIM] ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL APIENTRY
|
||||
DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
|
||||
{
|
||||
|
||||
if ( dwReason == DLL_PROCESS_ATTACH) {
|
||||
// Controllo commentato per problemi con VB.NET
|
||||
//#if defined( NDEBUG)
|
||||
// BOOL IsDbgPresent = FALSE ;
|
||||
// CheckRemoteDebuggerPresent( GetCurrentProcess(), &IsDbgPresent) ;
|
||||
// if ( IsDbgPresent)
|
||||
// return 0 ;
|
||||
//#endif
|
||||
// se debug, imposto stampe memory leaks all'uscita
|
||||
#if defined ( _DEBUG)
|
||||
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF) ;
|
||||
#endif
|
||||
// eseguo
|
||||
s_hModule = hModule ;
|
||||
EGT_TRACE( "EgtExecutor.dll Initializing!\n") ;
|
||||
}
|
||||
else if ( dwReason == DLL_PROCESS_DETACH) {
|
||||
s_hModule = NULL ;
|
||||
EGT_TRACE( "EgtExecutor.dll Terminating!\n") ;
|
||||
}
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const char*
|
||||
GetEXeVersion( void)
|
||||
{
|
||||
std::string sVer ;
|
||||
|
||||
GetModuleVersion( s_hModule, sVer) ;
|
||||
sprintf_s( s_szEXeNameVer, STR_DIM, "%s%s", EXE_STR, sVer.c_str()) ;
|
||||
|
||||
return s_szEXeNameVer ;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EgtExecutor", "EgtExecutor.vcxproj", "{DF654897-F85B-4108-A621-F2C4AB099A48}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{DF654897-F85B-4108-A621-F2C4AB099A48}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{DF654897-F85B-4108-A621-F2C4AB099A48}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{DF654897-F85B-4108-A621-F2C4AB099A48}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{DF654897-F85B-4108-A621-F2C4AB099A48}.Debug|x64.Build.0 = Debug|x64
|
||||
{DF654897-F85B-4108-A621-F2C4AB099A48}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{DF654897-F85B-4108-A621-F2C4AB099A48}.Release|Win32.Build.0 = Release|Win32
|
||||
{DF654897-F85B-4108-A621-F2C4AB099A48}.Release|x64.ActiveCfg = Release|x64
|
||||
{DF654897-F85B-4108-A621-F2C4AB099A48}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,284 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{DF654897-F85B-4108-A621-F2C4AB099A48}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>EgtExecutor</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
<TargetName>$(ProjectName)D$(PlatformArchitecture)</TargetName>
|
||||
<IncludePath>C:\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
<TargetName>$(ProjectName)D$(PlatformArchitecture)</TargetName>
|
||||
<IncludePath>C:\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
<TargetName>$(ProjectName)R$(PlatformArchitecture)</TargetName>
|
||||
<IncludePath>C:\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
<TargetName>$(ProjectName)R$(PlatformArchitecture)</TargetName>
|
||||
<IncludePath>C:\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;I_AM_EXE;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy $(TargetDir)$(TargetName).pdb \EgtDev\Lib\
|
||||
copy $(TargetDir)$(TargetName).lib \EgtDev\Lib\
|
||||
copy $(TargetPath) \EgtProg\DllD32</Command>
|
||||
</PostBuildEvent>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_UNICODE;UNICODE;_DEBUG;_DEB32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;I_AM_EXE;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<GenerateMapFile>false</GenerateMapFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy $(TargetDir)$(TargetName).pdb \EgtDev\Lib\
|
||||
copy $(TargetDir)$(TargetName).lib \EgtDev\Lib\
|
||||
copy $(TargetPath) \EgtProg\DllD64</Command>
|
||||
</PostBuildEvent>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_UNICODE;UNICODE;_DEBUG;_DEB64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;I_AM_EXE;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy $(TargetDir)$(TargetName).lib \EgtDev\Lib\
|
||||
copy $(TargetPath) \EgtProg\Dll32</Command>
|
||||
</PostBuildEvent>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_UNICODE;UNICODE;NDEBUG;NDEB32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;I_AM_EXE;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy $(TargetDir)$(TargetName).lib \EgtDev\Lib\
|
||||
copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
</PostBuildEvent>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_UNICODE;UNICODE;NDEBUG;NDEB64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Include\EGkCurveLocal.h" />
|
||||
<ClInclude Include="..\Include\EGkGeomDB.h" />
|
||||
<ClInclude Include="..\Include\EXeConst.h" />
|
||||
<ClInclude Include="..\Include\EXeDllMain.h" />
|
||||
<ClInclude Include="..\Include\EXeExecutor.h" />
|
||||
<ClInclude Include="EXE.h" />
|
||||
<ClInclude Include="EXE_Macro.h" />
|
||||
<ClInclude Include="AuxTools.h" />
|
||||
<ClInclude Include="DllExchange.h" />
|
||||
<ClInclude Include="DllGraphics.h" />
|
||||
<ClInclude Include="DllMachKernel.h" />
|
||||
<ClInclude Include="GeoTools.h" />
|
||||
<ClInclude Include="GseContext.h" />
|
||||
<ClInclude Include="LUA.h" />
|
||||
<ClInclude Include="LUA_Base.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="EXE_GdbCreateCurve.cpp" />
|
||||
<ClCompile Include="EXE_GdbCreateSurf.cpp" />
|
||||
<ClCompile Include="EXE_GdbModifyCurve.cpp" />
|
||||
<ClCompile Include="EXE_Exchange.cpp" />
|
||||
<ClCompile Include="EXE_GdbModify.cpp" />
|
||||
<ClCompile Include="EXE_GdbModifySurf.cpp" />
|
||||
<ClCompile Include="EXE_GdbObjAttribs.cpp" />
|
||||
<ClCompile Include="EXE_GdbObjects.cpp" />
|
||||
<ClCompile Include="EXE_GdbObjSelection.cpp" />
|
||||
<ClCompile Include="EXE_GdbPartLayers.cpp" />
|
||||
<ClCompile Include="EXE_General.cpp" />
|
||||
<ClCompile Include="EXE_GdbCreate.cpp" />
|
||||
<ClCompile Include="EXE_GeomDB.cpp" />
|
||||
<ClCompile Include="EXE_GeoSnap.cpp" />
|
||||
<ClCompile Include="EXE_GeoTransform.cpp" />
|
||||
<ClCompile Include="EXE_Lua.cpp" />
|
||||
<ClCompile Include="EXE_MachMgr.cpp" />
|
||||
<ClCompile Include="EXE_Messages.cpp" />
|
||||
<ClCompile Include="EXE_Scene.cpp" />
|
||||
<ClCompile Include="EXE_TscExec.cpp" />
|
||||
<ClCompile Include="AuxTools.cpp" />
|
||||
<ClCompile Include="DllExchange.cpp" />
|
||||
<ClCompile Include="DllGraphics.cpp" />
|
||||
<ClCompile Include="DllMachKernel.cpp" />
|
||||
<ClCompile Include="EXeDllMain.cpp" />
|
||||
<ClCompile Include="GeoTools.cpp" />
|
||||
<ClCompile Include="GseContext.cpp" />
|
||||
<ClCompile Include="LUA_Base.cpp" />
|
||||
<ClCompile Include="LUA_GdbCreateCurve.cpp" />
|
||||
<ClCompile Include="LUA_GdbCreateSurf.cpp" />
|
||||
<ClCompile Include="LUA_GdbModifyCurve.cpp" />
|
||||
<ClCompile Include="LUA_Exchange.cpp" />
|
||||
<ClCompile Include="LUA_GdbModify.cpp" />
|
||||
<ClCompile Include="LUA_GdbModifySurf.cpp" />
|
||||
<ClCompile Include="LUA_GdbObjAttribs.cpp" />
|
||||
<ClCompile Include="LUA_GdbObjects.cpp" />
|
||||
<ClCompile Include="LUA_GdbObjSelection.cpp" />
|
||||
<ClCompile Include="LUA_GdbPartLayers.cpp" />
|
||||
<ClCompile Include="LUA_General.cpp" />
|
||||
<ClCompile Include="LUA_GdbCreate.cpp" />
|
||||
<ClCompile Include="LUA_GeoBase.cpp" />
|
||||
<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>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtExecutor.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,236 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="File di origine">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="File di intestazione">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="File di risorse">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="File di origine\LUA">
|
||||
<UniqueIdentifier>{8d45f54c-e32b-4568-a8c6-6d9074ed565f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="File di origine\General">
|
||||
<UniqueIdentifier>{58650c7e-f303-498a-b85b-7bee0f52fa88}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="File di origine\Global">
|
||||
<UniqueIdentifier>{51194dc4-ffc1-435f-aa51-523e8d34f02a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="File di origine\Optional Dll">
|
||||
<UniqueIdentifier>{d42d96c4-e8e4-4bcf-a6de-65b5f0492a14}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="File di intestazione\Include">
|
||||
<UniqueIdentifier>{85a1c0e1-b6e3-4b5c-be4a-75dc9570c4db}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="File di origine\EXE">
|
||||
<UniqueIdentifier>{77e59e94-e3d5-4510-8bcb-d1360cf74848}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GseContext.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="LUA.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AuxTools.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GeoTools.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="LUA_Base.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCurveLocal.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkGeomDB.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DllMachKernel.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DllGraphics.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DllExchange.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EXE.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EXE_Macro.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EXeExecutor.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EXeDllMain.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EXeConst.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="LUA_Exchange.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_GdbCreate.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_GdbModify.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_GdbObjAttribs.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_GdbObjects.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_General.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_GeoBase.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_GeomDB.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_GeoSnap.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_GeoTransform.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_Scene.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>File di origine\General</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_GdbModifyCurve.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_GdbCreateCurve.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_GdbCreateSurf.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AuxTools.cpp">
|
||||
<Filter>File di origine\Global</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GseContext.cpp">
|
||||
<Filter>File di origine\Global</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_GdbObjSelection.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_GdbPartLayers.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeoTools.cpp">
|
||||
<Filter>File di origine\Global</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_GdbModifySurf.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_Base.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_MachMgr.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DllMachKernel.cpp">
|
||||
<Filter>File di origine\Optional Dll</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DllGraphics.cpp">
|
||||
<Filter>File di origine\Optional Dll</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DllExchange.cpp">
|
||||
<Filter>File di origine\Optional Dll</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_Exchange.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_General.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_GeomDB.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_GdbCreateCurve.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_GdbCreateSurf.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXeDllMain.cpp">
|
||||
<Filter>File di origine\General</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_GdbCreate.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_GdbModify.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_GdbModifyCurve.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_GdbModifySurf.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_GdbPartLayers.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_GdbObjAttribs.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_GdbObjects.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_GdbObjSelection.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_GeoTransform.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_TscExec.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_Lua.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_Messages.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_Scene.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_GeoSnap.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_MachMgr.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtExecutor.rc">
|
||||
<Filter>File di risorse</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,90 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : GeoTools.cpp Data : 01.02.15 Versione : 1.6b1
|
||||
// Contenuto : Funzioni geometriche ausiliarie.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 01.02.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GeoTools.h"
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Vector3d
|
||||
GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame3d& frLoc)
|
||||
{
|
||||
Vector3d vtVL( vtV) ;
|
||||
if ( nRefType == RTY_GLOB)
|
||||
vtVL.ToLoc( frLoc) ;
|
||||
else if ( nRefType == RTY_GRID)
|
||||
vtVL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
return vtVL ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Point3d
|
||||
GetPointLocal( IGeomDB* pGeomDB, const Point3d& ptP, int nRefType, const Frame3d& frLoc)
|
||||
{
|
||||
Point3d ptPL( ptP) ;
|
||||
if ( nRefType == RTY_GLOB)
|
||||
ptPL.ToLoc( frLoc) ;
|
||||
else if ( nRefType == RTY_GRID)
|
||||
ptPL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
return ptPL ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VerifySameFrame( IGeomDB* pGeomDB, const INTVECTOR& vIds)
|
||||
{
|
||||
// verifico puntatore a GeomDB
|
||||
if ( pGeomDB == nullptr)
|
||||
return false ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
bool bFirst = true ;
|
||||
Frame3d frFirst ;
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
|
||||
// se si deve agire su un singolo oggetto ( gruppo o entità)
|
||||
if ( vIds[i] != GDB_ID_SEL) {
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( vIds[i], frLoc) &&
|
||||
! pGeomDB->GetGlobFrame( vIds[i], frLoc))
|
||||
return false ;
|
||||
if ( bFirst) {
|
||||
frFirst = frLoc ;
|
||||
bFirst = false ;
|
||||
}
|
||||
else {
|
||||
if ( ! AreSameFrame( frFirst, frLoc))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti si deve agire sugli oggetti selezionati
|
||||
else {
|
||||
int nI = pGeomDB->GetFirstSelectedObj() ;
|
||||
while ( nI != GDB_ID_NULL) {
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nI, frLoc))
|
||||
return false ;
|
||||
if ( bFirst) {
|
||||
frFirst = frLoc ;
|
||||
bFirst = false ;
|
||||
}
|
||||
else {
|
||||
if ( ! AreSameFrame( frFirst, frLoc))
|
||||
return false ;
|
||||
}
|
||||
// passo alla successiva
|
||||
nI = pGeomDB->GetNextSelectedObj() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : GeoTools.h Data : 01.02.15 Versione : 1.6b1
|
||||
// Contenuto : Prototipi funzioni geometriche ausiliarie.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 01.02.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "/EgtDev/Include/EGkPoint3d.h"
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
|
||||
class IGeomDB ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Vettore espresso nel riferimento desiderato partendo da vettore nel riferimento RefType
|
||||
Vector3d GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame3d& frLoc) ;
|
||||
// Punto espresso nel riferimento desiderato partendo da punto nel riferimento RefType
|
||||
Point3d GetPointLocal( IGeomDB* pGeomDB, const Point3d& ptP, int nRefType, const Frame3d& frLoc) ;
|
||||
// Verifica che tutti gli oggetti dell'insieme abbiano lo stesso riferimento
|
||||
bool VerifySameFrame( IGeomDB* pGeomDB, const INTVECTOR& vIds) ;
|
||||
|
||||
+166
@@ -0,0 +1,166 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : GseContext.cpp Data : 01.09.14 Versione : 1.5i1
|
||||
// Contenuto : Gestione contesti GSE ( Geometria, Scena, Esecuzione).
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 01.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GseContext.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int s_nCurrGseCtx = 0 ;
|
||||
static const int MAX_CTX = 10 ;
|
||||
static bool s_GseOn[MAX_CTX] = { false, false, false, false, false, false, false, false, false, false} ;
|
||||
static GseContext s_GseCtx[MAX_CTX] ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
CreateGseContext( void)
|
||||
{
|
||||
for ( int i = 0 ; i < MAX_CTX ; ++ i) {
|
||||
if ( ! s_GseOn[i]) {
|
||||
s_GseCtx[i].Clear() ;
|
||||
s_GseOn[i] = true ;
|
||||
return ( i + 1) ;
|
||||
}
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DeleteGseContext( int nInd)
|
||||
{
|
||||
if ( nInd < 1 || nInd > MAX_CTX)
|
||||
return false ;
|
||||
s_GseOn[nInd-1] = false ;
|
||||
s_GseCtx[nInd-1].Clear() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ClearAllGseContexts( void)
|
||||
{
|
||||
for ( int i = 0 ; i < MAX_CTX ; ++ i) {
|
||||
s_GseOn[i] = false ;
|
||||
s_GseCtx[i].Clear() ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
GseContext*
|
||||
GetGseContext( int nInd)
|
||||
{
|
||||
if ( nInd < 1 || nInd > MAX_CTX || ! s_GseOn[nInd-1])
|
||||
return nullptr ;
|
||||
return &(s_GseCtx[nInd-1]) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IGeomDB*
|
||||
GetGeomDB( int nInd)
|
||||
{
|
||||
if ( nInd < 1 || nInd > MAX_CTX || ! s_GseOn[nInd-1])
|
||||
return nullptr ;
|
||||
return ( s_GseCtx[nInd-1].m_pGeomDB) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IEGrScene*
|
||||
GetScene( int nInd)
|
||||
{
|
||||
if ( nInd < 1 || nInd > MAX_CTX || ! s_GseOn[nInd-1])
|
||||
return nullptr ;
|
||||
return ( s_GseCtx[nInd-1].m_pScene) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ICmdParser*
|
||||
GetTscExecutor( int nInd)
|
||||
{
|
||||
if ( nInd < 1 || nInd > MAX_CTX || ! s_GseOn[nInd-1])
|
||||
return nullptr ;
|
||||
return ( s_GseCtx[nInd-1].m_pTscExec) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SetCurrGseContext( int nInd)
|
||||
{
|
||||
if ( nInd < 1 || nInd > MAX_CTX || ! s_GseOn[nInd-1]) {
|
||||
s_nCurrGseCtx = 0 ;
|
||||
return false ;
|
||||
}
|
||||
s_nCurrGseCtx = nInd ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ResetCurrGseContext( void)
|
||||
{
|
||||
s_nCurrGseCtx = 0 ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
GetIndCurrGseContext( void)
|
||||
{
|
||||
return s_nCurrGseCtx ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
GseContext*
|
||||
GetCurrGseContext( void)
|
||||
{
|
||||
if ( s_nCurrGseCtx < 1 || s_nCurrGseCtx > MAX_CTX || ! s_GseOn[s_nCurrGseCtx-1])
|
||||
return nullptr ;
|
||||
return &(s_GseCtx[s_nCurrGseCtx-1]) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IGeomDB*
|
||||
GetCurrGeomDB( void)
|
||||
{
|
||||
if ( s_nCurrGseCtx < 1 || s_nCurrGseCtx > MAX_CTX || ! s_GseOn[s_nCurrGseCtx-1])
|
||||
return nullptr ;
|
||||
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)
|
||||
{
|
||||
if ( s_nCurrGseCtx < 1 || s_nCurrGseCtx > MAX_CTX || ! s_GseOn[s_nCurrGseCtx-1])
|
||||
return nullptr ;
|
||||
return ( s_GseCtx[s_nCurrGseCtx-1].m_pScene) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ICmdParser*
|
||||
GetCurrTscExecutor( void)
|
||||
{
|
||||
if ( s_nCurrGseCtx < 1 || s_nCurrGseCtx > MAX_CTX || ! s_GseOn[s_nCurrGseCtx-1])
|
||||
return nullptr ;
|
||||
return ( s_GseCtx[s_nCurrGseCtx-1].m_pTscExec) ;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : GseContext.h Data : 01.09.14 Versione : 1.5i1
|
||||
// Contenuto : Dichiarazioni per contesti GSE ( Geometria, Scena, Esecuzione).
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 01.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#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>
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class GseContext
|
||||
{
|
||||
public :
|
||||
IGeomDB* m_pGeomDB ;
|
||||
Color m_colDef ;
|
||||
IMachMgr* m_pMachMgr ;
|
||||
HWND m_hWnd ;
|
||||
IEGrScene* m_pScene ;
|
||||
ICmdParser* m_pTscExec ;
|
||||
std::string m_sFilePath ;
|
||||
bool m_bEnableModified ;
|
||||
bool m_bModified ;
|
||||
int m_nCurrPart ;
|
||||
int m_nCurrLayer ;
|
||||
|
||||
public :
|
||||
GseContext( void)
|
||||
: 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)
|
||||
{ Clear() ; }
|
||||
void Clear( void)
|
||||
{
|
||||
if ( m_pTscExec != nullptr) {
|
||||
delete m_pTscExec ;
|
||||
m_pTscExec = nullptr ;
|
||||
}
|
||||
if ( m_pScene != nullptr) {
|
||||
m_pScene->Destroy() ;
|
||||
delete m_pScene ;
|
||||
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 ;
|
||||
}
|
||||
m_sFilePath.clear() ;
|
||||
m_bEnableModified = true ;
|
||||
m_bModified = false ;
|
||||
m_nCurrPart = GDB_ID_NULL ;
|
||||
m_nCurrLayer = GDB_ID_NULL ;
|
||||
}
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int CreateGseContext( void) ;
|
||||
bool DeleteGseContext( int nInd) ;
|
||||
bool ClearAllGseContexts( void) ;
|
||||
GseContext* GetGseContext( int nInd) ;
|
||||
IGeomDB* GetGeomDB( int nInd) ;
|
||||
IEGrScene* GetScene( int nInd) ;
|
||||
ICmdParser* GetTscExecutor( int nInd) ;
|
||||
bool SetCurrGseContext( int nInd) ;
|
||||
bool ResetCurrGseContext( void) ;
|
||||
int GetIndCurrGseContext( void) ;
|
||||
GseContext* GetCurrGseContext( void) ;
|
||||
IGeomDB* GetCurrGeomDB( void) ;
|
||||
IMachMgr* GetCurrMachMgr( void) ;
|
||||
IEGrScene* GetCurrScene( void) ;
|
||||
ICmdParser* GetCurrTscExecutor( void) ;
|
||||
@@ -0,0 +1,70 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA.h Data : 16.01.15 Versione : 1.6a3
|
||||
// Contenuto : Dichiarazioni locali per moduli LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 27.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EGnLuaMgr.h"
|
||||
|
||||
//-------------------------- General -----------------------------------------
|
||||
bool LuaInstallGeneral( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- GeoBase -----------------------------------------
|
||||
bool LuaInstallGeoBase( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- GeomDB ------------------------------------------
|
||||
bool LuaInstallGeomDB( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- GdbCreate ---------------------------------------
|
||||
bool LuaInstallGdbCreate( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- GdbCreateCurve ----------------------------------
|
||||
bool LuaInstallGdbCreateCurve( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- GdbCreateSurf -----------------------------------
|
||||
bool LuaInstallGdbCreateSurf( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- GdbModify ---------------------------------------
|
||||
bool LuaInstallGdbModify( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- GdbModifyCurve ----------------------------------
|
||||
bool LuaInstallGdbModifyCurve( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- GdbModifySurf -----------------------------------
|
||||
bool LuaInstallGdbModifySurf( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- GdbPartLayer ------------------------------------
|
||||
bool LuaInstallGdbPartLayer( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- GdbObjects --------------------------------------
|
||||
bool LuaInstallGdbObjects( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- GdbObjSelection ---------------------------------
|
||||
bool LuaInstallGdbObjSelection( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- GdbObjAttribs -----------------------------------
|
||||
bool LuaInstallGdbObjAttribs( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- GeoSnap -----------------------------------------
|
||||
bool LuaInstallGeoSnap( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- GeoTransform ------------------------------------
|
||||
bool LuaInstallGeoTransform( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- MachMgr -----------------------------------------
|
||||
bool LuaInstallMachMgr( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- Scene -------------------------------------------
|
||||
bool LuaInstallScene( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- Exchange ----------------------------------------
|
||||
bool LuaInstallExchange( LuaMgr& luaMgr) ;
|
||||
+185
@@ -0,0 +1,185 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_General.cpp Data : 27.09.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni generali per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 27.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "LUA.h"
|
||||
#include "LUA_Base.h"
|
||||
#include "/EgtDev/Include/EGnLuaMgr.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallAllFunctions( LuaMgr& LuaMgr)
|
||||
{
|
||||
if ( ! LuaInstallGeneral( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGeneral (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallGeoBase( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGeoBase (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallGeomDB( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGeomDB (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallGdbCreate( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbCreate (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallGdbCreateCurve( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbCreateCurve (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallGdbCreateSurf( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbCreateSurf (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallGdbModify( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbModify (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallGdbModifyCurve( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbModifyCurve (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallGdbModifySurf( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbModifySurf (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallGdbPartLayer( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbPartLayer (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallGdbObjects( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbObjects (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallGdbObjSelection( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbObjSelection (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallGdbObjAttribs( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbObjAttribs (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallGeoSnap( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGeoSnap (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallGeoTransform( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGeoTransform (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallMachMgr( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallMachMgr (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallScene( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallScene (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallExchange( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallExchange (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Static LuaMgr per EgtExecutor
|
||||
//----------------------------------------------------------------------------
|
||||
static LuaMgr s_LuaMgr ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInit( void)
|
||||
{
|
||||
// inizializzo l'interprete lua
|
||||
if ( ! s_LuaMgr.Init())
|
||||
return false ;
|
||||
|
||||
// carico le funzioni speciali
|
||||
if ( ! LuaInstallAllFunctions( s_LuaMgr))
|
||||
return false ;
|
||||
|
||||
// recupero la versione di Lua
|
||||
string sLua ;
|
||||
if ( s_LuaMgr.GetVersion( sLua))
|
||||
sLua += " interpreter started" ;
|
||||
else
|
||||
sLua = "Lua *.* interpreter started" ;
|
||||
LOG_INFO( GetLogger(), sLua.c_str())
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
LuaExit( void)
|
||||
{
|
||||
s_LuaMgr.Exit() ;
|
||||
LOG_INFO( GetLogger(), "Lua interpreter closed")
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
LuaSetLuaLibsDir( const string& sDir)
|
||||
{
|
||||
return s_LuaMgr.SetLuaLibsDir( sDir) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
LuaRequire( const string& sFile)
|
||||
{
|
||||
return s_LuaMgr.Require( sFile) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
LuaEvalNumExpr( const string& sExpr, double& dVal)
|
||||
{
|
||||
return s_LuaMgr.EvalNumExpr( sExpr, dVal) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
LuaEvalStringExpr( const string& sExpr, string& sVal)
|
||||
{
|
||||
return s_LuaMgr.EvalStringExpr( sExpr, sVal) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
LuaExecLine( const string& sLine)
|
||||
{
|
||||
return s_LuaMgr.ExecLine( sLine) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
LuaExecFile( const string& sFile)
|
||||
{
|
||||
return s_LuaMgr.ExecFile( sFile) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const string&
|
||||
LuaGetLastError( void)
|
||||
{
|
||||
return s_LuaMgr.GetLastError() ;
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_Base.h Data : 21.03.15 Versione : 1.6c6
|
||||
// Contenuto : Dichiarazioni per funzioni di base gestione LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 21.03.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
struct lua_State ;
|
||||
typedef int(*PFLUA) ( lua_State*) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool LuaInit( void) ;
|
||||
bool LuaExit( void) ;
|
||||
bool LuaSetLuaLibsDir( const std::string& sDir) ;
|
||||
bool LuaRequire( const std::string& sFile) ;
|
||||
bool LuaEvalNumExpr( const std::string& sExpr, double& dVal) ;
|
||||
bool LuaEvalStringExpr( const std::string& sExpr, std::string& sVal) ;
|
||||
bool LuaExecLine( const std::string& sLine) ;
|
||||
bool LuaExecFile( const std::string& sFile) ;
|
||||
const std::string& LuaGetLastError( void) ;
|
||||
@@ -0,0 +1,118 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_Exchange.cpp Data : 29.09.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni generali per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 29.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
#include "/EgtDev/Include/EgnStringUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaImportDxf( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : path del file da importare [, Fattore di scala]
|
||||
string sFilePath ;
|
||||
LuaCheckParam( L, 1, sFilePath)
|
||||
double dScaleFactor = 1.0 ;
|
||||
LuaGetParam( L, 2, dScaleFactor) ;
|
||||
LuaClearStack( L) ;
|
||||
// apro il file
|
||||
bool bOk = ExeImportDxf( sFilePath, dScaleFactor) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaImportStl( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : path del file da importare [, Fattore di scala]
|
||||
string sFilePath ;
|
||||
LuaCheckParam( L, 1, sFilePath)
|
||||
double dScaleFactor = 1.0 ;
|
||||
LuaGetParam( L, 2, dScaleFactor) ;
|
||||
LuaClearStack( L) ;
|
||||
// apro il file
|
||||
bool bOk = ExeImportStl( sFilePath, dScaleFactor) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaImportCnc( lua_State* L)
|
||||
{
|
||||
// 1 parametro : path del file da importare
|
||||
string sFilePath ;
|
||||
LuaCheckParam( L, 1, sFilePath)
|
||||
LuaClearStack( L) ;
|
||||
// apro il file
|
||||
bool bOk = ExeImportCnc( sFilePath) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExportDxf( lua_State* L)
|
||||
{
|
||||
// 2 parametri, GroupId e path del file da esportare
|
||||
int nGroupId ;
|
||||
LuaCheckParam( L, 1, nGroupId)
|
||||
string sFilePath ;
|
||||
LuaCheckParam( L, 2, sFilePath)
|
||||
LuaClearStack( L) ;
|
||||
// apro il file
|
||||
bool bOk = ExeExportDxf( nGroupId, sFilePath) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExportStl( lua_State* L)
|
||||
{
|
||||
// 2 parametri, GroupId e path del file da esportare
|
||||
int nGroupId ;
|
||||
LuaCheckParam( L, 1, nGroupId)
|
||||
string sFilePath ;
|
||||
LuaCheckParam( L, 2, sFilePath)
|
||||
LuaClearStack( L) ;
|
||||
// apro il file
|
||||
bool bOk = ExeExportStl( nGroupId, sFilePath) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallExchange( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtImportDxf", LuaImportDxf) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtImportStl", LuaImportStl) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtImportCnc", LuaImportCnc) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExportDxf", LuaExportDxf) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExportStl", LuaExportStl) ;
|
||||
return bOk ;
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_GdbCreate.cpp Data : 30.09.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni di creazione geometrica per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 30.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateGroup( lua_State* L)
|
||||
{
|
||||
// 1 o 2 o 3 parametri : ParentId [, Frame] [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Frame3d frFrame ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 2, frFrame))
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
else
|
||||
LuaGetParam( L, 2, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il gruppo
|
||||
int nId = ExeCreateGroup( nParentId, frFrame, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateGeoPoint( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : ParentId, PtP [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptP ;
|
||||
LuaCheckParam( L, 2, ptP)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il punto
|
||||
int nId = ExeCreateGeoPoint( nParentId, ptP, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateGeoVector( lua_State* L)
|
||||
{
|
||||
// 2 o 3 o 4 parametri : ParentId, VtV [, PtB] [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Vector3d vtV ;
|
||||
LuaCheckParam( L, 2, vtV)
|
||||
Point3d ptB ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 3, ptB))
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
else
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il vettore
|
||||
int nId = ExeCreateGeoVector( nParentId, vtV, ptB, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateGeoFrame( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : ParentId, Frame [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Frame3d frFrame ;
|
||||
LuaCheckParam( L, 2, frFrame) ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il gruppo
|
||||
int nId = ExeCreateGeoFrame( nParentId, frFrame, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateText( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : ParentId, ptP, AngRotDeg, Text, H [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptP ;
|
||||
LuaCheckParam( L, 2, ptP) ;
|
||||
double dAngRotDeg ;
|
||||
LuaCheckParam( L, 3, dAngRotDeg) ;
|
||||
string sText ;
|
||||
LuaCheckParam( L, 4, sText)
|
||||
double dH ;
|
||||
LuaCheckParam( L, 5, dH) ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il testo
|
||||
int nId = ExeCreateText( nParentId, ptP, dAngRotDeg, sText, dH, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateTextEx( lua_State* L)
|
||||
{
|
||||
// 8 o 9 parametri : ParentId, ptP, vtN, vtD, Text, Font, bItalic, H [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptP ;
|
||||
LuaCheckParam( L, 2, ptP) ;
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 3, vtN) ;
|
||||
Vector3d vtD ;
|
||||
LuaCheckParam( L, 4, vtD) ;
|
||||
string sText ;
|
||||
LuaCheckParam( L, 5, sText)
|
||||
string sFont ;
|
||||
LuaCheckParam( L, 6, sFont) ;
|
||||
string sItalic ;
|
||||
LuaCheckParam( L, 7, sItalic)
|
||||
ToUpper( sItalic) ;
|
||||
bool bItalic = ( sItalic == "I") ;
|
||||
double dH ;
|
||||
LuaCheckParam( L, 8, dH) ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 9, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il testo in modo esteso
|
||||
int nId = ExeCreateTextEx( nParentId, ptP, vtN, vtD, sText, sFont, bItalic, dH, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateTextAdv( lua_State* L)
|
||||
{
|
||||
// 12 o 13 parametri : ParentId, ptP, vtN, vtD, Text, Font, W, sItalic, H, Rat, AddAdv, InsPos [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptP ;
|
||||
LuaCheckParam( L, 2, ptP) ;
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 3, vtN) ;
|
||||
Vector3d vtD ;
|
||||
LuaCheckParam( L, 4, vtD) ;
|
||||
string sText ;
|
||||
LuaCheckParam( L, 5, sText)
|
||||
string sFont ;
|
||||
LuaCheckParam( L, 6, sFont)
|
||||
int nW ;
|
||||
LuaCheckParam( L, 7, nW)
|
||||
string sItalic ;
|
||||
LuaCheckParam( L, 8, sItalic)
|
||||
ToUpper( sItalic) ;
|
||||
bool bItalic = ( sItalic == "I") ;
|
||||
double dH ;
|
||||
LuaCheckParam( L, 9, dH)
|
||||
double dRat ;
|
||||
LuaCheckParam( L, 10, dRat)
|
||||
double dAddAdv ;
|
||||
LuaCheckParam( L, 11, dAddAdv)
|
||||
int nInsPos ;
|
||||
LuaCheckParam( L, 12, nInsPos)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 13, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il testo in modo avanzato
|
||||
int nId = ExeCreateTextAdv( nParentId, ptP, vtN, vtD,
|
||||
sText, sFont, nW, bItalic, dH, dRat, dAddAdv, nInsPos, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbCreate( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGroup", LuaCreateGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPoint", LuaCreateGeoPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVector", LuaCreateGeoVector) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtFrame", LuaCreateGeoFrame) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtText", LuaCreateText) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTextEx", LuaCreateTextEx) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTextAdv", LuaCreateTextAdv) ;
|
||||
return bOk ;
|
||||
}
|
||||
@@ -0,0 +1,836 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_GdbCreateCurve.cpp Data : 07.01.15 Versione : 1.6a1
|
||||
// Contenuto : Funzioni di creazione curve per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 07.01.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveLine( lua_State* L)
|
||||
{
|
||||
// 3 o 4 parametri : ParentId, PtIni, PtFin [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptIni ;
|
||||
LuaCheckParam( L, 2, ptIni)
|
||||
Point3d ptFin ;
|
||||
LuaCheckParam( L, 3, ptFin)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il segmento di retta
|
||||
int nId = ExeCreateCurveLine( nParentId, ptIni, ptFin, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveLineEx( lua_State* L)
|
||||
{
|
||||
// 7 o 8 parametri : ParentId, PtIni, nSepI, nIdI, PtFin, nSepF, nIdF [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptIni ;
|
||||
LuaCheckParam( L, 2, ptIni)
|
||||
int nSepI ;
|
||||
LuaCheckParam( L, 3, nSepI)
|
||||
int nIdI ;
|
||||
LuaCheckParam( L, 4, nIdI)
|
||||
Point3d ptFin ;
|
||||
LuaCheckParam( L, 5, ptFin)
|
||||
int nSepF ;
|
||||
LuaCheckParam( L, 6, nSepF)
|
||||
int nIdF ;
|
||||
LuaCheckParam( L, 7, nIdF)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 8, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il segmento di retta
|
||||
int nId = ExeCreateCurveLineEx( nParentId,
|
||||
ptIni, nSepI, nIdI,
|
||||
ptFin, nSepF, nIdF, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveLinePVL( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : ParentId, PtIni, VtDir, dLen [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptIni ;
|
||||
LuaCheckParam( L, 2, ptIni)
|
||||
Vector3d vtDir ;
|
||||
LuaCheckParam( L, 3, vtDir)
|
||||
double dLen ;
|
||||
LuaCheckParam( L, 4, dLen)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il segmento di retta
|
||||
int nId = ExeCreateCurveLinePVL( nParentId, ptIni, vtDir, dLen, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveLineMinPointCurve( lua_State* L)
|
||||
{
|
||||
// 3 o 4 o 5 parametri : ParentId, PtIni, CrvId [, NearPar] [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptIni ;
|
||||
LuaCheckParam( L, 2, ptIni)
|
||||
int nCrvId ;
|
||||
LuaCheckParam( L, 3, nCrvId)
|
||||
double dNearPar = 0 ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 4, dNearPar))
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
else
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il segmento di retta
|
||||
int nId = ExeCreateCurveLineMinPointCurve( nParentId, ptIni, nCrvId, dNearPar, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveCircle( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : ParentId, PtCen, VtN, Rad [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptCen ;
|
||||
LuaCheckParam( L, 2, ptCen)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 3, vtN)
|
||||
double dRad ;
|
||||
LuaCheckParam( L, 4, dRad)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco
|
||||
int nId = ExeCreateCurveCircle( nParentId, ptCen, vtN, dRad, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveCircleCPN( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : ParentId, PtCen, PtOn, VtN [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptCen ;
|
||||
LuaCheckParam( L, 2, ptCen)
|
||||
Point3d ptOn ;
|
||||
LuaCheckParam( L, 3, ptOn)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 4, vtN)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco
|
||||
int nId = ExeCreateCurveCircleCPN( nParentId, ptCen, ptOn, vtN, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveCircleCPNEx( lua_State* L)
|
||||
{
|
||||
// 6 o 7 parametri : ParentId, PtCen, PtOn, nSepO, nIdO, VtN [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptCen ;
|
||||
LuaCheckParam( L, 2, ptCen)
|
||||
Point3d ptOn ;
|
||||
LuaCheckParam( L, 3, ptOn)
|
||||
int nSepO ;
|
||||
LuaCheckParam( L, 4, nSepO)
|
||||
int nIdO ;
|
||||
LuaCheckParam( L, 5, nIdO)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 6, vtN)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 7, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco
|
||||
int nId = ExeCreateCurveCircleCPNEx( nParentId, ptCen, ptOn, nSepO, nIdO, vtN, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveCircle3P( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : ParentId, PtP1, PtP2, PtP3 [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptP1 ;
|
||||
LuaCheckParam( L, 2, ptP1)
|
||||
Point3d ptP2 ;
|
||||
LuaCheckParam( L, 3, ptP2)
|
||||
Point3d ptP3 ;
|
||||
LuaCheckParam( L, 4, ptP3)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco
|
||||
int nId = ExeCreateCurveCircle3P( nParentId, ptP1, ptP2, ptP3, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveArc( lua_State* L)
|
||||
{
|
||||
// 7 o 8 parametri : ParentId, PtCen, VtN, Rad, VtS, AngCenDeg, DeltaN [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptCen ;
|
||||
LuaCheckParam( L, 2, ptCen)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 3, vtN)
|
||||
double dRad ;
|
||||
LuaCheckParam( L, 4, dRad)
|
||||
Vector3d vtS ;
|
||||
LuaCheckParam( L, 5, vtS)
|
||||
double dAngCenDeg ;
|
||||
LuaCheckParam( L, 6, dAngCenDeg)
|
||||
double dDeltaN ;
|
||||
LuaCheckParam( L, 7, dDeltaN)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 8, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco
|
||||
int nId = ExeCreateCurveArc( nParentId, ptCen, vtN, dRad, vtS, dAngCenDeg, dDeltaN, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveArcC2PN( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : ParentId, PtCen, PtStart, PtNearEnd, VtNorm [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptCen ;
|
||||
LuaCheckParam( L, 2, ptCen)
|
||||
Point3d ptStart ;
|
||||
LuaCheckParam( L, 3, ptStart)
|
||||
Point3d ptNearEnd ;
|
||||
LuaCheckParam( L, 4, ptNearEnd)
|
||||
Vector3d vtNorm ;
|
||||
LuaCheckParam( L, 5, vtNorm)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco
|
||||
int nId = ExeCreateCurveArcC2PN( nParentId, ptCen, ptStart, ptNearEnd, vtNorm, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveArcC2PNEx( lua_State* L)
|
||||
{
|
||||
// 7 o 8 parametri : ParentId, PtCen, PtStart, nSepS, nIdS, PtNearEnd, VtNorm [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptCen ;
|
||||
LuaCheckParam( L, 2, ptCen)
|
||||
Point3d ptStart ;
|
||||
LuaCheckParam( L, 3, ptStart)
|
||||
int nSepS ;
|
||||
LuaCheckParam( L, 4, nSepS)
|
||||
int nIdS ;
|
||||
LuaCheckParam( L, 5, nIdS)
|
||||
Point3d ptNearEnd ;
|
||||
LuaCheckParam( L, 6, ptNearEnd)
|
||||
Vector3d vtNorm ;
|
||||
LuaCheckParam( L, 7, vtNorm)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 8, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco
|
||||
int nId = ExeCreateCurveArcC2PNEx( nParentId, ptCen, ptStart, nSepS, nIdS, ptNearEnd, vtNorm, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveArc3P( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : ParentId, PtP1, PtP2, PtP3 [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptP1 ;
|
||||
LuaCheckParam( L, 2, ptP1)
|
||||
Point3d ptP2 ;
|
||||
LuaCheckParam( L, 3, ptP2)
|
||||
Point3d ptP3 ;
|
||||
LuaCheckParam( L, 4, ptP3)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco
|
||||
int nId = ExeCreateCurveArc3P( nParentId, ptP1, ptP2, ptP3, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveArc2PVN( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : ParentId, PtStart, PtEnd, VtDirS, VtNorm [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptStart ;
|
||||
LuaCheckParam( L, 2, ptStart)
|
||||
Point3d ptEnd ;
|
||||
LuaCheckParam( L, 3, ptEnd)
|
||||
Vector3d vtDirS ;
|
||||
LuaCheckParam( L, 4, vtDirS)
|
||||
Vector3d vtNorm ;
|
||||
LuaCheckParam( L, 5, vtNorm)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco
|
||||
int nId = ExeCreateCurveArc2PVN( nParentId, ptStart, ptEnd, vtDirS, vtNorm, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveArc2PVNEx( lua_State* L)
|
||||
{
|
||||
// 7 o 8 parametri : ParentId, PtStart, PtEnd, nSepE, nIdE, VtDirS, VtNorm [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptStart ;
|
||||
LuaCheckParam( L, 2, ptStart)
|
||||
Point3d ptEnd ;
|
||||
LuaCheckParam( L, 3, ptEnd)
|
||||
int nSepE ;
|
||||
LuaCheckParam( L, 4, nSepE)
|
||||
int nIdE ;
|
||||
LuaCheckParam( L, 5, nIdE)
|
||||
Vector3d vtDirS ;
|
||||
LuaCheckParam( L, 6, vtDirS)
|
||||
Vector3d vtNorm ;
|
||||
LuaCheckParam( L, 7, vtNorm)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 8, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco
|
||||
int nId = ExeCreateCurveArc2PVNEx( nParentId, ptStart, ptEnd, nSepE, nIdE,
|
||||
vtDirS, vtNorm, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveFillet( lua_State* L)
|
||||
{
|
||||
// 8 o 9 parametri : ParentId, nCrv1, PtNear1, nCrv2, PtNear2, VtNorm, dRad, bTrim [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nCrv1 ;
|
||||
LuaCheckParam( L, 2, nCrv1)
|
||||
Point3d ptNear1 ;
|
||||
LuaCheckParam( L, 3, ptNear1)
|
||||
int nCrv2 ;
|
||||
LuaCheckParam( L, 4, nCrv2)
|
||||
Point3d ptNear2 ;
|
||||
LuaCheckParam( L, 5, ptNear2)
|
||||
Vector3d vtNorm ;
|
||||
LuaCheckParam( L, 6, vtNorm)
|
||||
double dRad ;
|
||||
LuaCheckParam( L, 7, dRad)
|
||||
bool bTrim ;
|
||||
LuaCheckParam( L, 8, bTrim)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 9, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco di fillet
|
||||
int nId = ExeCreateCurveFillet( nParentId, nCrv1, ptNear1, nCrv2, ptNear2,
|
||||
vtNorm, dRad, bTrim, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveChamfer( lua_State* L)
|
||||
{
|
||||
// 8 o 9 parametri : ParentId, nCrv1, PtNear1, nCrv2, PtNear2, VtNorm, dDist, bTrim [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nCrv1 ;
|
||||
LuaCheckParam( L, 2, nCrv1)
|
||||
Point3d ptNear1 ;
|
||||
LuaCheckParam( L, 3, ptNear1)
|
||||
int nCrv2 ;
|
||||
LuaCheckParam( L, 4, nCrv2)
|
||||
Point3d ptNear2 ;
|
||||
LuaCheckParam( L, 5, ptNear2)
|
||||
Vector3d vtNorm ;
|
||||
LuaCheckParam( L, 6, vtNorm)
|
||||
double dDist ;
|
||||
LuaCheckParam( L, 7, dDist)
|
||||
bool bTrim ;
|
||||
LuaCheckParam( L, 8, bTrim)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 9, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco di fillet
|
||||
int nId = ExeCreateCurveChamfer( nParentId, nCrv1, ptNear1, nCrv2, ptNear2,
|
||||
vtNorm, dDist, bTrim, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveBezier( lua_State* L)
|
||||
{
|
||||
// 3 o 4 parametri : ParentId, Degree, CtrlPnts [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nDegree ;
|
||||
LuaCheckParam( L, 2, nDegree)
|
||||
PNTVECTOR vPnt ;
|
||||
LuaCheckParam( L, 3, vPnt)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo la curva
|
||||
int nId = ExeCreateCurveBezier( nParentId, nDegree, vPnt, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveBezierRational( lua_State* L)
|
||||
{
|
||||
// 3 o 4 parametri : ParentId, Degree, CtrlPntWs [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nDegree ;
|
||||
LuaCheckParam( L, 2, nDegree)
|
||||
PNTUVECTOR vPntW ;
|
||||
LuaCheckParam( L, 3, vPntW)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo la curva
|
||||
int nId = ExeCreateCurveBezierRational( nParentId, nDegree, vPntW, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveBezierFromArc( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : ParentId, ArcId[ , Erase]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nArcId ;
|
||||
LuaCheckParam( L, 2, nArcId)
|
||||
bool bErase = true ;
|
||||
LuaGetParam( L, 3, bErase) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo la curva
|
||||
int nId = ExeCreateCurveBezierFromArc( nParentId, nArcId, bErase) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveCompo( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : ParentId, nIds [, Erase]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
INTVECTOR vIds ;
|
||||
LuaCheckParam( L, 2, vIds)
|
||||
bool bErase = true ;
|
||||
LuaGetParam( L, 3, bErase) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo la curva composita
|
||||
int nId = ExeCreateCurveCompo( nParentId, vIds, bErase) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveCompoByChain( lua_State* L)
|
||||
{
|
||||
// 3 o 4 o 5 parametri : ParentId, nIds, PtNear [, Erase] [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
INTVECTOR vIds ;
|
||||
LuaCheckParam( L, 2, vIds)
|
||||
Point3d ptNear ;
|
||||
LuaCheckParam( L, 3, ptNear)
|
||||
bool bErase = true ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 4, bErase))
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
else
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo la curva composita
|
||||
int nCount = 0 ;
|
||||
int nId = ExeCreateCurveCompoByChain( nParentId, vIds, ptNear, bErase, nRefType, &nCount) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
LuaSetReturn( L, nCount) ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveCompoFromPoints( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : ParentId, ptPs [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
PNTVECTOR vPnt ;
|
||||
LuaCheckParam( L, 2, vPnt)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
PolyLine PL ;
|
||||
// creo una polilinea a partire dai punti
|
||||
for ( size_t i = 0 ; i < vPnt.size() ; ++ i)
|
||||
PL.AddUPoint( 0, vPnt[i]) ;
|
||||
// creo la curva composita
|
||||
int nId = ExeCreateCurveCompoFromPoints( nParentId, PL, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveCompoFromPointBulges( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : ParentId, ptPBs [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
PNTUVECTOR vPntB ;
|
||||
LuaCheckParam( L, 2, vPntB)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo un poliarco a partire dai punti con bulge
|
||||
PolyArc PA ;
|
||||
for ( size_t i = 0 ; i < vPntB.size() ; ++ i)
|
||||
PA.AddUPoint( 0, vPntB[i].first, vPntB[i].second) ;
|
||||
// creo la curva composita
|
||||
int nId = ExeCreateCurveCompoFromPointBulges( nParentId, PA, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveCompoByApprox( lua_State* L)
|
||||
{
|
||||
// 3 o 4 parametri : ParentId, nSouId, nArcsVsLines [, dLinTol]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nSouId ;
|
||||
LuaCheckParam( L, 2, nSouId)
|
||||
int nTemp ;
|
||||
LuaCheckParam( L, 3, nTemp)
|
||||
bool bArcsVsLines = ( nTemp != 0) ;
|
||||
double dLinTol = 0.01 ;
|
||||
LuaGetParam( L, 4, dLinTol) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo la curva composita
|
||||
int nId = ExeCreateCurveCompoByApprox( nParentId, nSouId, bArcsVsLines, dLinTol) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateRectangle3P( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : ParentId, PtIni, PtCross, PtDir [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptIni ;
|
||||
LuaCheckParam( L, 2, ptIni)
|
||||
Point3d ptCross ;
|
||||
LuaCheckParam( L, 3, ptCross)
|
||||
Point3d ptDir ;
|
||||
LuaCheckParam( L, 4, ptDir)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il poligono
|
||||
int nId = ExeCreateRectangle3P( nParentId, ptIni, ptCross, ptDir, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreatePolygonFromRadius( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : ParentId, nNumSides, PtCen, PtCorn, VtN [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nNumSides ;
|
||||
LuaCheckParam( L, 2, nNumSides)
|
||||
Point3d PtCen ;
|
||||
LuaCheckParam( L, 3, PtCen)
|
||||
Point3d PtCorn ;
|
||||
LuaCheckParam( L, 4, PtCorn)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 5, vtN)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il poligono
|
||||
int nId = ExeCreatePolygonFromRadius( nParentId, nNumSides, PtCen, PtCorn, vtN, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreatePolygonFromApothem( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : ParentId, nNumSides, PtCen, PtMid, VtN [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nNumSides ;
|
||||
LuaCheckParam( L, 2, nNumSides)
|
||||
Point3d PtCen ;
|
||||
LuaCheckParam( L, 3, PtCen)
|
||||
Point3d PtMid ;
|
||||
LuaCheckParam( L, 4, PtMid)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 5, vtN)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il poligono
|
||||
int nId = ExeCreatePolygonFromApothem( nParentId, nNumSides, PtCen, PtMid, vtN, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreatePolygonFromSide( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : ParentId, nNumSides, PtIni, PtFin, VtN [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nNumSides ;
|
||||
LuaCheckParam( L, 2, nNumSides)
|
||||
Point3d ptIni ;
|
||||
LuaCheckParam( L, 3, ptIni)
|
||||
Point3d ptFin ;
|
||||
LuaCheckParam( L, 4, ptFin)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 5, vtN)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il poligono
|
||||
int nId = ExeCreatePolygonFromSide( nParentId, nNumSides, ptIni, ptFin, vtN, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtLine", LuaCreateCurveLine) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtLineEx", LuaCreateCurveLineEx) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtLinePVL", LuaCreateCurveLinePVL) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtLineMinPointCurve", LuaCreateCurveLineMinPointCurve) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCircle", LuaCreateCurveCircle) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCircleCPN", LuaCreateCurveCircleCPN) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCircleCPNEx", LuaCreateCurveCircleCPNEx) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCircle3P", LuaCreateCurveCircle3P) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArc", LuaCreateCurveArc) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2PN", LuaCreateCurveArcC2PN) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2PNEx", LuaCreateCurveArcC2PNEx) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArc3P", LuaCreateCurveArc3P) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PVN", LuaCreateCurveArc2PVN) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PVNEx", LuaCreateCurveArc2PVNEx) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveFillet", LuaCreateCurveFillet) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveChamfer", LuaCreateCurveChamfer) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezier", LuaCreateCurveBezier) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierRat", LuaCreateCurveBezierRational) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierFromArc", LuaCreateCurveBezierFromArc) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompo", LuaCreateCurveCompo) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoByChain", LuaCreateCurveCompoByChain) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoFromPoints", LuaCreateCurveCompoFromPoints) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoFromPointBulges", LuaCreateCurveCompoFromPointBulges) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoByApprox", LuaCreateCurveCompoByApprox) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRectangle3P", LuaCreateRectangle3P) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromRadius", LuaCreatePolygonFromRadius) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromApothem", LuaCreatePolygonFromApothem) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromSide", LuaCreatePolygonFromSide) ;
|
||||
return bOk ;
|
||||
}
|
||||
@@ -0,0 +1,459 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_GdbCreateSurf.cpp Data : 07.01.15 Versione : 1.6a1
|
||||
// Contenuto : Funzioni di creazione superfici per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 07.01.15 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/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static const double LIN_TOL_DEF = 0.05 ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmBBox( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : ParentId, BBox3d [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
BBox3d b3Box ;
|
||||
LuaCheckParam( L, 2, b3Box)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM bounding box
|
||||
int nId = ExeCreateSurfTmBBox( nParentId, b3Box, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmBox( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : ParentId, PtIni, PtCross, PtDir, dHeight [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptIni ;
|
||||
LuaCheckParam( L, 2, ptIni)
|
||||
Point3d ptCross ;
|
||||
LuaCheckParam( L, 3, ptCross)
|
||||
Point3d ptDir ;
|
||||
LuaCheckParam( L, 4, ptDir)
|
||||
double dHeight ;
|
||||
LuaCheckParam( L, 5, dHeight)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM parallelepipedo
|
||||
int nId = ExeCreateSurfTmBox( nParentId, ptIni, ptCross, ptDir, dHeight, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmPyramid( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : ParentId, PtIni, PtCross, PtDir, dHeight [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptIni ;
|
||||
LuaCheckParam( L, 2, ptIni)
|
||||
Point3d ptCross ;
|
||||
LuaCheckParam( L, 3, ptCross)
|
||||
Point3d ptDir ;
|
||||
LuaCheckParam( L, 4, ptDir)
|
||||
double dHeight ;
|
||||
LuaCheckParam( L, 5, dHeight)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM cilindro
|
||||
int nId = ExeCreateSurfTmPyramid( nParentId, ptIni, ptCross, ptDir, dHeight, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmCylinder( lua_State* L)
|
||||
{
|
||||
// 5 o 6 o 7 parametri : ParentId, PtOrig, vtN, dRad, dHeight [, dTol] [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptOrig ;
|
||||
LuaCheckParam( L, 2, ptOrig)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 3, vtN)
|
||||
double dRad ;
|
||||
LuaCheckParam( L, 4, dRad)
|
||||
double dHeight ;
|
||||
LuaCheckParam( L, 5, dHeight)
|
||||
double dLinTol = LIN_TOL_DEF ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 6, dLinTol))
|
||||
LuaGetParam( L, 7, nRefType) ;
|
||||
else
|
||||
LuaGetParam( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM cilindro
|
||||
int nId = ExeCreateSurfTmCylinder( nParentId, ptOrig, vtN, dRad, dHeight, dLinTol, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmCone( lua_State* L)
|
||||
{
|
||||
// 5 o 6 o 7 parametri : ParentId, PtOrig, vtN, dRad, dHeight [, dTol] [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptOrig ;
|
||||
LuaCheckParam( L, 2, ptOrig)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 3, vtN)
|
||||
double dRad ;
|
||||
LuaCheckParam( L, 4, dRad)
|
||||
double dHeight ;
|
||||
LuaCheckParam( L, 5, dHeight)
|
||||
double dLinTol = LIN_TOL_DEF ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 6, dLinTol))
|
||||
LuaGetParam( L, 7, nRefType) ;
|
||||
else
|
||||
LuaGetParam( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM cilindro
|
||||
int nId = ExeCreateSurfTmCone( nParentId, ptOrig, vtN, dRad, dHeight, dLinTol, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmSphere( lua_State* L)
|
||||
{
|
||||
// 3 o 4 o 5 parametri : ParentId, PtOrig, dRad [, dTol] [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptOrig ;
|
||||
LuaCheckParam( L, 2, ptOrig)
|
||||
double dRad ;
|
||||
LuaCheckParam( L, 3, dRad)
|
||||
double dLinTol = LIN_TOL_DEF ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 4, dLinTol))
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
else
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM cilindro
|
||||
int nId = ExeCreateSurfTmSphere( nParentId, ptOrig, dRad, dLinTol, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmByFlatContour( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : ParentId, CrvId [, dTol]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nCrvId ;
|
||||
LuaCheckParam( L, 2, nCrvId)
|
||||
double dLinTol = LIN_TOL_DEF ;
|
||||
if ( lua_gettop( L) >= 3)
|
||||
LuaCheckParam( L, 3, dLinTol) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM riempiendo un contorno piano
|
||||
int nId = ExeCreateSurfTmByFlatContour( nParentId, nCrvId, dLinTol) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmByRegion( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : ParentId, CrvIds [, dTol]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
INTVECTOR vCrvIds ;
|
||||
LuaCheckParam( L, 2, vCrvIds)
|
||||
double dLinTol = LIN_TOL_DEF ;
|
||||
if ( lua_gettop( L) >= 3)
|
||||
LuaCheckParam( L, 3, dLinTol) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM riempiendo una regione (piana)
|
||||
int nId = ExeCreateSurfTmByRegion( nParentId, vCrvIds, dLinTol) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmByExtrusion( lua_State* L)
|
||||
{
|
||||
// 3 o 4 o 5 parametri : ParentId, CrvIds, vtExtr [, dTol] [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
INTVECTOR vCrvIds ;
|
||||
LuaCheckParam( L, 2, vCrvIds)
|
||||
Vector3d vtExtr ;
|
||||
LuaCheckParam( L, 3, vtExtr)
|
||||
double dLinTol = LIN_TOL_DEF ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 4, dLinTol))
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
else
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM estrudendo uno o più percorsi, se piani si possono mettere i tappi
|
||||
int nId = ExeCreateSurfTmByExtrusion( nParentId, vCrvIds, vtExtr,
|
||||
dLinTol, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmByRegionExtrusion( lua_State* L)
|
||||
{
|
||||
// 3 o 4 o 5 parametri : ParentId, CrvIds, vtExtr [, dTol] [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
INTVECTOR vCrvIds ;
|
||||
LuaCheckParam( L, 2, vCrvIds)
|
||||
Vector3d vtExtr ;
|
||||
LuaCheckParam( L, 3, vtExtr)
|
||||
double dLinTol = LIN_TOL_DEF ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 4, dLinTol))
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
else
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM estrudendo uno o più percorsi, con aggiunta dei tappi
|
||||
int nId = ExeCreateSurfTmByRegionExtrusion( nParentId, vCrvIds, vtExtr, dLinTol, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmByRevolve( lua_State* L)
|
||||
{
|
||||
// 5 o 6 o 7 parametri : ParentId, CrvId, ptAx, vtAx, bCapEnds [, dTol] [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nCrvId ;
|
||||
LuaCheckParam( L, 2, nCrvId)
|
||||
Point3d ptAx ;
|
||||
LuaCheckParam( L, 3, ptAx)
|
||||
Vector3d vtAx ;
|
||||
LuaCheckParam( L, 4, vtAx)
|
||||
bool bCapEnds ;
|
||||
LuaCheckParam( L, 5, bCapEnds)
|
||||
double dLinTol = 0.1 ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 6, dLinTol))
|
||||
LuaGetParam( L, 7, nRefType) ;
|
||||
else
|
||||
LuaGetParam( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM riempiendo un contorno piano
|
||||
int nId = ExeCreateSurfTmByRevolve( nParentId, nCrvId, ptAx, vtAx, bCapEnds, dLinTol, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmByScrewing( lua_State* L)
|
||||
{
|
||||
// 6 o 7 o 8 parametri : ParentId, CrvId, ptAx, vtAx, dAngRotDeg, dMove [, dTol] [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nCrvId ;
|
||||
LuaCheckParam( L, 2, nCrvId)
|
||||
Point3d ptAx ;
|
||||
LuaCheckParam( L, 3, ptAx)
|
||||
Vector3d vtAx ;
|
||||
LuaCheckParam( L, 4, vtAx)
|
||||
double dAngRotDeg ;
|
||||
LuaCheckParam( L, 5, dAngRotDeg)
|
||||
double dMove ;
|
||||
LuaCheckParam( L, 6, dMove)
|
||||
double dLinTol = LIN_TOL_DEF ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 7, dLinTol))
|
||||
LuaGetParam( L, 8, nRefType) ;
|
||||
else
|
||||
LuaGetParam( L, 7, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM riempiendo un contorno piano
|
||||
int nId = ExeCreateSurfTmByScrewing( nParentId, nCrvId, ptAx, vtAx, dAngRotDeg, dMove, dLinTol, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmRuled( lua_State* L)
|
||||
{
|
||||
// 3 o 4 parametri : ParentId, PtOrCrvId1, PtOrCrvId2, [, dTol]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nPtOrCrvId1 ;
|
||||
LuaCheckParam( L, 2, nPtOrCrvId1)
|
||||
int nPtOrCrvId2 ;
|
||||
LuaCheckParam( L, 3, nPtOrCrvId2)
|
||||
double dLinTol = LIN_TOL_DEF ;
|
||||
if ( lua_gettop( L) >= 4)
|
||||
LuaCheckParam( L, 4, dLinTol) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM riempiendo un contorno piano
|
||||
int nId = ExeCreateSurfTmRuled( nParentId, nPtOrCrvId1, nPtOrCrvId2, dLinTol) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmByTriangles( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : ParentId, Id/s [, bErase]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 2, vId)
|
||||
bool bErase = true ;
|
||||
if ( lua_gettop( L) >= 3)
|
||||
LuaCheckParam( L, 3, bErase) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM mediante cucitura di superfici
|
||||
int nId = ExeCreateSurfTmByTriangles( nParentId, vId, bErase) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmBySewing( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : ParentId, Id/s [, bErase]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 2, vId)
|
||||
bool bErase = true ;
|
||||
if ( lua_gettop( L) >= 3)
|
||||
LuaCheckParam( L, 3, bErase) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM mediante cucitura di superfici
|
||||
int nId = ExeCreateSurfTmBySewing( nParentId, vId, bErase) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBBox", LuaCreateSurfTmBBox) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBox", LuaCreateSurfTmBox) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPyramid", LuaCreateSurfTmPyramid) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCylinder", LuaCreateSurfTmCylinder) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCone", LuaCreateSurfTmCone) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSphere", LuaCreateSurfTmSphere) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByFlatContour", LuaCreateSurfTmByFlatContour) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRegion", LuaCreateSurfTmByRegion) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByExtrusion", LuaCreateSurfTmByExtrusion) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRegionExtrusion", LuaCreateSurfTmByRegionExtrusion) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRevolve", LuaCreateSurfTmByRevolve) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByScrewing", LuaCreateSurfTmByScrewing) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRuled", LuaCreateSurfTmRuled) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ;
|
||||
return bOk ;
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_GdbModify.cpp Data : 06.10.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni di modifica geometrica per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 06.10.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/ExeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaChangeGroupFrame( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, frNewRef [, nRefType]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
Frame3d frNewRef ;
|
||||
LuaCheckParam( L, 2, frNewRef)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// modifica del riferimento
|
||||
bool bOk = ExeChangeGroupFrame( nId, frNewRef, nRefType) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaChangeVectorBase( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, ptBase [, nRefType]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
Point3d ptBase ;
|
||||
LuaCheckParam( L, 2, ptBase)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// modifica del punto base
|
||||
bool bOk = ExeChangeVectorBase( nId, ptBase, nRefType) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaModifyText( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, sNewText
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
string sNewText ;
|
||||
LuaCheckParam( L, 2, sNewText)
|
||||
LuaClearStack( L) ;
|
||||
// modifica del testo
|
||||
bool bOk = ExeModifyText( nId, sNewText) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaChangeTextFont( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, sNewFont
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
string sNewFont ;
|
||||
LuaCheckParam( L, 2, sNewFont)
|
||||
LuaClearStack( L) ;
|
||||
// modifica del testo
|
||||
bool bOk = ExeChangeTextFont( nId, sNewFont) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaFlipText( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// flip del testo
|
||||
bool bOk = ExeFlipText( nId) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaMirrorText( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : Id [, bOnL]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
bool bOnL = true ;
|
||||
LuaGetParam( L, 2, bOnL) ;
|
||||
LuaClearStack( L) ;
|
||||
// flip del testo
|
||||
bool bOk = ExeMirrorText( nId, bOnL) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExplodeText( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// esplosione del testo in contorni
|
||||
int nCount ;
|
||||
int nFirstId = ExeExplodeText( nId, &nCount) ;
|
||||
if ( nFirstId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nFirstId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
LuaSetReturn( L, nCount) ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSplitText( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// esplosione del testo in più testi, uno per riga
|
||||
int nCount ;
|
||||
int nFirstId = ExeSplitText( nId, &nCount) ;
|
||||
if ( nFirstId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nFirstId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
LuaSetReturn( L, nCount) ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbModify( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeGroupFrame", LuaChangeGroupFrame) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeVectorBase", LuaChangeVectorBase) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyText", LuaModifyText) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeTextFont", LuaChangeTextFont) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtFlipText", LuaFlipText) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMirrorText", LuaMirrorText) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeText", LuaExplodeText) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitText", LuaSplitText) ;
|
||||
return bOk ;
|
||||
}
|
||||
@@ -0,0 +1,390 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_GdbModifyCurve.cpp Data : 28.12.14 Versione : 1.5l2
|
||||
// Contenuto : Funzioni di modifica delle curve per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 03.10.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaInvertCurve( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id/s
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo inversione curve
|
||||
bool bOk = ExeInvertCurve( vId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaOffsetCurve( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, dDist [, nType]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
double dDist ;
|
||||
LuaCheckParam( L, 2, dDist)
|
||||
int nType = ICurve::OFF_FILLET ;
|
||||
LuaGetParam( L, 3, nType) ;
|
||||
LuaClearStack( L) ;
|
||||
// offset della curva
|
||||
bool bOk = ExeOffsetCurve( nId, dDist, nType) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaChangeClosedCurveStartPoint( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, NewStart [, nRefType]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
Point3d ptStart ;
|
||||
LuaCheckParam( L, 2, ptStart)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// modifico il punto iniziale
|
||||
bool bOk = ExeChangeClosedCurveStartPoint( nId, ptStart, nRefType) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaModifyCurveStartPoint( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, NewStart [, nRefType]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
Point3d ptStart ;
|
||||
LuaCheckParam( L, 2, ptStart)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// modifico il punto iniziale
|
||||
bool bOk = ExeModifyCurveStartPoint( nId, ptStart, nRefType) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaModifyCurveEndPoint( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, NewEnd [, nRefType]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
Point3d ptEnd ;
|
||||
LuaCheckParam( L, 2, ptEnd)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// modifico il punto finale
|
||||
bool bOk = ExeModifyCurveEndPoint( nId, ptEnd, nRefType) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaModifyCurveExtrusion( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id/s, vtExtr [, nRefType]
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
Vector3d vtExtr ;
|
||||
LuaCheckParam( L, 2, vtExtr)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// modifico il vettore estrusione
|
||||
bool bOk = ExeModifyCurveExtrusion( vId, vtExtr, nRefType) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaModifyCurveThickness( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id/s, Thick
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
double dThick ;
|
||||
LuaCheckParam( L, 2, dThick)
|
||||
LuaClearStack( L) ;
|
||||
// modifico lo spessore di estrusione
|
||||
bool bOk = ExeModifyCurveThickness( vId, dThick) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimCurveStartAtLen( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, dLen
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
double dLen ;
|
||||
LuaCheckParam( L, 2, dLen)
|
||||
LuaClearStack( L) ;
|
||||
// taglio la curva all'inizio
|
||||
bool bOk = ExeTrimCurveStartAtLen( nId, dLen) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimCurveEndAtLen( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, dLen
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
double dLen ;
|
||||
LuaCheckParam( L, 2, dLen)
|
||||
LuaClearStack( L) ;
|
||||
// taglio la curva alla fine
|
||||
bool bOk = ExeTrimCurveEndAtLen( nId, dLen) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimCurveStartAtParam( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, dPar
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
double dPar ;
|
||||
LuaCheckParam( L, 2, dPar)
|
||||
LuaClearStack( L) ;
|
||||
// taglio la curva all' inizio
|
||||
bool bOk = ExeTrimCurveStartAtParam( nId, dPar) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimCurveEndAtParam( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, dPar
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
double dPar ;
|
||||
LuaCheckParam( L, 2, dPar)
|
||||
LuaClearStack( L) ;
|
||||
// taglio la curva alla fine
|
||||
bool bOk = ExeTrimCurveEndAtParam( nId, dPar) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimCurveStartEndAtParam( lua_State* L)
|
||||
{
|
||||
// 3 parametri : Id, dParS, dParE
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
double dParS ;
|
||||
LuaCheckParam( L, 2, dParS)
|
||||
double dParE ;
|
||||
LuaCheckParam( L, 3, dParE)
|
||||
LuaClearStack( L) ;
|
||||
// taglio la curva alla fine
|
||||
bool bOk = ExeTrimCurveStartEndAtParam( nId, dParS, dParE) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimExtendCurveByLen( lua_State* L)
|
||||
{
|
||||
// 3 o 4 parametri : Id, dLen, ptNear [, nRefType]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
double dLen ;
|
||||
LuaCheckParam( L, 2, dLen)
|
||||
Point3d ptNear ;
|
||||
LuaCheckParam( L, 3, ptNear)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// taglio o allungo la curva nell'estremo più vicino al punto
|
||||
bool bOk = ExeTrimExtendCurveByLen( nId, dLen, ptNear, nRefType) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSplitCurve( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, nParts
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nParts ;
|
||||
LuaCheckParam( L, 2, nParts)
|
||||
LuaClearStack( L) ;
|
||||
// divido la curva nel punto
|
||||
int nFirstId = ExeSplitCurve( nId, nParts) ;
|
||||
if ( nFirstId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nFirstId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSplitCurveAtPoint( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, ptOn [, nRefType]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
Point3d ptOn ;
|
||||
LuaCheckParam( L, 2, ptOn)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// divido la curva nel punto
|
||||
int nNewId = ExeSplitCurveAtPoint( nId, ptOn, nRefType) ;
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nNewId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaModifyCurveArcRadius( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, dNewRad
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
double dNewRad ;
|
||||
LuaCheckParam( L, 2, dNewRad)
|
||||
LuaClearStack( L) ;
|
||||
// modifica del raggio
|
||||
bool bOk = ExeModifyCurveArcRadius( nId, dNewRad) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExplodeCurveCompo( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// esplosione della curva composita
|
||||
int nCount ;
|
||||
int nFirstId = ExeExplodeCurveCompo( nId, &nCount) ;
|
||||
if ( nFirstId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nFirstId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
LuaSetReturn( L, nCount) ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaApproxCurveArc( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : Id [, dLinTol]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
double dLinTol = 0.01 ;
|
||||
LuaGetParam( L, 2, dLinTol) ;
|
||||
LuaClearStack( L) ;
|
||||
// approssimazione dell'arco con rette
|
||||
int nNewId = ExeApproxCurveArc( nId, dLinTol) ;
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nNewId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaApproxCurveBezier( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, nArcsVsLines [, dLinTol]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nTemp ;
|
||||
LuaCheckParam( L, 2, nTemp)
|
||||
bool bArcsVsLines = ( nTemp != 0) ;
|
||||
double dLinTol = 0.01 ;
|
||||
LuaGetParam( L, 3, dLinTol) ;
|
||||
LuaClearStack( L) ;
|
||||
// approssimazione della curva di Bezier con archi o rette
|
||||
int nNewId = ExeApproxCurveBezier( nId, bArcsVsLines, dLinTol) ;
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nNewId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtInvertCurve", LuaInvertCurve) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOffsetCurve", LuaOffsetCurve) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeClosedCurveStartPoint", LuaChangeClosedCurveStartPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveStartPoint", LuaModifyCurveStartPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveEndPoint", LuaModifyCurveEndPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveExtrusion", LuaModifyCurveExtrusion) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveThickness", LuaModifyCurveThickness) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimCurveStartAtLen", LuaTrimCurveStartAtLen) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimCurveEndAtLen", LuaTrimCurveEndAtLen) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimCurveStartAtParam", LuaTrimCurveStartAtParam) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimCurveEndAtParam", LuaTrimCurveEndAtParam) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimCurveStartEndAtParam", LuaTrimCurveStartEndAtParam) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimExtendCurveByLen", LuaTrimExtendCurveByLen) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurve", LuaSplitCurve) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurveAtPoint", LuaSplitCurveAtPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveArcRadius", LuaModifyCurveArcRadius) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeCurveCompo", LuaExplodeCurveCompo) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtApproxCurveArc", LuaApproxCurveArc) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtApproxCurveBezier", LuaApproxCurveBezier) ;
|
||||
return bOk ;
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_GdbModifySurf.cpp Data : 09.03.15 Versione : 1.6b6
|
||||
// Contenuto : Funzioni di modifica delle superfici per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 09.03.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaInvertSurf( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id/s
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo inversione superfici
|
||||
bool bOk = ExeInvertSurface( vId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExtractSurfTmFacetLoops( lua_State* L)
|
||||
{
|
||||
// 3 parametri : nId, nFacet, nDestGrpId
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nFacet ;
|
||||
LuaCheckParam( L, 2, nFacet)
|
||||
int nDestGrpId ;
|
||||
LuaCheckParam( L, 3, nDestGrpId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo inversione superfici
|
||||
int nCount ;
|
||||
int nNewId = ExeExtractSurfTmFacetLoops( nId, nFacet, nDestGrpId, &nCount) ;
|
||||
// restituisco il risultato
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nNewId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
LuaSetReturn( L, nCount) ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExplodeSurfTm( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// esplosione della superficie trimesh
|
||||
int nCount ;
|
||||
int nFirstId = ExeExplodeSurfTm( nId, &nCount) ;
|
||||
if ( nFirstId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nFirstId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
LuaSetReturn( L, nCount) ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbModifySurf( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtInvertSurf", LuaInvertSurf) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmFacetLoops", LuaExtractSurfTmFacetLoops) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeSurfTm", LuaExplodeSurfTm) ;
|
||||
return bOk ;
|
||||
}
|
||||
@@ -0,0 +1,579 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_GdbObjAttribs.cpp Data : 30.09.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni di trasformazione geometrica per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 30.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetLevel( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nId, nLevel
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nLevel ;
|
||||
LuaCheckParam( L, 2, nLevel)
|
||||
// imposto lo stato
|
||||
bool bOk = ExeSetLevel( nId, nLevel) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRevertLevel( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nId
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// porto il livello al valore precedente
|
||||
bool bOk = ExeRevertLevel( nId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetLevel( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nId
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il livello
|
||||
int nLevel ;
|
||||
bool bOk = ExeGetLevel( nId, &nLevel) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetReturn( L, nLevel) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetCalcLevel( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nId
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il livello
|
||||
int nLevel ;
|
||||
bool bOk = ExeGetCalcLevel( nId, &nLevel) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetReturn( L, nLevel) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetMode( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nId, nMode
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nMode ;
|
||||
LuaCheckParam( L, 2, nMode)
|
||||
LuaClearStack( L) ;
|
||||
// imposto il modo
|
||||
bool bOk = ExeSetMode( nId, nMode) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRevertMode( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// porto il modo al valore precedente
|
||||
bool bOk = ExeRevertMode( nId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetMode( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il modo
|
||||
int nMode ;
|
||||
if ( ExeGetMode( nId, &nMode))
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nMode) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetCalcMode( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il modo calcolato (ovvero proprio ed ereditato)
|
||||
int nMode ;
|
||||
if ( ExeGetCalcMode( nId, &nMode))
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nMode) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetStatus( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, nStatus
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
int nStatus ;
|
||||
LuaCheckParam( L, 2, nStatus)
|
||||
LuaClearStack( L) ;
|
||||
// imposto lo stato
|
||||
bool bOk = ExeSetStatus( vId, nStatus) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRevertStatus( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// porto lo stato al valore precedente
|
||||
bool bOk = ExeRevertStatus( nId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetStatus( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero lo stato
|
||||
int nStatus ;
|
||||
if ( ExeGetStatus( nId, &nStatus))
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nStatus) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetCalcStatus( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero lo stato
|
||||
int nStatus ;
|
||||
if ( ExeGetCalcStatus( nId, &nStatus))
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nStatus) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetMark( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// imposto l'evidenziazione
|
||||
bool bOk = ExeSetMark( nId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaResetMark( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// cancello l'evidenziazione
|
||||
bool bOk = ExeResetMark( nId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetMark( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero lo stato di evidenziazione
|
||||
BOOL nMark ;
|
||||
if ( ExeGetMark( nId, &nMark))
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, ( nMark != GDB_MK_OFF)) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetCalcMark( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero lo stato calcolato di evidenziazione
|
||||
BOOL nMark ;
|
||||
if ( ExeGetCalcMark( nId, &nMark))
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, ( nMark != GDB_MK_OFF)) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaStdColor( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Nome
|
||||
string sName ;
|
||||
LuaCheckParam( L, 1, sName)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il colore con il nome indicato
|
||||
Color cCol ;
|
||||
if ( ExeStdColor( sName, cCol)) {
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, cCol) ;
|
||||
}
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetColor( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id/s, Colore [, bSetAlpha]
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
Color cCol ;
|
||||
LuaCheckParam( L, 2, cCol)
|
||||
bool bSetAlpha = true ;
|
||||
LuaGetParam( L, 3, bSetAlpha) ;
|
||||
LuaClearStack( L) ;
|
||||
// assegno il colore
|
||||
bool bOk = ExeSetColor( vId, cCol, bSetAlpha) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetAlpha( lua_State* L)
|
||||
{
|
||||
// 2 : Id/s, nAlpha
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
int nAlpha ;
|
||||
LuaCheckParam( L, 2, nAlpha)
|
||||
LuaClearStack( L) ;
|
||||
// assegno la trasparenza
|
||||
bool bOk = ExeSetAlpha( vId, nAlpha) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaResetColor( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id/s
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
LuaClearStack( L) ;
|
||||
// tolgo il colore
|
||||
bool bOk = ExeResetColor( vId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetColor( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il colore
|
||||
Color cCol ;
|
||||
if ( ExeGetColor( nId, cCol)) {
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, cCol) ;
|
||||
}
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetCalcColor( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il colore
|
||||
Color cCol ;
|
||||
if ( ExeGetCalcColor( nId, cCol)) {
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, cCol) ;
|
||||
}
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetName( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, Name
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
string sName ;
|
||||
LuaCheckParam( L, 2, sName)
|
||||
LuaClearStack( L) ;
|
||||
// assegno il nome
|
||||
bool bOk = ExeSetName( nId, sName) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetName( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il nome
|
||||
string sName ;
|
||||
bool bOk = ExeGetName( nId, sName) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetReturn( L, sName) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExistsName( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// verifico esistenza nome
|
||||
bool bOk = ExeExistsName( nId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRemoveName( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// verifico esistenza nome
|
||||
bool bOk = ExeRemoveName( nId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetInfo( lua_State* L)
|
||||
{
|
||||
// 3 parametri : Id, Key, Info
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
string sKey ;
|
||||
LuaCheckParam( L, 2, sKey)
|
||||
string sInfo ;
|
||||
LuaCheckParam( L, 3, sInfo)
|
||||
LuaClearStack( L) ;
|
||||
// assegno la info
|
||||
bool bOk = ExeSetInfo( nId, sKey, sInfo) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetInfo( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, Key
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
string sKey ;
|
||||
LuaCheckParam( L, 2, sKey)
|
||||
LuaClearStack( L) ;
|
||||
// recupero l'info
|
||||
string sInfo ;
|
||||
bool bOk = ExeGetInfo( nId, sKey, sInfo) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetReturn( L, sInfo) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExistsInfo( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, Key
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
string sKey ;
|
||||
LuaCheckParam( L, 2, sKey)
|
||||
LuaClearStack( L) ;
|
||||
// verifico esistenza info
|
||||
bool bOk = ExeExistsInfo( nId, sKey) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRemoveInfo( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, Key
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
string sKey ;
|
||||
LuaCheckParam( L, 2, sKey)
|
||||
LuaClearStack( L) ;
|
||||
// rimuovo info
|
||||
bool bOk = ExeRemoveInfo( nId, sKey) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbObjAttribs( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetLevel", LuaSetLevel) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRevertLevel", LuaRevertLevel) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLevel", LuaGetLevel) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcLevel", LuaGetCalcLevel) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetMode", LuaSetMode) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRevertMode", LuaRevertMode) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMode", LuaGetMode) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcMode", LuaGetCalcMode) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetStatus", LuaSetStatus) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRevertStatus", LuaRevertStatus) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetStatus", LuaGetStatus) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcStatus", LuaGetCalcStatus) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetMark", LuaSetMark) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtResetMark", LuaResetMark) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMark", LuaGetMark) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcMark", LuaGetCalcMark) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtStdColor", LuaStdColor) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetColor", LuaSetColor) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetAlpha", LuaSetAlpha) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtResetColor", LuaResetColor) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetColor", LuaGetColor) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcColor", LuaGetCalcColor) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetName", LuaSetName) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetName", LuaGetName) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsName", LuaExistsName) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveName", LuaRemoveName) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetInfo", LuaSetInfo) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetInfo", LuaGetInfo) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsInfo", LuaExistsInfo) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveInfo", LuaRemoveInfo) ;
|
||||
return bOk ;
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_GdbObjSelection.cpp Data : 08.01.15 Versione : 1.6a1
|
||||
// Contenuto : Funzioni di selezione oggetti del DB geometrico per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 08.01.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSelectObj( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la selezione
|
||||
bool bOk = ExeSelectObj( nId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaDeselectObj( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la selezione
|
||||
bool bOk = ExeDeselectObj( nId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSelectAll( lua_State* L)
|
||||
{
|
||||
// 1 parametro : bOnlyIfVisible
|
||||
bool bOnlyIfVisible ;
|
||||
LuaCheckParam( L, 1, bOnlyIfVisible)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la selezione
|
||||
bool bOk = ExeSelectAll( bOnlyIfVisible) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaDeselectAll( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la selezione
|
||||
bool bOk = ExeDeselectAll() ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSelectGroupObjs( lua_State* L)
|
||||
{
|
||||
// 1 parametro : GroupId
|
||||
int GroupId ;
|
||||
LuaCheckParam( L, 1, GroupId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la selezione
|
||||
bool bOk = ExeSelectGroupObjs( GroupId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaDeselectGroupObjs( lua_State* L)
|
||||
{
|
||||
// 1 parametro : GroupId
|
||||
int GroupId ;
|
||||
LuaCheckParam( L, 1, GroupId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la deselezione
|
||||
bool bOk = ExeDeselectGroupObjs( GroupId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaIsSelectedObj( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la selezione
|
||||
bool bOk = ExeIsSelectedObj( nId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetSelectedObjNbr( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la selezione
|
||||
int nNbr = ExeGetSelectedObjNbr() ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nNbr) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetFirstSelectedObj( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero il primo oggetto selezionato
|
||||
int nId = ExeGetFirstSelectedObj() ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetNextSelectedObj( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero il successivo oggetto selezionato
|
||||
int nId = ExeGetNextSelectedObj() ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetLastSelectedObj( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero l'ultimo oggetto selezionato
|
||||
int nId = ExeGetLastSelectedObj() ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetPrevSelectedObj( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero il precedente oggetto selezionato
|
||||
int nId = ExeGetPrevSelectedObj() ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbObjSelection( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSelectObj", LuaSelectObj) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDeselectObj", LuaDeselectObj) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSelectAll", LuaSelectAll) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDeselectAll", LuaDeselectAll) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSelectGroupObjs", LuaSelectGroupObjs) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDeselectGroupObjs", LuaDeselectGroupObjs) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtIsSelectedObj", LuaIsSelectedObj) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSelectedObjNbr", LuaGetSelectedObjNbr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstSelectedObj", LuaGetFirstSelectedObj) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextSelectedObj", LuaGetNextSelectedObj) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastSelectedObj", LuaGetLastSelectedObj) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevSelectedObj", LuaGetPrevSelectedObj) ;
|
||||
return bOk ;
|
||||
}
|
||||
@@ -0,0 +1,518 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_GdbObjects.cpp Data : 30.09.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni di iterazione di DB geometrico per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 30.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExistsObj( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId = GDB_ID_NULL ;
|
||||
LuaGetParam( L, 1, nId) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico esistenza oggetto
|
||||
bool bOk = ExeExistsObj( nId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetType( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId = GDB_ID_NULL ;
|
||||
LuaGetParam( L, 1, nId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero tipo dell'oggetto
|
||||
int nType = ExeGetType( nId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nType) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetGroupObjs( lua_State* L)
|
||||
{
|
||||
// 1 parametro : GroupId
|
||||
int nGroupId ;
|
||||
LuaCheckParam( L, 1, nGroupId)
|
||||
LuaClearStack( L) ;
|
||||
// determino il numero di oggetti nel gruppo
|
||||
int nObjs = ExeGetGroupObjs( nGroupId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nObjs) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetFirstInGroup( lua_State* L)
|
||||
{
|
||||
// 1 parametro : GroupId
|
||||
int nGroupId ;
|
||||
LuaCheckParam( L, 1, nGroupId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il primo oggetto del gruppo
|
||||
int nId = ExeGetFirstInGroup( nGroupId) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetNext( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il prossimo oggetto nello stesso gruppo
|
||||
int nNextId = ExeGetNext( nId) ;
|
||||
// restituisco il risultato
|
||||
if ( nNextId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nNextId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetLastInGroup( lua_State* L)
|
||||
{
|
||||
// 1 parametro : GroupId
|
||||
int nGroupId ;
|
||||
LuaCheckParam( L, 1, nGroupId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero l'ultimo oggetto del gruppo
|
||||
int nId = ExeGetLastInGroup( nGroupId) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetPrev( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il precedente oggetto nello stesso gruppo
|
||||
int nPrevId = ExeGetPrev( nId) ;
|
||||
// restituisco il risultato
|
||||
if ( nPrevId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nPrevId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetFirstNameInGroup( lua_State* L)
|
||||
{
|
||||
// 2 parametri : GroupId, sName
|
||||
int nGroupId ;
|
||||
LuaCheckParam( L, 1, nGroupId)
|
||||
string sName ;
|
||||
LuaCheckParam( L, 2, sName)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il primo oggetto del gruppo con il nome desiderato
|
||||
int nId = ExeGetFirstNameInGroup( nGroupId, sName) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetNextName( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, sName
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
string sName ;
|
||||
LuaCheckParam( L, 2, sName)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il prossimo oggetto nello stesso gruppo con il nome desiderato
|
||||
int nNextId = ExeGetNextName( nId, sName) ;
|
||||
// restituisco il risultato
|
||||
if ( nNextId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nNextId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetLastNameInGroup( lua_State* L)
|
||||
{
|
||||
// 2 parametri : GroupId, sName
|
||||
int nGroupId ;
|
||||
LuaCheckParam( L, 1, nGroupId)
|
||||
string sName ;
|
||||
LuaCheckParam( L, 2, sName)
|
||||
LuaClearStack( L) ;
|
||||
// recupero l'ultimo oggetto del gruppo con il nome desiderato
|
||||
int nId = ExeGetLastNameInGroup( nGroupId, sName) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetPrevName( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, sName
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
string sName ;
|
||||
LuaCheckParam( L, 2, sName)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il precedente oggetto nello stesso gruppo con il nome desiderato
|
||||
int nPrevId = ExeGetPrevName( nId, sName) ;
|
||||
// restituisco il risultato
|
||||
if ( nPrevId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nPrevId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetFirstGroupInGroup( lua_State* L)
|
||||
{
|
||||
// 1 parametro : GroupId
|
||||
int nGroupId ;
|
||||
LuaCheckParam( L, 1, nGroupId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il primo oggetto gruppo del gruppo
|
||||
int nId = ExeGetFirstGroupInGroup( nGroupId) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetNextGroup( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il prossimo oggetto gruppo dello stesso gruppo
|
||||
int nNewId = ExeGetNextGroup( nId) ;
|
||||
// restituisco il risultato
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nNewId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetLastGroupInGroup( lua_State* L)
|
||||
{
|
||||
// 1 parametro : GroupId
|
||||
int nGroupId ;
|
||||
LuaCheckParam( L, 1, nGroupId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero l'ultimo oggetto gruppo del gruppo
|
||||
int nId = ExeGetLastGroupInGroup( nGroupId) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetPrevGroup( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il precedenteo oggetto gruppo dello stesso gruppo
|
||||
int nNewId = ExeGetPrevGroup( nId) ;
|
||||
// restituisco il risultato
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nNewId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetBBox( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, nFlag
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 2, nFlag)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il bounding box dell'oggetto in locale
|
||||
BBox3d b3Box ;
|
||||
bool bOk = ExeGetBBox( nId, nFlag, b3Box) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetReturn( L, b3Box) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetBBoxGlob( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, nFlag
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 2, nFlag)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il bounding box dell'oggetto in globale
|
||||
BBox3d b3Box ;
|
||||
bool bOk = ExeGetBBoxGlob( nId, nFlag, b3Box) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetReturn( L, b3Box) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetBBoxRef( lua_State* L)
|
||||
{
|
||||
// 3 parametri : Id, nFlag, Ref
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 2, nFlag)
|
||||
Frame3d frRef ;
|
||||
LuaCheckParam( L, 3, frRef)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il bounding box dell'oggetto in globale
|
||||
BBox3d b3Box ;
|
||||
bool bOk = ExeGetBBoxRef( nId, nFlag, frRef, b3Box) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetReturn( L, b3Box) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCopy( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : SouId, RefId [, nSonBeforeAfter]
|
||||
int nSouId ;
|
||||
LuaCheckParam( L, 1, nSouId)
|
||||
int nRefId ;
|
||||
LuaCheckParam( L, 2, nRefId)
|
||||
int nSonBeforeAfter = GDB_LAST_SON ;
|
||||
LuaGetParam( L, 3, nSonBeforeAfter) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la copia
|
||||
int nNewId = ExeCopy( nSouId, nRefId, nSonBeforeAfter) ;
|
||||
// restituisco il risultato
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nNewId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCopyGlob( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : SouId, RefId [, nSonBeforeAfter]
|
||||
int nSouId ;
|
||||
LuaCheckParam( L, 1, nSouId)
|
||||
int nRefId ;
|
||||
LuaCheckParam( L, 2, nRefId)
|
||||
int nSonBeforeAfter = GDB_LAST_SON ;
|
||||
LuaGetParam( L, 3, nSonBeforeAfter) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la copia
|
||||
int nNewId = ExeCopyGlob( nSouId, nRefId, nSonBeforeAfter) ;
|
||||
// restituisco il risultato
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nNewId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRelocate( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : SouId, RefId [, nSonBeforeAfter]
|
||||
int nSouId ;
|
||||
LuaCheckParam( L, 1, nSouId)
|
||||
int nRefId ;
|
||||
LuaCheckParam( L, 2, nRefId)
|
||||
int nSonBeforeAfter = GDB_LAST_SON ;
|
||||
LuaGetParam( L, 3, nSonBeforeAfter) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la rilocazione
|
||||
bool bOk = ( ExeRelocate( nSouId, nRefId, nSonBeforeAfter) != FALSE) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRelocateGlob( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : SouId, RefId [, SonBeforeAfter]
|
||||
int nSouId ;
|
||||
LuaCheckParam( L, 1, nSouId)
|
||||
int nRefId ;
|
||||
LuaCheckParam( L, 2, nRefId)
|
||||
int nSonBeforeAfter = GDB_LAST_SON ;
|
||||
LuaGetParam( L, 3, nSonBeforeAfter) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la rilocazione
|
||||
bool bOk = ExeRelocateGlob( nSouId, nRefId, nSonBeforeAfter) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaChangeId( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, nNewId
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nNewId ;
|
||||
LuaCheckParam( L, 2, nNewId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo il cambio di identificativo
|
||||
bool bOk = ExeChangeId( nId, nNewId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaErase( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id/s
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la cancellazione
|
||||
bool bOk = ExeErase( vId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaEmptyGroup( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la cancellazione
|
||||
bool bOk = ExeEmptyGroup( nId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbObjects( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsObj", LuaExistsObj) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetType", LuaGetType) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetGroupObjs", LuaGetGroupObjs) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstInGroup", LuaGetFirstInGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNext", LuaGetNext) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastInGroup", LuaGetLastInGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrev", LuaGetPrev) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstNameInGroup", LuaGetFirstNameInGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextName", LuaGetNextName) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastNameInGroup", LuaGetLastNameInGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevName", LuaGetPrevName) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstGroupInGroup", LuaGetFirstGroupInGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextGroup", LuaGetNextGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastGroupInGroup", LuaGetLastGroupInGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevGroup", LuaGetPrevGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetBBox", LuaGetBBox) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetBBoxGlob", LuaGetBBoxGlob) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetBBoxRef", LuaGetBBoxRef) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCopy", LuaCopy) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyGlob", LuaCopyGlob) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRelocate", LuaRelocate) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRelocateGlob", LuaRelocateGlob) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeId", LuaChangeId) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtErase", LuaErase) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEmptyGroup", LuaEmptyGroup) ;
|
||||
return bOk ;
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_GdbPartLayers.cpp Data : 29.01.15 Versione : 1.6a7
|
||||
// Contenuto : Funzioni di gestione pezzi e layer relativi per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 29.01.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaIsPart( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nIdPart
|
||||
int nIdPart ;
|
||||
LuaCheckParam( L, 1, nIdPart)
|
||||
LuaClearStack( L) ;
|
||||
// verifico sia un pezzo
|
||||
bool bOk = ExeIsPart( nIdPart) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaIsLayer( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nIdLayer
|
||||
int nIdLayer ;
|
||||
LuaCheckParam( L, 1, nIdLayer)
|
||||
LuaClearStack( L) ;
|
||||
// verifico sia un layer
|
||||
bool bOk = ExeIsLayer( nIdLayer) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetCurrPart( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero il pezzo corrente
|
||||
int nId = ExeGetCurrPart() ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nId) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetCurrLayer( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero il layer corrente
|
||||
int nId = ExeGetCurrLayer() ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nId) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetCurrPartLayer( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nPartId, nLayerId
|
||||
int nPartId ;
|
||||
LuaCheckParam( L, 1, nPartId)
|
||||
int nLayerId ;
|
||||
LuaCheckParam( L, 2, nLayerId)
|
||||
LuaClearStack( L) ;
|
||||
// imposto pezzo e layer correnti
|
||||
bool bOk = ExeSetCurrPartLayer( nPartId, nLayerId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaResetCurrPartLayer( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// cerco primo pezzo e layer validi per essere dichiarati correnti
|
||||
bool bOk = ExeResetCurrPartLayer() ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetPartNbr( lua_State* L)
|
||||
{
|
||||
// nessuno o 1 parametro : [bOnlyVisible]
|
||||
bool bOnlyVisible = false ;
|
||||
LuaGetParam( L, 1, bOnlyVisible) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero numero pezzi
|
||||
int nNbr = ExeGetPartNbr( bOnlyVisible) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nNbr) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetFirstPart( lua_State* L)
|
||||
{
|
||||
// nessuno o 1 parametro : [bOnlyVisible]
|
||||
bool bOnlyVisible = false ;
|
||||
LuaGetParam( L, 1, bOnlyVisible) ;
|
||||
LuaClearStack( L) ;
|
||||
// cerco primo pezzo
|
||||
int nId = ExeGetFirstPart( bOnlyVisible) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetNextPart( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nPartId [, bOnlyVisible]
|
||||
int nPartId ;
|
||||
LuaCheckParam( L, 1, nPartId)
|
||||
bool bOnlyVisible = false ;
|
||||
LuaGetParam( L, 2, bOnlyVisible) ;
|
||||
LuaClearStack( L) ;
|
||||
// cerco pezzo successivo
|
||||
int nId = ExeGetNextPart( nPartId, bOnlyVisible) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetFirstLayer( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nPartId [, bOnlyVisible]
|
||||
int nPartId ;
|
||||
LuaCheckParam( L, 1, nPartId)
|
||||
bool bOnlyVisible = false ;
|
||||
LuaGetParam( L, 2, bOnlyVisible) ;
|
||||
LuaClearStack( L) ;
|
||||
// cerco il primo layer del pezzo
|
||||
int nId = ExeGetFirstLayer( nPartId, bOnlyVisible) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetNextLayer( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nLayerId [, bOnlyVisible]
|
||||
int nLayerId ;
|
||||
LuaCheckParam( L, 1, nLayerId)
|
||||
bool bOnlyVisible = false ;
|
||||
LuaGetParam( L, 2, bOnlyVisible) ;
|
||||
LuaClearStack( L) ;
|
||||
// cerco il prossimo layer (ovviamente dello stesso pezzo)
|
||||
int nId = ExeGetNextLayer( nLayerId, bOnlyVisible) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSelectPartObjs( lua_State* L)
|
||||
{
|
||||
// 1 parametro : PartId
|
||||
int nPartId ;
|
||||
LuaCheckParam( L, 1, nPartId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la selezione
|
||||
bool bOk = ExeSelectPartObjs( nPartId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaDeselectPartObjs( lua_State* L)
|
||||
{
|
||||
// 1 parametro : PartId
|
||||
int nPartId ;
|
||||
LuaCheckParam( L, 1, nPartId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la selezione
|
||||
bool bOk = ExeDeselectPartObjs( nPartId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSelectLayerObjs( lua_State* L)
|
||||
{
|
||||
// 1 parametro : LayerId
|
||||
int nLayerId ;
|
||||
LuaCheckParam( L, 1, nLayerId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la selezione
|
||||
bool bOk = ExeSelectLayerObjs( nLayerId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaDeselectLayerObjs( lua_State* L)
|
||||
{
|
||||
// 1 parametro : LayerId
|
||||
int nLayerId ;
|
||||
LuaCheckParam( L, 1, nLayerId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la selezione
|
||||
bool bOk = ExeDeselectLayerObjs( nLayerId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSelectPathObjs( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nId, bHaltOnFork
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
bool bHaltOnFork ;
|
||||
LuaCheckParam( L, 2, bHaltOnFork)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la selezione
|
||||
bool bOk = ExeSelectPathObjs( nId, bHaltOnFork) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbPartLayer( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCurrPart", LuaGetCurrPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtIsPart", LuaIsPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtIsLayer", LuaIsLayer) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCurrLayer", LuaGetCurrLayer) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCurrPartLayer", LuaSetCurrPartLayer) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtResetCurrPartLayer", LuaResetCurrPartLayer) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPartNbr", LuaGetPartNbr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstPart", LuaGetFirstPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextPart", LuaGetNextPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstLayer", LuaGetFirstLayer) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextLayer", LuaGetNextLayer) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSelectPartObjs", LuaSelectPartObjs) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDeselectPartObjs", LuaDeselectPartObjs) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSelectLayerObjs", LuaSelectLayerObjs) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDeselectLayerObjs", LuaDeselectLayerObjs) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSelectPathObjs", LuaSelectPathObjs) ;
|
||||
return bOk ;
|
||||
}
|
||||
+321
@@ -0,0 +1,321 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_General.cpp Data : 27.09.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni generali per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 27.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/ExeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/EGnFileCompare.h"
|
||||
#include "/EgtDev/Include/EgtPerfCounter.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static PerformanceCounter s_Counter ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
MyPrint( lua_State* L)
|
||||
{
|
||||
string sOut ;
|
||||
int n = lua_gettop( L) ; /* number of arguments */
|
||||
lua_getglobal( L, "tostring") ;
|
||||
for ( int i = 1 ; i <= n ; ++ i) {
|
||||
const char* s ;
|
||||
lua_pushvalue( L, -1) ; /* function to be called */
|
||||
lua_pushvalue( L, i) ; /* value to print */
|
||||
lua_call( L, 1, 1) ;
|
||||
s = lua_tostring( L, -1) ; /* get result */
|
||||
if ( s == nullptr)
|
||||
return luaL_error( L,
|
||||
LUA_QL("tostring") " must return a string to " LUA_QL("print")) ;
|
||||
if ( i > 1)
|
||||
sOut += "\t" ;
|
||||
sOut += s ;
|
||||
lua_pop( L, 1) ; /* pop result */
|
||||
}
|
||||
if ( ! sOut.empty())
|
||||
LOG_INFO( GetLogger(), sOut.c_str())
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
SetContext( lua_State* L)
|
||||
{
|
||||
// un solo parametro intero
|
||||
int nGseCtx ;
|
||||
LuaCheckParam( L, 1, nGseCtx)
|
||||
LuaClearStack( L) ;
|
||||
// imposto il contesto
|
||||
bool bOk = SetCurrGseContext( nGseCtx) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
GetContext( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// restituisco l'indice del contesto
|
||||
LuaSetReturn( L, GetIndCurrGseContext()) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaPause( lua_State* L)
|
||||
{
|
||||
// 1 parametro : numero di millisecondi
|
||||
int nTime ;
|
||||
LuaCheckParam( L, 1, nTime)
|
||||
LuaClearStack( L) ;
|
||||
// controllo la durata della pausa e la eseguo
|
||||
const int MIN_TIME = 0 ;
|
||||
const int MAX_TIME = 10000 ;
|
||||
if ( nTime < MIN_TIME)
|
||||
nTime = MIN_TIME ;
|
||||
else if ( nTime > MAX_TIME)
|
||||
nTime = MAX_TIME ;
|
||||
Sleep( nTime) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, true) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaStartCounter( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// avvio il contatore
|
||||
s_Counter.Start() ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaStopCounter( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// fermo il contatore
|
||||
double dTime = s_Counter.Stop() ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, dTime) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaNumToString( lua_State* L)
|
||||
{
|
||||
// 2 parametri : dVal, nDec
|
||||
double dVal ;
|
||||
LuaCheckParam( L, 1, dVal)
|
||||
int nDec ;
|
||||
LuaCheckParam( L, 2, nDec)
|
||||
LuaClearStack( L) ;
|
||||
// costruisco la stringa
|
||||
string sVal = ToString( dVal, nDec) ;
|
||||
// ritorno il risultato
|
||||
LuaSetReturn( L, sVal) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExecTsc( lua_State* L)
|
||||
{
|
||||
// 1 parametro : file
|
||||
string sFile ;
|
||||
LuaCheckParam( L, 1, sFile)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo lo script TSC
|
||||
bool bOk = ExeTscExecFile( sFile) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaOutLog( lua_State* L)
|
||||
{
|
||||
// 1 parametro : stringa da emettere
|
||||
string sOut ;
|
||||
LuaCheckParam( L, 1, sOut)
|
||||
LuaClearStack( L) ;
|
||||
// accodo il messaggio nel file di log
|
||||
LOG_INFO( GetLogger(), sOut.c_str())
|
||||
// non c'è risultato
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaOutBox( lua_State* L)
|
||||
{
|
||||
// 3 parametri : stringa, titolo, icona
|
||||
string sOut ;
|
||||
LuaCheckParam( L, 1, sOut)
|
||||
string sTitle ;
|
||||
LuaCheckParam( L, 2, sTitle)
|
||||
string sIcon ;
|
||||
LuaCheckParam( L, 3, sIcon)
|
||||
int nIcon = MB_ICONINFORMATION ;
|
||||
ToUpper( sIcon) ;
|
||||
if ( sIcon == "ERROR")
|
||||
nIcon = MB_ICONERROR ;
|
||||
else if ( sIcon == "WARNING")
|
||||
nIcon = MB_ICONWARNING ;
|
||||
LuaClearStack( L) ;
|
||||
// accodo il messaggio nel file di log
|
||||
int nRes = MessageBox( nullptr, stringtoW( sOut), stringtoW( sTitle), MB_OKCANCEL | nIcon | MB_TASKMODAL) ;
|
||||
// risultato (Ok->true, Cancel->false)
|
||||
LuaSetReturn( L, ( nRes == IDOK)) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaEraseFile( lua_State* L)
|
||||
{
|
||||
// 1 parametro : file
|
||||
string sFile ;
|
||||
LuaCheckParam( L, 1, sFile)
|
||||
LuaClearStack( L) ;
|
||||
// svuoto il direttorio
|
||||
bool bOk = EraseFile( sFile) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaEmptyDirectory( lua_State* L)
|
||||
{
|
||||
// 1 parametro : dir
|
||||
string sDir ;
|
||||
LuaCheckParam( L, 1, sDir)
|
||||
LuaClearStack( L) ;
|
||||
// svuoto il direttorio
|
||||
bool bOk = EmptyDirectory( sDir) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTextFileCompare( lua_State* L)
|
||||
{
|
||||
// 4 parametri : file1, file2, inizio commento, file diff
|
||||
string sFile1 ;
|
||||
LuaCheckParam( L, 1, sFile1)
|
||||
string sFile2 ;
|
||||
LuaCheckParam( L, 2, sFile2)
|
||||
string sRemStart ;
|
||||
LuaCheckParam( L, 3, sRemStart)
|
||||
string sFileDiff ;
|
||||
LuaCheckParam( L, 4, sFileDiff)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo il confronto
|
||||
bool bOk = TextFileCompare( sFile1, sFile2, sRemStart, sFileDiff) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaBinaryFileCompare( lua_State* L)
|
||||
{
|
||||
// 3 parametri : file1, file2, file diff
|
||||
string sFile1 ;
|
||||
LuaCheckParam( L, 1, sFile1)
|
||||
string sFile2 ;
|
||||
LuaCheckParam( L, 2, sFile2)
|
||||
string sFileDiff ;
|
||||
LuaCheckParam( L, 3, sFileDiff)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo il confronto
|
||||
bool bOk = BinaryFileCompare( sFile1, sFile2, sFileDiff) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetVersion( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// costruisco la stringa con le versioni
|
||||
string sVer ;
|
||||
if ( ! ExeGetVersionInfo( sVer, "\n"))
|
||||
sVer = "VersionInfo error" ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, sVer) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaIs64bit( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// restituisco il risultato
|
||||
#if defined( _WIN64)
|
||||
bool bRes = true ;
|
||||
#elif defined( _WIN32)
|
||||
bool bRes = false ;
|
||||
#endif
|
||||
LuaSetReturn( L, bRes) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGeneral( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "print", MyPrint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetContext", SetContext) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetContext", GetContext) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPause", LuaPause) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtStartCounter", LuaStartCounter) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtStopCounter", LuaStopCounter) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtNumToString", LuaNumToString) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExecTsc", LuaExecTsc) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOutLog", LuaOutLog) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOutBox", LuaOutBox) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseFile", LuaEraseFile) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEmptyDirectory", LuaEmptyDirectory) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTextFileCompare", LuaTextFileCompare) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtBinaryFileCompare", LuaBinaryFileCompare) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetVersion", LuaGetVersion) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtIs64bit", LuaIs64bit) ;
|
||||
return bOk ;
|
||||
}
|
||||
+467
@@ -0,0 +1,467 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_GeoBasel.cpp Data : 20.12.14 Versione : 1.5l2
|
||||
// Contenuto : Funzioni generali per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 27.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaVectorRotate( lua_State* L)
|
||||
{
|
||||
// 3 parametri : Vector, VtAsse, AngRot in gradi
|
||||
Vector3d vtV ;
|
||||
LuaCheckParam( L, 1, vtV)
|
||||
Vector3d vtAx ;
|
||||
LuaCheckParam( L, 2, vtAx)
|
||||
double dAngRotDeg ;
|
||||
LuaCheckParam( L, 3, dAngRotDeg)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la rotazione
|
||||
if ( vtV.Rotate( vtAx, dAngRotDeg)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, vtV) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaVectorToGlob( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Vector, frame di trasformazione
|
||||
Vector3d vtV ;
|
||||
LuaCheckParam( L, 1, vtV)
|
||||
Frame3d frTool ;
|
||||
LuaCheckParam( L, 2, frTool)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la trasformazione
|
||||
if ( vtV.ToGlob( frTool)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, vtV) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaVectorToLoc( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Vector, frame di trasformazione
|
||||
Vector3d vtV ;
|
||||
LuaCheckParam( L, 1, vtV)
|
||||
Frame3d frTool ;
|
||||
LuaCheckParam( L, 2, frTool)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la trasformazione
|
||||
if ( vtV.ToLoc( frTool)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, vtV) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaVectorLocToLoc( lua_State* L)
|
||||
{
|
||||
// 3 parametri : Vector, frame origine, frame destinazione
|
||||
Vector3d vtV ;
|
||||
LuaCheckParam( L, 1, vtV)
|
||||
Frame3d frOri ;
|
||||
LuaCheckParam( L, 2, frOri)
|
||||
Frame3d frDest ;
|
||||
LuaCheckParam( L, 3, frDest)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la trasformazione
|
||||
if ( vtV.LocToLoc( frOri, frDest)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, vtV) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaPointRotate( lua_State* L)
|
||||
{
|
||||
// 4 parametri : Point, PtAsse, VtAsse, AngRot in gradi
|
||||
Point3d ptP ;
|
||||
LuaCheckParam( L, 1, ptP)
|
||||
Point3d ptAx ;
|
||||
LuaCheckParam( L, 2, ptAx)
|
||||
Vector3d vtAx ;
|
||||
LuaCheckParam( L, 3, vtAx)
|
||||
double dAngRotDeg ;
|
||||
LuaCheckParam( L, 4, dAngRotDeg)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la rotazione
|
||||
if ( ptP.Rotate( ptAx, vtAx, dAngRotDeg)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, ptP) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaPointToGlob( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Point, frame di trasformazione
|
||||
Point3d ptP ;
|
||||
LuaCheckParam( L, 1, ptP)
|
||||
Frame3d frTool ;
|
||||
LuaCheckParam( L, 2, frTool)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la trasformazione
|
||||
if ( ptP.ToGlob( frTool)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, ptP) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaPointToLoc( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Point, frame di trasformazione
|
||||
Point3d ptP ;
|
||||
LuaCheckParam( L, 1, ptP)
|
||||
Frame3d frTool ;
|
||||
LuaCheckParam( L, 2, frTool)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la trasformazione
|
||||
if ( ptP.ToLoc( frTool)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, ptP) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaPointLocToLoc( lua_State* L)
|
||||
{
|
||||
// 3 parametri : Point, frame origine, frame destinazione
|
||||
Point3d ptP ;
|
||||
LuaCheckParam( L, 1, ptP)
|
||||
Frame3d frOri ;
|
||||
LuaCheckParam( L, 2, frOri)
|
||||
Frame3d frDest ;
|
||||
LuaCheckParam( L, 3, frDest)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la trasformazione
|
||||
if ( ptP.LocToLoc( frOri, frDest)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, ptP) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaFrameFrom3Points( lua_State* L)
|
||||
{
|
||||
// 3 parametri : origine, punto su X, punto vicino a Y
|
||||
Point3d ptOrig ;
|
||||
LuaCheckParam( L, 1, ptOrig)
|
||||
Point3d ptOnX ;
|
||||
LuaCheckParam( L, 2, ptOnX)
|
||||
Point3d ptNearY ;
|
||||
LuaCheckParam( L, 3, ptNearY)
|
||||
LuaClearStack( L) ;
|
||||
// calcolo il riferimento e restituisco il risultato : bOk, Frame
|
||||
Frame3d frTemp ;
|
||||
if ( frTemp.Set( ptOrig, ptOnX, ptNearY)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, frTemp) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaFrameOCS( lua_State* L)
|
||||
{
|
||||
// 2 parametri : origine, asse Z
|
||||
Point3d ptOrig ;
|
||||
LuaCheckParam( L, 1, ptOrig)
|
||||
Vector3d vtDirZ ;
|
||||
LuaCheckParam( L, 2, vtDirZ)
|
||||
LuaClearStack( L) ;
|
||||
// calcolo il riferimento e restituisco il risultato : bOk, Frame
|
||||
Frame3d frTemp ;
|
||||
if ( frTemp.Set( ptOrig, vtDirZ)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, frTemp) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaFrameRotate( lua_State* L)
|
||||
{
|
||||
// 4 parametri : Frame, PtAsse, VtAsse, AngRot in gradi
|
||||
Frame3d frFrame ;
|
||||
LuaCheckParam( L, 1, frFrame)
|
||||
Point3d ptAx ;
|
||||
LuaCheckParam( L, 2, ptAx)
|
||||
Vector3d vtAx ;
|
||||
LuaCheckParam( L, 3, vtAx)
|
||||
double dAngRotDeg ;
|
||||
LuaCheckParam( L, 4, dAngRotDeg)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la rotazione
|
||||
if ( frFrame.Rotate( ptAx, vtAx, dAngRotDeg)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, frFrame) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaFrameToGlob( lua_State* L)
|
||||
{
|
||||
// 2 parametri : frame, frame di trasformazione
|
||||
Frame3d frFrame ;
|
||||
LuaCheckParam( L, 1, frFrame)
|
||||
Frame3d frTool ;
|
||||
LuaCheckParam( L, 2, frTool)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la trasformazione
|
||||
if ( frFrame.ToGlob( frTool)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, frFrame) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaFrameToLoc( lua_State* L)
|
||||
{
|
||||
// 2 parametri : frame, frame di trasformazione
|
||||
Frame3d frFrame ;
|
||||
LuaCheckParam( L, 1, frFrame)
|
||||
Frame3d frTool ;
|
||||
LuaCheckParam( L, 2, frTool)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la trasformazione
|
||||
if ( frFrame.ToLoc( frTool)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, frFrame) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaFrameLocToLoc( lua_State* L)
|
||||
{
|
||||
// 3 parametri : frame, frame origine, frame destinazione
|
||||
Frame3d frFrame ;
|
||||
LuaCheckParam( L, 1, frFrame)
|
||||
Frame3d frOri ;
|
||||
LuaCheckParam( L, 2, frOri)
|
||||
Frame3d frDest ;
|
||||
LuaCheckParam( L, 3, frDest)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la trasformazione
|
||||
if ( frFrame.LocToLoc( frOri, frDest)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, frFrame) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaBBoxRotate( lua_State* L)
|
||||
{
|
||||
// 4 parametri : bbox, PtAsse, VtAsse, AngRot in gradi
|
||||
BBox3d b3Box ;
|
||||
LuaCheckParam( L, 1, b3Box)
|
||||
Point3d ptAx ;
|
||||
LuaCheckParam( L, 2, ptAx)
|
||||
Vector3d vtAx ;
|
||||
LuaCheckParam( L, 3, vtAx)
|
||||
double dAngRotDeg ;
|
||||
LuaCheckParam( L, 4, dAngRotDeg)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la rotazione
|
||||
if ( b3Box.Rotate( ptAx, vtAx, dAngRotDeg)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, b3Box) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaBBoxToGlob( lua_State* L)
|
||||
{
|
||||
// 2 parametri : bbox, frame di trasformazione
|
||||
BBox3d b3Box ;
|
||||
LuaCheckParam( L, 1, b3Box)
|
||||
Frame3d frTool ;
|
||||
LuaCheckParam( L, 2, frTool)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la trasformazione
|
||||
if ( b3Box.ToGlob( frTool)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, b3Box) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaBBoxToLoc( lua_State* L)
|
||||
{
|
||||
// 2 parametri : bbox, frame di trasformazione
|
||||
BBox3d b3Box ;
|
||||
LuaCheckParam( L, 1, b3Box)
|
||||
Frame3d frTool ;
|
||||
LuaCheckParam( L, 2, frTool)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la trasformazione
|
||||
if ( b3Box.ToLoc( frTool)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, b3Box) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaBBoxLocToLoc( lua_State* L)
|
||||
{
|
||||
// 3 parametri : bbox, frame origine, frame destinazione
|
||||
BBox3d b3Box ;
|
||||
LuaCheckParam( L, 1, b3Box)
|
||||
Frame3d frOri ;
|
||||
LuaCheckParam( L, 2, frOri)
|
||||
Frame3d frDest ;
|
||||
LuaCheckParam( L, 3, frDest)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la trasformazione
|
||||
if ( b3Box.LocToLoc( frOri, frDest)) {
|
||||
LuaSetReturn( L, true) ;
|
||||
LuaSetReturn( L, b3Box) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGeoBase( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVectorRotate", LuaVectorRotate) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVectorToGlob", LuaVectorToGlob) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVectorToLoc", LuaVectorToLoc) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVectorLocToLoc", LuaVectorLocToLoc) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPointRotate", LuaPointRotate) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPointToGlob", LuaPointToGlob) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPointToLoc", LuaPointToLoc) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPointLocToLoc", LuaPointLocToLoc) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtFrameFrom3Points", LuaFrameFrom3Points) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtFrameOCS", LuaFrameOCS) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtFrameRotate", LuaFrameRotate) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtFrameToGlob", LuaFrameToGlob) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtFrameToLoc", LuaFrameToLoc) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtFrameLocToLoc", LuaFrameLocToLoc) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxRotate", LuaBBoxRotate) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToGlob", LuaBBoxToGlob) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToLoc", LuaBBoxToLoc) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxLocToLoc", LuaBBoxLocToLoc) ;
|
||||
return bOk ;
|
||||
}
|
||||
+582
@@ -0,0 +1,582 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_GeoSnap.cpp Data : 02.10.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni di snap ad oggetti del DB geometrico per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 02.10.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaStartPoint( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : Id [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 2, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto iniziale dell'entità
|
||||
Point3d ptP ;
|
||||
if ( ExeStartPoint( nId, nRefId, ptP))
|
||||
LuaSetReturn( L, ptP) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaEndPoint( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : Id [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 2, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto finale dell'entità
|
||||
Point3d ptP ;
|
||||
if ( ExeEndPoint( nId, nRefId, ptP))
|
||||
LuaSetReturn( L, ptP) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaMidPoint( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : Id [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 2, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto centrale dell'entità
|
||||
Point3d ptP ;
|
||||
if ( ExeMidPoint( nId, nRefId, ptP))
|
||||
LuaSetReturn( L, ptP) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCenterPoint( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : Id [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 2, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto centrale dell'entità
|
||||
Point3d ptP ;
|
||||
if ( ExeCenterPoint( nId, nRefId, ptP))
|
||||
LuaSetReturn( L, ptP) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCentroid( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : Id [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 2, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il centro geometrico dell'entità
|
||||
Point3d ptP ;
|
||||
if ( ExeCentroid( nId, nRefId, ptP))
|
||||
LuaSetReturn( L, ptP) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAtParamPoint( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, U [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
double dU ;
|
||||
LuaCheckParam( L, 2, dU)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 3, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto in posizione parametrica U della curva
|
||||
Point3d ptP ;
|
||||
if ( ExeAtParamPoint( nId, dU, nRefId, ptP))
|
||||
LuaSetReturn( L, ptP) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaNearPoint( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, ptNear [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
Point3d ptNear ;
|
||||
LuaCheckParam( L, 2, ptNear)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 3, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto di intersezione tra le curve più vicino al punto passato
|
||||
Point3d ptP ;
|
||||
if ( ExeNearPoint( nId, ptNear, nRefId, ptP))
|
||||
LuaSetReturn( L, ptP) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaIntersectionPoint( lua_State* L)
|
||||
{
|
||||
// 3 o 4 parametri : Id1, Id2, ptNear [, nRefId]
|
||||
int nId1 ;
|
||||
LuaCheckParam( L, 1, nId1)
|
||||
int nId2 ;
|
||||
LuaCheckParam( L, 2, nId2)
|
||||
Point3d ptNear ;
|
||||
LuaCheckParam( L, 3, ptNear)
|
||||
int nRefId = nId1 ;
|
||||
LuaGetParam( L, 4, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto di intersezione tra le curve più vicino al punto passato
|
||||
Point3d ptP ;
|
||||
if ( ExeIntersectionPoint( nId1, nId2, ptNear, nRefId, ptP))
|
||||
LuaSetReturn( L, ptP) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaStartVector( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : Id [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 2, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il vettore tangente all'inizio della curva
|
||||
Vector3d vtV ;
|
||||
if ( ExeStartVector( nId, nRefId, vtV))
|
||||
LuaSetReturn( L, vtV) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaEndVector( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : Id [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 2, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il vettore tangente alla fine della curva
|
||||
Vector3d vtV ;
|
||||
if ( ExeEndVector( nId, nRefId, vtV))
|
||||
LuaSetReturn( L, vtV) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaMidVector( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : Id [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 2, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il vettore tangente nel punto medio della curva
|
||||
Vector3d vtV ;
|
||||
if ( ExeMidVector( nId, nRefId, vtV))
|
||||
LuaSetReturn( L, vtV) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAtParamVector( lua_State* L)
|
||||
{
|
||||
// 2, 3 o 4 parametri : Id, U, nSide [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
double dU ;
|
||||
LuaCheckParam( L, 2, dU)
|
||||
int nSide ;
|
||||
LuaCheckParam( L, 3, nSide) ;
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 4, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto in posizione parametrica U della curva
|
||||
Vector3d vtV ;
|
||||
if ( ExeAtParamVector( nId, dU, nSide, nRefId, vtV))
|
||||
LuaSetReturn( L, vtV) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaFrame( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : Id [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 2, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il frame
|
||||
Frame3d frFrame ;
|
||||
if ( ExeFrame( nId, nRefId, frFrame))
|
||||
LuaSetReturn( L, frFrame) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveLength( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero la lunghezza della curva
|
||||
double dLen ;
|
||||
if ( ExeCurveLength( nId, &dLen) != FALSE)
|
||||
LuaSetReturn( L, dLen) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveExtrusion( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : Id [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 2, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il versore
|
||||
Vector3d vtExtr ;
|
||||
if ( ExeCurveExtrusion( nId, nRefId, vtExtr))
|
||||
LuaSetReturn( L, vtExtr) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveThickness( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero lo spessore
|
||||
double dThick ;
|
||||
if ( ExeCurveThickness( nId, &dThick) != FALSE)
|
||||
LuaSetReturn( L, dThick) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExtrusionByThickness( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : Id [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 2, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il versore e lo spessore
|
||||
Vector3d vtExtr ;
|
||||
double dThick ;
|
||||
if ( ExeCurveExtrusion( nId, nRefId, vtExtr) && ! vtExtr.IsSmall() &&
|
||||
ExeCurveThickness( nId, &dThick) && fabs( dThick) > EPS_SMALL)
|
||||
vtExtr *= dThick ;
|
||||
else
|
||||
vtExtr = V_NULL ;
|
||||
LuaSetReturn( L, vtExtr) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveArcRadius( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il raggio
|
||||
double dRad ;
|
||||
if ( ExeCurveArcRadius( nId, &dRad) != FALSE)
|
||||
LuaSetReturn( L, dRad) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveArcNormVersor( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : Id [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 2, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il versore
|
||||
Vector3d vtNorm ;
|
||||
if ( ExeCurveArcNormVersor( nId, nRefId, vtNorm))
|
||||
LuaSetReturn( L, vtNorm) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveCompoCenter( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, nCrv [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nCrv ;
|
||||
LuaCheckParam( L, 2, nCrv)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 3, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il centro della curva semplice indicizzata
|
||||
Point3d ptCen ;
|
||||
if ( ExeCurveCompoCenter( nId, nCrv, nRefId, ptCen))
|
||||
LuaSetReturn( L, ptCen) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmFacetNbr( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il numero di facce della superficie trimesh
|
||||
int nNbr = ExeSurfTmFacetNbr( nId) ;
|
||||
LuaSetReturn( L, nNbr) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmFacetNearestEndPoint( lua_State* L)
|
||||
{
|
||||
// 3 o 4 parametri : Id, nFacet, ptNear [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nFacet ;
|
||||
LuaCheckParam( L, 2, nFacet)
|
||||
Point3d ptNear ;
|
||||
LuaCheckParam( L, 3, ptNear)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 4, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto End più vicino della faccia della superficie trimesh
|
||||
Point3d ptEnd ;
|
||||
Vector3d vtN ;
|
||||
if ( ExeSurfTmFacetNearestEndPoint( nId, nFacet, ptNear, nRefId, ptEnd, vtN)) {
|
||||
LuaSetReturn( L, ptEnd) ;
|
||||
LuaSetReturn( L, vtN) ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L) ;
|
||||
LuaSetReturn( L) ;
|
||||
}
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmFacetNearestMidPoint( lua_State* L)
|
||||
{
|
||||
// 3 o 4 parametri : Id, nFacet, ptNear [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nFacet ;
|
||||
LuaCheckParam( L, 2, nFacet)
|
||||
Point3d ptNear ;
|
||||
LuaCheckParam( L, 3, ptNear)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 4, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto Mid più vicino della faccia della superficie trimesh
|
||||
Point3d ptMid ;
|
||||
Vector3d vtN ;
|
||||
if ( ExeSurfTmFacetNearestMidPoint( nId, nFacet, ptNear, nRefId, ptMid, vtN)) {
|
||||
LuaSetReturn( L, ptMid) ;
|
||||
LuaSetReturn( L, vtN) ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L) ;
|
||||
LuaSetReturn( L) ;
|
||||
}
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmFacetCenter( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, nFacet [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nFacet ;
|
||||
LuaCheckParam( L, 2, nFacet)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 3, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il centro della faccia della superficie trimesh
|
||||
Point3d ptCen ;
|
||||
Vector3d vtN ;
|
||||
if ( ExeSurfTmFacetCenter( nId, nFacet, nRefId, ptCen, vtN)) {
|
||||
LuaSetReturn( L, ptCen) ;
|
||||
LuaSetReturn( L, vtN) ;
|
||||
}
|
||||
else {
|
||||
LuaSetReturn( L) ;
|
||||
LuaSetReturn( L) ;
|
||||
}
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmFacetNormVersor( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, nFacet [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nFacet ;
|
||||
LuaCheckParam( L, 2, nFacet)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 3, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero la normale della faccia della superficie trimesh
|
||||
Vector3d vtNorm ;
|
||||
if ( ExeSurfTmFacetNormVersor( nId, nFacet, nRefId, vtNorm))
|
||||
LuaSetReturn( L, vtNorm) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExtTextNormVersor( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : Id [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 2, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il versore
|
||||
Vector3d vtNorm ;
|
||||
if ( ExeExtTextNormVersor( nId, nRefId, vtNorm))
|
||||
LuaSetReturn( L, vtNorm) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGeoSnap( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSP", LuaStartPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEP", LuaEndPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMP", LuaMidPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCP", LuaCenterPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGP", LuaCentroid) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtUP", LuaAtParamPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtNP", LuaNearPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtIP", LuaIntersectionPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSV", LuaStartVector) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEV", LuaEndVector) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMV", LuaMidVector) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtUV", LuaAtParamVector) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtFR", LuaFrame) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtET", LuaExtrusionByThickness) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveLength", LuaCurveLength) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveExtrusion", LuaCurveExtrusion) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveThickness", LuaCurveThickness) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveArcRadius", LuaCurveArcRadius) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveArcNormVersor", LuaCurveArcNormVersor) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoCenter", LuaCurveCompoCenter) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNbr", LuaSurfTmFacetNbr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestEndPoint", LuaSurfTmFacetNearestEndPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestMidPoint", LuaSurfTmFacetNearestMidPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCenter", LuaSurfTmFacetCenter) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNormVersor", LuaSurfTmFacetNormVersor) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExtTextNormVersor", LuaExtTextNormVersor) ;
|
||||
return bOk ;
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_GeoTransform.cpp Data : 29.09.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni di trasformazione geometrica per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 29.09.14 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"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaMove( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id/s, VtMove [, nRefType]
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
Vector3d vtMove ;
|
||||
LuaCheckParam( L, 2, vtMove)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo traslazione
|
||||
bool bOk = ExeMove( vId, vtMove, nRefType) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRotate( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : Id/s, PtAx, VtAx, dAngRotDeg [, nRefType]
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
Point3d ptAx ;
|
||||
LuaCheckParam( L, 2, ptAx)
|
||||
Vector3d vtAx ;
|
||||
LuaCheckParam( L, 3, vtAx)
|
||||
double dAngRotDeg ;
|
||||
LuaCheckParam( L, 4, dAngRotDeg)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo rotazione
|
||||
bool bOk = ExeRotate( vId, ptAx, vtAx, dAngRotDeg, nRefType) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaScale( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : Id/s, Frame, CoeffX, CoeffY, CoeffZ [, nRefType]
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
Frame3d frRef ;
|
||||
LuaCheckParam( L, 2, frRef)
|
||||
double dCoeffX ;
|
||||
LuaCheckParam( L, 3, dCoeffX)
|
||||
double dCoeffY ;
|
||||
LuaCheckParam( L, 4, dCoeffY)
|
||||
double dCoeffZ ;
|
||||
LuaCheckParam( L, 5, dCoeffZ)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo scalatura
|
||||
bool bOk = ExeScale( vId, frRef, dCoeffX, dCoeffY, dCoeffZ, nRefType) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaMirror( lua_State* L)
|
||||
{
|
||||
// 3 o 4 parametri : Id/s, PtOn, VtN [, nRefType]
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
Point3d ptOn ;
|
||||
LuaCheckParam( L, 2, ptOn)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 3, vtN)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo riflessione
|
||||
bool bOk = ExeMirror( vId, ptOn, vtN, nRefType) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaShear( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : Id, PtOn, VtN, VtDir, Coeff [, nRefType]
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
Point3d ptOn ;
|
||||
LuaCheckParam( L, 2, ptOn)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 3, vtN)
|
||||
Vector3d vtDir ;
|
||||
LuaCheckParam( L, 4, vtDir)
|
||||
double dCoeff ;
|
||||
LuaCheckParam( L, 5, dCoeff)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo stiramento
|
||||
bool bOk = ExeShear( vId, ptOn, vtN, vtDir, dCoeff, nRefType) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaMoveGroup( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, VtMove
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
Vector3d vtMove ;
|
||||
LuaCheckParam( L, 2, vtMove)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo traslazione
|
||||
bool bOk = ExeMoveGroup( nId, vtMove) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRotateGroup( lua_State* L)
|
||||
{
|
||||
// 4 parametri : Id, PtAx, VtAx, dAngRotDeg
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
Point3d ptAx ;
|
||||
LuaCheckParam( L, 2, ptAx)
|
||||
Vector3d vtAx ;
|
||||
LuaCheckParam( L, 3, vtAx)
|
||||
double dAngRotDeg ;
|
||||
LuaCheckParam( L, 4, dAngRotDeg)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo rotazione
|
||||
bool bOk = ExeRotateGroup( nId, ptAx, vtAx, dAngRotDeg) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaScaleGroup( lua_State* L)
|
||||
{
|
||||
// 5 parametri : Id, Frame, CoeffX, CoeffY, CoeffZ
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
Frame3d frRef ;
|
||||
LuaCheckParam( L, 2, frRef)
|
||||
double dCoeffX ;
|
||||
LuaCheckParam( L, 3, dCoeffX)
|
||||
double dCoeffY ;
|
||||
LuaCheckParam( L, 4, dCoeffY)
|
||||
double dCoeffZ ;
|
||||
LuaCheckParam( L, 5, dCoeffZ)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo scalatura
|
||||
bool bOk = ExeScaleGroup( nId, frRef, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaMirrorGroup( lua_State* L)
|
||||
{
|
||||
// 3 parametri : Id, PtOn, VtN
|
||||
int sId ;
|
||||
LuaCheckParam( L, 1, sId)
|
||||
Point3d ptOn ;
|
||||
LuaCheckParam( L, 2, ptOn)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 3, vtN)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo scalatura
|
||||
bool bOk = ExeMirrorGroup( sId, ptOn, vtN) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaShearGroup( lua_State* L)
|
||||
{
|
||||
// 5 parametri : Id, PtOn, VtN, VtDir, Coeff
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
Point3d ptOn ;
|
||||
LuaCheckParam( L, 2, ptOn)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 3, vtN)
|
||||
Vector3d vtDir ;
|
||||
LuaCheckParam( L, 4, vtDir)
|
||||
double dCoeff ;
|
||||
LuaCheckParam( L, 5, dCoeff)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo scalatura
|
||||
bool bOk = ExeShearGroup( nId, ptOn, vtN, vtDir, dCoeff) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGeoTransform( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMove", LuaMove) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRotate", LuaRotate) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtScale", LuaScale) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMirror", LuaMirror) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtShear", LuaShear) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMoveGroup", LuaMoveGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRotateGroup", LuaRotateGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtScaleGroup", LuaScaleGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMirrorGroup", LuaMirrorGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtShearGroup", LuaShearGroup) ;
|
||||
return bOk ;
|
||||
}
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_General.cpp Data : 27.09.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni generali per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 27.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetDefaultMaterial( lua_State* L)
|
||||
{
|
||||
// un solo parametro, il colore
|
||||
Color colDef ;
|
||||
if ( ! LuaGetParam( L, 1, colDef))
|
||||
return luaL_error( L, "Invalide first parameter") ;
|
||||
LuaClearStack( L) ;
|
||||
// imposto il colore di default
|
||||
int vCol[4] ;
|
||||
colDef.GetInt( vCol) ;
|
||||
bool bOk = ( ExeSetDefaultMaterial( vCol) != FALSE) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetGridFrame( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Frame
|
||||
Frame3d frFrame ;
|
||||
LuaCheckParam( L, 1, frFrame) ;
|
||||
LuaClearStack( L) ;
|
||||
// imposto il riferimento della Griglia (o CPlane)
|
||||
bool bOk = ( ExeSetGridFrame( frFrame)) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetGridFrame( lua_State* L)
|
||||
{
|
||||
// 1 o nessun parametro : [nRefId]
|
||||
int nRefId = GDB_ID_ROOT ;
|
||||
if ( lua_gettop( L) >= 1)
|
||||
LuaCheckParam( L, 1, nRefId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il riferimento della griglia
|
||||
Frame3d frFrame ;
|
||||
ExeGetGridFrame( nRefId, frFrame) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, frFrame) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetGridVersZ( lua_State* L)
|
||||
{
|
||||
// 1 o nessun parametro : [nRefId]
|
||||
int nRefId = GDB_ID_ROOT ;
|
||||
if ( lua_gettop( L) >= 1)
|
||||
LuaCheckParam( L, 1, nRefId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il versore Z della griglia e lo restituisco
|
||||
Vector3d vtVersZ ;
|
||||
if ( ExeGetGridVersZ( nRefId, vtVersZ))
|
||||
LuaSetReturn( L, vtVersZ) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaNewFile( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// nuovo progetto
|
||||
bool bOk = ExeNewFile() ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaOpenFile( lua_State* L)
|
||||
{
|
||||
// 1 parametro : path del file da aprire
|
||||
string sFilePath ;
|
||||
LuaCheckParam( L, 1, sFilePath)
|
||||
LuaClearStack( L) ;
|
||||
// apro il file
|
||||
bool bOk = ExeOpenFile( sFilePath) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaInsertFile( lua_State* L)
|
||||
{
|
||||
// 1 parametro : path del file da importare
|
||||
string sFilePath ;
|
||||
LuaCheckParam( L, 1, sFilePath)
|
||||
LuaClearStack( L) ;
|
||||
// apro il file
|
||||
bool bOk = ExeInsertFile( sFilePath) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSaveFile( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : path del file [, flag]
|
||||
string sFilePath ;
|
||||
LuaCheckParam( L, 1, sFilePath)
|
||||
int nFlag = GDB_SV_CMPTXT ;
|
||||
LuaGetParam( L, 2, nFlag) ;
|
||||
LuaClearStack( L) ;
|
||||
// salvo il file
|
||||
bool bOk = ExeSaveFile( sFilePath, nFlag) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSaveObjToFile( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : nId, path del file [, flag]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
string sFilePath ;
|
||||
LuaCheckParam( L, 2, sFilePath)
|
||||
int nFlag = GDB_SV_CMPTXT ;
|
||||
LuaGetParam( L, 3, nFlag) ;
|
||||
LuaClearStack( L) ;
|
||||
// copio il gruppo nel file
|
||||
bool bOk = ExeSaveObjToFile( nId, sFilePath, nFlag) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGeomDB( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetDefaultMaterial", LuaSetDefaultMaterial) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetGridFrame", LuaSetGridFrame) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetGridFrame", LuaGetGridFrame) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetGridVersZ", LuaGetGridVersZ) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtNewFile", LuaNewFile) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOpenFile", LuaOpenFile) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtInsertFile", LuaInsertFile) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSaveFile", LuaSaveFile) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSaveObjToFile", LuaSaveObjToFile) ;
|
||||
return bOk ;
|
||||
}
|
||||
+541
@@ -0,0 +1,541 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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 "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetMachGroupNbr( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero il numero di macchinate
|
||||
int nTot = ExeGetMachGroupNbr() ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nTot) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetFirstMachGroup( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero l'identificativo della prima macchinata
|
||||
int nId = ExeGetFirstMachGroup() ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetNextMachGroup( lua_State* L)
|
||||
{
|
||||
// 1 parametro : identificativo di una macchinata
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero l'identificativo della successiva macchinata
|
||||
int nNextId = ExeGetNextMachGroup( nId) ;
|
||||
// restituisco il risultato
|
||||
if ( nNextId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nNextId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
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 = ExeAddMachGroup( sName, sMachineName) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nId) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRemoveMachGroup( lua_State* L)
|
||||
{
|
||||
// 1 parametro : identificativo del gruppo
|
||||
int nMGroupInd ;
|
||||
LuaCheckParam( L, 1, nMGroupInd)
|
||||
LuaClearStack( L) ;
|
||||
// rimuovo la macchinata
|
||||
bool bOk = ExeRemoveMachGroup( nMGroupInd) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetMachGroupName( lua_State* L)
|
||||
{
|
||||
// 1 parametro : identificativo del gruppo
|
||||
int nMGroupInd ;
|
||||
LuaCheckParam( L, 1, nMGroupInd)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il nome della macchinata
|
||||
string sName ;
|
||||
bool bOk = ExeGetMachGroupName( nMGroupInd, sName) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetReturn( L, sName) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetMachGroupId( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nome del gruppo
|
||||
string sGroupName ;
|
||||
LuaCheckParam( L, 1, sGroupName)
|
||||
LuaClearStack( L) ;
|
||||
// recupero l'identificativo della macchinata
|
||||
int nId = ExeGetMachGroupId( sGroupName) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetCurrMachGroup( lua_State* L)
|
||||
{
|
||||
// 1 parametro : identificativo del gruppo
|
||||
int nMGroupInd ;
|
||||
LuaCheckParam( L, 1, nMGroupInd)
|
||||
LuaClearStack( L) ;
|
||||
// imposto il gruppo corrente
|
||||
bool bOk = ExeSetCurrMachGroup( nMGroupInd) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaResetCurrMachGroup( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// imposto il gruppo corrente
|
||||
bool bOk = ExeResetCurrMachGroup() ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetCurrMachGroup( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero l'identificativo del gruppo corrente
|
||||
int nId = ExeGetCurrMachGroup() ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetRawPartNbr( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero il numero di grezzi nella macchinata corrente
|
||||
int nCount = ExeGetRawPartNbr() ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nCount) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetFirstRawPart( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero identificativo primo grezzo nella macchinata corrente
|
||||
int nId = ExeGetFirstRawPart() ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetNextRawPart( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nRawId
|
||||
int nRawId ;
|
||||
LuaCheckParam( L, 1, nRawId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero identificativo successivo grezzo nella macchinata corrente
|
||||
int nId = ExeGetNextRawPart( nRawId) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAddRawPart( lua_State* L)
|
||||
{
|
||||
// 5 parametri : Pto origine, dWidth, dLen, dH, Color
|
||||
Point3d ptOrig ;
|
||||
LuaCheckParam( L, 1, ptOrig)
|
||||
double dWidth ;
|
||||
LuaCheckParam( L, 2, dWidth)
|
||||
double dLength ;
|
||||
LuaCheckParam( L, 3, dLength)
|
||||
double dHeight ;
|
||||
LuaCheckParam( L, 4, dHeight)
|
||||
Color cCol ;
|
||||
LuaCheckParam( L, 5, cCol)
|
||||
LuaClearStack( L) ;
|
||||
// inserisco il grezzo nella macchinata corrente
|
||||
int nInd = ExeAddRawPart( ptOrig, dWidth, dLength, dHeight, cCol) ;
|
||||
// restituisco il risultato
|
||||
if ( nInd != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nInd) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAddRawPartWithPart( lua_State* L)
|
||||
{
|
||||
// 4 parametri : nPartId, nCrvId, dOverMat, Color
|
||||
int nPartId ;
|
||||
LuaCheckParam( L, 1, nPartId)
|
||||
int nCrvId = GDB_ID_NULL ;
|
||||
LuaGetParam( L, 2, nCrvId) ;
|
||||
double dOverMat ;
|
||||
LuaCheckParam( L, 3, dOverMat)
|
||||
Color cCol ;
|
||||
LuaCheckParam( L, 4, cCol)
|
||||
LuaClearStack( L) ;
|
||||
// inserisco il grezzo nella macchinata corrente
|
||||
int nInd = ExeAddRawPartWithPart( nPartId, nCrvId, dOverMat, cCol) ;
|
||||
// restituisco il risultato
|
||||
if ( nInd != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nInd) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaModifyRawPartHeight( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nRawId, dHeight
|
||||
int nRawId ;
|
||||
LuaCheckParam( L, 1, nRawId)
|
||||
double dHeight ;
|
||||
LuaCheckParam( L, 2, dHeight)
|
||||
LuaClearStack( L) ;
|
||||
// modifico lo spessore del grezzo
|
||||
bool bOk = ExeModifyRawPartHeight( nRawId, dHeight) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRemoveRawPart( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nRawId
|
||||
int nRawId ;
|
||||
LuaCheckParam( L, 1, nRawId)
|
||||
LuaClearStack( L) ;
|
||||
// elimino il grezzo dalla macchinata corrente
|
||||
bool bOk = ExeRemoveRawPart( nRawId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTranslateRawPart( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nRawId, vtMove
|
||||
int nRawId ;
|
||||
LuaCheckParam( L, 1, nRawId)
|
||||
Vector3d vtMove ;
|
||||
LuaCheckParam( L, 2, vtMove)
|
||||
LuaClearStack( L) ;
|
||||
// traslo il grezzo
|
||||
bool bOk = ExeTranslateRawPart( nRawId, vtMove) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRotateRawPart( lua_State* L)
|
||||
{
|
||||
// 3 parametri : nRawId, vtAx, dAngRotDeg
|
||||
int nRawId ;
|
||||
LuaCheckParam( L, 1, nRawId)
|
||||
Vector3d vtAx ;
|
||||
LuaCheckParam( L, 2, vtAx)
|
||||
double dAngRotDeg ;
|
||||
LuaCheckParam( L, 3, dAngRotDeg)
|
||||
LuaClearStack( L) ;
|
||||
// ruoto il grezzo
|
||||
bool bOk = ExeRotateRawPart( nRawId, vtAx, dAngRotDeg) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaMoveToCornerRawPart( lua_State* L)
|
||||
{
|
||||
// 3 parametri : nRawId, ptCorner, nFlag
|
||||
int nRawId ;
|
||||
LuaCheckParam( L, 1, nRawId)
|
||||
Point3d ptCorner ;
|
||||
LuaCheckParam( L, 2, ptCorner)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 3, nFlag)
|
||||
LuaClearStack( L) ;
|
||||
// sposto il grezzo nel corner
|
||||
bool bOk = ExeMoveToCornerRawPart( nRawId, ptCorner, nFlag) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaMoveToCenterRawPart( lua_State* L)
|
||||
{
|
||||
// 3 parametri : nRawId, ptCenter, nFlag
|
||||
int nRawId ;
|
||||
LuaCheckParam( L, 1, nRawId)
|
||||
Point3d ptCenter ;
|
||||
LuaCheckParam( L, 2, ptCenter)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 3, nFlag)
|
||||
LuaClearStack( L) ;
|
||||
// sposto il grezzo nel corner
|
||||
bool bOk = ExeMoveToCenterRawPart( nRawId, ptCenter, nFlag) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetPartInRawPartNbr( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nRawId
|
||||
int nRawId ;
|
||||
LuaCheckParam( L, 1, nRawId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il numero di pezzi nel grezzo
|
||||
int nCount = ExeGetPartInRawPartNbr( nRawId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nCount) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetFirstPartInRawPart( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nRawId
|
||||
int nRawId ;
|
||||
LuaCheckParam( L, 1, nRawId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero identificativo primo pezzo nel grezzo
|
||||
int nId = ExeGetFirstPartInRawPart( nRawId) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetNextPartInRawPart( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nPartId
|
||||
int nPartId ;
|
||||
LuaCheckParam( L, 1, nPartId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero identificativo successivo pezzo nello stesso grezzo
|
||||
int nId = ExeGetNextPartInRawPart( nPartId) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAddPartToRawPart( lua_State* L)
|
||||
{
|
||||
// 3 parametri : nPartId, ptPos, nRawId
|
||||
int nPartId ;
|
||||
LuaCheckParam( L, 1, nPartId)
|
||||
Point3d ptPos ;
|
||||
LuaCheckParam( L, 2, ptPos)
|
||||
int nRawId ;
|
||||
LuaCheckParam( L, 3, nRawId)
|
||||
LuaClearStack( L) ;
|
||||
// inserisco il grezzo nella macchinata corrente
|
||||
bool bOk = ExeAddPartToRawPart( nPartId, ptPos, nRawId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRemovePartFromRawPart( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nPartId
|
||||
int nPartId ;
|
||||
LuaCheckParam( L, 1, nPartId)
|
||||
LuaClearStack( L) ;
|
||||
// elimino il grezzo dalla macchinata corrente
|
||||
bool bOk = ExeRemovePartFromRawPart( nPartId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTranslatePartInRawPart( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nPartId, vtMove
|
||||
int nPartId ;
|
||||
LuaCheckParam( L, 1, nPartId)
|
||||
Vector3d vtMove ;
|
||||
LuaCheckParam( L, 2, vtMove)
|
||||
LuaClearStack( L) ;
|
||||
// traslo il pezzo nel grezzo
|
||||
bool bOk = ExeTranslatePartInRawPart( nPartId, vtMove) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRotatePartInRawPart( lua_State* L)
|
||||
{
|
||||
// 3 parametri : nPartId, vtAx, dAngRotDeg
|
||||
int nPartId ;
|
||||
LuaCheckParam( L, 1, nPartId)
|
||||
Vector3d vtAx ;
|
||||
LuaCheckParam( L, 2, vtAx)
|
||||
double dAngRotDeg ;
|
||||
LuaCheckParam( L, 3, dAngRotDeg)
|
||||
LuaClearStack( L) ;
|
||||
// ruoto il pezzo nel grezzo
|
||||
bool bOk = ExeRotatePartInRawPart( nPartId, vtAx, dAngRotDeg) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallMachMgr( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupNbr", LuaGetMachGroupNbr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstMachGroup", LuaGetFirstMachGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextMachGroup", LuaGetNextMachGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachGroup", LuaAddMachGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveMachGroup", LuaRemoveMachGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupName", LuaGetMachGroupName) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupId", LuaGetMachGroupId) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCurrMachGroup", LuaSetCurrMachGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtResetCurrMachGroup", LuaResetCurrMachGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCurrMachGroup", LuaGetCurrMachGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRawPartNbr", LuaGetRawPartNbr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstRawPart", LuaGetFirstRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextRawPart", LuaGetNextRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPart", LuaAddRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPartWithPart", LuaAddRawPartWithPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPartHeight", LuaModifyRawPartHeight) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveRawPart", LuaRemoveRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMoveRawPart", LuaTranslateRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRotateRawPart", LuaRotateRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMoveToCornerRawPart", LuaMoveToCornerRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMoveToCenterRawPart", LuaMoveToCenterRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPartInRawPartNbr", LuaGetPartInRawPartNbr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstPartInRawPart", LuaGetFirstPartInRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextPartInRawPart", LuaGetNextPartInRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddPartToRawPart", LuaAddPartToRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRemovePartFromRawPart", LuaRemovePartFromRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMovePartInRawPart", LuaTranslatePartInRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRotatePartInRawPart", LuaRotatePartInRawPart) ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_Scene.cpp Data : 29.09.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni di visualizzazione per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 29.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetBackground( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : colore top, colore bottom [, flag ridisegna]
|
||||
Color colTop ;
|
||||
LuaCheckParam( L, 1, colTop)
|
||||
Color colBot ;
|
||||
LuaCheckParam( L, 2, colBot)
|
||||
bool bRedraw ;
|
||||
LuaGetParam( L, 3, bRedraw) ;
|
||||
LuaClearStack( L) ;
|
||||
// imposto lo sfondo
|
||||
bool bOk = ExeSetBackground( colTop, colBot, bRedraw) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaDraw( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// eseguo ridisegno
|
||||
bool bOk = ExeDraw() ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetShowMode( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nShowMode [, flag ridisegna]
|
||||
int nShowMode ;
|
||||
LuaCheckParam( L, 1, nShowMode)
|
||||
bool bRedraw = true ;
|
||||
LuaGetParam( L, 2, bRedraw) ;
|
||||
LuaClearStack( L) ;
|
||||
// imposto il modo di visualizzazione
|
||||
bool bOk = ExeSetShowMode( nShowMode, bRedraw) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetShowCurveDirection( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : bool bShowCrvDir [, flag ridisegna]
|
||||
bool bShowCrvDir ;
|
||||
LuaCheckParam( L, 1, bShowCrvDir)
|
||||
bool bRedraw = true ;
|
||||
LuaGetParam( L, 2, bRedraw) ;
|
||||
LuaClearStack( L) ;
|
||||
// imposto visualizzazione direzione curve
|
||||
bool bOk = ExeSetShowCurveDirection( bShowCrvDir, bRedraw) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetShowTriaAdv( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : flag bAdvanced [, flag ridisegna]
|
||||
bool bAdvanced ;
|
||||
LuaCheckParam( L, 1, bAdvanced)
|
||||
bool bRedraw = true ;
|
||||
LuaGetParam( L, 2, bRedraw) ,
|
||||
LuaClearStack( L) ;
|
||||
// imposto visualizzazione direzione curve
|
||||
bool bOk = ExeSetShowTriaAdv( bAdvanced, bRedraw) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaZoom( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nZoomType [, flag ridisegna]
|
||||
int nZoomType ;
|
||||
LuaCheckParam( L, 1, nZoomType)
|
||||
bool bRedraw = true ;
|
||||
LuaGetParam( L, 2, bRedraw) ;
|
||||
LuaClearStack( L) ;
|
||||
// imposto zoom
|
||||
bool bOk = ExeZoom( nZoomType, bRedraw) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetView( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nViewDir [, flag ridisegna]
|
||||
int nViewDir ;
|
||||
LuaCheckParam( L, 1, nViewDir)
|
||||
bool bRedraw = true ;
|
||||
LuaGetParam( L, 2, bRedraw) ;
|
||||
LuaClearStack( L) ;
|
||||
// imposto direzione di vista
|
||||
bool bOk = ExeSetView( nViewDir, bRedraw) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetGenericView( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : dAngVertDeg, dAngHorizDeg [, flag ridisegna]
|
||||
double dAngVertDeg ;
|
||||
LuaCheckParam( L, 1, dAngVertDeg)
|
||||
double dAngHorizDeg ;
|
||||
LuaCheckParam( L, 2, dAngHorizDeg)
|
||||
bool bRedraw = true ;
|
||||
LuaGetParam( L, 3, bRedraw) ;
|
||||
LuaClearStack( L) ;
|
||||
// imposto direzione di vista
|
||||
bool bOk = ExeSetGenericView( dAngVertDeg, dAngHorizDeg, bRedraw) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetViewCenter( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : ptCen [, flag ridisegna]
|
||||
Point3d ptCen ;
|
||||
LuaCheckParam( L, 1, ptCen)
|
||||
bool bRedraw = true ;
|
||||
LuaGetParam( L, 2, bRedraw) ;
|
||||
LuaClearStack( L) ;
|
||||
// imposto centro di vista
|
||||
bool bOk = ExeSetViewCenter( ptCen, bRedraw) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallScene( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetBackground", LuaSetBackground) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDraw", LuaDraw) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowMode", LuaSetShowMode) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowCurveDirection", LuaSetShowCurveDirection) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowTriaAdv", LuaSetShowTriaAdv) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtZoom", LuaZoom) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetView", LuaSetView) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetGenericView", LuaSetGenericView) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewCenter", LuaSetViewCenter) ;
|
||||
return bOk ;
|
||||
}
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : file di origine che include solo le inclusioni standard
|
||||
// EgtInterface.pch sarà l'intestazione precompilata
|
||||
// stdafx.obj conterrà le informazioni sui tipi precompilati
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: fare riferimento alle intestazioni aggiuntive necessarie in STDAFX.H
|
||||
// e non in questo file
|
||||
@@ -0,0 +1,34 @@
|
||||
// stdafx.h : file di inclusione per file di inclusione di sistema standard
|
||||
// o file di inclusione specifici del progetto utilizzati di frequente, ma
|
||||
// modificati raramente
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EgtTargetVer.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
|
||||
// in Debug riconoscimento memory leakage
|
||||
#if defined( _DEBUG)
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
// in Debug controllo iteratori
|
||||
#if defined( _DEBUG)
|
||||
#define _SECURE_SCL 1
|
||||
#else
|
||||
#define _SECURE_SCL 0
|
||||
#endif
|
||||
|
||||
#include "/EgtDev/Include/EgtLibVer.h"
|
||||
|
||||
#pragma comment(lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "EgtNumKernel" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "EgtGeomKernel" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTEXTDIR "Lua/Lib/Lua52" EGTLIBVER ".lib")
|
||||
Reference in New Issue
Block a user