Compare commits

..

4 Commits

Author SHA1 Message Date
Daniele Bariletti a5a0646ddc EgtExecutor :
- correzione minore a export 3dm.
2023-10-17 11:12:09 +02:00
Daniele Bariletti b954be810c EgtExecutor :
- aggiunte funzioni per l'Export 3dm.
2023-10-12 11:01:31 +02:00
Daniele Bariletti 8500a0467e EgtExecutor :
- aggiunta del 3dm Export.
2023-10-12 11:01:27 +02:00
Daniele Bariletti 8145b4586c EgtExecutor :
- introdotto l'uso della grafica di default per gli ExtDim
importati da 3dm.
2023-10-12 11:01:20 +02:00
79 changed files with 1928 additions and 13039 deletions
-181
View File
@@ -1,181 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : DllExch3dm.cpp Data : 14.11.23 Versione : 2.5k2
// Contenuto : Funzioni di gestione della libreria opzionale EgtExch3dme.
//
//
//
// Modifiche : 14.11.23 DS Creazione modulo.
//
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "DllExch3dm.h"
#include "/EgtDev/Include/EE3DllMain.h"
#define NOMINMAX
#include <windows.h>
using namespace std ;
//-----------------------------------------------------------------------------
// Nome della libreria
#if defined( _WIN64) && defined( _DEBUG)
static const wchar_t* EE3_NAME = L"EgtExch3dmD64.dll" ;
#elif defined( _WIN64)
static const wchar_t* EE3_NAME = L"EgtExch3dmR64.dll" ;
#elif defined( _WIN32) && defined( _DEBUG)
static const wchar_t* EE3_NAME = L"EgtExch3dmD32.dll" ;
#else
static const wchar_t* EE3_NAME = L"EgtExch3dmR32.dll" ;
#endif
// Nome delle funzioni caricate
static const char* EE3_SETEE3LOGGER = "SetEE3Logger" ;
static const char* EE3_GETEE3VERSION = "GetEE3Version" ;
static const char* EE3_SETEE3KEY = "SetEE3Key" ;
static const char* EE3_SETEE3NETHWKEY = "SetEE3NetHwKey" ;
static const char* EE3_CREATEIMPORT3DM = "CreateImport3dm" ;
static const char* EE3_CREATEEXPORT3DM = "CreateExport3dm" ;
//-----------------------------------------------------------------------------
HMODULE s_hEE3 = nullptr ;
//-----------------------------------------------------------------------------
bool
LoadExch3dmDll( ILogger* pLogger, const string& sKey, bool bNetHwKey)
{
// verifico la chiave
if ( ! TestKeyForEE3( sKey, 0, pLogger)) {
FreeExch3dmDll() ;
return false ;
}
// se già caricata
if ( s_hEE3 != nullptr)
return true ;
// carico la libreria EgtExch3dm
s_hEE3 = LoadLibrary( EE3_NAME) ;
if ( s_hEE3 == nullptr)
return false ;
// imposto logger
MySetEE3Logger( pLogger) ;
// imposto i codici della chiave
MySetEE3Key( sKey) ;
// imposto eventuale chiave di rete
MySetEE3NetHwKey( bNetHwKey) ;
return true ;
}
//-----------------------------------------------------------------------------
bool
FreeExch3dmDll( void)
{
// se non è già caricata
if ( s_hEE3 == nullptr)
return true ;
// libero la libreria EgtExch3dm
FreeLibrary( s_hEE3) ;
s_hEE3 = nullptr ;
return true ;
}
//-----------------------------------------------------------------------------
bool
IsLoadedExch3dmDll( void)
{
return ( s_hEE3 != nullptr) ;
}
//-----------------------------------------------------------------------------
void
MySetEE3Logger( ILogger* pLogger)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return ;
// recupero funzione che imposta il logger
typedef void (* PF_SetEE3Logger) ( ILogger* pLogger) ;
PF_SetEE3Logger pFun = (PF_SetEE3Logger)GetProcAddress( s_hEE3, EE3_SETEE3LOGGER) ;
if ( pFun == nullptr)
return ;
pFun( pLogger) ;
}
//-----------------------------------------------------------------------------
const char*
MyGetEE3Version( void)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return "" ;
// recupero funzione che restituisce la versione della libreria
typedef const char* (* PF_GetEE3Version) ( void) ;
PF_GetEE3Version pFun = (PF_GetEE3Version)GetProcAddress( s_hEE3, EE3_GETEE3VERSION) ;
if ( pFun == nullptr)
return "" ;
return pFun() ;
}
//-----------------------------------------------------------------------------
void
MySetEE3Key( const string& sKey)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return ;
// recupero funzione che imposta i codici di protezione
typedef void (* PF_SetEE3Key) ( const string& sKey) ;
PF_SetEE3Key pFun = (PF_SetEE3Key)GetProcAddress( s_hEE3, EE3_SETEE3KEY) ;
if ( pFun == nullptr)
return ;
pFun( sKey) ;
}
//-----------------------------------------------------------------------------
void
MySetEE3NetHwKey( bool bNetHwKey)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return ;
// recupero funzione che imposta il flag per chiave di rete
typedef void (* PF_SetEE3NetHwKey) ( bool bNetHwKey) ;
PF_SetEE3NetHwKey pFun = (PF_SetEE3NetHwKey)GetProcAddress( s_hEE3, EE3_SETEE3NETHWKEY) ;
if ( pFun == nullptr)
return ;
pFun( bNetHwKey) ;
}
//-----------------------------------------------------------------------------
IImport3dm*
MyCreateImport3dm( void)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IImport3dm* (* PF_CreateImport3dm) ( void) ;
PF_CreateImport3dm pFun = (PF_CreateImport3dm)GetProcAddress( s_hEE3, EE3_CREATEIMPORT3DM) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IExport3dm*
MyCreateExport3dm( void)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IExport3dm* (* PF_CreateExport3dm) ( void) ;
PF_CreateExport3dm pFun = (PF_CreateExport3dm)GetProcAddress( s_hEE3, EE3_CREATEEXPORT3DM) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
-31
View File
@@ -1,31 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : DllExch3dm.h Data : 14.11.23 Versione : 2.5k3
// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtExchange.
//
//
//
// Modifiche : 14.11.23 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
class ILogger ;
class IImport3dm ;
class IExport3dm ;
//----------------------------------------------------------------------------
bool LoadExch3dmDll( ILogger* pLogger, const std::string& sKey, bool bNetHwKey) ;
bool FreeExch3dmDll( void) ;
bool IsLoadedExch3dmDll( void) ;
void MySetEE3Logger( ILogger* pLogger) ;
void MySetEE3Key( const std::string& sKey) ;
void MySetEE3NetHwKey( bool bNetHwKey) ;
const char* MyGetEE3Version( void) ;
IImport3dm* MyCreateImport3dm( void) ;
IExport3dm* MyCreateExport3dm( void) ;
+36 -52
View File
@@ -10,8 +10,8 @@
// 03.07.18 DS Aggiunto ImportPnt.
// 15.09.19 DS Aggiunto ExportSvg.
// 14.12.20 DS Aggiunto ImportBtlx.
// 23.10.23 DB Aggiunto Export3dm.
// 07.11.23 DB Aggiunto Import3dm.
// 23.06.23 DB Aggiunto Import3dm.
// 21.09.23 DB Aggiunto Export3dm.
//
//----------------------------------------------------------------------------
@@ -42,7 +42,6 @@ static const char* EEX_GETEEXVERSION = "GetEExVersion" ;
static const char* EEX_SETEEXKEY = "SetEExKey" ;
static const char* EEX_SETEEXNETHWKEY = "SetEExNetHwKey" ;
static const char* EEX_SETBTLAUXDIR = "SetBtlAuxDir" ;
static const char* EEX_SETBTLLUADATA = "SetBtlLuaData" ;
static const char* EEX_CREATEBEAMMGR = "CreateBeamMgr" ;
static const char* EEX_CREATEIMPORTBTL = "CreateImportBtl" ;
static const char* EEX_CREATEIMPORTBTLX = "CreateImportBtlx" ;
@@ -51,12 +50,12 @@ static const char* EEX_CREATEIMPORTCSF = "CreateImportCsf" ;
static const char* EEX_CREATEIMPORTDXF = "CreateImportDxf" ;
static const char* EEX_CREATEIMPORTPNT = "CreateImportPnt" ;
static const char* EEX_CREATEIMPORTSTL = "CreateImportStl" ;
static const char* EEX_CREATEIMPORTOFF = "CreateImportOff" ;
static const char* EEX_CREATEIMPORTPLY = "CreateImportPly" ;
static const char* EEX_CREATEIMPORT3MF = "CreateImport3MF" ;
static const char* EEX_CREATEIMPORT3DM = "CreateImport3dm" ;
static const char* EEX_CREATEEXPORTDXF = "CreateExportDxf" ;
static const char* EEX_CREATEEXPORTSTL = "CreateExportStl" ;
static const char* EEX_CREATEEXPORT3MF = "CreateExport3MF" ;
static const char* EEX_CREATEEXPORT3DM = "CreateExport3dm" ;
static const char* EEX_CREATEEXPORTSVG = "CreateExportSvg" ;
static const char* EEX_SETTHREEJSLIBDIR = "SetThreeJSLibDir" ;
static const char* EEX_CREATEEXPORTTHREEJS = "CreateExportThreeJS" ;
@@ -75,7 +74,7 @@ LoadExchangeDll( ILogger* pLogger, const string& sKey, bool bNetHwKey)
FreeExchangeDll() ;
return false ;
}
// se già caricata
// se già caricata
if ( s_hEEx != nullptr)
return true ;
// carico la libreria EgtExchange
@@ -95,7 +94,7 @@ LoadExchangeDll( ILogger* pLogger, const string& sKey, bool bNetHwKey)
bool
FreeExchangeDll( void)
{
// se non è già caricata
// se non è già caricata
if ( s_hEEx == nullptr)
return true ;
// libero la libreria EgtExchange
@@ -186,21 +185,6 @@ MySetBtlAuxDir( const string& sBtlAuxDir)
return pFun( sBtlAuxDir) ;
}
//-----------------------------------------------------------------------------
bool
MySetBtlLuaData( const string& sLuaLibsDir, const string& sLuaLastRequire)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return false ;
// recupero funzione creazione oggetto
typedef bool (* PF_SetBtlLuaData) ( const string& sLuaLibsDir, const string& sLuaLastRequire) ;
PF_SetBtlLuaData pFun = (PF_SetBtlLuaData)GetProcAddress( s_hEEx, EEX_SETBTLLUADATA) ;
if ( pFun == nullptr)
return false ;
return pFun( sLuaLibsDir, sLuaLastRequire) ;
}
//-----------------------------------------------------------------------------
IBeamMgr*
MyCreateBeamMgr( void)
@@ -321,36 +305,6 @@ MyCreateImportStl( void)
return pFun() ;
}
//-----------------------------------------------------------------------------
IImportOff*
MyCreateImportOff( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IImportOff* (* PF_CreateImportOff) ( void) ;
PF_CreateImportOff pFun = (PF_CreateImportOff)GetProcAddress( s_hEEx, EEX_CREATEIMPORTOFF) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IImportPly*
MyCreateImportPly( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IImportPly* (* PF_CreateImportPly) ( void) ;
PF_CreateImportPly pFun = (PF_CreateImportPly)GetProcAddress( s_hEEx, EEX_CREATEIMPORTPLY) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IImport3MF*
MyCreateImport3MF( void)
@@ -366,6 +320,21 @@ MyCreateImport3MF( void)
return pFun() ;
}
//-----------------------------------------------------------------------------
IImport3dm*
MyCreateImport3dm( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IImport3dm* (* PF_CreateImport3dm) ( void) ;
PF_CreateImport3dm pFun = (PF_CreateImport3dm)GetProcAddress( s_hEEx, EEX_CREATEIMPORT3DM) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IExportDxf*
MyCreateExportDxf( void)
@@ -411,6 +380,21 @@ MyCreateExport3MF( void)
return pFun() ;
}
//-----------------------------------------------------------------------------
IExport3dm*
MyCreateExport3dm( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IExport3dm* (* PF_CreateExport3dm) ( void) ;
PF_CreateExport3dm pFun = (PF_CreateExport3dm)GetProcAddress( s_hEEx, EEX_CREATEEXPORT3DM) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IExportSvg*
MyCreateExportSvg( void)
+6 -7
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2025
// EgalTech 2015-2021
//----------------------------------------------------------------------------
// File : DllExchange.h Data : 28.02.25 Versione : 2.7b2
// File : DllExchange.h Data : 27.08.21 Versione : 2.3h2
// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtExchange.
//
//
@@ -24,12 +24,12 @@ class IImportCsf ;
class IImportDxf ;
class IImportPnt ;
class IImportStl ;
class IImportOff ;
class IImportPly ;
class IImport3MF ;
class IImport3dm ;
class IExportDxf ;
class IExportStl ;
class IExport3MF ;
class IExport3dm ;
class IExportThreeJS ;
class IExportSvg ;
class IExcExecutor ;
@@ -43,7 +43,6 @@ void MySetEExKey( const std::string& sKey) ;
void MySetEExNetHwKey( bool bNetHwKey) ;
const char* MyGetEExVersion( void) ;
bool MySetBtlAuxDir( const std::string& sBtlAuxDir) ;
bool MySetBtlLuaData( const std::string& sLuaLibsDir, const std::string& sLuaLastRequire) ;
IBeamMgr* MyCreateBeamMgr( void) ;
IImportBtl* MyCreateImportBtl( void) ;
IImportBtlx* MyCreateImportBtlx( void) ;
@@ -52,12 +51,12 @@ IImportCsf* MyCreateImportCsf( void) ;
IImportDxf* MyCreateImportDxf( void) ;
IImportPnt* MyCreateImportPnt( void) ;
IImportStl* MyCreateImportStl( void) ;
IImportOff* MyCreateImportOff( void) ;
IImportPly* MyCreateImportPly( void) ;
IImport3MF* MyCreateImport3MF( void) ;
IImport3dm* MyCreateImport3dm( void) ;
IExportDxf* MyCreateExportDxf( void) ;
IExportStl* MyCreateExportStl( void) ;
IExport3MF* MyCreateExport3MF( void) ;
IExport3dm* MyCreateExport3dm( void) ;
bool MySetThreeJSLibDir( const std::string& sThreeJSLibDir) ;
IExportThreeJS* MyCreateExportThreeJS( void) ;
IExportSvg* MyCreateExportSvg( void) ;
+2 -6
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2024
// EgalTech 2014-2023
//----------------------------------------------------------------------------
// File : EXE.h Data : 15.05.24 Versione : 2.6e4
// File : EXE.h Data : 05.02.23 Versione : 2.5a6
// Contenuto : Dichiarazioni locali per moduli EXE.
//
//
@@ -26,7 +26,6 @@ const std::string& ExeGetIniFile( void) ;
const std::string& ExeGetKey( void) ;
const std::string& ExeGetNestKey( void) ;
const std::string& ExeGetLockId( void) ;
bool ExeVerifyKeyOption( int nOptInd) ;
//----------------------------------------------------------------------------
ILogger* GetLogger( void) ;
@@ -44,6 +43,3 @@ bool ExeInsertDuplo( int nInsGrp) ;
//----------------------------------------------------------------------------
bool ExeCreateMutex( const std::string& sMutexName) ;
bool ExeReleaseMutex( void) ;
//----------------------------------------------------------------------------
bool ExeSetModified( int nCtx) ;
-66
View File
@@ -1,66 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : EXE_Base64.cpp Data : 03.11.25 Versione : 2.7k1
// Contenuto : Funzioni per codificare/decodificare in Base64.
//
//
//
// Modifiche : 03.11.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtBase64.h"
#include <fstream>
using namespace std ;
//----------------------------------------------------------------------------
bool
ExeBase64Encode( const string& sFile, string& sB64Dest)
{
// apro il file in modo binario
ifstream InFile( stringtoW( sFile), ios::in | ios::binary, _SH_DENYWR) ;
if ( InFile.fail()) {
if ( InFile.is_open())
InFile.close() ;
return false ;
}
// leggo il file
string sSou( istreambuf_iterator<char>( InFile), {}) ;
// lo chiudo
if ( InFile.is_open())
InFile.close() ;
// converto in Base64
return B64Encode( sSou, sB64Dest) ;
}
//----------------------------------------------------------------------------
bool
ExeBase64Decode( const string& sB64Sou, const string& sFile)
{
// converto da Base64
string sDest ;
if ( ! B64Decode( sB64Sou, sDest))
return false ;
// apro il file in modo binario
ofstream OutFile( stringtoW( sFile), ios::out | ios::binary, _SH_DENYWR) ;
if ( ! OutFile.good()) {
if ( OutFile.is_open())
OutFile.close() ;
return false ;
}
// scrivo sul file
OutFile.write( sDest.data(), sDest.size()) ;
// lo chiudo
if ( OutFile.is_open())
OutFile.close() ;
return true ;
}
+4 -42
View File
@@ -216,44 +216,6 @@ ExeBeamEnableProcess( int nGeomId, bool bEnable, bool bUpdate)
return pBeamMgr->EnableProcess( nGeomId, bEnable, bUpdate) ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamCalcAllSolids( bool bShow, bool bRecalc)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// disabilito possibilità di alterare il flag di modifica
bool bOldEnabModif = ExeGetEnableModified() ;
if ( bOldEnabModif)
ExeDisableModified() ;
// calcolo i solidi di tutte le travi
bool bOk = pBeamMgr->CalcAllSolids( bShow, bRecalc, ExeProcessEvents) ;
// ripristino possibilità di alterare il flag di modifica
if ( bOldEnabModif)
ExeEnableModified() ;
// risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamShowAllSolids( bool bShow)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// disabilito possibilità di alterare il flag di modifica
bool bOldEnabModif = ExeGetEnableModified() ;
if ( bOldEnabModif)
ExeDisableModified() ;
// aggiorno stato di visualizzazione dei solidi di tutte le travi
bool bOk = pBeamMgr->ShowAllSolids( bShow, ExeProcessEvents) ;
// ripristino possibilità di alterare il flag di modifica
if ( bOldEnabModif)
ExeEnableModified() ;
// risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamCalcSolid( int nPartId, bool bRecalc)
@@ -304,17 +266,17 @@ ExeBeamShowSolid( int nPartId, bool bShow)
//-----------------------------------------------------------------------------
bool
ExeBeamGetBuildingIsOn( int nAssGrpId)
ExeBeamGetBuildingIsOn( void)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// verifico se assemblaggio attivato
return pBeamMgr->GetBuildingIsOn( nAssGrpId) ;
return pBeamMgr->GetBuildingIsOn() ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamShowBuilding( int nAssGrpId, bool bShow)
ExeBeamShowBuilding( bool bShow)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
@@ -323,7 +285,7 @@ ExeBeamShowBuilding( int nAssGrpId, bool bShow)
if ( bOldEnabModif)
ExeDisableModified() ;
// attivo o disattivo la visualizzazione l'assemblaggio
bool bOk = pBeamMgr->ShowBuilding( nAssGrpId, bShow) ;
bool bOk = pBeamMgr->ShowBuilding( bShow) ;
// ripristino possibilità di alterare il flag di modifica
if ( bOldEnabModif)
ExeEnableModified() ;
+6 -37
View File
@@ -22,7 +22,6 @@
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkCAvToolSurfTm.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
@@ -99,28 +98,6 @@ ExeCAvGetToolOutline( int nDestGrpId, bool bApprox)
return nId ;
}
//----------------------------------------------------------------------------
double
ExeCAvToolPosBox( const Point3d& ptP, const Vector3d& vtAx, const BBox3d& b3Box, const Vector3d& vtMove)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// creo la superficie TriMesh
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshBox( b3Box.GetDimX(), b3Box.GetDimY(), b3Box.GetDimZ())) ;
if ( IsNull( pStm))
return -1 ;
pStm->Translate( b3Box.GetMin() - ORIG) ;
// verifico oggetto per evitare collisioni
if ( IsNull( s_pCAvTlStm))
return -1 ;
// imposto dati
s_pCAvTlStm->SetSurfTm( *pStm) ;
double dMove ;
if ( ! s_pCAvTlStm->TestPosition( ptP, vtAx, vtMove, dMove))
return -1 ;
return dMove ;
}
//----------------------------------------------------------------------------
double
ExeCAvToolPosStm( const Point3d& ptP, const Vector3d& vtAx, int nSurfTmId, const Vector3d& vtMove, int nRefType)
@@ -175,23 +152,16 @@ ExeCAvToolPathStm( int nCrvId, const Vector3d& vtAx, int nSurfTmId, const Vector
// verifico oggetto per evitare collisioni
if ( IsNull( s_pCAvTlStm))
return false ;
// Controllo la tolleranza lineare (se negativa non vanno fatti controlli sui punti medi)
if ( dLinTol > -EPS_ZERO)
dLinTol = max( dLinTol, EPS_SMALL) ;
else
dLinTol = -1 ;
// approssimo la curva con una polilinea
PolyLine PL ;
if ( ! pCrv->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, ICurve::APL_SPECIAL, PL))
return false ;
// eventuale aggiunta di punti per garantire max distanza
if ( dLinTol > 0) {
const double MIN_DIST = 1. ;
const double MAX_DIST = 50. ;
double dDist = Clamp( s_pCAvTlStm->GetToolRadius(), MIN_DIST, MAX_DIST) ;
if ( ! PL.AdjustForMaxSegmentLen( dDist))
return false ;
}
const double MIN_DIST = 1. ;
const double MAX_DIST = 50. ;
double dDist = Clamp( s_pCAvTlStm->GetToolRadius(), MIN_DIST, MAX_DIST) ;
if ( ! PL.AdjustForMaxSegmentLen( dDist))
return false ;
// porto nel riferimento della superficie
PL.LocToLoc( frCrv, frSurf) ;
// porto i dati geometrici in locale alla superficie
@@ -205,8 +175,7 @@ ExeCAvToolPathStm( int nCrvId, const Vector3d& vtAx, int nSurfTmId, const Vector
// riporto la polilinea nel riferimento della curva
PL.LocToLoc( frSurf, frCrv) ;
// elimino i punti allineati
if ( dLinTol > 0)
PL.RemoveAlignedPoints( 0.8 * dLinTol) ;
PL.RemoveAlignedPoints( 0.8 * dLinTol) ;
// creo una curva composita a partire dalla polilinea
PtrOwner< ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL))
+17 -21
View File
@@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// EgalTech 2020-2020
//----------------------------------------------------------------------------
// File : EXE_CDeObjSolid.cpp Data : 09.01.20 Versione : 2.2a2
// File : EXE_CDeObjClosedSurfTm.cpp Data : 09.01.20 Versione : 2.2a2
// Contenuto : Funzioni per verificare collisioni tra
// Objects e Solidi (Closed SurftriMesh e Zmap).
// Objects e Closed SurftriMesh.
//
//
// Modifiche : 09.01.20 DS Creazione modulo.
@@ -49,7 +49,7 @@ MyCDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, int nSurfTmI
// porto in locale alla superficie il riferimento del box (il vettore è già in questo stesso riferimento)
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frSurf) ;
// verifico la collisione
return ( CDeBoxClosedSurfTm( frBoxL, vtDiag, *pStm, dSafeDist) ? 1 : 0) ;
return ( CDeBoxClosedSurfTm( frBoxL, vtDiag, dSafeDist, *pStm) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
@@ -69,7 +69,7 @@ MyCDeBoxVolZmap( const Frame3d& frBox, const Vector3d& vtDiag, int nZmapId, doub
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frLoc) ;
// verifico la collisione
return ( pVZM->CDeBox( frBoxL, vtDiag, dSafeDist, false) ? 1 : 0) ;
return ( pVZM->AvoidBox( frBoxL, vtDiag, dSafeDist, false) ? 0 : 1) ;
}
//----------------------------------------------------------------------------
@@ -118,7 +118,7 @@ MyCDeRectPrismoidClosedSurfTm( const Frame3d& frPrismoid, double dBaseLenX, doub
// porto in locale alla superficie il riferimento del prismoide rettangolare
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frSurf) ;
// verifico la collisione
return ( CDeRectPrismoidClosedSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, *pStm, dSafeDist) ? 1 : 0) ;
return ( CDeRectPrismoidClosedSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, *pStm) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
@@ -140,7 +140,7 @@ MyCDeRectPrismoidVolZmap( const Frame3d& frPrismoid, double dBaseLenX, double dB
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frLoc) ;
// verifico la collisione
return ( pVZM->CDeRectPrismoid( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, false) ? 1 : 0) ;
return ( pVZM->AvoidRectPrismoid( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, false) ? 0 : 1) ;
}
//----------------------------------------------------------------------------
@@ -193,7 +193,7 @@ MyCDeCylClosedSurfTm( const Frame3d& frCyl, double dR, double dH, int nSurfTmId,
// porto in locale alla superficie il riferimento del cilindro
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frSurf) ;
// verifico la collisione
return ( CDeCylClosedSurfTm( frCylL, dR, dH, *pStm, dSafeDist) ? 1 : 0) ;
return ( CDeCylClosedSurfTm( frCylL, dR, dH, dSafeDist, *pStm) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
@@ -213,7 +213,7 @@ MyCDeCylVolZmap( const Frame3d& frCyl, double dR, double dH, int nZmapId, double
// porto in locale il riferimento
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frLoc) ;
// verifico la collisione
return ( pVZM->CDeCylinder( frCylL, dR, dH, dSafeDist, false) ? 1 : 0) ;
return ( pVZM->AvoidCylinder( frCylL, dR, dH, dSafeDist, false) ? 0 : 1) ;
}
//----------------------------------------------------------------------------
@@ -261,7 +261,7 @@ MyCDeConeClosedSurfTm( const Frame3d& frCone, double dR1, double dR2, double dH,
// porto in locale alla superficie il riferimento del cilindro
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frSurf) ;
// verifico la collisione
return ( CDeConeFrustumClosedSurfTm( frConeL, dR1, dR2, dH, *pStm, dSafeDist) ? 1 : 0) ;
return ( CDeConeFrustumClosedSurfTm( frConeL, dR1, dR2, dH, dSafeDist, *pStm) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
@@ -281,7 +281,7 @@ MyCDeConeVolZmap( const Frame3d& frCone, double dR1, double dR2, double dH, int
// porto in locale il riferimento
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frLoc) ;
// verifico la collisione
return ( pVZM->CDeConeFrustum( frConeL, dR1, dR2, dH, dSafeDist, false) ? 1 : 0) ;
return ( pVZM->AvoidConeFrustum( frConeL, dR1, dR2, dH, dSafeDist, false) ? 0 : 1) ;
}
//----------------------------------------------------------------------------
@@ -330,7 +330,7 @@ MyCDeSpheClosedSurfTm( const Point3d& ptCen, double dR, int nSurfTmId, double dS
// porto in locale alla superficie il centro della sfera
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ;
// verifico la collisione
return ( CDeSpheClosedSurfTm( ptCenL, dR, *pStm, dSafeDist) ? 1 : 0) ;
return ( CDeSpheClosedSurfTm( ptCenL, dR, dSafeDist, *pStm) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
@@ -350,7 +350,7 @@ MyCDeSpheVolZmap( const Point3d& ptCen, double dRad, int nZmapId, double dSafeDi
// porto in locale il centro della sfera
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
// verifico la collisione
return ( pVZM->CDeSphere( ptCenL, dRad, dSafeDist, false) ? 1 : 0) ;
return ( pVZM->AvoidSphere( ptCenL, dRad, dSafeDist, false) ? 0 : 1) ;
}
//----------------------------------------------------------------------------
@@ -420,7 +420,7 @@ MyCDeClosedSurfTmVolZmap( int nSurfTmId, int nZmapId, double dSafeDist)
if ( pVZM == nullptr)
return -1 ;
// verifico la collisione
return ( pVZM->CDeSurfTm( *pStm, dSafeDist, false) ? 1 : 0) ;
return ( pVZM->AvoidSurfTm( *pStm, dSafeDist, false) ? 0 : 1) ;
}
//----------------------------------------------------------------------------
@@ -429,14 +429,10 @@ ExeCDeSolidSolid( int nSolid1Id, int nSolid2Id, double dSafeDist)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr) {
if ( pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
nRes = MyCDeClosedSurfTmClosedSurfTm( nSolid1Id, nSolid2Id, dSafeDist) ;
else if ( pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == VOL_ZMAP)
nRes = MyCDeClosedSurfTmVolZmap( nSolid1Id, nSolid2Id, dSafeDist) ;
else if ( pGeomDB->GetGeoType( nSolid1Id) == VOL_ZMAP && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
nRes = MyCDeClosedSurfTmVolZmap( nSolid2Id, nSolid1Id, dSafeDist) ;
}
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
nRes = MyCDeClosedSurfTmClosedSurfTm( nSolid1Id, nSolid2Id, dSafeDist) ;
else if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == VOL_ZMAP)
nRes = MyCDeClosedSurfTmVolZmap( nSolid1Id, nSolid2Id, dSafeDist) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCDeSolidSolid({" + IdToString( nSolid1Id) + "," +
+43 -180
View File
@@ -15,10 +15,8 @@
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "LUA_Base.h"
#include "AuxTools.h"
#include "DllExchange.h"
#include "DllExch3dm.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EXeCmdLogOff.h"
@@ -30,15 +28,13 @@
#include "/EgtDev/Include/EExImportPnt.h"
#include "/EgtDev/Include/EExImportBtl.h"
#include "/EgtDev/Include/EExImportBtlx.h"
#include "/EgtDev/Include/EExImportOff.h"
#include "/EgtDev/Include/EExImportPly.h"
#include "/EgtDev/Include/EExImport3dm.h"
#include "/EgtDev/Include/EExExportDxf.h"
#include "/EgtDev/Include/EExExportStl.h"
#include "/EgtDev/Include/EExExport3MF.h"
#include "/EgtDev/Include/EExExport3dm.h"
#include "/EgtDev/Include/EExExportSvg.h"
#include "/EgtDev/Include/EExExportThreeJS.h"
#include "/EgtDev/Include/EE3Import3dm.h"
#include "/EgtDev/Include/EE3Export3dm.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtStringConverter.h"
@@ -76,14 +72,8 @@ ExeGetFileType( const string& sFilePath)
return FT_STL ;
else if ( sFileExt == "3MF")
return FT_3MF ;
else if ( sFileExt == "3DM")
return FT_3DM ;
else if ( sFileExt == "OBJ")
return FT_OBJ ;
else if ( sFileExt == "OFF")
return FT_OFF ;
else if ( sFileExt == "PLY")
return FT_PLY ;
else if ( sFileExt == "CNC" || sFileExt == "XPI" || sFileExt == "MPF" || sFileExt == "ISO" || sFileExt == "EIA")
return FT_CNC ;
else if ( sFileExt == "HED" || sFileExt == "ENT" || sFileExt == "ENS")
@@ -92,6 +82,8 @@ ExeGetFileType( const string& sFilePath)
return FT_BTL ;
else if ( sFileExt == "BTLX")
return FT_BTLX ;
else if ( sFileExt == "3DM")
return FT_3DM ;
else if ( sFileExt == "PNG" || sFileExt == "JPG" || sFileExt == "JPEG" || sFileExt == "BMP")
return FT_IMG ;
else if ( sFileExt == "PNT" || sFileExt == "XYZ")
@@ -130,9 +122,7 @@ ExeGetFileType( const string& sFilePath)
bool
ExeSetBtlAuxDir( const string& sBtlAuxDir)
{
bool bOk1 = MySetBtlAuxDir( sBtlAuxDir) ;
bool bOk2 = MySetBtlLuaData( LuaGetLuaLibsDir(), LuaGetLastRequire()) ;
return ( bOk1 && bOk2) ;
return MySetBtlAuxDir( sBtlAuxDir) ;
}
//-----------------------------------------------------------------------------
@@ -159,11 +149,6 @@ ExeImportBtl( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpBtl)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -192,11 +177,6 @@ ExeImportBtlx( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpBtlx)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -227,11 +207,6 @@ ExeImportCnc( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpCnc)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -259,11 +234,6 @@ ExeImportCsf( const string& sFilePath)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpCsf)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -294,11 +264,6 @@ ExeImportDxf( const string& sFilePath, double dScaleFactor)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpDxf)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -329,11 +294,6 @@ ExeImportPnt( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpPnt)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -349,10 +309,10 @@ ExeImportStl( const string& sFilePath, double dScaleFactor)
// 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
// preparo l'importatore
PtrOwner<IImportStl> pImpStl( MyCreateImportStl()) ;
bOk = bOk && ! IsNull( pImpStl) ;
// eseguo l'importazione
// eseguo l'importazione
bOk = bOk && pImpStl->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ;
// aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty())
@@ -365,106 +325,26 @@ ExeImportStl( const string& sFilePath, double dScaleFactor)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpStl)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeImportOff( const string& sFilePath, double dScaleFactor)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// importo il file OFF
// 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<IImportOff> pImpOff( MyCreateImportOff()) ;
bOk = bOk && ! IsNull( pImpOff) ;
// eseguo l'importazione
bOk = bOk && pImpOff->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ;
// aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtImportOff('" + StringToLuaString( sFilePath) + "'," +
ToString( dScaleFactor) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpOff)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeImportPly( const string& sFilePath, double dScaleFactor)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// importo il file PLY
// 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<IImportPly> pImpPly( MyCreateImportPly()) ;
bOk = bOk && ! IsNull( pImpPly) ;
// eseguo l'importazione
bOk = bOk && pImpPly->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ;
// aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtImportPly('" + StringToLuaString( sFilePath) + "'," +
ToString( dScaleFactor) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpPly)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeImport3MF( const string& sFilePath, int nFlag)
ExeImport3MF( const string& sFilePath)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// importo il file 3MF
int nLayerId = GDB_ID_ROOT ;
// aggiungo un gruppo pezzo e un gruppo layer se non devo conservare la gerarchia del file
if ( ( nFlag & EI3FLAG_KEEP_GROUPS) == 0) {
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
nLayerId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
}
// preparo l'importatore
// 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<IImport3MF> pImp3MF( MyCreateImport3MF()) ;
bOk = bOk && ! IsNull( pImp3MF) ;
// eseguo l'importazione
bOk = bOk && pImp3MF->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, nFlag) ;
// eseguo l'importazione
bOk = bOk && pImp3MF->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId) ;
// aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
@@ -475,30 +355,25 @@ ExeImport3MF( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImp3MF)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeImport3dm( const string& sFilePath)
ExeImport3dm( const string& sFilePath, double dScaleFactor)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
// se necessario, carico libreria exchange 3dm opzionale
if ( ! IsLoadedExch3dmDll() && LoadExch3dmDll( GetLogger(), ExeGetKey(), ExeGetNetHwKey()))
LOG_INFO( GetLogger(), MyGetEE3Version())
// importo il file 3dm
bool bOk = true ;
// preparo l'importatore
// importo il file 3dm
// 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<IImport3dm> pImp3dm( MyCreateImport3dm()) ;
bOk = bOk && ! IsNull( pImp3dm) ;
// eseguo l'importazione
// eseguo l'importazione
const DimensionStyle& DimSt = pGseCtx->m_dsCurr ;
double dExtLine = DimSt.dExtLineLen ;
double dArrLen = DimSt.dArrowLen ;
@@ -507,7 +382,7 @@ ExeImport3dm( const string& sFilePath)
int nDecDig = DimSt.nDecDigit ;
string sFont = DimSt.sFont ;
double dTextHeight = DimSt.dTextHeight ;
bOk = bOk && pImp3dm->Import( sFilePath, pGseCtx->m_pGeomDB, GDB_ID_ROOT,
bOk = bOk && pImp3dm->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor,
dTextHeight, dExtLine, dArrLen, dTextDist, bLenIsMM, nDecDig, sFont) ;
// aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty())
@@ -515,15 +390,11 @@ ExeImport3dm( const string& sFilePath)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtImport3dm('" + StringToLuaString( sFilePath) + "')" +
string sLua = "EgtImport3dm('" + StringToLuaString( sFilePath) + "'," +
ToString( dScaleFactor) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImp3dm)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -553,7 +424,7 @@ ExeAdvancedImportIsEnabled( void)
//-----------------------------------------------------------------------------
bool
ExeAdvancedImport( const string& sFilePath, double dToler, int nFlag)
ExeAdvancedImport( const string& sFilePath, double dToler)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
@@ -587,7 +458,7 @@ ExeAdvancedImport( const string& sFilePath, double dToler, int nFlag)
#endif
string sCmdLine = "\"" + sExec + "\" \"" + sFilePath + "\" \"" + sFileOut + "\" \"" +
ToString( dToler, 3) + "\" \"" + ToString( ExeGetDebugLevel()) + "\" \"" +
ExeGetKey() + "\" \"" + ExeGetLockId() + "\" \"" + ToString( nFlag) + "\"" ;
ExeGetKey() + "\" \"" + ExeGetLockId() + "\"" ;
STARTUPINFO si ;
PROCESS_INFORMATION pi ;
ZeroMemory( &si, sizeof( si)) ;
@@ -631,11 +502,6 @@ ExeAdvancedImport( const string& sFilePath, double dToler, int nFlag)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
{
string sLog = "Advanced Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -648,11 +514,11 @@ ExeExportDxf( int nId, const string& sFilePath, int nFlag, int nFilter)
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// esporto il file DXF
// preparo l'esportatore
// preparo l'esportatore
PtrOwner<IExportDxf> pExpDxf( MyCreateExportDxf()) ;
bOk = bOk && ! IsNull( pExpDxf) ;
// eseguo l'esportazione
bOk = bOk && pExpDxf->SetOptions( nFilter, nFlag) ;
pExpDxf->SetOptions( nFilter, nFlag) ;
bOk = bOk && pExpDxf->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -674,11 +540,11 @@ ExeExportStl( int nId, const string& sFilePath, int nFilter)
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// esporto il file STL
// preparo l'esportatore
// preparo l'esportatore
PtrOwner<IExportStl> pExpStl( MyCreateExportStl()) ;
bOk = bOk && ! IsNull( pExpStl) ;
// eseguo l'esportazione
bOk = bOk && pExpStl->SetOptions( nFilter) ;
pExpStl->SetOptions( nFilter) ;
bOk = bOk && pExpStl->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -699,11 +565,11 @@ ExeExport3MF( int nId, const string& sFilePath, int nFilter)
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// esporto il file 3MF
// preparo l'esportatore
// preparo l'esportatore
PtrOwner<IExport3MF> pExp3MF( MyCreateExport3MF()) ;
bOk = bOk && ! IsNull( pExp3MF) ;
// eseguo l'esportazione
bOk = bOk && pExp3MF->SetOptions( nFilter) ;
// eseguo l'esportazione
pExp3MF->SetOptions( nFilter) ;
bOk = bOk && pExp3MF->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -722,22 +588,19 @@ ExeExport3dm( int nId, const string& sFilePath, int nFilter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se necessario, carico libreria exchange 3dm opzionale
if ( ! IsLoadedExch3dmDll() && LoadExch3dmDll( GetLogger(), ExeGetKey(), ExeGetNetHwKey()))
LOG_INFO( GetLogger(), MyGetEE3Version())
// esporto il file 3dm
bool bOk = true ;
// preparo l'esportatore
// esporto il file 3dm
// preparo l'esportatore
PtrOwner<IExport3dm> pExp3dm( MyCreateExport3dm()) ;
bOk = bOk && ! IsNull( pExp3dm) ;
// eseguo l'esportazione
bOk = bOk && pExp3dm->SetOptions( nFilter) ;
bOk = bOk && pExp3dm->Export( pGeomDB, nId, sFilePath) ;
// eseguo l'esportazione
bOk = bOk && pExp3dm->SetOptions( nFilter) ;
bOk = bOk && pExp3dm->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtExport3dm(" + ToString( nId) + ",'" +
StringToLuaString( sFilePath) + "')" +
" -- Ok=" + ToString( bOk) ;
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
@@ -751,12 +614,12 @@ ExeExportSvg( int nId, const string& sFilePath, int nFilter)
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// esporto il file SVG
// preparo l'esportatore
// esporto il file SVG
// preparo l'esportatore
PtrOwner<IExportSvg> pExpSvg( MyCreateExportSvg()) ;
bOk = bOk && ! IsNull( pExpSvg) ;
// eseguo l'esportazione
bOk = bOk && pExpSvg->SetOptions( nFilter) ;
// eseguo l'esportazione
pExpSvg->SetOptions( nFilter) ;
bOk = bOk && pExpSvg->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
+181 -134
View File
@@ -131,7 +131,7 @@ ExeCreateGeoVector( int nParentId, const Vector3d& vtV, const Point3d& ptB, int
Point3d ptBL = GetPointLocal( pGeomDB, ptB, nRefType, frLoc) ;
// creo il vettore
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
bOk = bOk && ! IsNull( pGeoVct) ;
bOk = bOk && !IsNull( pGeoVct) ;
// setto il vettore (con il punto base)
bOk = bOk && pGeoVct->Set( vtVL, ptBL) ;
// inserisco il vettore nel DB
@@ -480,7 +480,7 @@ MyCreateRadialDimension( int nParentId, int nCrvId, const Point3d& ptDim,
Point3d ptCenL = pArc->GetCenter() ;
ptCenL.LocToLoc( frArc, frLoc) ;
Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ;
vtNL.LocToLoc( frArc, frLoc) ;
// porto ptDimL sulla circonferenza cui appartiene l'arco
Vector3d vtDir = ptDimL - ptCenL ;
if ( ! vtDir.Normalize())
@@ -543,7 +543,7 @@ MyCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
Point3d ptCenL = pArc->GetCenter() ;
ptCenL.LocToLoc( frArc, frLoc) ;
Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ;
vtNL.LocToLoc( frArc, frLoc) ;
// porto ptDimL sulla circonferenza
Vector3d vtDir = ptDimL - ptCenL ;
if ( ! vtDir.Normalize())
@@ -583,7 +583,7 @@ ExeCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2,
MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP0, const Point3d& ptP2,
const Point3d& ptDim, const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
@@ -594,7 +594,7 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// porto in locale i punti e assegno i versori
Point3d ptVL = GetPointLocal( pGeomDB, ptV, nRefType, frLoc) ;
Point3d ptP0L = GetPointLocal( pGeomDB, ptP0, nRefType, frLoc) ;
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
@@ -603,7 +603,7 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim ) ||
! pDim->SetAngular( ptVL, ptP1L, ptP2L, ptDimL, vtNL, sText))
! pDim->SetAngular( ptP1L, ptP0L, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
@@ -611,16 +611,16 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2,
ExeCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP0, const Point3d& ptP2,
const Point3d& ptDim, const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
int nId = MyCreateAngularDimension( nParentId, ptP1, ptP0, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimension(" + IdToString( nParentId) + ",{" +
ToString( ptV) + "},{" +
ToString( ptP0) + "},{" +
ToString( ptP1) + "},{" +
ToString( ptP2) + "},{" +
ToString( ptDim) + "},'" +
@@ -633,62 +633,6 @@ ExeCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
const Point3d& ptV2,const Point3d& ptP2, const Point3d& ptDim,
const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// porto in locale i punti e assegno i versori
Point3d ptV1L = GetPointLocal( pGeomDB, ptV1, nRefType, frLoc) ;
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
Point3d ptV2L = GetPointLocal( pGeomDB, ptV2, nRefType, frLoc) ;
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim ) ||
! pDim->SetAngularEx( ptV1L, ptP1L, ptV2L, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
const Point3d& ptV2, const Point3d& ptP2, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimensionEx( nParentId, ptV1, ptP1, ptV2, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimensionEx(" + IdToString( nParentId) + ",{" +
ToString( ptV1) + "},{" +
ToString( ptP1) + "},{" +
ToString( ptV2) + "},{" +
ToString( ptP2) + "},{" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Point3d& ptDim,
@@ -701,24 +645,27 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero le linee
//recupero le linee
ICurveLine* pCrv1 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[0])) ;
ICurveLine* pCrv2 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[1])) ;
if ( pCrv1 == nullptr || pCrv2 == nullptr)
return GDB_ID_NULL ;
PtrOwner<ICurveLine> pL1( pCrv1->Clone()) ;
PtrOwner<ICurveLine> pL2( pCrv2->Clone()) ;
if ( IsNull( pL1 ) || ! pL1->IsValid() || IsNull( pL2) || ! pL2->IsValid())
if ( IsNull( pL1 ) || ! pL1->IsValid() || IsNull( pL2) || ! pL2->IsValid())
return GDB_ID_NULL ;
// porto tutto nel frLoc
//porto tutto nel frLoc
Frame3d frL1, frL2 ;
if ( ! pGeomDB->GetGlobFrame( vLineIds[0], frL1) || ! pGeomDB->GetGlobFrame( vLineIds[1], frL2))
return GDB_ID_NULL ;
pL1->LocToLoc( frL1, frLoc) ;
pL2->LocToLoc( frL2, frLoc) ;
// recupero il punto lo porto nel riferimento locale
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
// recupero i punti e le direzioni
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
//recupero i punti e le direzioni
Point3d ptP1L, ptP2L, ptP3L, ptP4L ;
Vector3d vtL1, vtL2 ;
pL1->GetStartPoint( ptP1L) ;
@@ -727,12 +674,15 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL2->GetEndPoint( ptP4L) ;
pL1->GetStartDir( vtL1) ;
pL2->GetStartDir( vtL2) ;
// controllo se le rette sono coincidenti o parallele
if ( AreSameOrOppositeVectorApprox( vtL1, vtL2))
return GDB_ID_NULL ;
// verifico se le rette si intersecano già
Point3d ptCenL ;
Point3d ptP0L ;
IntersCurveCurve pInters( *pL1, *pL2) ;
IntCrvCrvInfo Info ;
int nNumeroInters = pInters.GetIntersCount() ;
// se non ho intersezioni estendo
if ( nNumeroInters == 0) {
@@ -741,54 +691,54 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL2->ExtendStartByLen( dLen) ;
pL1->ExtendEndByLen( dLen) ;
pL2->ExtendEndByLen( dLen) ;
// faccio intersezione
//faccio intersezione
IntersCurveCurve pIntersExt( *pL1, *pL2) ;
nNumeroInters = pIntersExt.GetIntersCount() ;
// le linee estese non si intersecano, quindi vuol dire che sono quasi parallele e lontanissime
if ( nNumeroInters == 0 )
return GDB_ID_NULL ;
else {
IntCrvCrvInfo Info ;
pIntersExt.GetIntCrvCrvInfo( 0, Info) ;
// controllo che non siano coincidenti
if ( Info.bOverlap)
return false ;
else
ptCenL = Info.IciA->ptI ;
ptP0L = Info.IciA->ptI ;
}
// seleziono i punti necessari
// se ptDimL è più vicino a ptCenL rispetto agli estremi esterni delle linee, allora tengo gli estremi interni
double dP1Cen = ( ptP1L - ptCenL).Len() ;
double dP2Cen = ( ptP2L - ptCenL).Len() ;
double dDimCen = ( ptDimL - ptCenL).Len() ;
if ( ( dDimCen < dP1Cen || dDimCen < dP2Cen))
// se uno dei due punti è più vicino a ptCenL rispetto a ptDimL, allora tengo il punto più vicino a ptDimL
// se ptDimL è più vicino a ptP0L rispetto agli estremi esterni delle linee, allora tengo gli estremi interni
double dP1P0 = ( ptP1L - ptP0L ).Len() ;
double dP2P0 = ( ptP2L - ptP0L ).Len() ;
double dDimP0 = ( ptDimL - ptP0L ).Len() ;
if ( ( dDimP0 < dP1P0 || dDimP0 < dP2P0))
// se uno dei due punti è più vicino a ptP0L rispetto a ptDimL, allora tengo il punto più vicino a ptDimL
ptP1L = ( ( ptDimL - ptP1L ).Len() < ( ptDimL - ptP2L ).Len() ? ptP1L : ptP2L) ;
else
ptP1L = ( dP1Cen < dP2Cen ? ptP2L : ptP1L ) ;
ptP1L = ( dP1P0 < dP2P0 ? ptP2L : ptP1L ) ;
// rifaccio anche per l'altro lato
double dP3Cen = ( ptP3L - ptCenL).Len() ;
double dP4Cen = ( ptP4L - ptCenL).Len() ;
if ( dDimCen < dP3Cen || dDimCen < dP4Cen)
ptP3L = ( ( ptDimL - ptP3L).Len() < ( ptDimL - ptP4L).Len() ? ptP3L : ptP4L) ;
double dP3P0 = ( ptP3L - ptP0L).Len() ;
double dP4P0 = ( ptP4L - ptP0L).Len() ;
if ( dDimP0 < dP3P0 || dDimP0 < dP4P0 )
ptP3L = ( ( ptDimL - ptP3L).Len() < ( ptDimL - ptP4L).Len() ? ptP3L : ptP4L ) ;
else
ptP3L = ( dP3Cen < dP4Cen ? ptP4L : ptP3L) ;
ptP3L = ( dP3P0 < dP4P0 ? ptP4L : ptP3L) ;
}
// se ho già intesezioni devo capire in quale quadrante si trova ptDim
else {
// recupero l'intersezione
IntCrvCrvInfo Info ;
pInters.GetIntCrvCrvInfo( 0, Info) ;
// controllo che non siano coincidenti
if ( Info.bOverlap)
return false ;
// se non coincidono restituisco l'intersezione
else
ptCenL = Info.IciA->ptI ;
// se le due linee hanno un estremo in comune, estendo le linee da quel lato
if ( ( AreSamePointApprox( ptCenL, ptP1L) || AreSamePointApprox( ptCenL, ptP2L)) &&
( AreSamePointApprox( ptCenL, ptP3L) || AreSamePointApprox( ptCenL, ptP4L))) {
if ( AreSamePointApprox( ptCenL, ptP1L)) {
ptP0L = Info.IciA->ptI ; // se non coincidono restituisco l'intersezione
// se le due linee hanno un estremo in comune, estendo le linee quel lato
if ( ( AreSamePointApprox( ptP0L, ptP1L) || AreSamePointApprox( ptP0L, ptP2L)) &&
( AreSamePointApprox( ptP0L, ptP3L) || AreSamePointApprox( ptP0L, ptP4L))) {
if ( AreSamePointApprox( ptP0L, ptP1L)) {
pL1->ExtendStartByLen(Dist( ptP1L, ptP2L) / 2) ;
pL1->GetStartPoint( ptP1L) ;
}
@@ -796,8 +746,8 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL1->ExtendEndByLen(Dist( ptP1L, ptP2L) / 2) ;
pL1->GetEndPoint( ptP2L) ;
}
if ( AreSamePointApprox( ptCenL, ptP3L)) {
pL2->ExtendStartByLen( Dist( ptP3L, ptP4L) / 2);
if ( AreSamePointApprox( ptP0L, ptP3L) ) {
pL2->ExtendStartByLen(Dist( ptP3L, ptP4L) / 2);
pL2->GetStartPoint( ptP3L) ;
}
else {
@@ -805,42 +755,36 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL2->GetEndPoint( ptP4L) ;
}
}
// seleziono i punti necessari
// proietto pdDim su vtLine1 e su vtLine2
Point3d ptDim1, ptDim2 ;
DistPointCurve distPL1( ptDimL, *pL1, true) ;
DistPointCurve distPL2( ptDimL, *pL2, true) ;
int nFlag1, nFlag2 ;
if ( ! distPL1.GetMinDistPoint( 0, ptDim1, nFlag1) || ! distPL2.GetMinDistPoint( 0, ptDim2, nFlag2) )
if ( ! distPL1.GetMinDistPoint( 0, ptDim1, nFlag1) || ! distPL2.GetMinDistPoint( 0, ptDim2, nFlag2) )
return false ;
if ( abs(( ptDim1 - ptP1L).Len() + ( ptCenL - ptDim1).Len() - ( ptCenL - ptP1L).Len()) < EPS_SMALL ||
abs(( ptDim1 - ptP1L).Len() + ( ptCenL - ptP1L ).Len() - ( ptDim1 - ptCenL).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L, quindi tengo ptP1L
if ( abs(( ptDim1 - ptP1L).Len() + ( ptP0L - ptDim1).Len() - ( ptP0L - ptP1L).Len()) < EPS_SMALL ||
abs(( ptDim1 - ptP1L).Len() + ( ptP0L - ptP1L ).Len() - ( ptDim1 - ptP0L).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L, quindi tengo ptP1L
;
else
// ptDim è dal lato di ptP2L
ptP1L = ptP2L ;
if ( abs(( ptDim2 - ptP3L).Len() + ( ptCenL - ptDim2).Len() - ( ptCenL - ptP3L).Len()) < EPS_SMALL ||
abs(( ptDim2 - ptP3L).Len() + ( ptCenL - ptP3L).Len() - ( ptDim2 - ptCenL).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L
;
if ( abs(( ptDim2 - ptP3L).Len() + ( ptP0L - ptDim2).Len() - ( ptP0L - ptP3L).Len()) < EPS_SMALL ||
abs(( ptDim2 - ptP3L).Len() + ( ptP0L - ptP3L).Len() - ( ptDim2 - ptP0L).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L, quindi tengo ptP3L
;
else
// ptDim è dal lato di ptP2L
ptP3L = ptP4L ;
}
// recupero la normale al piano dell'angolo da quotare
Frame3d frArc;
frArc.Set(ptCenL, ptP1L, ptP3L);
Vector3d vtNL = frArc.VersZ() ;
if ( vtNL * Z_AX < - EPS_SMALL) {
frArc.Set(ptCenL, ptP3L, ptP1L);
vtNL = frArc.VersZ() ;
}
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim ) ||
! MySetDimensionStyle( pDim ) ||
! pDim->SetAngular( ptP1L, ptCenL, ptP3L, ptDimL, vtNL, sText))
! pDim->SetAngular( ptP1L, ptP0L, ptP3L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
@@ -881,36 +825,50 @@ MyCreateAngularDimensionFromArc( int nParentId, int nCrvId, const Point3d& ptDim
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero l'arco e il suo frame
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pArc == nullptr)
ICurveArc* pCurve = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCurve == nullptr)
return GDB_ID_NULL ;
Frame3d frArc ;
Frame3d frArc;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frArc))
return GDB_ID_NULL ;
// recupero i punti e la normale e li porto nel frame locale
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ;
Point3d ptCenL, ptP1L, ptP2L ;
pArc->GetStartPoint( ptP1L) ;
ptP1L.LocToLoc( frArc, frLoc) ;
pArc->GetEndPoint( ptP2L) ;
ptP2L.LocToLoc( frArc, frLoc) ;
pArc->GetCenterPoint( ptCenL) ;
ptCenL.LocToLoc( frArc, frLoc) ;
// porto ptDimL nell'area di influenza dell'arco
Point3d ptMid ;
pArc->GetMidPoint( ptMid) ;
Vector3d vtDir = ( ptMid - ptCenL) ;
if ( ! vtDir.Normalize())
PtrOwner<ICurveArc> pCrv( pCurve->Clone()) ;
if ( IsNull( pCrv ) || ! pCrv->IsValid())
return GDB_ID_NULL ;
ptDimL = ptCenL + Dist( ptDimL, ptCenL) * vtDir ;
// porto tutto nel frLoc
pCrv->LocToLoc( frArc, frLoc ) ;
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
//recupero i punti e i versori
Point3d ptP0L, ptP1L, ptP2L ;
pCrv->GetStartPoint( ptP1L) ;
pCrv->GetEndPoint( ptP2L) ;
pCrv->GetCenterPoint( ptP0L) ;
// porto ptDimL nell'area di influenza dell'arco
Point3d ptDimNew ;
double dDist = ( ptDimL - ptP0L).Len() ;
Point3d ptMid ;
pCrv->GetMidPoint( ptMid) ;
Vector3d vtDir = ( ptMid - ptP0L) ;
vtDir.Normalize() ;
ptDimNew = ptP0L + dDist * vtDir ;
// proietto il punto sul piano XY della griglia
Frame3d frGrid = pGeomDB->GetGridFrame() ;
if ( ! frGrid.IsValid())
return GDB_ID_NULL ;
Point3d ptOrig = frGrid.Orig() ;
ptDimNew -= ( ptDimNew - ptOrig) * vtNL * vtNL;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim ) ||
! MySetDimensionStyle( pDim) ||
! pDim->SetAngular( ptP1L, ptCenL, ptP2L, ptDimL, vtNL, sText))
! pDim->SetAngular( ptP1L, ptP0L, ptP2L, ptDimNew, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
@@ -936,4 +894,93 @@ ExeCreateAngularDimensionFromArc( int nParentId, int nCrvId, const Point3d& ptDi
}
// restituisco l'identificativo del oggetto
return nId ;
}
}
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimensionFromCircle( int nParentId, int nCrvId, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptDim,
const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId ) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero il cerchio e il suo frame
ICurveArc* pCurve = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCurve == nullptr)
return GDB_ID_NULL ;
Frame3d frCrv;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frCrv))
return GDB_ID_NULL ;
PtrOwner<ICurveArc> pCrv( pCurve->Clone()) ;
if ( IsNull( pCrv ) || ! pCrv->IsValid())
return GDB_ID_NULL ;
// porto tutto nel frLoc
pCrv->LocToLoc( frCrv, frLoc ) ;
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// recupero il centro
Point3d ptP0L ;
pCrv->GetCenterPoint( ptP0L) ;
// verifico che i punti P1 e P2 siano sul cerchio, sennò prendo i più vicini
if ( ! pCrv->IsPointOn(ptP1L)) {
DistPointCurve distPC( ptP1L, *pCrv) ;
int nFlag ;
distPC.GetMinDistPoint(0,ptP1L,nFlag);
}
if ( ! pCrv->IsPointOn(ptP2L)) {
DistPointCurve distPC(ptP2L, *pCrv) ;
int nFlag ;
distPC.GetMinDistPoint(0, ptP2L, nFlag);
}
// proietto il punto sul piano XY della griglia
Frame3d frGrid = pGeomDB->GetGridFrame() ;
if ( ! frGrid.IsValid())
return GDB_ID_NULL ;
Point3d ptOrig = frGrid.Orig() ;
ptDimL -= ( ptDimL - ptOrig) * vtNL * vtNL;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim) ||
! pDim->SetAngular( ptP1L, ptP0L, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimensionFromCircle( int nParentId, int nCrvId, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimensionFromCircle( nParentId, nCrvId, ptP1, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimensionFromCircle(" + IdToString( nParentId) + "," +
IdToString( nCrvId) + ",{" +
ToString( ptP1) + "},'" +
ToString( ptP2) + "},'" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
+9 -95
View File
@@ -40,12 +40,11 @@
#include "/EgtDev/Include/EGkChainCurves.h"
#include "/EgtDev/Include/EGkCurveByInterp.h"
#include "/EgtDev/Include/EGkCurveByApprox.h"
#include "/EgtDev/Include/EGkCurveAux.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
@@ -363,13 +362,16 @@ CreateLineTgTwoCurves( IGeomDB* pGeomDB, int nParentId,
if ( pCrv2 == nullptr)
return nullptr ;
// porto la seconda curva nel riferimento della prima
CurveLocal Crv2Loc( pGeomDB, nIdF, frCrv1) ;
PtrOwner<ICurve> pCrv2Loc( pCrv2->Clone()) ;
if ( IsNull( pCrv2Loc))
return nullptr ;
pCrv2Loc->LocToLoc( frCrv2, frCrv1) ;
// porto il punto vicino al finale nel riferimento della prima curva
Point3d ptN2loc( ptFin) ;
ptN2loc.LocToLoc( frDest, frCrv1) ;
// calcolo la retta tangente alle due curve
PtrOwner<ICurveLine> pCrvLine ;
pCrvLine.Set( GetLineTgTwoCurves( *pCrv1, ptN1loc, *Crv2Loc, ptN2loc)) ;
pCrvLine.Set( GetLineTgTwoCurves( *pCrv1, ptN1loc, *pCrv2Loc, ptN2loc)) ;
if ( IsNull( pCrvLine))
return nullptr ;
// porto la linea nel riferimento del gruppo destinazione
@@ -1089,45 +1091,6 @@ ExeCreateArc3P( int nParentId, const Point3d& ptP1,
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateArc2PR( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
double dRad, bool bCCW, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti, il versore normale e quelloe estrusione
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo l'arco
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
bOk = bOk && ( ! IsNull( pCrvArc) &&
pCrvArc->Set2PNRS( ptStartL, ptEndL, vtNormL, dRad, bCCW)) ;
// assegno il versore estrusione
bOk = bOk && pCrvArc->SetExtrusion( vtExtrL) ;
// inserisco l'arco nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtArc2PR(" + IdToString( nParentId) + ",{" +
ToString( ptStart) + "},{" +
ToString( ptEnd) + "}," +
ToString( dRad) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateArc2PB( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
@@ -1665,55 +1628,6 @@ ExeCreateCurveBezierFromArc( int nParentId, int nArcId, bool bErase)
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateCurveBezierFromCurve( int nParentId, int nCrvId, bool bRational)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento della curva
Frame3d frCrv ;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frCrv))
return GDB_ID_NULL ;
// recupero il riferimento di destinazione
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero la curva
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCurve == nullptr || ! pCurve->IsValid())
return GDB_ID_NULL ;
// recupero il vettore estrusione della curva e lo porto in locale al gruppo destinazione
Vector3d vtExtr ;
pCurve->GetExtrusion( vtExtr) ;
vtExtr.LocToLoc( frCrv, frLoc) ;
PtrOwner<ICurve> pCrvBez ( CurveToBezierCurve( pCurve, bRational)) ;
// setto l'estrusione
pCrvBez->SetExtrusion( vtExtr) ;
// aggiungo la curva in forma di Bezier al DB
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvBez)) ;
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateCurveBezierFromCurve( int nParentId, int nCrvId, bool bRational)
{
// eseguo
int nId = MyCreateCurveBezierFromCurve( nParentId, nCrvId, bRational) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCurveBezierFromCurve(" + IdToString( nParentId) + "," +
IdToString( nCrvId) + ")"
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
MyCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase)
@@ -2062,12 +1976,12 @@ ExeCreateCurveCompoByInterpolation( int nParentId, const PolyLine& PL, int nType
nMethod = CurveByInterp::BESSEL ;
nCrvType = CurveByInterp::CUBIC_BEZIERS ;
}
else if ( nType == ITT_CUBICS_LONG)
nCrvType = CurveByInterp::CUBIC_BEZIERS_LONG ;
// oggetto interpolatore
CurveByInterp crvByInterp ;
Point3d ptP ;
for ( bool bFound = PL.GetFirstPoint( ptP) ; bFound ; bFound = PL.GetNextPoint( ptP))
for ( bool bFound = PL.GetFirstPoint( ptP) ;
bFound ;
bFound = PL.GetNextPoint( ptP))
crvByInterp.AddPoint( ptP) ;
PtrOwner<ICurve> pCrvCompo( crvByInterp.GetCurve( nMethod, nCrvType)) ;
bOk = bOk && ! IsNull( pCrvCompo) ;
+108 -1393
View File
File diff suppressed because it is too large Load Diff
+10 -110
View File
@@ -1,4 +1,4 @@
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// EgalTech 2016-2016
//----------------------------------------------------------------------------
// File : EXE_GdbCreateVol.cpp Data : 27.10.16 Versione : 1.6v7
@@ -64,50 +64,7 @@ ExeCreateVolZmap( int nParentId, const Point3d& ptIni, double dDimX, double dDim
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int ExeCreateVolZmapEmpty( int nParentId, const Point3d& ptIni, double dDimX, double dDimY, double dDimZ,
double dPrec, bool bTriDex, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// 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 ptOnXL = GetPointLocal( pGeomDB, ptIni + X_AX, nRefType, frLoc) ;
Point3d ptOnYL = GetPointLocal( pGeomDB, ptIni + Y_AX, nRefType, frLoc) ;
// ne ricavo un riferimento intrinseco
Frame3d frBox ;
bOk = bOk && frBox.Set( ptIniL, ptOnXL, ptOnYL) ;
// creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ;
bOk = bOk && pVZM->CreateEmpty( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex) ;
// lo porto nel riferimento locale
bOk = bOk && pVZM->ToGlob( frBox) ;
// inserisco lo Zmap nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pVZM)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapEmpty(" + IdToString( nParentId) + ",{" +
ToString( ptIni) + "}," +
ToString( dDimX) + "," +
ToString( dDimY) + "," +
ToString( dDimZ) + "," +
ToString( dPrec) + "," +
( bTriDex ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -146,13 +103,13 @@ ExeCreateVolZmapByRegionExtrusion( int nParentId, int nSfrId, double dDimZ, doub
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDex, double dExtraBox)
ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDex)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -169,7 +126,7 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
// creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ;
bOk = bOk && pVZM->CreateFromTriMesh( *pStm, dPrec, bTriDex, dExtraBox) ;
bOk = bOk && pVZM->CreateFromTriMesh( *pStm, dPrec, bTriDex) ;
// lo porto nel riferimento di destinazione
bOk = bOk && pVZM->LocToLoc( frStm, frDest) ;
// inserisco lo Zmap nel DB
@@ -177,70 +134,13 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapFromSurfTm(" + IdToString( nParentId) + "," +
ToString( nStmId) + "," +
ToString( dPrec) + "," +
( bTriDex ? "true" : "false") + "," +
ToString( dExtraBox) + ")" +
string sLua = "EgtVolZmapFromTriMesh(" + IdToString( nParentId) + "," +
ToString( nStmId) + "," +
ToString( dPrec) + "," +
( bTriDex ? "true" : "false") + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
bool
ExeUpdateVolZmapByAddingSurfTm( int nVolZmapId, int nStmId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nVolZmapId)) ;
bool bOk = ( pVZM != nullptr) ;
// recupero la trimesh
PtrOwner<ISurfTriMesh> pStm( CloneSurfTriMesh( pGeomDB->GetGeoObj( nStmId))) ;
bOk = bOk && !IsNull( pStm) ;
// recupero il frame dello Zmap e della Trimesh
Frame3d frZmap, frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nVolZmapId, frZmap) &&
pGeomDB->GetGlobFrame( nStmId, frStm) ;
// porto la Stm nel frame dello Zmap
bOk = bOk && pStm->LocToLoc( frStm, frZmap) ;
// aggiorno lo Zmap con la nuova superficie
bOk = bOk && pVZM->AddSurfTm( pStm) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtUpdateVolZmapByAddingSurfTm(" + ToString( nVolZmapId) + "," +
ToString( nStmId) + ")"
" -- bOk =" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeUniformVolZmap( int nVolZmapId, double dToler, bool bExtensionFirst, int nToolNum)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nVolZmapId)) ;
bool bOk = ( pVZM != nullptr) ;
// aggiorno lo Zmap
dToler = max( dToler, EPS_SMALL) ;
bOk = bOk && pVZM->MakeUniform( dToler, bExtensionFirst, nToolNum) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtUniformVolZmap(" + ToString( nVolZmapId) + "," +
ToString( dToler) + "," +
( bExtensionFirst ? "true" : "false") +
ToString( nToolNum) + ")"
" -- bOk =" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
+3 -251
View File
@@ -16,24 +16,17 @@
#include "EXE.h"
#include "EXE_Const.h"
#include "EXE_Macro.h"
#include "AuxTools.h"
#include "GeoTools.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveBezier.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkCurveAux.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
using namespace std ;
//----------------------------------------------------------------------------
bool
ExeCurveDomain( int nId, double* pdStart, double* pdEnd)
@@ -64,21 +57,6 @@ ExeCurveLength( int nId, double* pdLen)
return ( pCurve != nullptr && pCurve->GetLength( *pdLen)) ;
}
//----------------------------------------------------------------------------
bool
ExeCurveLengthAtParam( int nId, double dPar, 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)) ;
// recupero la lunghezza
return ( pCurve != nullptr && pCurve->GetLengthAtParam( dPar, *pdLen)) ;
}
//----------------------------------------------------------------------------
bool
ExeCurveParamAtLength( int nId, double dLen, double* pdPar)
@@ -182,7 +160,7 @@ ExeCurveIsFlat( int nId, Plane3d& Plane, bool bUseExtrusion, double dToler)
return false ;
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
// ne verifico la planarit
// ne verifico la planarità
return ( pCurve != nullptr && pCurve->IsFlat( Plane, bUseExtrusion, dToler)) ;
}
@@ -227,8 +205,6 @@ ExeCurveIsACircle( int nId, Point3d& ptCen, Vector3d& vtN, double& dRad, bool& b
return false ;
return pCompo->IsACircle( dToler, ptCen, vtN, dRad, bCCW) ;
}
default :
return false ;
}
return false ;
@@ -314,7 +290,7 @@ ExeCurveNearestExtremityToPoint( int nId, const Point3d& ptP, bool& bStart)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
// recupero quale estremo pi vicino al punto
// recupero quale estremo è più vicino al punto
return ( pCurve != nullptr && pCurve->GetNearestExtremityToPoint( ptP, bStart)) ;
}
@@ -390,7 +366,7 @@ ExeCurveMinAreaRectangleXY( int nId, int nRefId, Frame3d& frRect, double& dDimX,
PL.LocToLoc( frCrv, pGeomDB->GetGridFrame()) ;
else if ( bOk && nRefId != nId) {
Frame3d frDest ;
// nRefId pu essere un gruppo o una entit
// nRefId può essere un gruppo o una entità
if ( pGeomDB->GetGroupGlobFrame( nRefId, frDest) ||
pGeomDB->GetGlobFrame( nRefId, frDest))
PL.LocToLoc( frCrv, frDest) ;
@@ -638,9 +614,6 @@ ExeCurveCompoRadius( int nId, int nSimpCrv, double& dRad)
case CRV_BEZIER :
dRad = -2 ;
break ;
default :
dRad = -3 ;
break ;
}
return true ;
}
@@ -670,9 +643,6 @@ ExeCurveCompoAngCenter( int nId, int nSimpCrv, double& dAngCen)
case CRV_BEZIER :
dAngCen = 0 ;
break ;
default :
dAngCen = 0 ;
break ;
}
return true ;
}
@@ -702,225 +672,7 @@ ExeCurveCompoNormVersor( int nId, int nSimpCrv, int nRefId, Vector3d& vtNorm)
case CRV_BEZIER :
vtNorm = V_NULL ;
break ;
default :
vtNorm = V_NULL ;
break ;
}
// gestione trasformazione ( eventuale)
return TransformVector( pGeomDB, nId, nRefId, vtNorm) ;
}
//----------------------------------------------------------------------------
bool
ExeCurveCompoGetTempProp( int nId, INTVECTOR& vProp, int nPropInd)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva composita
const ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
if ( pCompo == nullptr)
return false ;
// recupero i valori
vProp.clear() ;
vProp.reserve( pCompo->GetCurveCount()) ;
const ICurve* pSmplCrv = pCompo->GetFirstCurve() ;
while ( pSmplCrv != nullptr) {
vProp.push_back( pSmplCrv->GetTempProp( nPropInd)) ;
pSmplCrv = pCompo->GetNextCurve() ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
ExeCurveCompoGetTempParam( int nId, DBLVECTOR& vParam, int nParamInd)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva composita
const ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
if ( pCompo == nullptr)
return false ;
// recupero i valori
vParam.clear() ;
vParam.reserve( pCompo->GetCurveCount()) ;
const ICurve* pSmplCrv = pCompo->GetFirstCurve() ;
while ( pSmplCrv != nullptr) {
vParam.push_back( pSmplCrv->GetTempParam( nParamInd)) ;
pSmplCrv = pCompo->GetNextCurve() ;
}
return true ;
}
//----------------------------------------------------------------------------
int
ExeShowCurveBezierControlPoints( int nCrvId, int nDestGrpId, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva di Bezier
IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nCrvId) ;
if ( pGeoObj->GetType() != CRV_BEZIER && pGeoObj->GetType() != CRV_COMPO)
return GDB_ID_NULL ;
// recupero il riferimento della curva
Frame3d frCrv ;
bool bOk = true ;
bOk = bOk && pGeomDB->GetGlobFrame( nCrvId, frCrv) ;
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
if ( ! bOk)
return GDB_ID_NULL ;
int nType = pGeoObj->GetType() ;
if ( nType == CRV_COMPO) {
const ICurveComposite* pCrvCompo = GetCurveComposite( pGeoObj) ;
if ( pCrvCompo == nullptr)
return false ;
int nFirstId = -1 ;
int nCount = 0 ;
for ( int i = 0 ; i < pCrvCompo->GetCurveCount() ; ++i) {
const ICurveBezier* pCrvBezier = GetCurveBezier( pCrvCompo->GetCurve(i)) ;
if ( pCrvBezier == nullptr) {
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
int nDeg = pCrvBezier->GetDegree() ;
//bool bRat = pCrvBezier->IsRational() ;
for ( int i = 0 ; i < nDeg + 1 ; ++i) {
IGeoPoint3d* pGeoPt( CreateGeoPoint3d()) ;
//if ( ! bRat)
// pGeoPt->Set( pCrvBezier->GetControlPoint( i)) ;
//else
// pGeoPt->Set( pCrvBezier->GetControlPoint( i) * pCrvBezier->GetControlWeight( i)) ;
pGeoPt->Set( pCrvBezier->GetControlPoint( i)) ;
pGeoPt->LocToLoc( frCrv, frDest) ;
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pGeoPt) ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nId ;
if ( nId != GDB_ID_NULL)
++nCount ;
}
}
// restituisco i risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
else if ( nType == CRV_BEZIER) {
const ICurveBezier* pCrvBezier = GetCurveBezier( pGeoObj) ;
if ( pCrvBezier == nullptr)
return false ;
int nDeg = pCrvBezier->GetDegree() ;
//bool bRat = pCrvBezier->IsRational() ;
int nFirstId = -1 ;
int nCount = 0 ;
for ( int i = 0 ; i < nDeg + 1 ; ++i) {
IGeoPoint3d* pGeoPt( CreateGeoPoint3d()) ;
//if ( ! bRat)
// pGeoPt->Set( pCrvBezier->GetControlPoint( i)) ;
//else
// pGeoPt->Set( pCrvBezier->GetControlPoint( i) * pCrvBezier->GetControlWeight( i)) ;
pGeoPt->Set( pCrvBezier->GetControlPoint( i)) ;
pGeoPt->LocToLoc( frCrv, frDest) ;
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pGeoPt) ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nId ;
if ( nId != GDB_ID_NULL)
++nCount ;
}
// restituisco i risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
else
return GDB_ID_NULL ;
}
//----------------------------------------------------------------------------
bool
ExeCurveMaxOffset( int nId, double& dMaxOffset)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico il parametro
if ( &dMaxOffset == nullptr)
return false ;
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
if ( pCrv == nullptr)
return false ;
return CalcCurveLimitOffset( *pCrv, dMaxOffset) ;
}
//----------------------------------------------------------------------------
int
ExeCopyCompoSubCurve( int nCrvId, int nSubCrvToCopy, int nDestGrpId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva compo
const ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCompo == nullptr)
return GDB_ID_NULL ;
// recupero il riferimento della curva
Frame3d frCrv ;
bool bOk = true ;
bOk = bOk && pGeomDB->GetGlobFrame( nCrvId, frCrv) ;
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
if ( ! bOk)
return GDB_ID_NULL ;
// creo una copia e la porto nel frame della destinazione
const ICurve* pSubCrv = pCompo->GetCurve( nSubCrvToCopy) ;
if ( pSubCrv == nullptr)
return GDB_ID_NULL ;
ICurve* pSubCrvCopy = pSubCrv->Clone() ;
if ( pSubCrvCopy == nullptr)
return GDB_ID_NULL ;
pSubCrvCopy->LocToLoc( frCrv, frDest) ;
int nSubCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pSubCrvCopy) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCopyCompoSubCurve(" + IdToString( nCrvId) + "," +
ToString( nSubCrvToCopy) + "," +
IdToString( nDestGrpId) + ")" +
" -- Id=" + ToString( nSubCrvId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nSubCrvId ;
}
//----------------------------------------------------------------------------
int
ExeCopyParamRange( int nCrvId, double dUStart, double dUEnd, int nDestGrpId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
// recupero il riferimento della curva
Frame3d frCrv ;
bool bOk = true ;
bOk = bOk && pGeomDB->GetGlobFrame( nCrvId, frCrv) ;
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
if ( ! bOk)
return GDB_ID_NULL ;
// creo una copia e la porto nel frame della destinazione
ICurve* pSubCrvCopy = pCrv->CopyParamRange( dUStart, dUEnd) ;
if ( pSubCrvCopy == nullptr)
return GDB_ID_NULL ;
pSubCrvCopy->LocToLoc( frCrv, frDest) ;
int nSubCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pSubCrvCopy) ;
ExeSetModified() ;
return nSubCrvId ;
}
-161
View File
@@ -1,161 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2024
//----------------------------------------------------------------------------
// File : Exe_GdbGetPocketing.cpp Data : 02.02.24 Versione : 2.6b1
// Contenuto : Funzioni di interrogazione di regioni piane del DBG per EXE.
//
//
//
// Modifiche : 29.11.23 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkCalcPocketing.h"
using namespace std ;
//----------------------------------------------------------------------------
bool
ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId,
int& nFirstId, int& nCrvCount)
{
// database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) ;
// recupero la FlatRegion da svuotare
PtrOwner<ISurfFlatRegion> pMySfr ;
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pSfr == nullptr) {
// verifico se è una curva chiusa e piana che permette di definire una regione
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
Plane3d plPlane ;
if ( pCrv == nullptr || ! pCrv->IsFlat( plPlane, true, 10 * EPS_SMALL))
return false ;
SurfFlatRegionByContours SfrCntr ;
SfrCntr.AddCurve( pCrv->Clone()) ;
pMySfr.Set( SfrCntr.GetSurf()) ;
if ( IsNull( pMySfr))
return false ;
pSfr = pMySfr ;
}
// recupero il suo frame
Frame3d frSfr ;
if ( ! pGeomDB->GetGlobFrame( nId, frSfr))
return false ;
// recupero il riferimento del gruppo di destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return false ;
// eseguo Pocketing
ICRVCOMPOPOVECTOR vCrvCompoRes ;
bool bOk = CalcPocketing( pSfr, dRad, 0, dStep, dAngle, 5., nType, bSmooth, true, false, false, false, true, P_INVALID, nullptr, false, dStep, INFINITO, 0, vCrvCompoRes) ;
nFirstId = GDB_ID_NULL ;
nCrvCount = int( vCrvCompoRes.size()) ;
if ( bOk && nCrvCount > 0) {
// scorro le curve di Pocketing ottenute
for ( int nI = 0 ; nI < nCrvCount ; ++ nI) {
vCrvCompoRes[nI]->LocToLoc( frSfr, frDest) ;
// inserisco la curva nel DB Geometrico
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrvCompoRes[nI])) ;
if ( nCurrId == GDB_ID_NULL)
return false ;
if ( nI == 0)
nFirstId = nCurrId ;
}
ExeSetModified() ;
}
if ( IsCmdLog()) {
string sLua = "EgtPocketing(" + ToString( nId) + "," +
ToString( dRad) + "," +
ToString( dStep) + "," +
ToString( dAngle) + "," +
ToString( nType) + "," +
ToString( bSmooth) + "," +
ToString( nDestGrpId) + ")" +
" FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCrvCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
int
ExeSurfFrGetZigZagInfill( int nId, int nDestGrpId, double dStep, double dAng, bool bSmooth, bool bRemoveOverlapLink,
int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie FlatRegion
ISurfFlatRegion* pOrigSrf = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pOrigSrf == nullptr)
return GDB_ID_NULL ;
PtrOwner<ISurfFlatRegion> pSfr( pOrigSrf->Clone()) ;
bool bOk = ( ! IsNull( pSfr)) ;
// 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) ;
// creo il riferimento per il calcolo del percorso a zigzag
Vector3d vtN ;
if ( bOk)
vtN = pSfr->GetNormVersor() ;
bOk = bOk && vtN.ToGlob( frSurf) ;
Frame3d frRef ;
bOk = bOk && frRef.Set( ORIG, vtN) ;
bOk = bOk && frRef.Rotate( ORIG, vtN, dAng) ;
// calcolo il percorso a zigzag
bOk = bOk && pSfr->LocToLoc( frSurf, frRef) ;
ICRVCOMPOPOVECTOR vpCrvs ;
bOk = bOk && CalcZigZagInfill( pSfr, dStep, bSmooth, bRemoveOverlapLink, vpCrvs) ;
// inserisco le curve risultanti nel DB
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
for ( int i = 0 ; bOk && i < ( int) vpCrvs.size() ; i ++) {
// porto la curva nel riferimento di destinazione
bOk = bOk && vpCrvs[i]->LocToLoc( frRef, frDest) ;
// la inserisco nel DB geometrico
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vpCrvs[i])) : GDB_ID_NULL) ;
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
// aggiorno contatori
if ( bOk && nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
if ( bOk)
++ nCount ;
}
ExeSetModified() ;
// restituisco risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
if ( IsCmdLog()) {
string sLua = "EgtGetSurfFrZigZagInfill(" + ToString( nId) + "," +
ToString( dStep) + "," +
ToString( dAng) + "," +
ToString( bSmooth) + "," +
ToString( bRemoveOverlapLink) + "," +
" -- Ok=" + ToString( bOk) + " FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return nFirstId ;
}
+130 -589
View File
@@ -21,7 +21,6 @@
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveBezier.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
@@ -29,14 +28,7 @@
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EGkDistPointSurfFr.h"
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkIntersLineBox.h"
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
#include "/EgtDev/Include/EGkCAvSilhouetteSurfTm.h"
#include "/EgtDev/Include/EGkCalcPocketing.h"
#include "/EgtDev/Include/EGkPolygonElevation.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
@@ -65,7 +57,7 @@ ExeSurfIsClosed( int nId)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ;
// verifico se è superficie chiusa
// verifico se è superficie chiusa
return ( pSurf != nullptr && pSurf->IsClosed()) ;
}
@@ -80,7 +72,7 @@ ExeSurfVolume( int nId, double& dVol)
return false ;
// recupero la superficie
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ;
// ne restituisco l'eventuale volume (se è chiusa)
// ne restituisco l'eventuale volume (se è chiusa)
return ( pSurf != nullptr && pSurf->GetVolume( dVol)) ;
}
@@ -120,26 +112,24 @@ bool
ExeSurfFrTestExternal( int nId1, int nId2, double dMinDist)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la prima superficie FlatRegion
const ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
if ( pSfr1 == nullptr)
return false ;
// se richiesta distanza di sicurezza, ne faccio l'offset
PtrOwner<ISurfFlatRegion> pSfr1O ;
if ( abs( dMinDist) > 5 * EPS_SMALL) {
pSfr1O.Set( pSfr1->Clone()) ;
if ( IsNull( pSfr1O) || ! pSfr1O->Offset( dMinDist, ICurve::OFF_FILLET))
return false ;
pSfr1 = Get( pSfr1O) ;
}
PtrOwner<ISurfFlatRegion> pSfr1O( pSfr1->Clone()) ;
if ( IsNull( pSfr1O))
return false ;
if ( dMinDist > 10 * EPS_SMALL)
pSfr1O->Offset( dMinDist, ICurve::OFF_FILLET) ;
// recupero il riferimento della superficie
Frame3d frSurf1 ;
if ( ! pGeomDB->GetGlobFrame( nId1, frSurf1))
return false ;
// recupero il tipo della seconda entità
// recupero il tipo della seconda entità
int nType2 = pGeomDB->GetGeoType( nId2) ;
// se seconda entità regione
// se seconda entità regione
if ( nType2 == SRF_FLATRGN) {
// recupero la seconda superficie FlatRegion in locale alla prima
SurfLocal Surf2Loc( pGeomDB, nId2, frSurf1) ;
@@ -147,9 +137,9 @@ ExeSurfFrTestExternal( int nId1, int nId2, double dMinDist)
if ( pSfr2L == nullptr)
return false ;
// eseguo il test di intersezione tra le due regioni
for ( int i = 0 ; i < pSfr1->GetChunkCount() ; ++ i) {
for ( int i = 0 ; i < pSfr1O->GetChunkCount() ; ++ i) {
for ( int j = 0 ; j < pSfr2L->GetChunkCount() ; ++ j) {
if ( pSfr1->GetChunkSimpleClassification( i, *pSfr2L, j) != REGC_OUT)
if ( pSfr1O->GetChunkSimpleClassification( i, *pSfr2L, j) != REGC_OUT)
return false ;
}
}
@@ -163,8 +153,8 @@ ExeSurfFrTestExternal( int nId1, int nId2, double dMinDist)
if ( pCrv2L == nullptr)
return false ;
// eseguo il test di intersezione tra regione e curva
for ( int i = 0 ; i < pSfr1->GetChunkCount() ; ++ i) {
PtrOwner<ICurve> pCrv1( pSfr1->GetLoop( i, 0)) ;
for ( int i = 0 ; i < pSfr1O->GetChunkCount() ; ++ i) {
PtrOwner<ICurve> pCrv1( pSfr1O->GetLoop( i, 0)) ;
if ( pCrv1 == nullptr)
return false ;
IntersCurveCurve ccInt( *pCrv1, *pCrv2L) ;
@@ -172,8 +162,7 @@ ExeSurfFrTestExternal( int nId1, int nId2, double dMinDist)
if ( ! ccInt.GetCurveClassification( 1, EPS_SMALL, vcClass) || vcClass.empty())
return false ;
for ( auto& cClass : vcClass) {
if ( cClass.nClass == CRVC_IN || cClass.nClass == CRVC_ON_M ||
cClass.nClass == CRVC_ON_P || cClass.nClass == CRVC_NULL)
if ( cClass.nClass == CRVC_IN || cClass.nClass == CRVC_NULL)
return false ;
}
}
@@ -183,17 +172,34 @@ ExeSurfFrTestExternal( int nId1, int nId2, double dMinDist)
else if ( nType2 == GEO_PNT3D) {
// recupero il punto
IGeoPoint3d* pGeoPt = GetGeoPoint3d( pGeomDB->GetGeoObj( nId2)) ;
Point3d ptP = pGeoPt->GetPoint() ;
Point3d pt = pGeoPt->GetPoint() ;
// porto il punto in locale
Frame3d frPt ;
if ( ! pGeomDB->GetGlobFrame( nId2, frPt))
return false ;
ptP.LocToLoc( frPt, frSurf1) ;
// determino se interno (comprende la frontiera)
bool bInside ;
if ( ! IsPointInsideSurfFr( ptP, pSfr1, 0, bInside))
return false ;
return ( ! bInside) ;
pt.LocToLoc( frPt, frSurf1) ;
for ( int i = 0 ; i < pSfr1O->GetChunkCount() ; i ++) {
// verifico se è contenuto nel loop esterno
PtrOwner<ICurve> pCrv( pSfr1O->GetLoop( i, 0)) ;
PolyLine PL ;
pCrv->ApproxWithLines( 10 * EPS_SMALL, 15, ICurve::APL_STD, PL) ;
if ( IsPointInsidePolyLine( pt, PL, EPS_SMALL)) {
bool bInsideHole = false ;
// verifico se è contenuto in un loop interno
for ( int j = 1 ; j < pSfr1O->GetLoopCount( i) ; j ++) {
PtrOwner<ICurve> pCrv( pSfr1O->GetLoop( i, j)) ;
pCrv->ApproxWithLines( 10 * EPS_SMALL, 15, ICurve::APL_STD, PL) ;
PL.Invert() ;
if ( IsPointInsidePolyLine( pt, PL, EPS_SMALL))
bInsideHole = true ;
}
// se è contenuto nel loop esterno ma non è contenuto in nessuno dei loop interni allora il punto è interno
if ( ! bInsideHole)
return false ;
}
}
return true ;
}
// altrimenti non valida
else
@@ -214,20 +220,6 @@ ExeSurfFrChunkCount( int nId)
return pSfr->GetChunkCount() ;
}
//----------------------------------------------------------------------------
bool
ExeSurfFrChunkMaxOffset( int nId, int nChunk, double& dMaxOffset)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico il parametro
if ( &dMaxOffset == nullptr)
return false ;
// recupero la Regione
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
return ( pSfr != nullptr && pSfr->GetChunkMaxOffset( nChunk, dMaxOffset)) ;
}
//----------------------------------------------------------------------------
int
ExeSurfFrChunkSimpleClassify( int nId1, int nChunk1, int nId2, int nChunk2, double dToler)
@@ -261,25 +253,6 @@ ExeSurfFrChunkSimpleClassify( int nId1, int nChunk1, int nId2, int nChunk2, doub
return nRes ;
}
//----------------------------------------------------------------------------
bool
ExeSurfFrChunkCenter( int nId, int nChunk, int nRefId, Point3d& ptCen, Vector3d& vtN)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie FlatRegion
ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pSfr == nullptr)
return false ;
// recupero il centro della parte
if ( ! pSfr->GetChunkCentroid( nChunk, ptCen))
return false ;
// recupero la normale della regione
vtN = pSfr->GetNormVersor() ;
// gestione trasformazioni ( eventuali)
return TransformPoint( pGeomDB, nId, nRefId, ptCen) && TransformVector( pGeomDB, nId, nRefId, vtN) ;
}
//----------------------------------------------------------------------------
int
ExeExtractSurfFrChunkLoops( int nId, int nChunk, int nDestGrpId, int* pnCount)
@@ -332,6 +305,67 @@ ExeExtractSurfFrChunkLoops( int nId, int nChunk, int nDestGrpId, int* pnCount)
return nFirstId ;
}
//----------------------------------------------------------------------------
int
ExeSurfFrGetZigZagInfill( int nId, int nDestGrpId, double dStep, double dAng, bool bStepCorrection, bool bInvert, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie FlatRegion
ISurfFlatRegion * pOrigSrf = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pOrigSrf == nullptr)
return GDB_ID_NULL ;
PtrOwner<ISurfFlatRegion> pSfr( pOrigSrf->Clone()) ;
bool bOk = ( ! IsNull( pSfr)) ;
// 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) ;
// creo il riferimento per il calcolo del percorso a zigzag
Vector3d vtN ;
if ( bOk)
vtN = pSfr->GetNormVersor() ;
bOk = bOk && vtN.ToGlob( frSurf) ;
Frame3d frRef ;
bOk = bOk && frRef.Set( ORIG, vtN) ;
bOk = bOk && frRef.Rotate( ORIG, vtN, dAng) ;
// calcolo il percorso a zigzag
bOk = bOk && pSfr->LocToLoc( frSurf, frRef) ;
ICRVCOMPOPOVECTOR vpCrvs ;
bOk = bOk && pSfr->GetZigZagInfill( dStep, bStepCorrection, bInvert, vpCrvs) ;
// inserisco le curve risultanti nel DB
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
for ( int i = 0 ; bOk && i < ( int) vpCrvs.size() ; i ++) {
// porto la curva nel riferimento di destinazione
bOk = bOk && vpCrvs[i]->LocToLoc( frRef, frDest) ;
// la inserisco nel DB geometrico
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vpCrvs[i])) : GDB_ID_NULL) ;
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
// copio il materiale
if ( ! pGeomDB->CopyMaterial( nId, nNewId))
return GDB_ID_NULL ;
// aggiorno contatori
if ( bOk && nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
if ( bOk)
++ nCount ;
}
ExeSetModified() ;
// restituisco risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
//----------------------------------------------------------------------------
int
ExeSurfTmVertexCount( int nId)
@@ -401,11 +435,11 @@ ExeSurfTmGetNearestVertex( int nId, const Point3d& ptNear, int nRefId, int& nVer
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return false ;
// porto il punto Near nel riferimento dell'entità
// porto il punto Near nel riferimento dell'entità
Point3d ptNearL = ptNear ;
if ( ! InvTransformPoint( pGeomDB, nId, nRefId, ptNearL))
return false ;
// recupero il vertice più vicino della superficie
// recupero il vertice più vicino della superficie
nVert = GetSurfTmNearestVertex( ptNearL, *pStm) ;
if ( ! pStm->GetVertex( nVert, ptVert))
return false ;
@@ -413,26 +447,6 @@ ExeSurfTmGetNearestVertex( int nId, const Point3d& ptNear, int nRefId, int& nVer
return TransformPoint( pGeomDB, nId, nRefId, ptVert) ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmTriangleNormVersor( int nId, int nTria, 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 triangolo
Triangle3d Tria ;
if ( ! pStm->GetTriangle( nTria, Tria))
return false ;
// assegno la normale
vtNorm = Tria.GetN() ;
// gestione trasformazione ( eventuale)
return TransformVector( pGeomDB, nId, nRefId, vtNorm) ;
}
//----------------------------------------------------------------------------
int
ExeSurfTmFacetFromTria( int nId, int nT)
@@ -472,11 +486,11 @@ ExeSurfTmFacetNearestEndPoint( int nId, int nFacet, const Point3d& ptNear, int n
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return false ;
// porto il punto Near nel riferimento dell'entità
// porto il punto Near nel riferimento dell'entità
Point3d ptNearL = ptNear ;
if ( ! InvTransformPoint( pGeomDB, nId, nRefId, ptNearL))
return false ;
// recupero il punto End più vicino della faccia
// recupero il punto End più vicino della faccia
if ( ! pStm->GetFacetNearestEndPoint( nFacet, ptNearL, ptEnd, vtN))
return false ;
// gestione trasformazioni ( eventuali)
@@ -494,11 +508,11 @@ ExeSurfTmFacetNearestMidPoint( int nId, int nFacet, const Point3d& ptNear, int n
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return false ;
// porto il punto Near nel riferimento dell'entità
// porto il punto Near nel riferimento dell'entità
Point3d ptNearL = ptNear ;
if ( ! InvTransformPoint( pGeomDB, nId, nRefId, ptNearL))
return false ;
// recupero il punto Mid più vicino della faccia
// recupero il punto Mid più vicino della faccia
if ( ! pStm->GetFacetNearestMidPoint( nFacet, ptNearL, ptMid, vtN))
return false ;
// gestione trasformazioni ( eventuali)
@@ -573,83 +587,6 @@ ExeSurfTmFacetMinAreaRectangle( int nId, int nFacet, int nRefId, Frame3d& frRect
return TransformFrame( pGeomDB, nId, nRefId, frRect) ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmFacetElevationInBBox( int nId, int nFacet, const BBox3d& b3Box, bool bAcceptOutFacet, int nRefId, double& dElev)
{
// La faccia deve essere tutta contenuta nel Box
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh e il suo riferimento
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return false ;
Frame3d frStm ;
if ( ! pGeomDB->GetGlobFrame( nId, frStm))
return false ;
// verifico il box e ne recupero il riferimento
if ( b3Box.IsEmpty())
return false ;
Frame3d frBox ;
if ( nRefId == GDB_ID_ROOT)
frBox = GLOB_FRM ;
else if ( nRefId == GDB_ID_GRID)
frBox = pGeomDB->GetGridFrame() ;
else {
// nRefId può essere un gruppo o una entità
if ( ! pGeomDB->GetGroupGlobFrame( nRefId, frBox) &&
! pGeomDB->GetGlobFrame( nRefId, frBox))
return false ;
}
// recupero il contorno esterno della faccia e lo porto nel riferimento del box
POLYLINEVECTOR vPL ;
pStm->GetFacetLoops( nFacet, vPL) ;
if ( vPL.empty())
return false ;
vPL[0].LocToLoc( frStm, frBox) ;
// ne derivo il poligono
Polygon3d pgFacet ;
if ( ! pgFacet.FromPolyLine( vPL[0]))
return false ;
// calcolo l'elevazione
return PolygonElevationInBBox( pgFacet, b3Box, bAcceptOutFacet, dElev) ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmFacetElevationInClosedSurfTm( int nFacetStmId, int nFacet, int nClosedStmId, bool bAcceptOutFacet, double& dElev)
{
// La faccia deve essere tutta contenuta nel Box
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh della faccia e il suo riferimento
const ISurfTriMesh* pFacStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nFacetStmId)) ;
if ( pFacStm == nullptr)
return false ;
Frame3d frFacStm ;
if ( ! pGeomDB->GetGlobFrame( nFacetStmId, frFacStm))
return false ;
// recupero la superficie trimesh chiusa (volume)
const ISurfTriMesh* pCldStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nClosedStmId)) ;
if ( pCldStm == nullptr)
return false ;
Frame3d frCldStm ;
if ( ! pGeomDB->GetGlobFrame( nClosedStmId, frCldStm))
return false ;
// recupero il contorno esterno della faccia e lo porto nel riferimento della superficie chiusa
POLYLINEVECTOR vPL ;
pFacStm->GetFacetLoops( nFacet, vPL) ;
if ( vPL.empty())
return false ;
vPL[0].LocToLoc( frFacStm, frCldStm) ;
// ne derivo il poligono
Polygon3d pgFacet ;
if ( ! pgFacet.FromPolyLine( vPL[0]))
return false ;
// calcolo l'elevazione
return PolygonElevationInClosedSurfTm( pgFacet, *pCldStm, bAcceptOutFacet, dElev) ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmFacetOppositeSide( int nId, int nFacet, const Vector3d& vtDir, int nRefId,
@@ -704,7 +641,7 @@ ExeSurfTmFacetOppositeSideEx( int nId, int nFacet, const Vector3d& vtDir, int nR
pCrvCompo->ToLoc( frSpec) ;
// ne faccio una copia per usi successivi
PtrOwner<ICurveComposite> pCrvCopy( pCrvCompo->Clone()) ;
// la direzione di riferimento è l'asse X, la sostituisco con quella perpendicolare alla curva più adatta
// la direzione di riferimento è l'asse X, la sostituisco con quella perpendicolare alla curva più adatta
Vector3d vtRef = X_AX ;
double dCosMax = -1 ;
const ICurve* pCrv = pCrvCompo->GetFirstCurve() ;
@@ -897,8 +834,7 @@ ExeExtractSurfTmLoops( int nId, int nDestGrpId, int* pnCount)
//----------------------------------------------------------------------------
int
ExeGetSurfTmSilhouette( int nId, const Vector3d& vtDir, double dToler, int nDestGrpId, int nRefType,
int* pnCount, bool bAllTria)
ExeGetSurfTmSilhouette( int nId, const Vector3d& vtDir, double dToler, int nDestGrpId, int nRefType, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -915,7 +851,7 @@ ExeGetSurfTmSilhouette( int nId, const Vector3d& vtDir, double dToler, int nDest
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frSurf) ;
// recupero i loop come polilinee
POLYLINEVECTOR vPL ;
bOk = bOk && pStm->GetSilhouette( vtDirL, dToler, vPL, bAllTria) ;
bOk = bOk && pStm->GetSilhouette( vtDirL, dToler, vPL) ;
// dalle polilinee creo le curve e le inserisco nel DB
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
@@ -943,110 +879,7 @@ ExeGetSurfTmSilhouette( int nId, const Vector3d& vtDir, double dToler, int nDest
string sLua = "EgtGetSurfTmSilhouette(" + ToString( nId) + ",{" +
ToString( vtDir) + "}," +
ToString( nDestGrpId) + "," +
RefTypeToString( nRefType) + "," +
ToString( bAllTria) + ")" +
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
//----------------------------------------------------------------------------
static int
MyGetSurfTmParSilhouettes( const INTVECTOR& vIds, const Point3d& ptOn, const Vector3d& vtN, const DBLVECTOR& vdDist,
double dToler, int nDestGrpId, int nRefType, int& nCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// inizializzo contatore a valore negativo (errore)
nCount = -1 ;
// se non ci sono superfici o quote di calcolo, non c'è niente da calcolare
if ( vIds.empty() || vdDist.empty())
return GDB_ID_NULL ;
// recupero il riferimento della prima superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( vIds[0], frSurf))
return GDB_ID_NULL ;
// recupero il riferimento di destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return GDB_ID_NULL ;
// recupero le superfici TriMesh e le porto tutte in locale alla prima
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vIds.size()) ;
CISURFTMPVECTOR vpStm ; vpStm.reserve( vIds.size()) ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
vSurfL.emplace_back( pGeomDB, vIds[i], frSurf) ;
if ( vSurfL[i].Get() == nullptr)
return GDB_ID_NULL ;
vpStm.emplace_back( GetSurfTriMesh( vSurfL[i].Get())) ;
}
// porto in locale alla superficie il punto e la normale e ne calcolo un riferimento
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frSurf) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frSurf) ;
Frame3d frPlanes ;
if ( ! frPlanes.Set( ptOnL, vtNL))
return GDB_ID_NULL ;
// recupero i contorni delle varie silhouette
int nFirstId = GDB_ID_NULL ;
int nTempCount = 0 ;
PtrOwner<ICAvParSilhouettesSurfTm> pCavParSilh( CreateCAvParSilhouettesSurfTm()) ;
if ( IsNull( pCavParSilh) || ! pCavParSilh->SetData( vpStm, frPlanes, dToler))
return GDB_ID_NULL ;
for ( auto dDist : vdDist) {
// recupero i loop come polilinee
POLYLINEVECTOR vPL ;
if ( ! pCavParSilh->GetSilhouette( dDist, vPL))
return GDB_ID_NULL ;
// dalle polilinee creo le curve e le inserisco nel DB
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
// creo la curva
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( ! pCrvCompo->FromPolyLine( vPL[i]))
return GDB_ID_NULL ;
// assegno direzione di estrusione
pCrvCompo->SetExtrusion( vtNL) ;
// la porto nel riferimento destinazione
pCrvCompo->LocToLoc( frSurf, frDest) ;
// la inserisco nel DB geometrico
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCrvCompo)) ;
if ( nNewId == GDB_ID_NULL)
return GDB_ID_NULL ;
// copio il materiale
if ( ! pGeomDB->CopyMaterial( vIds[0], nNewId))
return GDB_ID_NULL ;
// aggiorno contatori
if ( nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
++ nTempCount ;
}
}
nCount = nTempCount ;
return nFirstId ;
}
//----------------------------------------------------------------------------
int
ExeGetSurfTmParSilhouettes( const INTVECTOR& vIds, const Point3d& ptOn, const Vector3d& vtN, const DBLVECTOR& vdDist,
double dToler, int nDestGrpId, int nRefType, int* pnCount)
{
// eseguo
int nCount = -1 ;
int nFirstId = MyGetSurfTmParSilhouettes( vIds, ptOn, vtN, vdDist, dToler, nDestGrpId, nRefType, nCount) ;
// aggiorno contatori
if ( nFirstId != GDB_ID_NULL)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtGetSurfTmParSilhouettes({" + ToString( vIds) + "},{" +
ToString( ptOn) + "},{" +
ToString( vtN) + "},{" +
ToString( vdDist) + "}," +
ToString( dToler) + "," +
ToString( nDestGrpId) + "," +
RefTypeToString( nRefType) + ")" +
RefTypeToString( nRefType) + ")" +
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -1115,59 +948,6 @@ ExeExtractSurfTmFacetLoops( int nId, int nFacet, int nDestGrpId, int* pnCount)
return nFirstId ;
}
//----------------------------------------------------------------------------
int
ExeExtractSurfTmTriaLoop( int nId, int nT, int nDestGrpId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return GDB_ID_NULL ;
bool bOk = true ;
// 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 la normale del trinagolo (da usare come estrusione della curva)
Triangle3d tria ; pStm->GetTriangle(nT, tria) ;
Vector3d vtN = tria.GetN() ;
// creo il loop come poliline
PolyLine PL ;
for ( int i = 0 ; i < 3 ; ++i)
PL.AddUPoint( i, tria.GetP(i)) ;
PL.Close() ;
// dalla polilinea creo la curva e la inserisco nel DB
// creo la curva
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
bOk = bOk && pCrvCompo->FromPolyLine( PL) ;
// imposto estrusione
bOk = bOk && pCrvCompo->SetExtrusion( vtN) ;
// 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) ;
// copio il materiale
if ( ! pGeomDB->CopyMaterial( nId, nNewId))
return GDB_ID_NULL ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtExtractSurfTmTriaLoop(" + ToString( nId) + "," +
ToString( nT) + "," +
ToString( nDestGrpId) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCopySurfTmFacet( int nId, int nFacet, int nDestGrpId)
@@ -1250,7 +1030,7 @@ ExeSurfTmGetFacetBBoxGlob( int nId, int nFacet, int nFlag, BBox3d& b3Box)
return false ;
// recupero il riferimento globale del gruppo cui appartiene
Frame3d frGlob ;
if ( ! pGeomDB->GetGlobFrame( nId, frGlob))
if ( nId != GDB_ID_ROOT && ! pGeomDB->GetGroupGlobFrame( pGeomDB->GetParentId( nId), frGlob))
return false ;
// recupero il bounding box della faccia dell'oggetto in globale
return pStm->GetFacetBBox( nFacet, frGlob, b3Box, nFlag) ;
@@ -1268,7 +1048,7 @@ ExeSurfTmGetFacetBBoxRef( int nId, int nFacet, int nFlag, const Frame3d& frRef,
return false ;
// recupero il riferimento globale del gruppo cui appartiene
Frame3d frGlob ;
if ( ! pGeomDB->GetGlobFrame( nId, frGlob))
if ( nId != GDB_ID_ROOT && ! pGeomDB->GetGroupGlobFrame( pGeomDB->GetParentId( nId), frGlob))
return false ;
// porto il riferimento di espressione in quello della superficie
Frame3d frGlobL = frGlob ;
@@ -1277,201 +1057,6 @@ ExeSurfTmGetFacetBBoxRef( int nId, int nFacet, int nFlag, const Frame3d& frRef,
return pStm->GetFacetBBox( nFacet, frGlobL, b3Box, nFlag) ;
}
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetFacetOutlineInfo( int nId, int nFacet, int nRefId,
int& nStatus, BOOLVECTOR& vbOpen, INTVECTOR& vnAdj, DBLVECTOR& vdLen,
PNTVECTOR& vptStart, VCT3DVECTOR& vvtNorm, DBLVECTOR& vdElev)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return false ;
// recupero normale della faccia
Vector3d vtNorm ;
if ( ! pStm->GetFacetNormal( nFacet, vtNorm))
return false ;
// recupero i loop come polilinee
POLYLINEVECTOR vPL ;
if ( ! pStm->GetFacetLoops( nFacet, vPL) || vPL.empty())
return false ;
// calcolo lo stato
if ( vPL.size() == 1)
nStatus = 0 ;
else {
nStatus = -1 ;
for ( int i = 1 ; nStatus == -1 && i < int( vPL.size()) ; ++ i) {
double dIni, dFin ;
Point3d ptIni, ptFin ;
bool bFound = vPL[i].GetFirstULine( &dIni, &ptIni, &dFin, &ptFin) ;
while ( bFound) {
int nAdj = lround( dIni) ;
Vector3d vtNf ;
if ( nAdj >= 0 && pStm->GetFacetNormal( nAdj, vtNf)) {
Vector3d vtTg = ptFin - ptIni ;
vtTg.Normalize() ;
if ( ( vtTg ^ vtNf) * vtNorm > EPS_SMALL) {
nStatus = 1 ;
break ;
}
}
bFound = vPL[i].GetNextULine( &dIni, &ptIni, &dFin, &ptFin) ;
}
}
}
// pulisco e prealloco i vettori del risultato
int nDim = vPL[0].GetLineNbr() ;
vbOpen.clear() ; vbOpen.reserve( nDim) ;
vnAdj.clear() ; vnAdj.reserve( nDim) ;
vdLen.clear() ; vdLen.reserve( nDim) ;
vptStart.clear() ; vptStart.reserve( nDim) ;
vvtNorm.clear() ; vvtNorm.reserve( nDim) ;
vdElev.clear() ; vdElev.reserve( nDim) ;
// recupero riferimento alla lista dei punti
PNTULIST& lstPU = vPL[0].GetUPointList() ;
// ciclo sui lati del loop esterno (il primo)
double dIni, dFin ;
Point3d ptIni, ptFin ;
bool bFound = vPL[0].GetFirstULine( &dIni, &ptIni, &dFin, &ptFin) ;
while ( bFound) {
// faccia adiacente
int nAdj = lround( dIni) ;
// lunghezza lato
double dLen = Dist( ptIni, ptFin) ;
// aperto se senza adiacenza o con faccia adiacente che va da parte negativa (tipo foro)
bool bOpen = true ;
Vector3d vtTg = ptFin - ptIni ;
vtTg.Normalize() ;
Vector3d vtNf ;
if ( nAdj >= 0 && pStm->GetFacetNormal( nAdj, vtNf))
bOpen = ((vtTg ^ vtNf) * vtNorm < EPS_SMALL) ;
// normale al lato (verso interno se chiuso, verso esterno se aperto)
Vector3d vtN = vtTg ;
vtN.Rotate( vtNorm, 0, ( bOpen ? -1 : 1)) ;
// elevazione secondo direzione della normale al lato
double dElev = 0 ;
for ( const auto& PU : lstPU) {
double dDist = ( PU.first - ptIni) * vtN ;
dElev = ( bOpen ? min( dElev, dDist) : max( dElev, dDist)) ;
}
// porto punto iniziale nel riferimento desiderato
TransformPoint( pGeomDB, nId, nRefId, ptIni) ;
// porto normale nel riferimento desiderato
TransformVector( pGeomDB, nId, nRefId, vtN) ;
// inserisco dati nei parametri di ritorno
vbOpen.emplace_back( bOpen) ;
vnAdj.emplace_back( nAdj) ;
vdLen.emplace_back( dLen) ;
vptStart.emplace_back( ptIni) ;
vvtNorm.emplace_back( vtN) ;
vdElev.emplace_back( dElev) ;
// passo al prossimo lato
bFound = vPL[0].GetNextULine( &dIni, &ptIni, &dFin, &ptFin) ;
}
return true ;
}
//----------------------------------------------------------------------------
int
ExeSurfTmGetEdges( int nId, int nDestGrpId, bool bSmoothAng, 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 globale del gruppo cui appartiene
Frame3d frSurf ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
// ne determino gli spigoli
ICURVEPOVECTOR vpCurve ;
bOk = bOk && pStm->GetEdges( vpCurve) ;
// inserisco gli spigoli come curve nel DB
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
for ( int i = 0 ; i < int( vpCurve.size()) ; ++ i) {
// se richiesto, verifico l'angolo tra le facce adiacenti (0=allineate)
if ( bSmoothAng) {
double dAngInt = vpCurve[i]->GetTempParam() ;
if ( abs( dAngInt) < pStm->GetSmoothAngle())
continue ;
}
// lo porto nel riferimento destinazione
bOk = bOk && vpCurve[i]->LocToLoc( frSurf, frDest) ;
// lo inserisco nel DB geometrico
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vpCurve[i])) : GDB_ID_NULL) ;
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
// copio il materiale
bOk = bOk && pGeomDB->CopyMaterial( nId, nNewId) ;
// aggiorno contatori
if ( bOk && nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
if ( bOk)
++ nCount ;
}
if ( ! bOk)
nCount = -1 ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmGetEdges(" + ToString( nId) + ",{" +
ToString( nDestGrpId) + ")" +
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmGetCurvatures( int nId, int nV, double& dK1, Vector3d& vtK1, double& dK2, Vector3d& vtK2)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// Inzializzo i parametri di ritorno
dK1 = 0. ; dK2 = 0. ;
vtK1 = V_NULL ; vtK2 = V_NULL ;
// Recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// Recupero il riferimento globale del gruppo cui appartiene
Frame3d frSurf ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
// Calcolo la Curvatura
bool bPlanar = false ;
Vector3d vtNorm = V_NULL ;
bOk = bOk && pStm->GetCurvature( nV, dK1, vtK1, dK2, vtK2, bPlanar, vtNorm) ;
// Se superficie localmente piana
if ( bPlanar) {
vtK1 = V_NULL ; // Generico vettore parallelo alla superficie (dK1 circa 0.)
vtK2 = V_NULL ; // generico vettore generico parallelo alla superficie e perpendicolare a vtK1 (dK2 circa 0.)
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmGetCurvature(" + ToString( nId) + "," +
ToString( nV) + ")" +
" -- bOk=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// Restituisco il risultato
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfBezierGetPoint( int nSurfId, double dU, double dV, int nRefId, Point3d& ptP)
@@ -1594,7 +1179,7 @@ MySurfBezierGetCurveUV( int nSurfId, bool bIsU, double dPar, int nDestGrpId)
PtrOwner<ICurveComposite> pCrv( bIsU ? pSbz->GetCurveOnU( dPar) : pSbz->GetCurveOnV( dPar)) ;
if ( IsNull( pCrv))
return GDB_ID_NULL ;
// se è una curva
// se è una curva
if ( ! pCrv->IsAPoint()) {
// porto la curva nel riferimento destinazione
pCrv->LocToLoc( frSurf, frDest) ;
@@ -1604,7 +1189,7 @@ MySurfBezierGetCurveUV( int nSurfId, bool bIsU, double dPar, int nDestGrpId)
pGeomDB->CopyMaterial( nSurfId, nNewId) ;
return nNewId ;
}
// altrimenti è collassata in un punto
// altrimenti è collassata in un punto
else {
Point3d ptP ; pCrv->GetStartPoint( ptP) ;
PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ;
@@ -1708,7 +1293,7 @@ MySurfBezierGetControlCurveUV( int nSurfId, bool bIsU, int nInd, int nDestGrpId)
pSbz->GetControlCurveOnU( nInd, PL) ;
else
pSbz->GetControlCurveOnV( nInd, PL) ;
// se è una curva
// se è una curva
if ( PL.GetPointNbr() > 1) {
PtrOwner<ICurveComposite> pCrvCo( CreateCurveComposite()) ;
if ( IsNull( pCrvCo) || ! pCrvCo->FromPolyLine( PL))
@@ -1721,7 +1306,7 @@ MySurfBezierGetControlCurveUV( int nSurfId, bool bIsU, int nInd, int nDestGrpId)
pGeomDB->CopyMaterial( nSurfId, nNewId) ;
return nNewId ;
}
// se altrimenti è collassata in un punto
// se altrimenti è collassata in un punto
else if ( PL.GetPointNbr() == 1) {
Point3d ptP ; PL.GetFirstPoint( ptP) ;
PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ;
@@ -1735,7 +1320,7 @@ MySurfBezierGetControlCurveUV( int nSurfId, bool bIsU, int nInd, int nDestGrpId)
pGeomDB->CopyMaterial( nSurfId, nNewId) ;
return nNewId ;
}
// altrimenti è errore
// altrimenti è errore
else
return GDB_ID_NULL ;
}
@@ -1787,8 +1372,6 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
// recupero la superficie di Bezier
const ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pSbz != nullptr) ;
if( ! bOk)
return GDB_ID_NULL ;
// recupero il riferimento della superficie
Frame3d frSurf ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
@@ -1798,26 +1381,25 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
// richiedo i contorni della superficie e li inserisco nel DB
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
ICRVCOMPOPOVECTOR vCC ;
pSbz->GetLoops( vCC, true) ;
for ( int i = 0 ; i < int( vCC.size()) ; ++i) {
if ( IsNull( vCC[i]) || ! vCC[i]->IsValid())
continue ;
// porto la curva nel riferimento destinazione
bOk = bOk && vCC[i]->LocToLoc(frSurf, frDest) ;
// la inserisco nel DB geometrico
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCC[i])) : GDB_ID_NULL) ;
int nL = 0 ;
PtrOwner<ICurve> pCrv( bOk ? pSbz->GetLoop( nL) : nullptr) ;
while ( ! IsNull( pCrv)) {
// porto la curva nel riferimento destinazione
bOk = bOk && pCrv->LocToLoc( frSurf, frDest) ;
// la inserisco nel DB geometrico
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCrv)) : GDB_ID_NULL) ;
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
// copio il materiale
if ( ! pGeomDB->CopyMaterial( nId, nNewId))
// copio il materiale
if ( ! pGeomDB->CopyMaterial( nId, nNewId))
return GDB_ID_NULL ;
// aggiorno contatori
// aggiorno contatori
if ( bOk && nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
if ( bOk)
++ nCount ;
// passo alla prossima curva
pCrv.Set( bOk ? pSbz->GetLoop( ++nL) : nullptr) ;
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -1831,44 +1413,3 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
*pnCount = nCount ;
return nFirstId ;
}
//----------------------------------------------------------------------------
int
ExeShowSurfBezierControlPoints( int nSrfId, int nDestGrpId, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie di bezier
IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nSrfId) ;
if ( pGeoObj->GetType() != SRF_BEZIER)
return GDB_ID_NULL ;
// recupero il riferimento della superficie
Frame3d frSurf ;
bool bOk = true ;
bOk = bOk && pGeomDB->GetGlobFrame( nSrfId, frSurf) ;
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
if ( ! bOk)
return GDB_ID_NULL ;
int nDegU = - 1, nDegV = - 1, nSpanU = - 1, nSpanV = - 1 ;
bool bRat = false, bTrimmed = false ;
ISurfBezier* pSrfBez = GetSurfBezier( pGeoObj) ;
pSrfBez->GetInfo( nDegU, nDegV, nSpanU, nSpanV, bRat, bTrimmed) ;
int nFirstId = -1 ;
int nCount = 0 ;
for ( int i = 0 ; i < (nDegU * nSpanU + 1) * ( nDegV * nSpanV + 1) ; ++i) {
IGeoPoint3d* pGeoPt( CreateGeoPoint3d()) ;
pGeoPt->Set( pSrfBez->GetControlPoint( i, &bOk)) ;
pGeoPt->LocToLoc( frSurf, frDest) ;
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pGeoPt) ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nId ;
if ( nId != GDB_ID_NULL)
++nCount ;
}
// restituisco i risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
+2 -2
View File
@@ -250,8 +250,8 @@ ExeVolZmapGetEdges( int nId, int nDestGrpId, int* pnCount)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapGetEdges(" + ToString( nId) + ",{" +
ToString( nDestGrpId) + ")" +
string sLua = "EgtGetSurfTmSilhouette(" + ToString( nId) + ",{" +
ToString( nDestGrpId) + ")" +
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
+46 -929
View File
File diff suppressed because it is too large Load Diff
+42 -504
View File
@@ -23,16 +23,14 @@
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMeshAux.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDev/Include/EGkCAvSimpleSurfFrMove.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkSubtractProjectedFacesOnStmFace.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
//----------------------------------------------------------------------------
@@ -77,7 +75,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
return GDB_ID_NULL ;
// recupero il numero di componenti connesse
int nParts = pStm->GetPartCount() ;
// se ci sono più parti, separo queste
// se ci sono più parti, separo queste
if ( nParts > 1) {
int nFirstId = GDB_ID_NULL ;
nCount = 0 ;
@@ -102,36 +100,9 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
// restituisco risultati
return nFirstId ;
}
// recupero il numero di gusci
int nShells = pStm->GetShellCount() ;
// se ci sono più gusci, separo questi
if ( nShells > 1) {
int nFirstId = GDB_ID_NULL ;
nCount = 0 ;
for ( int i = 0 ; i < nShells ; ++ i) {
ISurfTriMesh* pFac = pStm->CloneShell( i) ;
if ( pFac == nullptr)
continue ;
// inserisco la superficie nello stesso gruppo e nello stesso posto del GeomDB
int nNewId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, pFac) ;
if ( nNewId == GDB_ID_NULL)
return GDB_ID_NULL ;
// copio gli attributi
if ( ! pGeomDB->CopyAttributes( nId, nNewId))
return GDB_ID_NULL ;
// aggiorno contatori
if ( nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
++ nCount ;
}
// elimino la superficie originale
pGeomDB->Erase( nId) ;
// restituisco risultati
return nFirstId ;
}
// recupero il numero di facce
int nFacets = pStm->GetFacetCount() ;
// se ci sono più facce, separo queste
// se ci sono più facce, separo queste
if ( nFacets > 1) {
// copio tutte le facce
int nFirstId = GDB_ID_NULL ;
@@ -157,7 +128,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
// restituisco risultati
return nFirstId ;
}
// non devo fare alcunché
// non devo fare alcunché
nCount = 1 ;
return nId ;
}
@@ -174,7 +145,7 @@ MyExplodeSurfFlatRegion( int nId, int& nCount)
return GDB_ID_NULL ;
// recupero il numero di componenti connessi (chunk)
int nChunk = pSfr->GetChunkCount() ;
// se c'è un solo componente, non devo fare alcunché
// se c'è un solo componente, non devo fare alcunché
if ( nChunk == 1) {
nCount = 1 ;
return nId ;
@@ -236,7 +207,7 @@ ExeExplodeSurface( int nId, int* pnCount)
//-------------------------------------------------------------------------------
bool
ExeApproxSurface( int nId, double dLinTol, double dTriaMinSide)
ExeApproxSurface( int nId, double dLinTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -257,7 +228,8 @@ ExeApproxSurface( int nId, double dLinTol, double dTriaMinSide)
else if ( nType == SRF_BEZIER) {
// recupero la superficie ausiliaria della Bezier
const ISurfBezier* pSbez = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
pStm.Set( ( pSbez != nullptr ? pSbez->GetApproxSurf( dLinTol, dTriaMinSide) : nullptr)) ;
const ISurfTriMesh* pAuxSurf = ( pSbez != nullptr ? pSbez->GetAuxSurf() : nullptr) ;
pStm.Set( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ;
}
bool bOk = ( ! IsNull( pStm)) ;
// semplificazione della trimesh
@@ -268,8 +240,7 @@ ExeApproxSurface( int nId, double dLinTol, double dTriaMinSide)
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtApproxSurf(" + ToString( nId) + "," +
ToString( dLinTol) + "," +
ToString( dTriaMinSide) + ")" +
ToString( dLinTol) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -323,8 +294,8 @@ ExeSurfFrSubtract( int nId1, int nId2)
bOk = bOk && ( pSfr2L != nullptr) ;
// eseguo la sottrazione della seconda superficie dalla prima
bOk = bOk && pSfr1->Subtract( *pSfr2L) ;
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr1->IsValid())
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr1->IsValid())
pGeomDB->Erase( nId1) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
@@ -355,8 +326,8 @@ ExeSurfFrIntersect( int nId1, int nId2)
bOk = bOk && ( pSfr2L != nullptr) ;
// eseguo l'intersezione tra le due superfici
bOk = bOk && pSfr1->Intersect( *pSfr2L) ;
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr1->IsValid())
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr1->IsValid())
pGeomDB->Erase( nId1) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
@@ -380,8 +351,8 @@ ExeSurfFrOffset( int nId, double dDist, int nType)
bool bOk = ( pSfr != nullptr) ;
// eseguo l'offset
bOk = bOk && pSfr->Offset( dDist, nType) ;
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr->IsValid())
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr->IsValid())
pGeomDB->Erase( nId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
@@ -395,58 +366,6 @@ ExeSurfFrOffset( int nId, double dDist, int nType)
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfFrOffsetAdv( int nId, double dDist, int nType, int& nNewId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie FlatRegion
ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pSfr == nullptr)
return false ;
// eseguo l'offset
PtrOwner<ISurfFlatRegion> pSfrOffs( pSfr->CreateOffsetSurf( dDist, nType)) ;
if ( IsNull( pSfrOffs))
return false ;
// salvo la superficie di offset
nNewId = GDB_ID_NULL ;
if ( pSfr->GetChunkCount() > 0) {
// inserisco nel DB geometrico
nNewId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_AFTER, Release( pSfrOffs)) ;
// copio gli attributi
pGeomDB->CopyAttributes( nId, nNewId) ;
ExeSetModified() ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
ExeSurfFrEraseChunk( int nId, int nChunk)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie FlatRegion
ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pSfr == nullptr)
return false ;
// elimino il chunk indicato
bool bOk = pSfr->EraseChunk( nChunk) ;
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr->IsValid())
pGeomDB->Erase( nId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfFrEraseChunk(" + ToString( nId) + "," +
ToString( nChunk) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, int nRefType)
@@ -496,11 +415,11 @@ bool
ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType, bool bUpdate)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero il riferimento in cui è immersa la superficie
// recupero il riferimento in cui è immersa la superficie
Frame3d frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
// eseguo la modifica
@@ -528,50 +447,6 @@ ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType,
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeSurfTmMoveFacet( int nId, int nFacet, const Vector3d& vtMove, int nRefType, bool bUpdate)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero il riferimento in cui è immersa la superficie
Frame3d frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
// porto in locale il movimento
Vector3d vtMoveL = GetVectorLocal( pGeomDB, vtMove, nRefType, frStm) ;
// recupero tutti i vertici della faccia
INTVECTOR vVert ;
bOk = bOk && pStm->GetAllVertInFacet( nFacet, vVert) ;
// sposto tutti i vertici della faccia della quantità desiderata
if ( bOk) {
for ( const auto nVert : vVert) {
// recupero la posizione originale del vertice
Point3d ptV ;
if ( pStm->GetVertex( nVert, ptV))
pStm->MoveVertex( nVert, ptV + vtMoveL) ;
}
}
// se richiesto, semplificazione della trimesh
if ( bUpdate)
bOk = bOk && pStm->DoCompacting() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmMoveFacet(" + IdToString( nId) + "," +
ToString( nFacet) + ",{" +
ToString( vtMove) + "}," +
RefTypeToString( nRefType) + "," +
( bUpdate ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-------------------------------------------------------------------------------
static int
MySurfTmToTriangles( int nId, int& nCount)
@@ -584,7 +459,7 @@ MySurfTmToTriangles( int nId, int& nCount)
return GDB_ID_NULL ;
// recupero il numero di triangoli
int nTria = pStm->GetTriangleCount() ;
// se ci sono più triangoli, li separo
// se ci sono più triangoli, li separo
if ( nTria > 1) {
// copio tutti triangoli
int nFirstId = GDB_ID_NULL ;
@@ -610,7 +485,7 @@ MySurfTmToTriangles( int nId, int& nCount)
// restituisco risultati
return nFirstId ;
}
// non devo fare alcunché
// non devo fare alcunché
nCount = 1 ;
return nId ;
}
@@ -825,7 +700,7 @@ ExeSurfTmSubtract( int nId1, int nId2, bool bTwoColors)
bOk = bOk && ( pStm2L != nullptr) ;
// eseguo la sottrazione tra le due superfici
bOk = bOk && pStm1->Subtract( *pStm2L) ;
// se il risultato vuoto, cancello la superficie
// se il risultato è vuoto, cancello la superficie
if ( bOk && ! pStm1->IsValid()) {
pGeomDB->Erase( nId1) ;
pStm1 = nullptr ;
@@ -862,7 +737,7 @@ ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors)
bOk = bOk && ( pStm2L != nullptr) ;
// eseguo l'intersezione tra le due superfici
bOk = bOk && pStm1->Intersect( *pStm2L) ;
// se il risultato vuoto, cancello la superficie
// se il risultato è vuoto, cancello la superficie
if ( bOk && ! pStm1->IsValid()) {
pGeomDB->Erase( nId1) ;
pStm1 = nullptr ;
@@ -881,6 +756,27 @@ ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors)
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmResetTwoColors( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// reset dei flag sui triangoli per i due colori
bOk = bOk && pStm->ResetTFlags() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmResetTwoColors(" + ToString( nId) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
static ISurfTriMesh*
MyCreateSubSurfTm( const ISurfTriMesh* pStm, const INTVECTOR& vTria, const INTVECTOR& vTria2)
@@ -1028,361 +924,3 @@ ExeSurfTmCut( int nId, int nCutterId, bool bInVsOut, bool bSaveOnEq)
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmSubtractProjectedFacesOnFace( int nSurfId, int nFaceInd, int nDestGrpId,
INTVECTOR vSurfsId, bool bOCFlag,
bool& bExistProjection, int& nNewId, int& nNewFaceNbr)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh su cui proiettare
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
if ( pStm == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nSurfId, frSurf))
return false ;
// recupero il riferimento del gruppo di destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return false ;
// costruzione vettori di superfici e indici delle facce per proiezione
ISURFTMPOVECTOR vpStmOthers ;
vector<SurfLocal> vSurfCLoc ;
// recupero le altre superfici e le porto nel sistema di riferimento della prima
for ( int i = 0 ; i < int( vSurfsId.size()) ; ++ i) {
if ( pGeomDB->GetGeoType( vSurfsId[i]) != SRF_TRIMESH)
return false ;
vSurfCLoc.emplace_back( pGeomDB, vSurfsId[i], frSurf) ;
const ISurfTriMesh* pStmCurr = GetSurfTriMesh( vSurfCLoc.back().Get()) ;
vpStmOthers.emplace_back( pStmCurr->Clone()) ;
}
// eseguo la proiezione
ISurfTriMesh* pStmRes = nullptr ;
bool bOk = SubtractProjectedFacesOnStmFace( *pStm, nFaceInd, vpStmOthers, bOCFlag,
bExistProjection, pStmRes, nNewFaceNbr) ;
if ( ! bOk) {
delete( pStmRes) ;
pStmRes = nullptr ;
}
nNewId = GDB_ID_NULL ;
if ( bOk && pStmRes != nullptr) {
// porto nel sistema di riferimento destinazione
pStmRes->LocToLoc( frSurf, frDest) ;
// la inserisco nel DB geometrico
nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pStmRes) ;
if ( nNewId == GDB_ID_NULL)
return false ;
ExeSetModified() ;
}
if ( IsCmdLog()) {
string sLua = "EgtSubtractProjectedFacesOnStmFace(" + ToString( nSurfId) + "," +
ToString( nFaceInd) + "," +
ToString( nDestGrpId) + "," +
ToString( vSurfsId) + "," +
ToString( bOCFlag) + ")" +
" -- Ok=" + ToString( bOk) + " Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmSetFaceColor( int nId, int nFacet, int nColor)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero tutti i triangoli della faccia e imposto il flag opportuno per il colore
INTVECTOR vTria ;
bOk = bOk && pStm->GetAllTriaInFacet( nFacet, vTria) ;
for ( const auto nT : vTria)
pStm->SetTFlag( nT, nColor) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmSetFaceColor(" + ToString( nId) + "," +
ToString( nFacet) + "," +
ToString( nColor) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmGetTriaColor( int nId, int nTria, int& nColor)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero il colore del triangolo
return ( bOk && pStm->GetTFlag( nTria, nColor)) ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmResetTwoColors( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// reset dei flag sui triangoli per i due colori
bOk = bOk && pStm->ResetTFlags() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmResetTwoColors(" + ToString( nId) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmSetShowEdges( int nId, bool bShow)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// imposto lo stato di visualizzazione degli spigoli vivi
if ( bOk)
pStm->SetShowEdges( bShow) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmSetShowEdges(" + ToString( nId) + "," +
ToString( bShow) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmGetShowEdges( int nId, bool& bShow)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero lo stato di visualizzazione degli spigoli vivi
bShow = ( bOk && pStm->GetShowEdges()) ;
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmSetSmoothAng( int nId, double dAngDeg)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimseh da trimmare
ISurfTriMesh* pSrfTm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pSrfTm == nullptr)
return false ;
pSrfTm->SetSmoothAngle( dAngDeg) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmSetSmoothAng(" + ToString( nId) + "," +
ToString( dAngDeg) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return true ;
}
//----------------------------------------------------------------------------
static double
GetStmOffsPrec( double dOffs, double dLinTol)
{
return max( min( abs( dOffs) / 4, 100 * max( dLinTol, EPS_SMALL)), 0.5) ;
}
//----------------------------------------------------------------------------
int
ExeSurfTmOffset( int nParentId, const INTVECTOR& vStmIds, double dOffs, double dLinTol, int nType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// se non ci sono superfici non c'è niente da calcolare
if ( vStmIds.empty())
return GDB_ID_NULL ;
// recupero il riferimento del gruppo di inserimento
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero le superfici TriMesh e le porto tutte in locale
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vStmIds.size()) ;
CISURFTMPVECTOR vpStm ; vpStm.reserve( vStmIds.size()) ;
for ( int i = 0 ; i < int( vStmIds.size()) ; ++ i) {
vSurfL.emplace_back( pGeomDB, vStmIds[i], frLoc) ;
if ( vSurfL[i].Get() == nullptr)
return GDB_ID_NULL ;
vpStm.emplace_back( GetSurfTriMesh( vSurfL[i].Get())) ;
}
// precisione per Tridexel in funzione dell'offset e della tolleranza lineare
double dPrec = GetStmOffsPrec( dOffs, dLinTol) ;
// recupero la superficie risultante
PtrOwner<ISurfTriMesh> pStmOffs( CreateSurfTriMeshesOffset( vpStm, dOffs, dPrec, nType)) ;
bool bOk = ( ! IsNull( pStmOffs) && pStmOffs->IsValid()) ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmOffs)) : GDB_ID_NULL) ;
// copio gli attributi
pGeomDB->CopyAttributes( vStmIds[0], nId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmOffset(" + ToString( nParentId) + ")" +
ToString( vStmIds) + "," +
ToString( dOffs) + "," +
ToString( dLinTol) + "," +
ToString( nType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeSurfTmThickeningOffset( int nParentId, const INTVECTOR& vStmIds, double dOffs, double dLinTol, int nType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// se non ci sono superfici non c'è niente da calcolare
if ( vStmIds.empty())
return GDB_ID_NULL ;
// recupero il riferimento del gruppo di inserimento
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero le superfici TriMesh e le porto tutte in locale
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vStmIds.size()) ;
CISURFTMPVECTOR vpStm ; vpStm.reserve( vStmIds.size()) ;
for ( int i = 0 ; i < int( vStmIds.size()) ; ++ i) {
vSurfL.emplace_back( pGeomDB, vStmIds[i], frLoc) ;
if ( vSurfL[i].Get() == nullptr)
return GDB_ID_NULL ;
vpStm.emplace_back( GetSurfTriMesh( vSurfL[i].Get())) ;
}
// precisione per Tridexel in funzione dell'offset e della tolleranza lineare
double dPrec = GetStmOffsPrec( dOffs, dLinTol) ;
// recupero la superficie risultante
PtrOwner<ISurfTriMesh> pStmOffs( CreateSurfTriMeshesThickeningOffset( vpStm, dOffs, dPrec, nType)) ;
bool bOk = ( ! IsNull( pStmOffs) && pStmOffs->IsValid()) ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmOffs)) : GDB_ID_NULL) ;
// copio gli attributi
pGeomDB->CopyAttributes( vStmIds[0], nId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmThickeningOffset(" + ToString( nParentId) + ")" +
ToString( vStmIds) + "," +
ToString( dOffs) + "," +
ToString( dLinTol) + "," +
ToString( nType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return nId ;
}
//-------------------------------------------------------------------------------
bool
ExeCutSurfBzPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSaveOnEq, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pSbz != nullptr) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale il punto e la normale del piano
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
// calcolo il piano di taglio
Plane3d plPlane ;
bOk = bOk && plPlane.Set( ptOnL, vtNL) ;
// eseguo il taglio
bOk = bOk && pSbz->Cut( plPlane, bSaveOnEq) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCutSurfBzPlane(" + IdToString( nId) + ",{" +
ToString( ptOn) + "},{" +
ToString( vtN) + "}," +
( bSaveOnEq ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//----------------------------------------------------------------------------
static bool
MySurfBzTrim( int nId, int nTrimmerId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie Bezier da trimmare
ISurfBezier* pSrfBz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
if ( pSrfBz == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nId, frSurf))
return false ;
// recupero la superficie TriMesh divisore in locale alla prima
SurfLocal SurfCLoc( pGeomDB, nTrimmerId, frSurf) ;
//const ISurfTriMesh* pStmCLoc = GetSurfTriMesh( SurfCLoc) ;
const ISurfFlatRegion* pSrfFr = GetSurfFlatRegion( SurfCLoc) ;
if ( pSrfFr == nullptr)
return false ;
PtrOwner<ISurfFlatRegion> pSrfFrCopy( pSrfFr->Clone()) ;
if ( ! pSrfFr->GetNormVersor().IsZplus())
pSrfFrCopy->Invert() ;
// eseguo il taglio
return pSrfBz->SetTrimRegion( *pSrfFrCopy) ;
}
//----------------------------------------------------------------------------
bool
ExeSurfBzTrim( int nId, int nCutterId)
{
bool bOk = MySurfBzTrim( nId, nCutterId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfBzCut(" + ToString( nId) + "," +
ToString( nCutterId) + "," +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
+3 -79
View File
@@ -104,9 +104,10 @@ ExeVolZmapChangeResolution( int nId, int nNewRes)
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pVZM != nullptr) ;
if ( pVZM == nullptr)
return false ;
// cambio la risoluzione (rapporto Voxel/Dexel, valori ammessi 1 e 2)
bOk = bOk && pVZM->ChangeResolution( nNewRes) ;
bool bOk = pVZM->ChangeResolution( nNewRes) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -119,29 +120,6 @@ ExeVolZmapChangeResolution( int nId, int nNewRes)
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapSetShowEdges( int nId, bool bShow)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pVZM != nullptr) ;
// imposto lo stato di visualizzazione degli spigoli vivi
if ( bOk)
pVZM->SetShowEdges( bShow) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapSetShowEdges(" + ToString( nId) + "," +
ToString( bShow) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeRemoveVolZmapPart( int nId, int nPart)
@@ -337,34 +315,6 @@ ExeVolZmapSetChiselTool( const INTVECTOR& vIds, const string& sToolName,
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapSetAdditiveTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dDiam, double dCornR, int nFlag, bool bFirst)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero gli Zmap e assegno i dati dell'utensile
bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( bOk && pVZM != nullptr && pVZM->SetAdditiveTool( sToolName, dLen, dDiam / 2, dCornR, nFlag, bFirst)) ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapSetAdditiveTool({" + IdListToString( vIds) + "}," +
sToolName + "," +
ToString( dLen) + "," +
ToString( dDiam) + "," +
ToString( dCornR) + "," +
ToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapResetTools( const INTVECTOR& vIds)
@@ -535,29 +485,3 @@ ExeCutVolZmapPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, int nRefT
// restituisco risultato
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZMapOffset( int nId, double dDist, int nType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVolZmap = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pVolZmap != nullptr) ;
// eseguo l'offset
bOk = bOk && pVolZmap->Offset( dDist, nType) ;
// se il risultato è vuoto, cancello lo Zmap
if ( bOk && ! pVolZmap->IsValid())
pGeomDB->Erase( nId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapOffset(" + ToString( nId) + "," +
ToString( dDist) + "," +
ToString( nType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
+10 -106
View File
@@ -38,56 +38,13 @@ ExeCopyAttributes( int nSouId, int nDestId)
//-----------------------------------------------------------------------------
bool
ExeSetLevel( const INTVECTOR& vIds, int nLevel)
ExeSetLevel( int nId, int nLevel)
{
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 ( int i = 0 ; i < ssize( vIds) && bOk ; ++ i) {
// impostazione livello
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
while ( nId != GDB_ID_NULL) {
// imposto il livello
if ( ! pGeomDB->SetLevel( nId, nLevel))
bOk = false ;
// se nascosto pezzo corrente o layer corrente
if ( nLevel != GDB_LV_USER) {
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
bool bPrevCmdLog = SetCmdLog( false) ;
if ( bCurrPartOff)
ExeResetCurrPartLayer() ;
else if ( bCurrLayerOff)
ExeSetCurrPartLayer( nCurrPartId, ExeGetFirstLayer( nCurrPartId, true)) ;
SetCmdLog( bPrevCmdLog) ;
// dichiaro progetto modificato
// imposto il livello
bool bOk = pGeomDB->SetLevel( nId, nLevel) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLevel = "GDB_LV.USER" ;
if ( nLevel == GDB_LV_SYSTEM)
sLevel = "GDB_LV.SYSTEM" ;
else if ( nLevel == GDB_LV_TEMP)
sLevel = "GDB_LV.TEMP" ;
string sLua = "EgtSetLevel({" + IdListToString( vIds) + "}," +
sLevel + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
@@ -131,56 +88,13 @@ ExeGetCalcLevel( int nId, int* pnLevel)
//-----------------------------------------------------------------------------
bool
ExeSetMode( const INTVECTOR& vIds, int nMode)
ExeSetMode( int nId, int nMode)
{
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 ( int i = 0 ; i < ssize( vIds) && bOk ; ++ i) {
// impostazione livello
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
while ( nId != GDB_ID_NULL) {
// imposto il modo
if ( ! pGeomDB->SetMode( nId, nMode))
bOk = false ;
// se nascosto pezzo corrente o layer corrente
if ( nMode != GDB_MD_STD) {
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
bool bPrevCmdLog = SetCmdLog( false) ;
if ( bCurrPartOff)
ExeResetCurrPartLayer() ;
else if ( bCurrLayerOff)
ExeSetCurrPartLayer( nCurrPartId, ExeGetFirstLayer( nCurrPartId, true)) ;
SetCmdLog( bPrevCmdLog) ;
// dichiaro progetto modificato
// imposto il modo
bool bOk = pGeomDB->SetMode( nId, nMode) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sMode = "GDB_MD.STD" ;
if ( nMode == GDB_MD_LOCKED)
sMode = "GDB_MD.LOCKED" ;
else if ( nMode == GDB_MD_HIDDEN)
sMode = "GDB_MD.HIDDEN" ;
string sLua = "EgtSetMode({" + IdListToString( vIds) + "}," +
sMode + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
@@ -235,11 +149,11 @@ ExeSetStatus( const INTVECTOR& vIds, int nStat)
int nCurrLayerId = ExeGetCurrLayer() ;
// ciclo sul vettore degli identificativi
bool bOk = true ;
for ( int i = 0 ; i < ssize( vIds) && bOk ; ++ i) {
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 lo stato
// imposto il modo
if ( ! pGeomDB->SetStatus( nId, nStat))
bOk = false ;
// se nascosto pezzo corrente o layer corrente
@@ -318,12 +232,12 @@ ExeGetCalcStatus( int nId, int* pnStat)
//-----------------------------------------------------------------------------
bool
ExeSetMark( int nId, int nMark)
ExeSetMark( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// imposto l'evidenziazione
bool bOk = pGeomDB->SetMark( nId, nMark) ;
bool bOk = pGeomDB->SetMark( nId) ;
// non produce modifica perchè mark ignorato in salvataggio
return bOk ;
}
@@ -912,13 +826,3 @@ ExeGetTextureFrame( int nId, int nRefId, Frame3d& frTxrRef)
// gestione trasformazione ( eventuale)
return TransformFrame( pGeomDB, nId, nRefId, frTxrRef) ;
}
//-----------------------------------------------------------------------------
bool
ExeSetStipple( int nId, int nFactor, int nPattern)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// setto stipple
return pGeomDB->SetStipple( nId, nFactor, nPattern) ;
}
+40 -117
View File
@@ -15,10 +15,8 @@
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "GeoTools.h"
#include "AuxTools.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkMultiGeomDB.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkUiUnits.h"
#include "/EgtDev/Include/EgtStringConverter.h"
@@ -220,43 +218,6 @@ ExeGetPrevName( int nId, const string& sName)
return pGeomDB->GetPrevName( nId, sName) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetNameInGroup( int nGroupId, const string& sName, INTVECTOR& vIds)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
if ( ! pGeomDB->ExistsObj( nGroupId))
return false ;
// recupero gli oggetti con il nome desiderato
vIds.clear() ;
int nId = pGeomDB->GetFirstNameInGroup( nGroupId, sName) ;
while ( nId != GDB_ID_NULL) {
vIds.push_back( nId) ;
nId = pGeomDB->GetNextName( nId, sName) ;
}
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeGetInfoInGroup( int nGroupId, const string& sKey, INTVECTOR& vIds)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
if ( ! pGeomDB->ExistsObj( nGroupId))
return false ;
// recupero gli oggetti con l'info desiderata
vIds.clear() ;
int nId = pGeomDB->GetFirstInGroup( nGroupId) ;
while ( nId != GDB_ID_NULL) {
if ( pGeomDB->ExistsInfo( nId, sKey))
vIds.push_back( nId) ;
nId = pGeomDB->GetNext( nId) ;
}
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeGetBBox( int nId, int nFlag, BBox3d& b3Box)
@@ -293,7 +254,6 @@ ExeCopy( int nSouId, int nRefId, int nSonBeforeAfter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nRefId = AdjustId( nRefId) ;
// eseguo la copia
int nNewId = pGeomDB->Copy( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
pGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
@@ -301,39 +261,16 @@ ExeCopy( int nSouId, int nRefId, int nSonBeforeAfter)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCopy(" + ToString( nSouId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nNewId ;
}
//-----------------------------------------------------------------------------
int
ExeCopyEx( int nSouCtx, int nSouId, int nDestCtx, int nRefId, int nSonBeforeAfter)
{
// recupero i due GeomDB
IGeomDB* pSouGeomDB = GetGeomDB( nSouCtx) ;
VERIFY_GEOMDB( pSouGeomDB, GDB_ID_NULL)
IGeomDB* pDstGeomDB = GetGeomDB( nDestCtx) ;
VERIFY_GEOMDB( pDstGeomDB, GDB_ID_NULL)
// risolvo l'Id di riferimento per destinazione
nRefId = AdjustId( nRefId, nDestCtx) ;
// eseguo la copia
int nNewId = Copy( pSouGeomDB, nSouId, pDstGeomDB, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_DUPLIST) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCopyEx(" + ToString( nSouCtx) + "," +
ToString( nSouId) + "," +
ToString( nDestCtx) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
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
@@ -346,7 +283,6 @@ ExeCopyGlob( int nSouId, int nRefId, int nSonBeforeAfter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nRefId = AdjustId( nRefId) ;
// eseguo la copia mantenendo la posizione in globale
int nNewId = pGeomDB->CopyGlob( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
pGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
@@ -354,39 +290,16 @@ ExeCopyGlob( int nSouId, int nRefId, int nSonBeforeAfter)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nNewId ;
}
//-----------------------------------------------------------------------------
int
ExeCopyGlobEx( int nSouCtx, int nSouId, int nDestCtx, int nRefId, int nSonBeforeAfter)
{
// recupero i due GeomDB
IGeomDB* pSouGeomDB = GetGeomDB( nSouCtx) ;
VERIFY_GEOMDB( pSouGeomDB, GDB_ID_NULL)
IGeomDB* pDstGeomDB = GetGeomDB( nDestCtx) ;
VERIFY_GEOMDB( pDstGeomDB, GDB_ID_NULL)
// risolvo l'Id di riferimento per destinazione
nRefId = AdjustId( nRefId, nDestCtx) ;
// eseguo la copia
int nNewId = CopyGlob( pSouGeomDB, nSouId, pDstGeomDB, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_DUPLIST) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCopyGlobEx(" + ToString( nSouCtx) + "," +
ToString( nSouId) + "," +
ToString( nDestCtx) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
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
@@ -399,16 +312,21 @@ ExeRelocate( int nSouId, int nRefId, int nSonBeforeAfter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
nRefId = AdjustId( nRefId) ;
// eseguo la rilocazione
bool bOk = pGeomDB->Relocate( nSouId, nRefId, nSonBeforeAfter) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtRelocate(" + ToString( nSouId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Ok=" + ToString( bOk) ;
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
@@ -421,16 +339,21 @@ ExeRelocateGlob( int nSouId, int nRefId, int nSonBeforeAfter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
nRefId = AdjustId( nRefId) ;
// 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 = "EgtRelocateGlob(" + ToString( nSouId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Ok=" + ToString( bOk) ;
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
+14 -150
View File
@@ -344,26 +344,6 @@ ExeGetPrevLayer( int nId, bool bOnlyVisible)
return ExeVerifyOrPrev( pGeomDB, nLayerId, bOnlyVisible) ;
}
//-------------------------------------------------------------------------------
bool
ExeIsGhostPart( int nGhostId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico sia il segnaposto di un pezzo (Ghost)
if ( pGeomDB->GetGdbType( nGhostId) == GDB_TY_GROUP &&
pGeomDB->GetParentId( nGhostId) == GDB_ID_ROOT &&
ExeIsSystemObj( pGeomDB, nGhostId) &&
pGeomDB->ExistsInfo( nGhostId, GDB_SI_SOURCE)) {
int nPartId = GDB_ID_NULL ;
pGeomDB->GetInfo( nGhostId, GDB_SI_SOURCE, nPartId) ;
int nRawId = pGeomDB->GetParentId( nPartId) ;
if ( ExeIsRawPart( nRawId))
return true ;
}
return false ;
}
//-------------------------------------------------------------------------------
int
ExeGetFirstGhostPart( void)
@@ -697,32 +677,6 @@ IsPartForDuplo( IGeomDB* pGeomDB, int nPartId)
return false ;
}
//-----------------------------------------------------------------------------
static bool
IsDuplo( IGeomDB* pGeomDB, int nDupId, bool& bInDuploGroup)
{
// verifica collegamento a DB geometrico
if ( pGeomDB == nullptr)
return false ;
// Recupero il gruppo base dei duplicati
int nDuploBaseId = GetDuploBase( pGeomDB) ;
if ( nDuploBaseId == GDB_ID_NULL)
return false ;
// Verifico sia un duplicato (gruppo sotto quello dei duplicati con riferimento a originale)
int nBaseId ;
if ( pGeomDB->GetGdbType( nDupId) == GDB_TY_GROUP && pGeomDB->ExistsInfo( nDupId, GDB_SI_DUPSOU)) {
if ( pGeomDB->GetParentId( nDupId) == nDuploBaseId) {
bInDuploGroup = true ;
return true ;
}
else if ( pGeomDB->GetInfo( nDupId, GDB_SI_BASE, nBaseId) && pGeomDB->GetParentId( nBaseId) == nDuploBaseId) {
bInDuploGroup = false ;
return true ;
}
}
return false ;
}
//-----------------------------------------------------------------------------
int
ExeDuploNew( int nSouId)
@@ -775,8 +729,7 @@ ExeDuploCount( int nSouId, int& nCount)
// Conto i reali duplo
nCount = 0 ;
for ( int i = 0 ; i < int( vnRef.size()) ; ++ i) {
bool bInDuploGroup ;
if ( IsDuplo( pGeomDB, vnRef[i], bInDuploGroup))
if ( ExeIsDuplo( vnRef[i]))
++ nCount ;
}
return true ;
@@ -801,105 +754,6 @@ ExeDuploList( int nSouId, INTVECTOR& vnRef)
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeDuploInRawCount( int nSouId, int& nCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Verifico sia un pezzo
if ( ! IsPartForDuplo( pGeomDB, nSouId))
return false ;
// Recupero info del sorgente
INTVECTOR vnRef ;
pGeomDB->GetInfo( nSouId, GDB_SI_DUPLIST, vnRef) ;
// Conto i reali duplo che sono riferiti o che stanno in un grezzo
nCount = 0 ;
for ( int i = 0 ; i < int( vnRef.size()) ; ++ i) {
// verifico sia un duplo
int nDupId = vnRef[i] ;
bool bInDuploGroup ;
if ( ! IsDuplo( pGeomDB, nDupId, bInDuploGroup))
continue ;
// se nel gruppo dei duplo
if ( bInDuploGroup) {
// verifico sia incluso in un grezzo di un gruppo di lavoro
INTVECTOR vnRef ;
if ( ! pGeomDB->GetInfo( nDupId, GDB_SI_LIST, vnRef))
continue ;
for ( auto& nId : vnRef) {
// verifico esista
if ( ! pGeomDB->ExistsObj( nId))
continue ;
// verifico sia in un grezzo (previsto solo in uno come massimo)
int nMachGrpId = pGeomDB->GetParentId( pGeomDB->GetParentId( pGeomDB->GetParentId( nId))) ;
string sMachGrpName ;
if ( ExeGetMachGroupName( nMachGrpId, sMachGrpName)) {
++ nCount ;
break ;
}
}
}
// se in altro gruppo
else {
// verifico se incluso nel grezzo del gruppo di lavoro corrente (previsto solo in un gruppo)
if ( ExeIsRawPart( pGeomDB->GetParentId( nDupId)))
++ nCount ;
}
}
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeDuploWithoutRawList( INTVECTOR& vnDup)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Reset del risultato
vnDup.clear() ;
// Recupero gruppo dei duplo
int nDuploBaseId = GetDuploBase( pGeomDB) ;
if ( nDuploBaseId == GDB_ID_NULL)
return true ;
// Ciclo sui duplo
for ( int nDuploId = pGeomDB->GetFirstGroupInGroup( nDuploBaseId) ;
nDuploId != GDB_ID_NULL ;
nDuploId = pGeomDB->GetNextGroup( nDuploId)) {
// se marcatore
if ( pGeomDB->ExistsInfo( nDuploId, GDB_SI_SOURCE)) {
int nPartId = GDB_ID_NULL ;
pGeomDB->GetInfo( nDuploId, GDB_SI_SOURCE, nPartId) ;
int nMachGrpId = pGeomDB->GetParentId( pGeomDB->GetParentId( pGeomDB->GetParentId( nPartId))) ;
string sMachGrpName ;
if ( pGeomDB->ExistsInfo( nPartId, GDB_SI_DUPSOU) && ExeGetMachGroupName( nMachGrpId, sMachGrpName))
continue ;
}
// se vero duplo
else if ( pGeomDB->ExistsInfo( nDuploId, GDB_SI_DUPSOU) && pGeomDB->ExistsInfo( nDuploId, GDB_SI_LIST)) {
// verifico sia incluso in un grezzo di un gruppo di lavoro
bool bFound = false ;
INTVECTOR vnRef ;
pGeomDB->GetInfo( nDuploId, GDB_SI_LIST, vnRef) ;
for ( auto& nId : vnRef) {
// verifico sia in un grezzo (previsto solo in uno come massimo)
int nMachGrpId = pGeomDB->GetParentId( pGeomDB->GetParentId( pGeomDB->GetParentId( nId))) ;
string sMachGrpName ;
if ( ExeGetMachGroupName( nMachGrpId, sMachGrpName)) {
bFound = true ;
break ;
}
}
if ( bFound)
continue ;
}
// inserisco nella lista dei duplo senza grezzo
vnDup.emplace_back( nDuploId) ;
}
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeDuploSetModified( int nSouId)
@@ -1101,9 +955,19 @@ ExeIsDuplo( int nDupId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Verifico sia un duplicato
bool bPartVsGhost ;
return IsDuplo( pGeomDB, nDupId, bPartVsGhost) ;
// Recupero il gruppo base dei duplicati
int nDuploBaseId = GetDuploBase( pGeomDB) ;
if ( nDuploBaseId == GDB_ID_NULL)
return false ;
// Verifico sia un duplicato (gruppo sotto quello dei duplicati con riferimento a originale)
int nBaseId ;
if ( pGeomDB->GetGdbType( nDupId) == GDB_TY_GROUP &&
( pGeomDB->GetParentId( nDupId) == nDuploBaseId ||
( pGeomDB->GetInfo( nDupId, GDB_SI_BASE, nBaseId) && pGeomDB->GetParentId( nBaseId) == nDuploBaseId)) &&
pGeomDB->ExistsInfo( nDupId, GDB_SI_DUPSOU))
return true ;
else
return false ;
}
//-----------------------------------------------------------------------------
+17 -106
View File
@@ -1,14 +1,13 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2023
// EgalTech 2014-2015
//----------------------------------------------------------------------------
// File : EXE_General.cpp Data : 14.11.23 Versione : 2.5k2
// File : EXE_General.cpp Data : 01.09.14 Versione : 1.5i1
// Contenuto : Funzioni generali per EXE.
//
//
//
// Modifiche : 01.09.14 DS Creazione modulo.
// 28.11.19 DS Aggiunto caricamento opzionale di Nesting.
// 14.11.23 DS Aggiunto caricamento opzionale di Exchange 3dm.
// 28.11.19 DS Aggiunto caricamento opzionale del Nesting.
//
//----------------------------------------------------------------------------
@@ -18,7 +17,6 @@
#include "LUA_Base.h"
#include "DllGraphics.h"
#include "DllExchange.h"
#include "DllExch3dm.h"
#include "DllMachKernel.h"
#include "DllNesting.h"
#include "/EgtDev/Include/EXeExecutor.h"
@@ -35,7 +33,6 @@
#include "/EgtDev/Include/EgtIniFile.h"
#include "/EgtDev/Include/EgtLogger.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/SELkLockId.h"
#include "/EgtDev/Include/SELkKeyProc.h"
#include <fstream>
@@ -53,15 +50,13 @@ static string s_sKey ;
static int s_nKeyType = KEY_LOCK_TYPE_ANY ;
static bool s_bNetHwKey = false ;
static int s_nKeyExpDays = 0 ;
static int s_nKeyAssExpDays = 0 ;
static int s_nKeyOptExpDays = 0 ;
static string s_sNestKey ;
static string s_sLockId ;
static string s_sIniFile ;
static bool s_bEnableUI = true ;
static psfOnTerminateProcess s_pFunOnTerminateProcess = nullptr ;
static psfProcEvents s_pFunProcEvents = nullptr ;
static psfOutText s_pFunOutText = nullptr ;
static pfProcEvents s_pFunProcEvents = nullptr ;
static pfOutText s_pFunOutText = nullptr ;
static HWND s_hMainWnd = nullptr ;
static string s_sTempDir ;
@@ -75,7 +70,6 @@ ExeInit( int nDebug, const string& sLogFile, const string& sLogMsg)
if ( s_pGenLog != nullptr)
delete s_pGenLog ;
// cancello riferimenti a funzioni installate
s_pFunOnTerminateProcess = nullptr ;
s_pFunProcEvents = nullptr ;
s_pFunOutText = nullptr ;
s_bEnableUI = true ;
@@ -118,9 +112,6 @@ ExeInit( int nDebug, const string& sLogFile, const string& sLogMsg)
if ( LoadExchangeDll( s_pGenLog, s_sKey, s_bNetHwKey))
LOG_INFO( s_pGenLog, MyGetEExVersion())
// la libreria exchange 3dm opzionale viene caricata solo al momento del bisogno
// (è molto lento il caricamento di OpenNurbs)
// carico libreria di lavorazione opzionale
if ( LoadMachKernelDll( s_pGenLog, s_sKey, s_bNetHwKey))
LOG_INFO( s_pGenLog, MyGetEMkVersion())
@@ -177,11 +168,9 @@ ExeExit( void)
// libero le librerie opzionali
FreeMachKernelDll() ;
FreeExchangeDll() ;
FreeExch3dmDll() ;
FreeGraphicsDll() ;
// cancello riferimenti a funzioni installate
s_pFunOnTerminateProcess = nullptr ;
s_pFunProcEvents = nullptr ;
s_pFunOutText = nullptr ;
s_bEnableUI = true ;
@@ -208,30 +197,6 @@ ExeExit( void)
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeSetOnTerminateProcess( psfOnTerminateProcess pFun)
{
s_pFunOnTerminateProcess = pFun ;
return ( pFun != nullptr) ;
}
//-----------------------------------------------------------------------------
bool
ExeOnTerminateProcess( int nExitCode)
{
// lancio eventuale callback
bool bTerminate = true ;
if ( s_pFunOnTerminateProcess != nullptr)
bTerminate = s_pFunOnTerminateProcess( nExitCode) ;
// se confermata chiusura, libero eventuale chiave di rete
if ( bTerminate && s_bNetHwKey)
CloseNetHwKey() ;
return bTerminate ;
}
//-----------------------------------------------------------------------------
int
ExeGetDebugLevel( void)
@@ -313,12 +278,9 @@ ExeSetLockId( const string& sLockId)
bOk = ( s_nKeyType != KEY_LOCK_TYPE_HW) ;
break ;
case KEY_LOCK_TYPE_HW :
{ string sAddrPort ;
GetLockIdStringNetData( sLockId, sAddrPort) ;
ExeSetNetHwKey( bNetKey, nUserId, sAddrPort) ;
bOk = true ;
break ;
}
ExeSetNetHwKey( bNetKey, nUserId) ;
bOk = true ;
break ;
}
if ( bOk)
s_sLockId = sLockId ;
@@ -338,58 +300,19 @@ ExeGetLockId( void)
//-----------------------------------------------------------------------------
bool
ExeSetNetHwKey( bool bNetHwKey, int nUserId, const string& sAddrPort)
ExeSetNetHwKey( bool bNetHwKey, int nUserId)
{
s_bNetHwKey = bNetHwKey ;
SetEGnNetHwKey( s_bNetHwKey) ;
return SetNetHwKey( s_bNetHwKey, nUserId, sAddrPort) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetNetHwKey( void)
{
return s_bNetHwKey ;
}
//-----------------------------------------------------------------------------
bool
ExeVerifyKeyOption( int nOptInd)
{
// recupero le opzioni abilitate
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( ! ExeGetNetHwKey())
nRet = GetKeyOptions( ExeGetKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
// verifico validità chiave con licenza
if ( nRet != KEY_OK || nOptExpDays < GetCurrDay())
return false ;
// verifico le opzioni (nOptInd = 100 -> bit 0 di Opt1 ... = 200 -> bit 0 di Opt2 ... = 231 -> bit 31 di Opt2)
if ( nOptInd >= 100 && nOptInd <= 131) {
unsigned int nOptVal = ( 1 << ( nOptInd - 100)) ;
return ( ( nOpt1 & nOptVal) != 0) ;
}
else if ( nOptInd >= 200 && nOptInd <= 231) {
unsigned int nOptVal = ( 1 << ( nOptInd - 200)) ;
return ( ( nOpt2 & nOptVal) != 0) ;
}
else
return false ;
return SetNetHwKey( s_bNetHwKey, nUserId) ;
}
//-----------------------------------------------------------------------------
bool
ExeSetFont( const string& sNfeFontDir, const string& sDefaultFont)
{
// se definito anche direttorio font Nfe, inizializzazione gestore font
if ( ! sNfeFontDir.empty())
InitFontManager( sNfeFontDir, sDefaultFont) ;
// altrimenti impostazione del solo font di default
else
SetDefaultFont( sDefaultFont) ;
// inizializzazioni gestore font Nfe
InitFontManager( sNfeFontDir, sDefaultFont) ;
return true ;
}
@@ -512,10 +435,6 @@ ExeGetVersionInfo( string& sVer, const char* szNewLine)
sVer += szNewLine ;
sVer += MyGetEExVersion() ;
}
if ( IsLoadedExch3dmDll()) {
sVer += szNewLine ;
sVer += MyGetEE3Version() ;
}
if ( IsLoadedMachKernelDll()) {
sVer += szNewLine ;
sVer += MyGetEMkVersion() ;
@@ -559,7 +478,7 @@ bool
ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev)
{
// verifico la chiave e il livello
int nRet = GetKeyLevelEx( s_sKey, nProd, nVer, nLev, nKLev, s_nKeyExpDays, s_nKeyAssExpDays) ;
int nRet = GetKeyLevel( s_sKey, nProd, nVer, nLev, nKLev, s_nKeyExpDays) ;
SetEGnKeyLevel( nRet, nKLev, s_nKeyExpDays) ;
if ( nRet != KEY_OK) {
string sErr = "Error on Key (EGKL/" + ToString( nRet) + ")" ;
@@ -567,6 +486,7 @@ ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev)
nKLev = - nRet ;
return false ;
}
return true ;
}
@@ -590,6 +510,7 @@ ExeGetKeyOptions( int nProd, int nVer, int nLev, unsigned int& nOpt2)
LOG_ERROR( s_pGenLog, sErr.c_str()) ;
return true ;
}
return true ;
}
@@ -603,16 +524,6 @@ ExeGetKeyLeftDays( int& nLeftDays)
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeGetKeyAssLeftDays( int& nAssLeftDays)
{
if ( s_nKeyAssExpDays == 0)
return false ;
nAssLeftDays = s_nKeyAssExpDays - GetCurrDay() ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeGetKeyOptLeftDays( int& nOptLeftDays)
@@ -689,7 +600,7 @@ ExeMessageBox( const string& sText, const string& sTitle, int nType)
//-----------------------------------------------------------------------------
bool
ExeSetProcessEvents( psfProcEvents pFun)
ExeSetProcessEvents( pfProcEvents pFun)
{
s_pFunProcEvents = pFun ;
SetEGkProcessEvents( pFun) ;
@@ -708,7 +619,7 @@ ExeProcessEvents( int nProg, int nPause)
//-----------------------------------------------------------------------------
bool
ExeSetOutText( psfOutText pFun)
ExeSetOutText( pfOutText pFun)
{
s_pFunOutText = pFun ;
return ( pFun != nullptr) ;
-36
View File
@@ -21,7 +21,6 @@
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
#include "/EgtDev/Include/EGkDistPointSurfBz.h"
using namespace std ;
@@ -123,38 +122,3 @@ ExePointSurfTmDist( const Point3d& ptP, int nStmId, int nRefType,
ptMin = GetPointInRef( pGeomDB, ptMinL, frStm, nRefType) ;
return distPS.GetMinDistTriaIndex( *pnTria) ;
}
//----------------------------------------------------------------------------
bool
ExePointSurfBzDist( const Point3d& ptP, int nSbzId, int nRefType,
double* pdDist, Point3d& ptMin, Vector3d& vtN)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico il primo parametro di ritorno obbligatorio
if ( pdDist == nullptr)
return false ;
// recupero la superficie bezier
ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nSbzId)) ;
if ( pSbz == nullptr)
return false ;
// recupero il suo riferimento globale
Frame3d frSbz ;
if ( ! pGeomDB->GetGlobFrame( nSbzId, frSbz))
return false ;
// porto il punto nel riferimento della superficie
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frSbz) ;
// recupero i risultati
DistPointSurfBz distPS( ptPL, *pSbz) ;
if ( ! distPS.GetDist( *pdDist))
return false ;
Point3d ptMinL ;
if ( ! distPS.GetMinDistPoint( ptMinL))
return false ;
ptMin = GetPointInRef( pGeomDB, ptMinL, frSbz, nRefType) ;
Vector3d vtNL ;
if ( ! distPS.GetNorm( vtNL))
return false ;
vtN = GetVectorInRef( pGeomDB, vtNL, frSbz, nRefType) ;
return true ;
}
+648 -825
View File
File diff suppressed because it is too large Load Diff
+21 -28
View File
@@ -32,7 +32,7 @@ ExeStartPoint( int nId, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ;
@@ -85,19 +85,12 @@ ExeEndPoint( int nId, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// 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) {
if ( pGObj->GetType() == GEO_VECT3D) {
// recupero il geo-vettore
const IGeoVector3d* pGV = GetGeoVector3d( pGObj) ;
// assegno il punto
@@ -129,7 +122,7 @@ ExeMidPoint( int nId, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ;
@@ -161,7 +154,7 @@ ExeCenterPoint( int nId, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ;
@@ -201,7 +194,7 @@ ExeCentroid( int nId, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ;
@@ -241,7 +234,7 @@ ExeAtParamPoint( int nId, double dU, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ;
@@ -264,11 +257,11 @@ ExeNearPoint( int nId, const Point3d& ptNear, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ;
if ( pGObj == nullptr)
return false ;
// porto il punto near nel riferimento dell'entità
// porto il punto near nel riferimento dell'entità
Point3d ptNearL = ptNear ;
if ( ! InvTransformPoint( pGeomDB, nId, nRefId, ptNearL))
return false ;
@@ -276,7 +269,7 @@ ExeNearPoint( int nId, const Point3d& ptNear, int nRefId, Point3d& ptP)
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
// calcolo il punto della curva più vicino al punto di riferimento
DistPointCurve dstPC( ptNearL, *pCrv) ;
int nFlag ;
if ( ! dstPC.GetMinDistPoint( 0, ptP, nFlag))
@@ -297,7 +290,7 @@ ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Poi
// se auto-intersezione
if ( nId1 == nId2) {
// deve essere entità geometriche
// deve essere entità geometriche
const IGeoObj* pGObj1 ;
if ( ( pGObj1 = pGeomDB->GetGeoObj( nId1)) == nullptr)
return false ;
@@ -305,11 +298,11 @@ ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Poi
if ( ( pGObj1->GetType() & GEO_CURVE) != 0) {
// recupero la curva
const ICurve* pCrv1 = GetCurve( pGObj1) ;
// porto il punto Near nel riferimento dell'entità
// porto il punto Near nel riferimento dell'entità
Point3d ptNearL = ptNear ;
if ( ! InvTransformPoint( pGeomDB, nId1, nRefId, ptNearL))
return false ;
// calcolo il punto di auto-intersezione sulla curva più vicino al punto di riferimento
// calcolo il punto di auto-intersezione sulla curva più vicino al punto di riferimento
SelfIntersCurve sintC( *pCrv1) ;
if ( ! sintC.GetIntersPointNearTo( ptNearL, ptP))
return false ;
@@ -320,7 +313,7 @@ ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Poi
return TransformPoint( pGeomDB, nId1, nRefId, ptP) ;
}
// devono essere entità geometriche
// devono essere entità geometriche
const IGeoObj* pGObj1 ;
if ( ( pGObj1 = pGeomDB->GetGeoObj( nId1)) == nullptr)
return false ;
@@ -339,7 +332,7 @@ ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Poi
Frame3d frEnt2 ;
if ( ! pGeomDB->GetGlobFrame( nId2, frEnt2))
return false ;
// se il riferimento della seconda curva è diverso da quello della prima entità, devo trasformarla
// se il riferimento della seconda curva è diverso da quello della prima entità, devo trasformarla
PtrOwner<ICurve> pcrvTrans ;
if ( ! AreSameFrame( frEnt1, frEnt2)) {
pcrvTrans.Set( pCrv2->Clone()) ;
@@ -348,11 +341,11 @@ ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Poi
pcrvTrans->LocToLoc( frEnt2, frEnt1) ;
pCrv2 = pcrvTrans ;
}
// porto il punto Near nel riferimento della prima entità
// porto il punto Near nel riferimento della prima entità
Point3d ptNearL = ptNear ;
if ( ! InvTransformPoint( pGeomDB, nId1, nRefId, ptNearL))
return false ;
// calcolo il punto di intersezione sulla prima curva più vicino al punto di riferimento
// 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 ;
@@ -369,7 +362,7 @@ ExeStartVector( int nId, int nRefId, Vector3d& vtV)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ;
if ( pGObj == nullptr)
return false ;
@@ -407,7 +400,7 @@ ExeEndVector( int nId, int nRefId, Vector3d& vtV)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ;
if ( pGObj == nullptr)
return false ;
@@ -431,7 +424,7 @@ ExeMidVector( int nId, int nRefId, Vector3d& vtV)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ;
@@ -455,7 +448,7 @@ ExeAtParamVector( int nId, double dU, int nSide, int nRefId, Vector3d& vtV)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ;
+21 -88
View File
@@ -226,18 +226,6 @@ ExeSetModified( void)
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeSetModified( int nCtx)
{
GseContext* pGseCtx = GetGseContext( nCtx) ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
// se consentito, imposto il flag
if ( pGseCtx->m_bEnableModified)
pGseCtx->m_bModified = true ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeResetModified( void)
@@ -289,8 +277,6 @@ ExeNewFile( void)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
LOG_INFO( GetLogger(), "New File") ;
// restituisco il risultato
return bOk ;
}
@@ -330,11 +316,6 @@ ExeOpenFile( const string& sFilePath)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
{
string sLog = "Open File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -399,7 +380,7 @@ ExeInsertFile( const string& sFilePath)
class CamStatus
{
public :
CamStatus( void) : m_nCurrMachGroup( GDB_ID_NULL), m_nCurrPhase( 0), m_nCurrMachining( GDB_ID_NULL) {
CamStatus( void) : m_nCurrMachGroup( GDB_ID_NULL), m_nCurrPhase( 0) {
IMachMgr* pMachMgr = GetCurrMachMgr() ;
if ( pMachMgr == nullptr)
return ;
@@ -466,71 +447,37 @@ ExeSaveFile( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
{
string sLog = "Saved File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
static bool
IsMachGroupOrWithin( int nId, const IGeomDB* pGeomDB, const IMachMgr* pMachMgr, int& nMachGroupId)
{
// default non definito
nMachGroupId = GDB_ID_NULL ;
// verifico validità puntatori
if ( pGeomDB == nullptr || pMachMgr == nullptr)
return false ;
// eseguo ricerca
int nParentId = pGeomDB->GetParentId( nId) ;
int nPrevParId = nId ;
while ( nParentId != GDB_ID_NULL && nParentId != GDB_ID_ROOT) {
if ( pMachMgr->IsMachBase( nParentId)) {
nMachGroupId = nPrevParId ;
return true ;
}
nPrevParId = nParentId ;
nParentId = pGeomDB->GetParentId( nParentId) ;
}
return false ;
}
//-----------------------------------------------------------------------------
bool
ExeSaveObjToFile( const INTVECTOR& vId, const string& sFilePath, int nFlag)
ExeSaveObjToFile( int nId, const string& sFilePath, int nFlag)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
IMachMgr* pMachMgr = GetCurrMachMgr() ;
// se uno degli oggetti è la base dei gruppi di lavoro, chiamo la funzione di salvataggio di tutto
for ( int nId : vId) {
if ( pMachMgr != nullptr && pMachMgr->IsMachBase( nId))
return ExeSaveFile( sFilePath, nFlag) ;
}
// se uno degli oggetti è un gruppo di lavoro o una sua parte, chiamo la appropriata funzione di salvataggio
for ( int nId : vId) {
int nMachGroupId ;
if ( IsMachGroupOrWithin( nId, pGeomDB, pMachMgr, nMachGroupId)) {
INTVECTOR vOthId ;
vOthId.reserve( vId.size()) ;
for ( int nSouId : vId) {
if ( nSouId != nId)
vOthId.push_back( nSouId) ;
}
return ExeSaveMachGroupToFile( nMachGroupId, vOthId, sFilePath, nFlag) ;
}
// se l'oggetto è la base dei gruppi di lavoro, chiamo la funzione di salvataggio di tutto
if ( pMachMgr != nullptr && pMachMgr->IsMachBase( nId))
return ExeSaveFile( sFilePath, nFlag) ;
// se l'oggetto è un gruppo di lavoro o una sua parte, chiamo la appropriata funzione di salvataggio
int nParentId = pGeomDB->GetParentId( nId) ;
int nPrevParId = nId ;
while ( pMachMgr != nullptr && nParentId != GDB_ID_NULL && nParentId != GDB_ID_ROOT) {
if ( pMachMgr->IsMachBase( nParentId))
return ExeSaveMachGroupToFile( nPrevParId, sFilePath, nFlag) ;
nPrevParId = nParentId ;
nParentId = pGeomDB->GetParentId( nParentId) ;
}
// se ero in CAM, non esco <---
// copio l'oggetto nel file
bool bOk = pGeomDB->Save( vId, sFilePath, nFlag) ;
bool bOk = pGeomDB->Save( nId, sFilePath, nFlag) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSaveObjToFile({" + ToString( vId) + "},'" +
StringToLuaString( sFilePath) + "'," +
NgeTypeToString( nFlag) + ")" +
string sLua = "EgtSaveObjToFile(" + ToString( nId) + ",'" +
StringToLuaString( sFilePath) + "'," +
NgeTypeToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -540,7 +487,7 @@ ExeSaveObjToFile( const INTVECTOR& vId, const string& sFilePath, int nFlag)
//-----------------------------------------------------------------------------
bool
ExeSaveMachGroupToFile( int nMGroupId, const INTVECTOR& vPlusId, const string& sFilePath, int nFlag)
ExeSaveMachGroupToFile( int nMGroupId, const string& sFilePath, int nFlag)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -555,21 +502,11 @@ ExeSaveMachGroupToFile( int nMGroupId, const INTVECTOR& vPlusId, const string& s
// se ero in CAM, esco dopo averne salvato lo stato
CamStatus CurrCamStatus ;
ExeResetCurrMachGroup() ;
// verifico che gli oggetti Plus non siano gruppi di lavoro o una loro parte
bool bOk = true ;
for ( int nPlusId : vPlusId) {
int nMGrpPlusId ;
if ( IsMachGroupOrWithin( nPlusId, pGeomDB, pMachMgr, nMGrpPlusId)) {
bOk = false ;
break ;
}
}
// recupero eventuali pezzi e foto del gruppo di lavoro
INTVECTOR vId ;
int nPhotoId = GDB_ID_NULL ;
string sPhotoOriPath = "" ;
bOk = bOk && pMachMgr->SetCurrMachGroup( nMGroupId) ;
if ( bOk) {
if ( pMachMgr->SetCurrMachGroup( nMGroupId)) {
// aggiungo gruppo di lavoro
vId.emplace_back( nMGroupId) ;
// aggiungo pezzi
@@ -603,11 +540,8 @@ ExeSaveMachGroupToFile( int nMGroupId, const INTVECTOR& vPlusId, const string& s
// disattivo gruppo di lavoro
pMachMgr->ResetCurrMachGroup() ;
}
// aggiungo gli oggetti plus
if ( bOk)
vId.insert( vId.end(), vPlusId.begin(), vPlusId.end()) ;
// salvo gli oggetti appena identificati
bOk = bOk && pGeomDB->Save( vId, sFilePath, nFlag) ;
bool bOk = pGeomDB->Save( vId, sFilePath, nFlag) ;
// eventuale ripristino dati fotografia
if ( nPhotoId != GDB_ID_NULL)
ExeChangePhotoPath( nPhotoId, sPhotoOriPath) ;
@@ -620,8 +554,7 @@ ExeSaveMachGroupToFile( int nMGroupId, const INTVECTOR& vPlusId, const string& s
SetCmdLog( bPrevCmdLog) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSaveMachGroupToFile(" + ToString( nMGroupId) + ",{" +
ToString( vPlusId) + "},'" +
string sLua = "EgtSaveMachGroupToFile(" + ToString( nMGroupId) + ",'" +
StringToLuaString( sFilePath) + "'," +
NgeTypeToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ;
+43 -328
View File
@@ -21,13 +21,10 @@
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EMkToolConst.h"
#include "/EgtDev/Include/EMkOperationConst.h"
#include "/EgtDev/Include/EMkSimuGenConst.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnEgtUUID.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtIniFile.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
@@ -287,26 +284,6 @@ ExeRemoveMachGroup( int nMGroupId)
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeChangeMachGroupName( int nId, const string& sNewName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// cambia il nome della macchinata
bool bOk = pMachMgr->ChangeMachGroupName( nId, sNewName) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtChangeMachGroupName(" + ToString( nId) + ",'" +
sNewName + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeGetMachGroupName( int nId, string& sName)
@@ -334,8 +311,8 @@ int
ExeGetMachGroupId( const string& sName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// recupero l'identificativo della macchinata
VERIFY_MACHMGR( pMachMgr, false)
// recupero l'indice della macchinata
return pMachMgr->GetMachGroupId( sName) ;
}
@@ -396,16 +373,16 @@ ExeAddPhase( void)
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, 0)
// aggiungo una nuova fase di lavorazione alla macchinata corrente
int nInd = pMachMgr->AddPhase() ;
int nId = pMachMgr->AddPhase() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAddPhase()"
" -- Ind=" + ToString( nInd) ;
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nInd ;
return nId ;
}
//-----------------------------------------------------------------------------
@@ -494,7 +471,7 @@ bool
ExeIsRawPart( int nRawId)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// verifico se è un grezzo della macchinata corrente
return pMachMgr->IsRawPart( nRawId) ;
}
@@ -559,12 +536,12 @@ ExeModifyRawPart( int nRawId, Point3d ptOrig, double dLength, double dWidth, dou
//-----------------------------------------------------------------------------
bool
ExeModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dHeight, Color cCol)
ExeModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// modifico grezzo indicato nella macchinata corrente
bool bOk = pMachMgr->ModifyRawPart( nRawId, nCrvId, dOverMat, dHeight, cCol) ;
bool bOk = pMachMgr->ModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ;
ExeSetModified() ;
// restituisco il risultato
return bOk ;
@@ -998,7 +975,7 @@ ExeGetTableAreaOffset( int nInd, BBox3d& b3AreaOffs)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero l'estensione dell'area utile con offset della fase corrente della tavola corrente della macchinata corrente
// recupero l'estensione dell'area utile con offset della tavola corrente della macchinata corrente
return pMachMgr->GetTableAreaOffset( nInd, b3AreaOffs) ;
}
@@ -1022,64 +999,6 @@ ExeShowOnlyTable( bool bVal)
return pMachMgr->ShowOnlyTable( bVal) ;
}
//-----------------------------------------------------------------------------
bool
ExeMoveDispAxis( const string& sName, double dPos)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// eseguo e registro il movimento dell'asse
bool bOk = pMachMgr->MoveDispAxis( sName, dPos) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtMoveDispAxis('" + StringToLuaString( sName) + "'," +
ToString( dPos) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeRemoveDispAxis( const string& sName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// eseguo e registro la rimozione del movimento dell'asse
bool bOk = pMachMgr->RemoveDispAxis( sName) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtRemoveDispAxis('" + StringToLuaString( sName) + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeKeepAllDispAxes( int nSouPhase)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// confermo i movimenti degli assi di disposizione nella fase corrente della macchinata corrente
bool bOk = pMachMgr->KeepAllDispAxes( nSouPhase) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtKeepAllDispAxes(" + ToString( nSouPhase) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
int
ExeAddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov)
@@ -1091,10 +1010,10 @@ ExeAddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg, dou
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAddFixture('" + StringToLuaString( sName) + "',{" +
ToString( ptPos) + "}," +
ToString( dAngRotDeg) + "," +
ToString( dMov) + ")" +
string sLua = "EgtAddFixture(" + sName + ",{" +
ToString( ptPos) + "}," +
ToString( dAngRotDeg) + "," +
ToString( dMov) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -1197,33 +1116,13 @@ ExeRotateFixture( int nFxtId, double dDeltaAngDeg)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// vario la rotazione del dispositivo di presa dell'angolo indicato
// ruoto il dispositivo di presa dell'angolo indicato
bool bOk = pMachMgr->RotateFixture( nFxtId, dDeltaAngDeg) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtRotateFixture(" + ToString( nFxtId) + "," +
ToString( dDeltaAngDeg) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeSetFixtureLink( int nFxtId, const string& sTaLink)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// imposto il collegamento all'asse di tavola indicato
bool bOk = pMachMgr->SetFixtureLink( nFxtId, sTaLink) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSetFixtureLink(" + ToString( nFxtId) + ",'" +
StringToLuaString( sTaLink) + "')" +
string sLua = "EgtRotateFixture(" + ToString( nFxtId) + ",{" +
ToString( dDeltaAngDeg) + "})" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -1237,7 +1136,7 @@ ExeMoveFixtureMobile( int nFxtId, double dDeltaMove)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// varia il movimento della parte mobile della morsa della quantità indicata
// ruoto il dispositivo di presa dell'angolo indicato
bool bOk = pMachMgr->MoveFixtureMobile( nFxtId, dDeltaMove) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
@@ -1251,26 +1150,6 @@ ExeMoveFixtureMobile( int nFxtId, double dDeltaMove)
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeSetFixtureMobile( int nFxtId, double dMove)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// imposta il movimento della parte mobile della morsa alla quantità indicata
bool bOk = pMachMgr->SetFixtureMobile( nFxtId, dMove) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSetFixtureMobile(" + ToString( nFxtId) + "," +
ToString( dMove) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
// DB utensili
//-----------------------------------------------------------------------------
@@ -1573,21 +1452,6 @@ ExeTdbGetCurrToolThLength( double& dThLen)
return pMachMgr->TdbGetCurrToolThLength( dThLen) ;
}
//-----------------------------------------------------------------------------
bool
ExeTdbCurrToolIsStandardDraw( bool& bStandard)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero il nome del disegno dell'utensile
string sDraw ;
if ( ! pMachMgr->TdbGetCurrToolParam( TPA_DRAW, sDraw))
return false ;
// verifico il tipo
bStandard = IsUUID( GetFileTitleEgt( sDraw)) ;
return true ;
}
//-----------------------------------------------------------------------------
int
ExeTdbCurrToolDraw( int nGenCtx, int nToolCtx)
@@ -1721,16 +1585,6 @@ ExeFindToolInCurrSetup( const string& sTool)
return pMachMgr->FindToolInCurrSetup( sTool) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// eseguo la verifica
return pMachMgr->GetToolSetupPosInCurrSetup( sTool, sTcPos) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools)
@@ -2106,42 +1960,42 @@ ExeGetPrevOperation( int nId)
}
//-----------------------------------------------------------------------------
int
ExeGetFirstActiveOperation( bool bNeedMachNotEmpty)
ExeGetFirstActiveOperation( void)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// recupero la prima operazione attiva della macchinata corrente
return pMachMgr->GetFirstActiveOperation( bNeedMachNotEmpty) ;
return pMachMgr->GetFirstActiveOperation() ;
}
//-----------------------------------------------------------------------------
int
ExeGetNextActiveOperation( int nId, bool bNeedMachNotEmpty)
ExeGetNextActiveOperation( int nId)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// recupero la successiva operazione attiva della macchinata corrente
return pMachMgr->GetNextActiveOperation( nId, bNeedMachNotEmpty) ;
return pMachMgr->GetNextActiveOperation( nId) ;
}
//-----------------------------------------------------------------------------
int
ExeGetLastActiveOperation( bool bNeedMachNotEmpty)
ExeGetLastActiveOperation( void)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero l'ultima operazione attiva della macchinata corrente
return pMachMgr->GetLastActiveOperation( bNeedMachNotEmpty) ;
return pMachMgr->GetLastActiveOperation() ;
}
//-----------------------------------------------------------------------------
int
ExeGetPrevActiveOperation( int nId, bool bNeedMachNotEmpty)
ExeGetPrevActiveOperation( int nId)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// recupero la precedente operazione attiva della macchinata corrente
return pMachMgr->GetPrevActiveOperation( nId, bNeedMachNotEmpty) ;
return pMachMgr->GetPrevActiveOperation( nId) ;
}
//-----------------------------------------------------------------------------
@@ -2206,12 +2060,12 @@ ExeGetOperationId( const string& sName)
//-----------------------------------------------------------------------------
bool
ExeIsOperationEmpty( int nId, int nEmptyType)
ExeIsOperationEmpty( int nId)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero lo stato dell'operazione indicata della macchinata corrente
return pMachMgr->IsOperationEmpty( nId, nEmptyType) ;
return pMachMgr->IsOperationEmpty( nId) ;
}
//-----------------------------------------------------------------------------
@@ -2467,16 +2321,6 @@ ExeSpecialUpdateDisposition( int nId)
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeGetDispositionToolData( int nId, string& sName, string& sHead, int& nExit, string& sTcPos)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// aggiorno assi macchina e collegamento con precedente della disposizione indicata
return pMachMgr->GetDispositionToolData( nId, sName, sHead, nExit, sTcPos) ;
}
//-----------------------------------------------------------------------------
// Lavorazioni
//-----------------------------------------------------------------------------
@@ -2760,22 +2604,12 @@ ExeRemovePreviewMachiningTool( void)
//-----------------------------------------------------------------------------
int
ExeGetPreviewMachiningToolStepCount( void)
ExePreviewMachiningTool( int nEntId, int nFlag)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, -1)
// restituisce il numero di passi per anteprima utensile presenti nella lavorazione
return pMachMgr->GetPreviewMachiningToolStepCount() ;
}
//-----------------------------------------------------------------------------
int
ExePreviewMachiningTool( int nEntId, int nStep)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
VERIFY_MACHMGR( pMachMgr, false)
// visualizzazione anteprima utensile su lavorazione
return pMachMgr->PreviewMachiningTool( nEntId, nStep) ;
return pMachMgr->PreviewMachiningTool( nEntId, nFlag) ;
}
//-----------------------------------------------------------------------------
@@ -2830,22 +2664,12 @@ ExeGetMachiningGeometry( SELVECTOR& vIds)
//-----------------------------------------------------------------------------
bool
ExeGetMachiningSkippedGeometry( SELVECTOR& vIds)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero la geometria non lavorata della lavorazione corrente
return pMachMgr->GetMachiningSkippedGeometry( vIds) ;
}
//-----------------------------------------------------------------------------
bool
ExeIsMachiningEmpty( int nEmptyType)
ExeIsMachiningEmpty( void)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// restituisco lo stato della lavorazione corrente
return pMachMgr->IsMachiningEmpty( nEmptyType) ;
return pMachMgr->IsMachiningEmpty() ;
}
//-----------------------------------------------------------------------------
@@ -3042,12 +2866,12 @@ ExeGetClEntMove( int nEntId, int& nMove)
//-----------------------------------------------------------------------------
bool
ExeGetClEntFlag( int nEntId, int& nFlag, int& nFlag2)
ExeGetClEntFlag( int nEntId, int& nFlag)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero i flag
return pMachMgr->GetClEntFlag( nEntId, nFlag, nFlag2) ;
// recupero il flag
return pMachMgr->GetClEntFlag( nEntId, nFlag) ;
}
//-----------------------------------------------------------------------------
@@ -3060,36 +2884,6 @@ ExeGetClEntIndex( int nEntId, int& nIndex)
return pMachMgr->GetClEntIndex( nEntId, nIndex) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntAxesStatus( int nEntId, int& nStatus)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero lo stato del movimento assi
return pMachMgr->GetClEntAxesStatus( nEntId, nStatus) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntAxesMask( int nEntId, int& nMask)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero la mascheratura del movimento assi (valida solo in rapido)
return pMachMgr->GetClEntAxesMask( nEntId, nMask) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntAxesVal( int nEntId, DBLVECTOR& vAxes)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero il valore degli assi
return pMachMgr->GetClEntAxesVal( nEntId, vAxes) ;
}
//-----------------------------------------------------------------------------
// Simulazione
//-----------------------------------------------------------------------------
@@ -3152,16 +2946,6 @@ ExeSimSetUiStatus( int nUiStatus)
return pMachMgr->SimSetUiStatus( nUiStatus) ;
}
//-----------------------------------------------------------------------------
bool
ExeSimEnableToolTipTrace( bool bEnable)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// imposto abilitazione disegno traccia della punta utensile
return pMachMgr->SimEnableToolTipTrace( bEnable) ;
}
//-----------------------------------------------------------------------------
bool
ExeSimGetAxisInfoPos( int nI, string& sName, string& sToken, bool& bLinear, double& dVal)
@@ -3232,13 +3016,8 @@ ExeGenerate( const string& sCncFile, const string& sInfo)
ReplaceString( sDir, "/", "\\") ;
// recupero il nome
string sNcName ;
if ( ! ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sNcName)) {
string sCurrMachDir ; pMachMgr->GetCurrMachineDir( sCurrMachDir) ;
string sCurrMachName ; pMachMgr->GetCurrMachineName( sCurrMachName) ;
string sCurrMachIni = sCurrMachDir + "\\" + sCurrMachName + ".ini" ;
string sExt = GetPrivateProfileStringUtf8( "PartProgram", "Extension", ".cnc", sCurrMachIni.c_str()) ;
sNcName = ChangeFileExtension( GetFileTitleEgt( sProjPath), sExt) ;
}
if ( ! ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sNcName))
sNcName = GetFileTitleEgt( sProjPath) + ".cnc" ;
// creo la path completa
sMyCncFile = sDir + "\\" + sNcName ;
}
@@ -3295,9 +3074,7 @@ ExeSimulate( int& nErr, string& sError)
nErr = SHE_NONE ;
sError = "" ;
// disabilito UI
bool bPrevEnableUI = ExeGetEnableUI() ;
if ( bPrevEnableUI)
ExeSetEnableUI( false) ;
ExeSetEnableUI( false) ;
// avvio simulazione
if ( ! pMachMgr->SimInit() || ! pMachMgr->SimStart( true) || ! pMachMgr->SimStart( false)) {
// inutile continuare con simulazione se avvio non riuscito
@@ -3359,8 +3136,7 @@ ExeSimulate( int& nErr, string& sError)
// terminazione simulazione
pMachMgr->SimExit() ;
// riabilito UI
if ( bPrevEnableUI)
ExeSetEnableUI( true) ;
ExeSetEnableUI( true) ;
return ( nErr == 0) ;
}
@@ -3396,16 +3172,6 @@ ExeSetRotAxisBlock( const string& sAxis, double dVal)
return pMachMgr->SetRotAxisBlock( sAxis, dVal) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetCalcTable( string& sTable)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// restituisco la tavola corrente per il calcolo sulla macchina della macchinata corrente
return pMachMgr->GetCalcTable( sTable) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetCalcTool( string& sTool, string& sHead, int& nExit)
@@ -3416,16 +3182,6 @@ ExeGetCalcTool( string& sTool, string& sHead, int& nExit)
return ( pMachMgr->GetCalcTool( sTool) && pMachMgr->GetCalcHead( sHead) && pMachMgr->GetCalcExit( nExit)) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetAllCurrAxesNames( STRVECTOR& vAxName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero gli assi correnti derivanti dalla scelta di tavola e utensile
return pMachMgr->GetAllCurrAxesNames( vAxName) ;
}
//----------------------------------------------------------------------------
bool
ExeGetRotAxisBlocked( int nInd, string& sAxis, double& dVal)
@@ -3461,34 +3217,23 @@ ExeGetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
//-----------------------------------------------------------------------------
bool
ExeGetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
double& dX, double& dY, double& dZ)
int& nStat, double& dX, double& dY, double& dZ)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// calcolo gli assi lineari macchina dalla posizione e dagli assi rotanti
return pMachMgr->GetCalcPositions( ptP, dAngA, dAngB, dX, dY, dZ) ;
return pMachMgr->GetCalcPositions( ptP, dAngA, dAngB, nStat, dX, dY, dZ) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng,
double& dX, double& dY, double& dZ)
int& nStat, double& dX, double& dY, double& dZ)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// calcolo gli assi lineari macchina dalla posizione e dagli assi rotanti
return pMachMgr->GetCalcPositions( ptP, vAng, dX, dY, dZ) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
DBLVECTOR& vAng1, DBLVECTOR& vAng2)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// calcolo gli angoli macchina dalle direzioni fresa e ausiliaria passate
return pMachMgr->GetRobotAngles( ptP, vtDirT, vtDirA, vAng1, vAng2) ;
return pMachMgr->GetCalcPositions( ptP, vAng, nStat, dX, dY, dZ) ;
}
//-----------------------------------------------------------------------------
@@ -3606,16 +3351,6 @@ ExeGetHeadExitCount( const string& sHead)
return pMachMgr->GetHeadExitCount( sHead) ;
}
//-----------------------------------------------------------------------------
int
ExeGetExitId( const string& sHead, int nExit)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// restituisco identificativo dell'uscita della testa indicata nella macchina della macchinata corrente
return pMachMgr->GetExitId( sHead, nExit) ;
}
//-----------------------------------------------------------------------------
int
ExeGetTcPosId( const string& sTcPos)
@@ -3646,16 +3381,6 @@ ExeGetAxisType( const string& sAxis, bool& bLinear)
return pMachMgr->GetAxisType( sAxis, bLinear) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetAxisDir( const string& sAxis, Vector3d& vtDir)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero la direzione dell'asse
return pMachMgr->GetAxisDir( sAxis, vtDir) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetAxisInvert( const string& sAxis, bool& bInvert)
@@ -3686,16 +3411,6 @@ ExeGetAllTablesNames( STRVECTOR& vNames)
return pMachMgr->GetAllTablesNames( vNames) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetAllAxesNames( STRVECTOR& vNames)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero l'elenco degli assi
return pMachMgr->GetAllAxesNames( vNames) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetAllHeadsNames( STRVECTOR& vNames)
-158
View File
@@ -1,158 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : EXE_MachOpt.cpp Data : 02.04.2025 Versione : 2.7c1
// Contenuto : Funzioni per Ottimizzare i tempi tra le lavorazioni.
//
//
//
// Modifiche : 02.04.25 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "EXE_Const.h"
#include "DllNesting.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/ENkMachOptimization.h"
using namespace std ;
//----------------------------------------------------------------------------
// Static LuaMgr per EgtExecutor
//----------------------------------------------------------------------------
static PtrOwner<IMachOptimization> s_pMO ;
//----------------------------------------------------------------------------
bool
ExeOptMachInit( void)
{
// Creo l'oggetto per il calcolo del percorso minimo (ShortestPath)
s_pMO.Set( CreateMachOptimization()) ;
return ( ! IsNull( s_pMO)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachTerminate( void)
{
// Distruggo l'oggetto
s_pMO.Reset() ;
return ( IsNull( s_pMO)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachAddTool( int nId, double dTCX, double dTCY, double dTCZ, double dTCA,
double dTCB, double dTCC, bool bX, bool bY, bool bZ, bool bA,
bool bB, bool bC, double dTLoad, double dTUnL)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Inserisco il Record
return ( s_pMO->InsertTool( nId, dTCX, dTCY, dTCZ, dTCA, dTCB, dTCC, bX, bY, bZ, bA,
bB, bC, dTLoad, dTUnL)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachAddMachining( int nId, int nToolId, int nGroup,
double dX_Start, double dY_Start, double dZ_Start,
double dA_Start, double dB_Start, double dC_Start,
double dX_End, double dY_End, double dZ_End,
double dA_End, double dB_End, double dC_End)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Inserisco il Record
return ( s_pMO->InsertMachining( nId, nToolId, nGroup,
dX_Start, dY_Start, dZ_Start,
dA_Start, dB_Start, dC_Start,
dX_End, dY_End, dZ_End,
dA_End, dB_End, dC_End)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetFirstMachining( int nId)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto la prima lavorazione
return ( s_pMO->SetFirstMachining( nId)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetLastMachining( int nId)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto l'ultima lavorazione
return ( s_pMO->SetLastMachining( nId)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetFeeds( double dFeedL, double dFeedA)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto l'ultima lavorazione
return ( s_pMO->SetFeeds( dFeedL, dFeedA)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachAddDependence( int nIdPrec, int nIdSucc)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Inserisco la Dipendenza obbligatoria
return ( s_pMO->InsertDependence( nIdPrec, nIdSucc)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachAddSuggestedDependence( int nIdPrec, int nIdSucc)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Inserisco la Dipendenza obbligatoria
return ( s_pMO->InsertSuggestedDependences( nIdPrec, nIdSucc)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetAllGroupDependencesAsMandatory( bool bAllMandatory)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto il Flag
return ( s_pMO->SetAllGroupsAsMandatory( bAllMandatory)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachGetResult( INTVECTOR& vIds)
{
vIds.clear() ;
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Recupero i risultati
return ( s_pMO->GetResult( vIds)) ;
}
+1 -18
View File
@@ -19,6 +19,7 @@
#include "DllNesting.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/ENsAutoNester.h"
#include "/EgtDev/Include/EGnStringUtils.h"
@@ -257,15 +258,6 @@ ExeAutoNestSetInterpartGap( double dGap)
return s_pAutoNester->SetInterpartGap( dGap) ;
}
//-----------------------------------------------------------------------------
bool
ExeAutoNestSetShearGap( double dShearGap)
{
if ( IsNull( s_pAutoNester))
return false ;
return s_pAutoNester->SetShearGap( dShearGap) ;
}
//-----------------------------------------------------------------------------
bool
ExeAutoNestSetReportFile( const string& sReportFile)
@@ -347,12 +339,3 @@ ExeAutoNestGetOneResult( int nInd, int& nType, int& nId, int& nFlag, double& dX,
dAngRot = s_vANestInfo[nInd].dAngRot ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeAutoNestCalcShearSequence( int nNesting, PNTVECTOR& vPtStart, PNTVECTOR& vPtEnd)
{
if ( IsNull( s_pAutoNester))
return false ;
return s_pAutoNester->CalcShearSequence( nNesting, vPtStart, vPtEnd) ;
}
+9 -81
View File
@@ -89,10 +89,6 @@ ApproxCurveIfNeeded( IGdbIterator* pEnt, double dToler)
PolyArc PA ;
double dTol = max( dToler, LIN_TOL_FINE) ;
bool bOk = pCrv->ApproxWithArcsEx( dTol, ANG_TOL_STD_DEG, LIN_FEA_STD, PA) && pCC->FromPolyArc( PA) ;
// eliminazione di small Z
bOk = bOk && pCC->RemoveSmallDefects( 0.5 * dTol, ANG_TOL_STD_DEG) ;
// merge di archi identici di biarchi
bOk = bOk && pCC->MergeCurves( 0.5 * dTol, ANG_TOL_STD_DEG) ;
bOk = bOk && pEnt->GetGDB()->ReplaceGeoObj( pEnt->GetId(), Release( pCC)) ;
return bOk ;
}
@@ -1617,50 +1613,6 @@ ExeCalcFlatPartUpRegion( int nPartId, bool bCalc)
return true ;
}
//----------------------------------------------------------------------------
static bool
IgnoreOutlineFillet( IGeomDB* pGeomDB, int nCrvId, int nLayId)
{
// verifico se la curva nCrvId è un raccordo che deve essere ignorato, ovvero se si tratta di un arco non inclinato, in tangenza
// e consecutivo ad almeno un lato inclinato
// verifico se arco
if ( pGeomDB->GetGeoType( nCrvId) == CRV_ARC) {
// verifico se non inclinato
double dSideAng = 0, dSideAng2 = 0 ;
pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) ;
pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) ;
if ( abs( dSideAng) < EPS_ANG_SMALL && abs( dSideAng2) < EPS_ANG_SMALL) {
// verifico se in tangenza con curve consecutive
double dPrevAng = ANG_RIGHT, dNextAng = ANG_RIGHT ;
pGeomDB->GetInfo( nCrvId, MCH_KEY_PREVANG, dPrevAng) ;
pGeomDB->GetInfo( nCrvId, MCH_KEY_NEXTANG, dNextAng) ;
if ( abs( dPrevAng) < EPS_ANG_SMALL && abs( dNextAng) < EPS_ANG_SMALL) {
// verifico se è inclinata almeno una tra la curva precedente e quella successiva
int nPrevId = pGeomDB->GetPrev( nCrvId) ;
if ( nPrevId == GDB_ID_NULL)
nPrevId = pGeomDB->GetLastInGroup( nLayId) ;
if ( nPrevId == GDB_ID_NULL)
return false ;
double dSideAng, dSideAng2 ;
if ( ( pGeomDB->GetInfo( nPrevId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) ||
( pGeomDB->GetInfo( nPrevId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL))
return true ;
int nNextId = pGeomDB->GetNext( nCrvId) ;
if ( nNextId == GDB_ID_NULL)
nNextId = pGeomDB->GetFirstInGroup( nLayId) ;
if ( nNextId == GDB_ID_NULL)
return false ;
if ( ( pGeomDB->GetInfo( nNextId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) ||
( pGeomDB->GetInfo( nNextId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL))
return true ;
}
}
}
return false ;
}
//----------------------------------------------------------------------------
static bool
AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOrig, int nLayReg, double dH)
@@ -1731,8 +1683,7 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
if ( pCrv == nullptr)
return false ;
if ( ! pCrv->SimpleOffset( dCalcOffset))
pGeomDB->Erase( nNewId) ;
pCrv->SimpleOffset( dCalcOffset) ;
}
else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) {
double dOffset2 = 0 ;
@@ -1745,12 +1696,8 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
if ( pCrv == nullptr)
return false ;
if ( ! pCrv->SimpleOffset( dCalcOffset))
pGeomDB->Erase( nNewId) ;
pCrv->SimpleOffset( dCalcOffset) ;
}
// verifico se raccordo da ignorare per poter calcolare la regione
else if ( IgnoreOutlineFillet( pGeomDB, nCrvId, nLayId))
pGeomDB->Erase( nNewId) ;
}
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
if ( ! AdjustLayerCurves( pGeomDB, nTmpLayId))
@@ -1773,7 +1720,7 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
if ( nNewId == GDB_ID_NULL)
return false ;
// determino ed eseguo offset
double dSideAng, dSideAng2 ;
double dSideAng ;
if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) {
double dOffset = 0 ;
pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET, dOffset) ;
@@ -1781,22 +1728,8 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
if ( pCrv == nullptr)
return false ;
if ( ! pCrv->SimpleOffset( dCalcOffset))
pGeomDB->Erase( nNewId) ;
pCrv->SimpleOffset( dCalcOffset) ;
}
else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) {
double dOffset2 = 0 ;
pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET2, dOffset2) ;
double dCalcOffset = dOffset2 ;
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
if ( pCrv == nullptr)
return false ;
if ( ! pCrv->SimpleOffset( dCalcOffset))
pGeomDB->Erase( nNewId) ;
}
// verifico se raccordo da ignorare per poter calcolare la regione
else if ( IgnoreOutlineFillet( pGeomDB, nCrvId, nLayId))
pGeomDB->Erase( nNewId) ;
}
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
if ( ! AdjustLayerCurves( pGeomDB, nTmpLay2Id))
@@ -1836,13 +1769,10 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
//if ( dStartProD > EPS_SMALL)
// pCrv->ExtendStartByLen( dStartProD) ;
double dStartProMin = min( dStartProD, dStartProU) ;
if ( dStartProMin < - EPS_SMALL) {
if ( dStartProMin < - EPS_SMALL)
pCrv->TrimStartAtLen( - dStartProMin) ;
if ( abs( dStartProD - dStartProU) > EPS_SMALL)
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, abs( dStartProD - dStartProU)) ;
}
else
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, max( dStartProD, dStartProU)) ;
if ( abs( dStartProD - dStartProU) > EPS_SMALL)
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, abs( dStartProD - dStartProU)) ;
}
else {
if ( dStartProD < - EPS_SMALL)
@@ -1869,11 +1799,9 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
double dLen ;
pCrv->GetLength( dLen) ;
pCrv->TrimEndAtLen( dLen + dEndProMin) ;
if ( abs( dEndProD - dEndProU) > EPS_SMALL)
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, abs( dEndProD - dEndProU)) ;
}
else
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, max( dEndProD, dEndProU)) ;
if ( abs( dEndProD - dEndProU) > EPS_SMALL)
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, abs( dEndProD - dEndProU)) ;
}
else {
if ( dEndProD < - EPS_SMALL) {
+4 -4
View File
@@ -254,7 +254,7 @@ ExeVerifyCutAsSplitting( int nMchId)
pMachMgr->MachiningPreview( true) ;
// verifico interferenza
int nRes ;
if ( ExeVerifyMachining( nMchId, nRes) && ( nRes == FMI_NONE || nRes == FMI_LO))
if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE)
nResult += CAR_LI_OK ;
// ripristino attacco originale
pMachMgr->SetMachiningParam( MPA_LEADINTYPE, nLiType) ;
@@ -265,7 +265,7 @@ ExeVerifyCutAsSplitting( int nMchId)
else {
// verifico interferenza
int nRes ;
if ( ExeVerifyMachining( nMchId, nRes) && ( nRes == FMI_NONE || nRes == FMI_LO))
if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE)
nResult += CAR_LI_OK ;
}
// verifico se posso portare uscita al bordo grezzo
@@ -276,7 +276,7 @@ ExeVerifyCutAsSplitting( int nMchId)
pMachMgr->MachiningPreview( true) ;
// verifico interferenza
int nRes ;
if ( ExeVerifyMachining( nMchId, nRes) && ( nRes == FMI_NONE || nRes == FMI_LI))
if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE)
nResult += CAR_LO_OK ;
// ripristino uscita originale
pMachMgr->SetMachiningParam( MPA_LEADOUTTYPE, nLoType) ;
@@ -287,7 +287,7 @@ ExeVerifyCutAsSplitting( int nMchId)
else {
// verifico interferenza
int nRes ;
if ( ExeVerifyMachining( nMchId, nRes) && ( nRes == FMI_NONE || nRes == FMI_LI))
if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE)
nResult += CAR_LO_OK ;
}
// verifico se taglio non passante
-1271
View File
File diff suppressed because it is too large Load Diff
+9 -231
View File
@@ -16,14 +16,10 @@
#include "EXE.h"
#include "EXE_Macro.h"
#include "DllGraphics.h"
#include "DllMain.h"
#include "resource.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <Windowsx.h>
using namespace std ;
@@ -113,12 +109,12 @@ ExeSetLineAttribs( int nWidth)
//-----------------------------------------------------------------------------
bool
ExeSetMarkAttribs( Color MarkCol, Color Mark2Col)
ExeSetMarkAttribs( Color MarkCol)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// imposto il colore del Mark
return ( pScene->SetMark( MarkCol) && pScene->SetMark2( Mark2Col)) ;
return pScene->SetMark( MarkCol) ;
}
//-----------------------------------------------------------------------------
@@ -187,23 +183,10 @@ ExeSetGridGeo( double dSnapStep, int nMinLineSstep, int nMajLineSstep, int nExtS
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// imposto i parametri geometrici di griglia
return pScene->SetGridGeo( dSnapStep, nMinLineSstep, nMajLineSstep, nExtSstep) ;
}
//-----------------------------------------------------------------------------
bool
ExeSetGridGeoAdv( double dSnapStep, int nMinLineSstep, int nMajLineSstep,
double dXmin, double dXmax, double dYmin, double dYmax)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// imposto i parametri geometrici di griglia
return pScene->SetGridGeoAdv( dSnapStep, nMinLineSstep, nMajLineSstep, dXmin, dXmax, dYmin, dYmax) ;
}
//-----------------------------------------------------------------------------
bool
ExeSetGridColor( Color colMin, Color colMaj)
@@ -214,31 +197,6 @@ ExeSetGridColor( Color colMin, Color colMaj)
return pScene->SetGridColor( colMin, colMaj) ;
}
//-----------------------------------------------------------------------------
bool
ExeSetCameraType( bool bOrthoOrPersp, bool bRedraw)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
pScene->SetCameraType( bOrthoOrPersp) ;
if ( bRedraw)
pScene->RedrawWindow() ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeSetZoomType( int nMode, bool bRedraw)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
if ( ! pScene->SetZoomType( nMode))
return false ;
if ( bRedraw)
pScene->RedrawWindow() ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeResize( int nW, int nH)
@@ -257,7 +215,6 @@ ExeDraw( void)
// se interfaccia disabilitata, esco subito
if ( ! ExeGetEnableUI())
return true ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false)
// eseguo disegno
@@ -460,44 +417,17 @@ ExeGetShowCurveDirection( void)
return pScene->GetShowCurveDirection() ;
}
//-----------------------------------------------------------------------------
static bool
MyResetGroupObjGraphics( IGeomDB* pGDB, int nGroupId)
{
if ( pGDB == nullptr)
return false ;
int nEntId = pGDB->GetFirstInGroup( nGroupId) ;
while ( nEntId != GDB_ID_NULL) {
if ( pGDB->GetGdbType( nEntId) == GDB_TY_GROUP) {
MyResetGroupObjGraphics( pGDB, nEntId) ;
}
else {
IGeoObj* pGeoObj = pGDB->GetGeoObj( nEntId) ;
if ( pGeoObj != nullptr)
pGeoObj->SetObjGraphics( nullptr) ;
}
nEntId = pGDB->GetNext( nEntId) ;
}
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeSetShowTriaAdv( bool bAdvanced, bool bRedraw)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// se cambiato, imposto stato
if ( pScene->GetShowTriaAdvanced() != bAdvanced) {
// imposto il nuovo stato
pScene->SetShowTriaAdvanced( bAdvanced) ;
// forzo ricalcolo della grafica di tutti gli oggetti
if ( ! MyResetGroupObjGraphics( pScene->GetGeomDB(), GDB_ID_ROOT))
return false ;
}
// imposto stato
pScene->SetShowTriaAdvanced( bAdvanced) ;
if ( bRedraw)
pScene->RedrawWindow() ;
return true ;
return TRUE ;
}
//-----------------------------------------------------------------------------
@@ -510,50 +440,17 @@ ExeGetShowTriaAdv( void)
return pScene->GetShowTriaAdvanced() ;
}
//-------------------------------------------------------------------------------
bool
ExeSetShowSurfBezierTol( double dLinTol, bool bRedraw)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// se diverso, imposto il nuovo valore
if ( abs( GetSurfBezierAuxSurfTol() - dLinTol) > 10 * EPS_SMALL) {
// imposto il nuovo valore di approssimazione
SetSurfBezierAuxSurfTol( dLinTol) ;
// forzo ricalcolo della grafica di tutti gli oggetti
if ( ! MyResetGroupObjGraphics( pScene->GetGeomDB(), GDB_ID_ROOT))
return false ;
}
if ( bRedraw)
pScene->RedrawWindow() ;
return true ;
}
//-----------------------------------------------------------------------------
double
ExeGetShowSurfBezierTol( void)
{
// recupero il valore
return GetSurfBezierAuxSurfTol() ;
}
//-----------------------------------------------------------------------------
bool
ExeSetShowZmap( int nMode, bool bRedraw)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// se cambiato, imposto il nuovo stato
if ( pScene->GetShowZmap() != nMode) {
// imposto il nuovo stato
pScene->SetShowZmap( nMode) ;
// forzo ricalcolo della grafica di tutti gli oggetti
if ( ! MyResetGroupObjGraphics( pScene->GetGeomDB(), GDB_ID_ROOT))
return false ;
}
// imposto stato
pScene->SetShowZmap( nMode) ;
if ( bRedraw)
pScene->RedrawWindow() ;
return true ;
return TRUE ;
}
//-----------------------------------------------------------------------------
@@ -561,7 +458,7 @@ int
ExeGetShowZmap( void)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, -1)
VERIFY_SCENE( pScene, false)
// recupero lo stato
return pScene->GetShowZmap() ;
}
@@ -583,10 +480,6 @@ ExeZoomRadius( double dRadius, bool bRedraw)
bool
ExeZoom( int nZoom, bool bRedraw)
{
// se interfaccia disabilitata, esco subito
if ( ! ExeGetEnableUI())
return true ;
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
@@ -734,23 +627,10 @@ ExeZoomWin( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeSetViewOrizzOffsStep( int nDirOffsStep)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
return pScene->SetCameraDirOrizzOffset( nDirOffsStep) ;
}
//-----------------------------------------------------------------------------
bool
ExeSetView( int nDir, bool bRedraw)
{
// se interfaccia disabilitata, esco subito
if ( ! ExeGetEnableUI())
return true ;
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// imposto vista
@@ -816,19 +696,6 @@ ExeRotateView( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeGetViewOrizzOffsStep( int* pnDirOffsStep)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// recupero offset direzione di vista
if ( pnDirOffsStep == nullptr)
return false ;
*pnDirOffsStep = pScene->GetCameraDirOrizzOffset() ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeGetView( int* pnDir)
@@ -985,92 +852,3 @@ ExeGetImage( int nShowMode, Color colBackTop, Color colBackBottom,
// creo e salvo una immagine della scena
return pScene->GetImage( nShowMode, colBackTop, colBackBottom, nWidth, nHeight, sFile) ;
}
//-------------------------------------------------------------------------------
static int s_nContext = 0 ;
static int s_nDriver = 3 ;
static bool s_b2Buff = true ;
static int s_nColorBits = 32 ;
static int s_nDepthBits = 24 ;
static int s_nShowMode = SM_SHADING ;
static Color s_colBackTop = WHITE ;
static Color s_colBackBottom = WHITE ;
static int s_nCameraDir = CT_TOP ;
static int s_nWidth = 1024 ;
static int s_nHeight = 1024 ;
static string s_sImageFile ;
//-------------------------------------------------------------------------------
BOOL
CALLBACK SceneBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch ( message) {
case WM_INITDIALOG :
{
// imposto dimensione box e picture
const int WIN_MAX_DIM = 1024 ;
int nWinW = ( s_nWidth >= s_nHeight ? WIN_MAX_DIM : ( WIN_MAX_DIM * s_nWidth) / s_nHeight) ;
int nWinH = ( s_nHeight >= s_nWidth ? WIN_MAX_DIM : ( WIN_MAX_DIM * s_nHeight) / s_nWidth) ;
HWND hPic = GetDlgItem( hwndDlg, IDC_PICTURE1) ;
SetWindowPos( hwndDlg, HWND_TOP, 0, 0, nWinW, nWinH, SWP_NOMOVE | SWP_NOREPOSITION) ;
SetWindowPos( hPic, HWND_TOP, 0, 0, nWinW, nWinH, SWP_NOMOVE | SWP_NOREPOSITION) ;
// imposto scena
int nContext = GetIndCurrGseContext() ;
GseContext* pGseCtx = GetGseContext( nContext) ;
if ( pGseCtx != nullptr && pGseCtx->m_pScene == nullptr) {
ExeInitScene( hPic, s_nDriver, s_b2Buff, s_nColorBits, s_nDepthBits) ;
if ( pGseCtx->m_pGeomDB != nullptr && pGseCtx->m_pScene != nullptr) {
s_nContext = nContext ;
pGseCtx->m_pScene->SetCamera( s_nCameraDir) ;
pGseCtx->m_pScene->ZoomAll() ;
pGseCtx->m_pScene->GetImage( s_nShowMode, s_colBackTop, s_colBackBottom, s_nWidth, s_nHeight, s_sImageFile) ;
MyResetGroupObjGraphics( pGseCtx->m_pGeomDB, GDB_ID_ROOT) ;
EndDialog( hwndDlg, wParam) ;
}
}
else
s_nContext = 0 ;
}
break ;
}
return FALSE ;
}
//-------------------------------------------------------------------------------
bool
ExeGetImageEx( int nDriver, bool b2Buff, int nColorBits, int nDepthBits,
int nShowMode, Color colBackTop, Color colBackBottom,
int nCameraDir, int nWidth, int nHeight, const string& sFile)
{
// Se il contesto corrente possiede già una scena
if ( GetCurrScene() != nullptr) {
return ExeGetImage( nShowMode, colBackTop, colBackBottom, nWidth, nHeight, sFile) ;
}
// altrimenti ne creo una temporanea
else {
// salvo i parametri
s_nDriver = nDriver ;
s_b2Buff = b2Buff ;
s_nColorBits = nColorBits ;
s_nDepthBits = nDepthBits ;
s_nShowMode = nShowMode ;
s_colBackTop = colBackTop ;
s_colBackBottom = colBackBottom ;
s_nCameraDir = nCameraDir ;
s_nWidth = nWidth ;
s_nHeight = nHeight ;
s_sImageFile = sFile ;
// lancio dialogo
HWND hTopWnd = ExeGetMainWindowHandle() ;
DialogBox( GetModuleIstance(), MAKEINTRESOURCE( IDD_LUASCENE), hTopWnd, (DLGPROC)SceneBoxProc) ;
bool bOk = ( s_nContext != 0) ;
// elimino la scena dal contesto
GseContext* pGseCtx = GetGseContext( s_nContext) ;
if ( pGseCtx != nullptr) {
delete pGseCtx->m_pScene ;
pGseCtx->m_pScene = nullptr ;
}
s_nContext = 0 ;
return bOk ;
}
}
-316
View File
@@ -1,316 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : EXE_TestObjSurface.cpp Data : 24.03.24 Versione : 2.6c2
// Contenuto : Funzioni per verificare collisioni tra
// Objects e Superfici (TriMesh).
//
//
// Modifiche : 09.01.20 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "EXE_Const.h"
#include "AuxTools.h"
#include "GeoTools.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkCDeBoxClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeRectPrismoidClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeConeFrustumClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeSpheClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeClosedSurfTmClosedSurfTm.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
using namespace std ;
//----------------------------------------------------------------------------
static int
MyTestBoxSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, int nSurfTmId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
if ( pStm == nullptr)
return -1 ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
return -1 ;
// porto in locale alla superficie il riferimento del box (il vettore è già in questo stesso riferimento)
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frSurf) ;
// verifico l'a collisione'interferenza
return ( TestBoxSurfTm( frBoxL, vtDiag, *pStm, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeTestBoxSurface( const Frame3d& frBox, const Vector3d& vtDiag, int nSurfId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSurfId) == SRF_TRIMESH)
nRes = MyTestBoxSurfTm( frBox, vtDiag, nSurfId, dSafeDist, nRefType) ;
// è da aggiungere il test con le superfici di Bezier
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTestBoxSurface({{" + ToString( frBox.Orig()) + "},{" +
ToString( frBox.VersX()) + "},{" +
ToString( frBox.VersY()) + "},{" +
ToString( frBox.VersZ()) + "}},{" +
ToString( vtDiag) + "}," +
IdToString( nSurfId) + "," +
ToString( dSafeDist) + "," +
RefTypeToString( nRefType) + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nRes ;
}
//----------------------------------------------------------------------------
static int
MyTestRectPrismoidSurfTm( const Frame3d& frPrismoid, double dBaseLenX, double dBaseLenY,
double dTopLenX, double dTopLenY, double dHeight,
int nSurfTmId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
if ( pStm == nullptr)
return -1 ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
return -1 ;
// porto in locale alla superficie il riferimento del prismoide rettangolare
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frSurf) ;
// verifico l'a collisione'interferenza
return ( TestRectPrismoidSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, *pStm, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeTestRectPrismoidSurface( const Frame3d& frPrismoid, double dBaseLenX, double dBaseLenY,
double dTopLenX, double dTopLenY, double dHeight,
int nSurfId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSurfId) == SRF_TRIMESH)
nRes = MyTestRectPrismoidSurfTm( frPrismoid, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, nSurfId, dSafeDist, nRefType) ;
// è da aggiungere il test con le superfici di Bezier
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTestRectPrismoidSurface({{" + ToString( frPrismoid.Orig()) + "},{" +
ToString( frPrismoid.VersX()) + "},{" +
ToString( frPrismoid.VersY()) + "},{" +
ToString( frPrismoid.VersZ()) + "}}," +
ToString( dBaseLenX) + "," +
ToString( dBaseLenY) + "," +
ToString( dTopLenX) + "," +
ToString( dTopLenY) + "," +
ToString( dHeight) + "," +
IdToString( nSurfId) + "," +
ToString( dSafeDist) + "," +
RefTypeToString( nRefType) + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nRes ;
}
//----------------------------------------------------------------------------
static int
MyTestCylSurfTm( const Frame3d& frCyl, double dR, double dH, int nSurfTmId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
if ( pStm == nullptr)
return -1 ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
return -1 ;
// porto in locale alla superficie il riferimento del cilindro
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frSurf) ;
// verifico l'interferenza
return ( TestCylSurfTm( frCylL, dR, dH, *pStm, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeTestCylSurface( const Frame3d& frCyl, double dR, double dH, int nSurfId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSurfId) == SRF_TRIMESH)
nRes = MyTestCylSurfTm( frCyl, dR, dH, nSurfId, dSafeDist, nRefType) ;
// è da aggiungere il test con le superfici di Bezier
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTestCylSurface({{" + ToString( frCyl.Orig()) + "},{" +
ToString( frCyl.VersX()) + "},{" +
ToString( frCyl.VersY()) + "},{" +
ToString( frCyl.VersZ()) + "}}," +
ToString( dR) + "," +
ToString( dH) + "," +
IdToString( nSurfId) + "," +
ToString( dSafeDist) + "," +
RefTypeToString( nRefType) + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nRes ;
}
//----------------------------------------------------------------------------
static int
MyTestConeSurfTm( const Frame3d& frCone, double dR1, double dR2, double dH, int nSurfTmId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
if ( pStm == nullptr)
return -1 ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
return -1 ;
// porto in locale alla superficie il riferimento del cilindro
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frSurf) ;
// verifico l'interferenza
return ( TestConeFrustumSurfTm( frConeL, dR1, dR2, dH, *pStm, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeTestConeSurface( const Frame3d& frCone, double dR1, double dR2, double dH, int nSurfId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSurfId) == SRF_TRIMESH)
nRes = MyTestConeSurfTm( frCone, dR1, dR2, dH, nSurfId, dSafeDist, nRefType) ;
// è da aggiungere il test con le superfici di Bezier
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTestConeSurface({{" + ToString( frCone.Orig()) + "},{" +
ToString( frCone.VersX()) + "},{" +
ToString( frCone.VersY()) + "},{" +
ToString( frCone.VersZ()) + "}}," +
ToString( dR1) + "," +
ToString( dR2) + "," +
ToString( dH) + "," +
IdToString( nSurfId) + "," +
ToString( dSafeDist) + "," +
RefTypeToString( nRefType) + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nRes ;
}
//----------------------------------------------------------------------------
static int
MyTestSpheSurfTm( const Point3d& ptCen, double dR, int nSurfTmId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
if ( pStm == nullptr)
return -1 ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
return -1 ;
// porto in locale alla superficie il centro della sfera
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ;
// verifico l'a collisione'interferenza
return ( TestSpheSurfTm( ptCenL, dR, *pStm, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeTestSpheSurface( const Point3d& ptCen, double dR, int nSurfId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSurfId) == SRF_TRIMESH)
nRes = MyTestSpheSurfTm( ptCen, dR, nSurfId, dSafeDist, nRefType) ;
// è da aggiungere il test con le superfici di Bezier
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTestSpheSurface({" + ToString( ptCen) + "}," +
ToString( dR) + "," +
IdToString( nSurfId) + "," +
ToString( dSafeDist) + "," +
RefTypeToString( nRefType) + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nRes ;
}
//----------------------------------------------------------------------------
static int
MyTestSurfTmSurfTm( int nSurfTm1Id, int nSurfTm2Id, double dSafeDist)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero il riferimento della seconda superficie
Frame3d frSurf2 ;
if ( ! pGeomDB->GetGlobFrame( nSurfTm2Id, frSurf2))
return -1 ;
// recupero la prima superficie in locale alla seconda
SurfLocal Surf1Loc( pGeomDB, nSurfTm1Id, frSurf2) ;
const ISurfTriMesh* pStm1 = GetSurfTriMesh( Surf1Loc) ;
if ( pStm1 == nullptr)
return -1 ;
// recupero la seconda superficie TriMesh
const ISurfTriMesh* pStm2 = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTm2Id)) ;
if ( pStm2 == nullptr)
return -1 ;
// verifico l'a collisione'interferenza
return ( TestSurfTmSurfTm( *pStm1, *pStm2, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeTestSurfaceSurface( int nSurf1Id, int nSurf2Id, double dSafeDist)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr) {
if ( pGeomDB->GetGeoType( nSurf1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSurf2Id) == SRF_TRIMESH)
nRes = MyTestSurfTmSurfTm( nSurf1Id, nSurf2Id, dSafeDist) ;
// è da aggiungere il test con le superfici di Bezier
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTestSurfaceSurface({" + IdToString( nSurf1Id) + "," +
IdToString( nSurf2Id) + "," +
ToString( dSafeDist) + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nRes ;
}
+5 -6
View File
@@ -36,6 +36,7 @@ const int STR_DIM = 50 ;
//-----------------------------------------------------------------------------
static HINSTANCE s_hModule = nullptr ;
static char s_szEXeNameVer[STR_DIM] ;
//-----------------------------------------------------------------------------
BOOL APIENTRY
@@ -70,12 +71,10 @@ DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
const char*
GetEXeVersion( void)
{
static char s_szEXeNameVer[STR_DIM] = "" ;
if ( s_szEXeNameVer[0] == '\0') {
std::string sVer ;
GetModuleVersion( s_hModule, sVer) ;
sprintf_s( s_szEXeNameVer, STR_DIM, "%s%s", EXE_STR, sVer.c_str()) ;
}
std::string sVer ;
GetModuleVersion( s_hModule, sVer) ;
sprintf_s( s_szEXeNameVer, STR_DIM, "%s%s", EXE_STR, sVer.c_str()) ;
return s_szEXeNameVer ;
}
BIN
View File
Binary file not shown.
+2 -7
View File
@@ -1,8 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.35919.96 d17.13
MinimumVisualStudioVersion = 10.0.40219.1
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
@@ -25,7 +23,4 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {30B63942-DD1D-428A-BFD1-E603299B17B6}
EndGlobalSection
EndGlobal
+8 -20
View File
@@ -22,14 +22,14 @@
<ProjectGuid>{DF654897-F85B-4108-A621-F2C4AB099A48}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>EgtExecutor</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
</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>v143</PlatformToolset>
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -42,7 +42,7 @@
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -105,7 +105,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
<OpenMPSupport>false</OpenMPSupport>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -131,7 +131,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
<OmitFramePointers>false</OmitFramePointers>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile>
<Link>
@@ -166,7 +166,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -200,8 +200,8 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
<OpenMPSupport>false</OpenMPSupport>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<LanguageStandard>stdcpp20</LanguageStandard>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile>
<Link>
@@ -228,7 +228,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EXeConst.h" />
<ClInclude Include="..\Include\EXeDllMain.h" />
<ClInclude Include="..\Include\EXeExecutor.h" />
<ClInclude Include="DllExch3dm.h" />
<ClInclude Include="DllMain.h" />
<ClInclude Include="DllNesting.h" />
<ClInclude Include="EXE.h" />
@@ -249,23 +248,19 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="stdafx.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="DllExch3dm.cpp" />
<ClCompile Include="DllNesting.cpp" />
<ClCompile Include="EXE_Base64.cpp" />
<ClCompile Include="EXE_BeamMgr.cpp" />
<ClCompile Include="EXE_CAvTool.cpp" />
<ClCompile Include="EXE_CDeObjSolid.cpp" />
<ClCompile Include="EXE_GdbCreateVol.cpp" />
<ClCompile Include="EXE_GdbGet.cpp" />
<ClCompile Include="EXE_GdbGetCurve.cpp" />
<ClCompile Include="EXE_GdbGetPocketing.cpp" />
<ClCompile Include="EXE_GdbGetSurf.cpp" />
<ClCompile Include="EXE_GdbGetVol.cpp" />
<ClCompile Include="EXE_GdbModifyVol.cpp" />
<ClCompile Include="EXE_GeoDist.cpp" />
<ClCompile Include="EXE_GeoInters.cpp" />
<ClCompile Include="EXE_Image.cpp" />
<ClCompile Include="EXE_MachOpt.cpp" />
<ClCompile Include="EXE_MaxFiller.cpp" />
<ClCompile Include="EXE_Mutex.cpp" />
<ClCompile Include="EXE_NstAutoNesting.cpp" />
@@ -293,10 +288,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="EXE_NstCreateFlatParts.cpp" />
<ClCompile Include="EXE_Photo.cpp" />
<ClCompile Include="EXE_Picture.cpp" />
<ClCompile Include="EXE_Redis.cpp" />
<ClCompile Include="EXE_Scene.cpp" />
<ClCompile Include="EXE_ShortestPath.cpp" />
<ClCompile Include="EXE_TestObjSurface.cpp" />
<ClCompile Include="EXE_TscExec.cpp" />
<ClCompile Include="AuxTools.cpp" />
<ClCompile Include="DllExchange.cpp" />
@@ -307,23 +300,18 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="GenTools.cpp" />
<ClCompile Include="GeoTools.cpp" />
<ClCompile Include="GseContext.cpp" />
<ClCompile Include="LUA_Base64.cpp" />
<ClCompile Include="LUA_BeamMgr.cpp" />
<ClCompile Include="LUA_CAvTool.cpp" />
<ClCompile Include="LUA_CDeObjSolid.cpp" />
<ClCompile Include="LUA_GdbGet.cpp" />
<ClCompile Include="LUA_GdbGetCurve.cpp" />
<ClCompile Include="LUA_GdbGetPocketing.cpp" />
<ClCompile Include="LUA_GdbGetSurf.cpp" />
<ClCompile Include="LUA_GdbGetVol.cpp" />
<ClCompile Include="LUA_GeoDist.cpp" />
<ClCompile Include="LUA_GeoInters.cpp" />
<ClCompile Include="LUA_MachOpt.cpp" />
<ClCompile Include="LUA_MaxFiller.cpp" />
<ClCompile Include="LUA_Picture.cpp" />
<ClCompile Include="LUA_PolynomialRoots.cpp" />
<ClCompile Include="LUA_Redis.cpp" />
<ClCompile Include="LUA_TestObjSurface.cpp" />
<ClCompile Include="PictureObj.cpp" />
<ClCompile Include="LUA_Base.cpp" />
<ClCompile Include="LUA_GdbCreateCurve.cpp" />
-36
View File
@@ -108,9 +108,6 @@
<ClInclude Include="DllNesting.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="DllExch3dm.h">
<Filter>File di intestazione</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="LUA_Exchange.cpp">
@@ -392,39 +389,6 @@
<ClCompile Include="EXE_Mutex.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="DllExch3dm.cpp">
<Filter>File di origine\Optional Dll</Filter>
</ClCompile>
<ClCompile Include="EXE_GdbGetPocketing.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_GdbGetPocketing.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="EXE_TestObjSurface.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_TestObjSurface.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="EXE_MachOpt.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_MachOpt.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="EXE_Redis.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_Redis.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="EXE_Base64.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_Base64.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtExecutor.rc">
+2 -2
View File
@@ -20,9 +20,9 @@
//----------------------------------------------------------------------------
int
AdjustId( int nId, int nCtx)
AdjustId( int nId)
{
GseContext* pCtx = ( nCtx == 0 ? GetCurrGseContext() : GetGseContext( nCtx));
GseContext* pCtx = GetCurrGseContext() ;
VERIFY_CTX( pCtx, GDB_ID_NULL)
if ( nId == GDB_ID_CURRPART)
return pCtx->m_nCurrPart ;
+1 -1
View File
@@ -20,7 +20,7 @@ class IGeomDB ;
//----------------------------------------------------------------------------
// Sistemo Id per pezzo o layer correnti
int AdjustId( int nId, int nCtx = 0) ;
int AdjustId( int nId) ;
// Vettore espresso nel riferimento desiderato partendo da vettore nel riferimento RefType
Vector3d GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame3d& frLoc) ;
// Vettore espresso nel riferimento RefType partendo da vettore nel riferimento locale
+3 -18
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2025
// EgalTech 2014-2015
//----------------------------------------------------------------------------
// File : LUA.h Data : 03.11.25 Versione : 2.7k1
// File : LUA.h Data : 16.01.15 Versione : 1.6a3
// Contenuto : Dichiarazioni locali per moduli LUA.
//
//
@@ -54,9 +54,6 @@ bool LuaInstallGdbModifyVol( LuaMgr& luaMgr) ;
//-------------------------- GdbGet ------------------------------------------
bool LuaInstallGdbGet( LuaMgr& luaMgr) ;
//-------------------------- GdbGetPocketing ---------------------------------
bool LuaInstallGdbGetPocketing( LuaMgr& luaMgr) ;
//-------------------------- GdbGetCurve -------------------------------------
bool LuaInstallGdbGetCurve( LuaMgr& luaMgr) ;
@@ -65,7 +62,7 @@ bool LuaInstallGdbGetSurf( LuaMgr& luaMgr) ;
//-------------------------- GdbGetVol ---------------------------------------
bool LuaInstallGdbGetVol( LuaMgr& luaMgr) ;
//-------------------------- GdbPartLayer ------------------------------------
bool LuaInstallGdbPartLayer( LuaMgr& luaMgr) ;
@@ -93,9 +90,6 @@ bool LuaInstallGeoInters( LuaMgr& luaMgr) ;
//-------------------------- Collision Detection -----------------------------
bool LuaInstallCDeObjSolid( LuaMgr& luaMgr) ;
//-------------------------- Test Interference -------------------------------
bool LuaInstallTestObjSurface( LuaMgr& luaMgr) ;
//-------------------------- MachMgr -----------------------------------------
bool LuaInstallMachMgr( LuaMgr& luaMgr) ;
@@ -129,15 +123,6 @@ bool LuaInstallPolynomialRoots( LuaMgr& luaMgr) ;
//-------------------------- Shortest Path -----------------------------------
bool LuaInstallShortestPath( LuaMgr& luaMgr) ;
//----------------------- Machining Time Optimization ------------------------
bool LuaInstallMachiningOptimization( LuaMgr& luaMgr) ;
//-------------------------- Collision Avoidance Tool ------------------------
bool LuaInstallCAvTool( LuaMgr& luaMgr) ;
//---------------------------------- Redis ----------------------------------
bool LuaInstallRedis( LuaMgr& luaMgr) ;
//-------------------------- Base64 ------------------------------------------
bool LuaInstallBase64( LuaMgr& luaMgr) ;
-21
View File
@@ -78,10 +78,6 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGet (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallGdbGetPocketing( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGetPocketing (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallGdbGetCurve( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGetCurve (LuaInstallEgtFunctions)")
return false ;
@@ -130,10 +126,6 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
LOG_ERROR( GetLogger(), "Error in LuaInstallCDeObjSolid (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallTestObjSurface( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallTestObjSurface (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallMachMgr( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallMachMgr (LuaInstallEgtFunctions)")
return false ;
@@ -178,23 +170,10 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
LOG_ERROR( GetLogger(), "Error in LuaInstallShortestPath (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallMachiningOptimization( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallMachiningOptimization (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallCAvTool( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallCAvTool (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallRedis( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallRedis (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallBase64( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallBase64 (LuaInstallEgtFunctions)")
return false ;
}
return true ;
}
-65
View File
@@ -1,65 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : LUA_Base64.cpp Data : 03.11.25 Versione : 2.7k1
// Contenuto : Funzioni per codificare/decodificare in Base64 per LUA.
//
//
//
// Modifiche : 03.11.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaBase64Encode( lua_State* L)
{
// 1 parametro : sFile
string sFile ;
LuaCheckParam( L, 1, sFile) ;
LuaClearStack( L) ;
// eseguo la codifica del contenuto del file
string sB64Dest ;
bool bOk = ExeBase64Encode( sFile, sB64Dest) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, sB64Dest) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBase64Decode( lua_State* L)
{
// 2 parametro : sB64Sou, sFile
string sB64Sou ;
LuaCheckParam( L, 1, sB64Sou) ;
string sFile ;
LuaCheckParam( L, 2, sFile) ;
LuaClearStack( L) ;
// eseguo la decodifica della stringa nel file
bool bOk = ExeBase64Decode( sB64Sou, sFile) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallBase64( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBase64Encode", LuaBase64Encode) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBase64Decode", LuaBase64Decode) ;
return bOk ;
}
+8 -66
View File
@@ -21,21 +21,6 @@
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaInitBeamMgr( lua_State* L)
{
// 1 o nessun parametro : [nFlag]
int nFlag = EIB_FLAG_NONE ;
LuaGetParam( L, 1, nFlag) ;
LuaClearStack( L) ;
// inizializzo in gestore di travi e pareti
bool bOk = ExeInitBeamMgr( nFlag) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamCreatePart( lua_State* L)
@@ -166,7 +151,7 @@ LuaBeamGetSideData( lua_State* L)
int nSide ;
LuaCheckParam( L, 1, nSide)
LuaClearStack( L) ;
// restituisce i dati della faccia indicata del pezzo corrente
// imposto le dimensioni al pezzo corrente
Frame3d frRef ;
double dLength, dWidth, dHeight ;
bool bOk = ExeBeamGetSideData( nSide, frRef, dLength, dWidth, dHeight) ;
@@ -188,7 +173,7 @@ LuaBeamGetSideData( lua_State* L)
static int
LuaBeamAddProcess( lua_State* L)
{
// 9 o 10 o 11 o 12 parametri : nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar, vsUAtt [, nCrv] [, nCrv2] [, bUpdate]
// 9 o 10 o 11 o 12 parametri : nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar [, nCrv, nCrv2] [, bUpdate]
int nGroup ;
LuaCheckParam( L, 1, nGroup)
int nProc ;
@@ -213,8 +198,6 @@ LuaBeamAddProcess( lua_State* L)
if ( LuaGetParam( L, 10, nCrvId) &&
LuaGetParam( L, 11, nCrv2Id))
LuaGetParam( L, 12, bUpdate) ;
else if ( LuaGetParam( L, 10, nCrvId))
LuaGetParam( L, 11, bUpdate) ;
else
LuaGetParam( L, 10, bUpdate) ;
LuaClearStack( L) ;
@@ -232,7 +215,7 @@ LuaBeamAddProcess( lua_State* L)
static int
LuaBeamModifyProcess( lua_State* L)
{
// 10 o 11 o 12 o 13 parametri : nGeomId, nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar, vsUAtt [, nCrv, nCrv2] [, bUpdate]
// 10 o 11 o 12 o 13 parametri : nGeomId, nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar [, nCrv, nCrv2] [, bUpdate]
int nGeomId ;
LuaCheckParam( L, 1, nGeomId)
int nGroup ;
@@ -259,8 +242,6 @@ LuaBeamModifyProcess( lua_State* L)
if ( LuaGetParam( L, 11, nCrvId) &&
LuaGetParam( L, 12, nCrv2Id))
LuaGetParam( L, 13, bUpdate) ;
else if ( LuaGetParam( L, 11, nCrvId))
LuaGetParam( L, 12, bUpdate) ;
else
LuaGetParam( L, 11, bUpdate) ;
LuaClearStack( L) ;
@@ -310,38 +291,6 @@ LuaBeamEnableProcess( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamCalcAllSolids( lua_State* L)
{
// 1 o 2 parametri : bShow [,bRecalc]
bool bShow ;
LuaCheckParam( L, 1, bShow)
bool bRecalc = false ;
LuaGetParam( L, 2, bRecalc) ;
LuaClearStack( L) ;
// eseguo calcolo dei solidi di tutte le travi
bool bOk = ExeBeamCalcAllSolids( bShow, bRecalc) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamShowAllSolids( lua_State* L)
{
// 1 parametro : bShow
bool bShow ;
LuaCheckParam( L, 1, bShow)
LuaClearStack( L) ;
// aggiorno stato di visualizzazione dei solidi di tutte le travi
bool bOk = ExeBeamShowAllSolids( bShow) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamCalcSolid( lua_State* L)
@@ -398,12 +347,10 @@ LuaBeamShowSolid( lua_State* L)
static int
LuaBeamGetBuildingIsOn( lua_State* L)
{
// 1 o nessun parametro : [nAssGrpId]
int nAssGrpId = GDB_ID_NULL ;
LuaGetParam( L, 1, nAssGrpId) ;
// Nessun parametro
LuaClearStack( L) ;
// restituisco identificativo del solido della trave
bool bOk = ExeBeamGetBuildingIsOn( nAssGrpId) ;
bool bOk = ExeBeamGetBuildingIsOn() ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -413,14 +360,12 @@ LuaBeamGetBuildingIsOn( lua_State* L)
static int
LuaBeamShowBuilding( lua_State* L)
{
// 1 o 2 parametri : [nAssGrpId,] bShow
int nAssGrpId = GDB_ID_NULL ;
int nPar = ( LuaGetParam( L, 1, nAssGrpId) ? 2 : 1) ;
// 1 parametro : bShow
bool bShow ;
LuaCheckParam( L, nPar, bShow)
LuaCheckParam( L, 1, bShow)
LuaClearStack( L) ;
// attivo o disattivo la visualizzazione l'assemblaggio
bool bOk = ExeBeamShowBuilding( nAssGrpId, bShow) ;
bool bOk = ExeBeamShowBuilding( bShow) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -431,7 +376,6 @@ bool
LuaInstallBeamMgr( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtInitBeamMgr", LuaInitBeamMgr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamCreatePart", LuaBeamCreatePart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamSetPart", LuaBeamSetPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamErasePart", LuaBeamErasePart) ;
@@ -445,8 +389,6 @@ LuaInstallBeamMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamModifyProcess", LuaBeamModifyProcess) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamEraseProcess", LuaBeamEraseProcess) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamEnableProcess", LuaBeamEnableProcess) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamCalcAllSolids", LuaBeamCalcAllSolids) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamShowAllSolids", LuaBeamShowAllSolids) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamCalcSolid", LuaBeamCalcSolid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamGetSolid", LuaBeamGetSolid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamShowSolid", LuaBeamShowSolid) ;
-22
View File
@@ -118,27 +118,6 @@ LuaCAvGetToolOutline( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCAvToolPosBox( lua_State* L)
{
// 4 parametri : ptP, vtAx, b3Box, vtMove
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtAx ;
LuaCheckParam( L, 2, vtAx)
BBox3d b3Box ;
LuaCheckParam( L, 3, b3Box)
Vector3d vtMove ;
LuaCheckParam( L, 4, vtMove)
LuaClearStack( L) ;
// determino il movimento da dare all'utensile per evitare la collisione con il parallelepipedo
double dMove = ExeCAvToolPosBox( ptP, vtAx, b3Box, vtMove) ;
// restituisco il risultato
LuaSetParam( L, dMove) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCAvToolPosStm( lua_State* L)
@@ -197,7 +176,6 @@ LuaInstallCAvTool( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetSawTool", LuaCAvSetSawTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetGenTool", LuaCAvSetGenTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvGetToolOutline", LuaCAvGetToolOutline) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPosBox", LuaCAvToolPosBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPosStm", LuaCAvToolPosStm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPathStm", LuaCAvToolPathStm) ;
return bOk ;
+11 -49
View File
@@ -154,52 +154,16 @@ LuaImportStl( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaImportOff( 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 = ExeImportOff( sFilePath, dScaleFactor) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaImportPly( 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 = ExeImportPly( sFilePath, dScaleFactor) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaImport3MF( lua_State* L)
{
// 1 o 2 parametri : path del file da importare [, flag]
// 1 parametro : path del file da importare
string sFilePath ;
LuaCheckParam( L, 1, sFilePath)
int nFlag = 0 ;
LuaGetParam( L, 2, nFlag) ;
LuaCheckParam( L, 1, sFilePath)
LuaClearStack( L) ;
// apro il file
bool bOk = ExeImport3MF( sFilePath, nFlag) ;
bool bOk = ExeImport3MF( sFilePath) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -209,12 +173,14 @@ LuaImport3MF( lua_State* L)
static int
LuaImport3dm( lua_State* L)
{
// 1 parametro : path del file da importare
// 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 = ExeImport3dm( sFilePath) ;
bool bOk = ExeImport3dm( sFilePath, dScaleFactor) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -224,16 +190,14 @@ LuaImport3dm( lua_State* L)
static int
LuaAdvancedImport( lua_State* L)
{
// 1 o 2 o 3 parametri : path del file da importare [, dLinToler] [, nFlag]
// 1 o 2 parametri : path del file da importare [, dLinToler]
string sFilePath ;
LuaCheckParam( L, 1, sFilePath)
double dLinToler = 0.1 ;
LuaGetParam( L, 2, dLinToler) ;
int nFlag = 0 ;
LuaGetParam( L, 3, nFlag) ;
LuaClearStack( L) ;
// apro il file
bool bOk = ExeAdvancedImport( sFilePath, dLinToler, nFlag) ;
bool bOk = ExeAdvancedImport( sFilePath, dLinToler) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -292,7 +256,7 @@ LuaExport3MF( lua_State* L)
LuaGetParam( L, 3, nFilter) ;
LuaClearStack( L) ;
// creo il file
bool bOk = ExeExport3MF( nGroupId, sFilePath, nFilter) ;
bool bOk = ExeExport3MF( nGroupId, sFilePath) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -311,7 +275,7 @@ LuaExport3dm( lua_State* L)
LuaGetParam( L, 3, nFilter) ;
LuaClearStack( L) ;
// creo il file
bool bOk = ExeExport3dm( nGroupId, sFilePath, nFilter) ;
bool bOk = ExeExport3dm( nGroupId, sFilePath) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -368,8 +332,6 @@ LuaInstallExchange( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtImportDxf", LuaImportDxf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportPnt", LuaImportPnt) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportStl", LuaImportStl) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportOff", LuaImportOff) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportPly", LuaImportPly) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImport3MF", LuaImport3MF) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImport3dm", LuaImport3dm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAdvancedImport", LuaAdvancedImport) ;
+37 -39
View File
@@ -400,13 +400,13 @@ LuaCreateDiametralDimension( lua_State* L )
static int
LuaCreateAngularDimension(lua_State* L)
{
// 6 o 7 parametri : ParentId, ptV, ptP1, ptP2, ptDim, Text [, nRefType]
// 6 o 7 parametri : ParentId, ptP1, ptP0, ptP2, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptV ;
LuaCheckParam( L, 2, ptV) ;
Point3d ptP1 ;
LuaCheckParam( L, 3, ptP1) ;
LuaCheckParam( L, 2, ptP1) ;
Point3d ptP0 ;
LuaCheckParam( L, 3, ptP0) ;
Point3d ptP2 ;
LuaCheckParam( L, 4, ptP2) ;
Point3d ptDim ;
@@ -417,39 +417,7 @@ LuaCreateAngularDimension(lua_State* L)
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ;
// creo la quota angolare
int nId = ExeCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateAngularDimensionEx(lua_State* L)
{
// 7 o 8 parametri : ParentId, ptV1, ptP1, ptV2, ptP2, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptV1 ;
LuaCheckParam( L, 2, ptV1) ;
Point3d ptP1 ;
LuaCheckParam( L, 3, ptP1) ;
Point3d ptV2 ;
LuaCheckParam( L, 4, ptV2) ;
Point3d ptP2 ;
LuaCheckParam( L, 5, ptP2) ;
Point3d ptDim ;
LuaCheckParam( L, 6, ptDim) ;
string sText ;
LuaCheckParam( L, 7, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 8, nRefType) ;
LuaClearStack( L) ;
// creo la quota angolare
int nId = ExeCreateAngularDimensionEx( nParentId, ptV1, ptP1, ptV2, ptP2, ptDim, sText, nRefType) ;
int nId = ExeCreateAngularDimension( nParentId, ptP1, ptP0, ptP2, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -510,6 +478,36 @@ LuaCreateAngularDimensionFromArc( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateAngularDimensionFromCircle( lua_State* L)
{
// 6 o 7 parametri : nParentId, nCrvId, ptP1, ptP2, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId) ;
Point3d ptP1 ;
LuaCheckParam( L, 3, ptP1) ;
Point3d ptP2 ;
LuaCheckParam( L, 4, ptP2) ;
Point3d ptDim ;
LuaCheckParam( L, 5, ptDim) ;
string sText ;
LuaCheckParam( L, 6, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ;
// creo la quota allineata
int nId = ExeCreateAngularDimensionFromCircle( nParentId, nCrvId, ptP1, ptP2, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbCreate( LuaMgr& luaMgr)
@@ -529,9 +527,9 @@ LuaInstallGdbCreate( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAlignedDimension", LuaCreateAlignedDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRadialDimension", LuaCreateRadialDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDiametralDimension", LuaCreateDiametralDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionEx", LuaCreateAngularDimensionEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension);
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromCircle", LuaCreateAngularDimensionFromCircle) ;
return bOk ;
}
-51
View File
@@ -425,34 +425,6 @@ LuaCreateArc3P( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateArc2PR( lua_State* L)
{
// 5 o 6 parametri : ParentId, PtStart, PtEnd, dRad, bCCW [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptStart ;
LuaCheckParam( L, 2, ptStart)
Point3d ptEnd ;
LuaCheckParam( L, 3, ptEnd)
double dRad ;
LuaCheckParam( L, 4, dRad)
bool bCCW ;
LuaCheckParam( L, 5, bCCW) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 6, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = ExeCreateArc2PR( nParentId, ptStart, ptEnd, dRad, bCCW, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateArc2PB( lua_State* L)
@@ -728,27 +700,6 @@ LuaCreateCurveBezierFromArc( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateCurveBezierFromCurve( lua_State* L)
{
// 2 o 3 parametri : ParentId, nCrvId [, bRat]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId)
bool bRat = true ;
LuaGetParam( L, 3, bRat) ;
// creo la versione bezier della curva
int nId = ExeCreateCurveBezierFromCurve( nParentId, nCrvId, bRat) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateCurveCompo( lua_State* L)
@@ -1132,7 +1083,6 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2P", LuaCreateArcC2P) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2PEx", LuaCreateArcC2PEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc3P", LuaCreateArc3P) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PR", LuaCreateArc2PR) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PB", LuaCreateArc2PB) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PD", LuaCreateArc2PD) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PDEx", LuaCreateArc2PDEx) ;
@@ -1143,7 +1093,6 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezier", LuaCreateCurveBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierRat", LuaCreateCurveBezierRational) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierFromArc", LuaCreateCurveBezierFromArc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierFromCurve", LuaCreateCurveBezierFromCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompo", LuaCreateCurveCompo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoByChain", LuaCreateCurveCompoByChain) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoByReorder", LuaCreateCurveCompoByReorder) ;
+30 -685
View File
@@ -15,7 +15,6 @@
#include "stdafx.h"
#include "LUA.h"
#include "EXE_Const.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
@@ -148,7 +147,7 @@ LuaCreateSurfFlatRegion( lua_State* L)
static int
LuaCreateSurfFrFatCurve( lua_State* L)
{
// 4 o 5 o 6 parametri : ParentId, nCrvId, dRad, bSquared [, bSquaredMids] [, dLinTol]
// 4 parametri : ParentId, nCrvId, dRad, bSquared
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
@@ -157,31 +156,9 @@ LuaCreateSurfFrFatCurve( lua_State* L)
LuaCheckParam( L, 3, dRad)
bool bSquared ;
LuaCheckParam( L, 4, bSquared)
bool bSquaredMids = bSquared ;
LuaGetParam( L, 5, bSquaredMids) ;
double dLinTol = 10 * EPS_SMALL ;
LuaGetParam( L, 6, dLinTol) ;
LuaClearStack( L) ;
// creo una regione piana
int nId = ExeCreateSurfFrFatCurve( nParentId, nCrvId, dRad, bSquared, bSquaredMids, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmEmpty( lua_State* L)
{
// 1 parametro : ParentId
int nParentId ;
LuaCheckParam( L, 1, nParentId)
LuaClearStack( L) ;
// creo STM vuoto
int nId = ExeCreateSurfTmEmpty( nParentId) ;
int nId = ExeCreateSurfFrFatCurve( nParentId, nCrvId, dRad, bSquared) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -408,7 +385,7 @@ LuaCreateSurfTmSphere( lua_State* L)
else
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// creo STM sfera
// creo STM cilindro
int nId = ExeCreateSurfTmSphere( nParentId, ptOrig, dRad, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
@@ -418,178 +395,6 @@ LuaCreateSurfTmSphere( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmPyramidFrustum( lua_State* L)
{
// 6 parametri : ParentId, dBaseDimX, dBaseDimY, dTopDimX, dTopDimY, dHeight
int nParentId ;
LuaCheckParam( L, 1, nParentId)
double dBaseDimX ;
LuaCheckParam( L, 2, dBaseDimX)
double dBaseDimY ;
LuaCheckParam( L, 3, dBaseDimY)
double dTopDimX ;
LuaCheckParam( L, 4, dTopDimX)
double dTopDimY ;
LuaCheckParam( L, 5, dTopDimY)
double dHeight ;
LuaCheckParam( L, 6, dHeight)
LuaClearStack( L) ;
// creo STM cilindro
int nId = ExeCreateSurfTmPyramidFrustum( nParentId, dBaseDimX, dBaseDimY, dTopDimX, dTopDimY, dHeight) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmConeFrustum( lua_State* L)
{
// 4 o 5 parametri : ParentId, dBaseRad, dTopRad, dHeight [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
double dBaseRad ;
LuaCheckParam( L, 2, dBaseRad)
double dTopRad ;
LuaCheckParam( L, 3, dTopRad)
double dHeight ;
LuaCheckParam( L, 4, dHeight)
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 5, dLinTol) ;
LuaClearStack( L) ;
// creo STM cilindro
int nId = ExeCreateSurfTmConeFrustum( nParentId, dBaseRad, dTopRad, dHeight, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmTriangle( 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 STM triangolo
int nId = ExeCreateSurfTmTriangle( nParentId, PtP1, PtP2, PtP3, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmRectangle( lua_State* L)
{
// 4 o 5 parametri : ParentId, PtO, PtL, PtT [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptO ;
LuaCheckParam( L, 2, ptO)
Point3d ptL ;
LuaCheckParam( L, 3, ptL)
Point3d ptT ;
LuaCheckParam( L, 4, ptT)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo STM rettangolo
int nId = ExeCreateSurfTmRectangle( nParentId, ptO, ptL, ptT, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmByPolygon( 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) ;
// creo una polilinea a partire dai punti
PolyLine PL ;
for ( size_t i = 0 ; i < vPnt.size() ; ++ i) {
if ( ! vPnt[i].IsValid())
break ;
PL.AddUPoint( double( i), vPnt[i]) ;
}
PL.Close() ;
// creo la SurfTriMesh del poligono
int nId = ExeCreateSurfTmByPolygon( nParentId, PL, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmByPolygonWithHoles( 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) ;
// creo un vettore di polilinee a partire dai punti
POLYLINEVECTOR vPL ;
vPL.push_back( {}) ;
for ( size_t i = 0 ; i < vPnt.size() ; ++ i) {
if ( vPnt[i].IsValid())
vPL.back().AddUPoint( double( i), vPnt[i]) ;
else {
if ( ! vPL.empty())
vPL.back().Close() ;
vPL.push_back( {}) ;
}
}
if ( ! vPL.empty())
vPL.back().Close() ;
// creo la SurfTriMesh del poligono
int nId = ExeCreateSurfTmByPolygonWithHoles( nParentId, vPL, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmByFlatContour( lua_State* L)
@@ -648,9 +453,11 @@ LuaCreateSurfTmByExtrusion( lua_State* L)
Vector3d vtExtr ;
LuaCheckParam( L, 3, vtExtr)
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 4, dLinTol) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
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,
@@ -796,41 +603,6 @@ LuaCreateSurfTmRectSwept( lua_State* L)
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmSwept( lua_State* L)
{
// 4, 5, 6 o 7 parametri : ParentId, SectId, GuideId [, vtAx], bCapEnds [, dTol] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSectId ;
LuaCheckParam( L, 2, nSectId)
int nGuideId ;
LuaCheckParam( L, 3, nGuideId)
int nPar = 4 ;
Vector3d vtAx = V_NULL ;
if ( LuaGetParam( L, nPar, vtAx))
++ nPar ;
bool bCapEnds ;
LuaCheckParam( L, nPar, bCapEnds)
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, nPar, nRefType))
++ nPar ;
LuaClearStack( L) ;
// creo STM swept
int nId = ExeCreateSurfTmSwept( nParentId, nSectId, nGuideId, vtAx, bCapEnds, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmTransSwept( lua_State* L)
{
// 4 o 5 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol]
int nParentId ;
@@ -844,8 +616,8 @@ LuaCreateSurfTmTransSwept( lua_State* L)
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 5, dLinTol) ;
LuaClearStack( L) ;
// creo STM swept di traslazione
int nId = ExeCreateSurfTmTransSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol) ;
// creo STM swept
int nId = ExeCreateSurfTmSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -933,6 +705,26 @@ LuaCreateSurfTmBySewing( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmBySurfBezier( lua_State* L)
{
// 2 parametri : ParentId, nSbezId
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nZmapId ;
LuaCheckParam( L, 2, nZmapId)
LuaClearStack( L) ;
// creo STM partendo da superficie di Bezier
int nId = ExeCreateSurfTmBySurfBezier( nParentId, nZmapId) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmByVolZmap( lua_State* L)
@@ -1024,432 +816,6 @@ LuaCreateSurfBezierRational( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBezierLeaves( lua_State* L)
{
// 2, 3 o 4 parametri : ParentId, nId [, nTextHeight] [, bShowTrim]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSurfBzId ;
LuaCheckParam( L, 2, nSurfBzId)
int nTextHeight = 50 ;
bool bShowTrim = false ;
if ( LuaGetParam( L, 3, nTextHeight))
LuaGetParam( L, 4, bShowTrim) ;
else
LuaGetParam( L, 3, bShowTrim) ;
LuaClearStack( L) ;
// creo la superficie
int nCount = 0 ;
int nId = ExeCreateSurfBezierLeaves( nParentId, nSurfBzId, nTextHeight, bShowTrim, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBezierTria2D( lua_State* L)
{
// 2, 3 o 4 parametri : ParentId, nId [, nTextHeight] [, bShowTrim]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSurfBzId ;
LuaCheckParam( L, 2, nSurfBzId)
int nTextHeight = 50 ;
bool bShowTrim = false ;
if ( LuaGetParam( L, 3, nTextHeight))
LuaGetParam( L, 4, bShowTrim) ;
else
LuaGetParam( L, 3, bShowTrim) ;
LuaClearStack( L) ;
// creo la superficie
int nCount = 0 ;
int nId = ExeCreateSurfBezierTria2D( nParentId, nSurfBzId, nTextHeight, bShowTrim, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateBezierSphere( lua_State* L)
{
// 3 o 4 parametri : ParentId, ptCenter, dRad [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptCenter ;
LuaCheckParam( L, 2, ptCenter)
double dRad ;
LuaCheckParam( L, 3, dRad)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 4, nRefType) ;
// creo la superficie
int nCount = 0 ;
int nId = ExeCreateBezierSphere( nParentId, ptCenter, dRad, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzByFlatContour( 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_SRF ;
if ( lua_gettop( L) >= 3)
LuaCheckParam( L, 3, dLinTol) ;
LuaClearStack( L) ;
// creo Sbz piana e la trimmo con il contorno
int nId = ExeCreateSurfBzByFlatContour( nParentId, nCrvId, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzByRegion( 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_SRF ;
if ( lua_gettop( L) >= 3)
LuaCheckParam( L, 3, dLinTol) ;
LuaClearStack( L) ;
// creo una Sbz piana a cui aggiungo le curve come trim
int nId = ExeCreateSurfBzByRegion( nParentId, vCrvIds, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzByExtrusion( lua_State* L)
{
// 3 o 4 o 5 o 6 parametri : ParentId, CrvId, vtExtr [, bool bCapEnds] [, dTol] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId)
Vector3d vtExtr ;
LuaCheckParam( L, 3, vtExtr)
bool bCapEnds = false ;
int nPar = 4 ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, nPar, nRefType) ;
LuaClearStack( L) ;
// creo SurfBezier estrudendo un percorso, se piano si possono mettere i tappi
int nCount = 0 ;
int nId = ExeCreateSurfBzByExtrusion( nParentId, nCrvId, vtExtr, bCapEnds, dLinTol, nRefType, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzByRegionExtrusion( lua_State* L)
{
// 3 o 4 o 5 o 6 parametri : ParentId, CrvIds, vtExtr [, bool bCapEnds] [, dTol] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
INTVECTOR vCrvIds ;
LuaCheckParam( L, 2, vCrvIds)
Vector3d vtExtr ;
LuaCheckParam( L, 3, vtExtr)
bool bCapEnds = false ;
int nPar = 4 ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, nPar, nRefType) ;
LuaClearStack( L) ;
// creo STM estrudendo uno o più percorsi, se piani si possono mettere i tappi
int nId = ExeCreateSurfBzByRegionExtrusion( nParentId, vCrvIds, vtExtr, bCapEnds, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzByScrewing( lua_State* L)
{
// 6 o 7 o 8 o 9 parametri : ParentId, CrvId, ptAx, vtAx, dAngRotDeg, dMove [, 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)
double dAngRotDeg ;
LuaCheckParam( L, 5, dAngRotDeg)
double dMove ;
LuaCheckParam( L, 6, dMove)
int nPar = 7 ;
bool bCapEnds = false ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, nPar, nRefType))
++ nPar ;
LuaClearStack( L) ;
// creo STM riempiendo un contorno piano
int nId = ExeCreateSurfBzByScrewing( nParentId, nCrvId, ptAx, vtAx, dAngRotDeg, dMove, bCapEnds, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzByRevolve( lua_State* L)
{
// 4 o 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)
int nPar = 5 ;
bool bCapEnds = false ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, nPar, nRefType))
++ nPar ;
LuaClearStack( L) ;
// creo STM riempiendo un contorno piano
int nId = ExeCreateSurfBzByRevolve( nParentId, nCrvId, ptAx, vtAx, bCapEnds, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzByPointCurve( lua_State* L)
{
// 4 o 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 ptTop ;
LuaCheckParam( L, 3, ptTop)
int nPar = 4 ;
bool bCapEnds = false ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, nPar, nRefType))
++ nPar ;
LuaClearStack( L) ;
// creo STM riempiendo un contorno piano
int nId = ExeCreateSurfBzByPointCurve( nParentId, nCrvId, ptTop, bCapEnds, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzRuled( lua_State* L)
{
// 4 o 5 o 6 parametri : ParentId, CrvId1, CrvId2, nRuledType [, bCapEnds] [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId1 ;
LuaCheckParam( L, 2, nCrvId1)
int nCrvId2 ;
LuaCheckParam( L, 3, nCrvId2)
int nRuledType ;
LuaCheckParam( L, 4, nRuledType)
bool bCapEnds = false ;
int nPar = 5 ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, nPar, dLinTol) ;
LuaClearStack( L) ;
// creo una surf bezier come rigata tra le due curve passate
int nId = ExeCreateSurfBzRuled( nParentId, nCrvId1, nCrvId2, nRuledType, bCapEnds, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzRuledGuided( lua_State* L)
{
// 4 o 5 o 6 parametri : ParentId, CrvId1, CrvId2 nLayGuides [, bCapEnds] [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId1 ;
LuaCheckParam( L, 2, nCrvId1)
int nCrvId2 ;
LuaCheckParam( L, 3, nCrvId2)
int nLayGuides ;
LuaCheckParam( L, 4, nLayGuides)
bool bCapEnds = false ;
int nPar = 5 ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, nPar, dLinTol) ;
LuaClearStack( L) ;
// creo una surf bezier come rigata tra le due curve passate, usando le isocurve nel layer nLayIso
int nId = ExeCreateSurfBzRuledGuided( nParentId, nCrvId1, nCrvId2, nLayGuides, bCapEnds, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzSkinned( lua_State* L)
{
// 2 o 3 o 4 parametri : ParentId, vCrvIds [, bCapEnds] [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
INTVECTOR vCrvIds ;
LuaCheckParam( L, 2, vCrvIds)
bool bCapEnds = false ;
int nPar = 3 ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, nPar, dLinTol) ;
LuaClearStack( L) ;
// creo STM riempiendo un contorno piano
int nId = ExeCreateSurfBzSkinned( nParentId, vCrvIds, bCapEnds, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzSwept( lua_State* L)
{
// 3 o 4 o 5 o 6 o 7 parametri : ParentId, nSectCrvId, nGuideCrvId [, vtAx] [, bCapEnds] [, dTol] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSectId ;
LuaCheckParam( L, 2, nSectId)
int nGuideId ;
LuaCheckParam( L, 3, nGuideId)
Vector3d vtAx = V_NULL ;
int nPar = 4 ;
if ( LuaGetParam( L, nPar, vtAx))
++ nPar ;
bool bCapEnds = false ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
LuaClearStack( L) ;
// creo STM riempiendo un contorno piano
int nId = ExeCreateSurfBzSwept( nParentId, nSectId, nGuideId, vtAx, bCapEnds, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
@@ -1461,7 +827,6 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrDisk", LuaCreateSurfFrDisk) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrFatCurve", LuaCreateSurfFrFatCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFlatRegion", LuaCreateSurfFlatRegion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmEmpty", LuaCreateSurfTmEmpty) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPlaneInBBox", LuaCreateSurfTmPlaneInBBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmConvexHullInBBox", LuaCreateSurfTmConvexHullInBBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBBox", LuaCreateSurfTmBBox) ;
@@ -1470,12 +835,6 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCylinder", LuaCreateSurfTmCylinder) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCone", LuaCreateSurfTmCone) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSphere", LuaCreateSurfTmSphere) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPyramidFrustum", LuaCreateSurfTmPyramidFrustum) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmConeFrustum", LuaCreateSurfTmConeFrustum) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTriangle", LuaCreateSurfTmTriangle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectangle", LuaCreateSurfTmRectangle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByPolygon", LuaCreateSurfTmByPolygon) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByPolygonWithHoles", LuaCreateSurfTmByPolygonWithHoles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByFlatContour", LuaCreateSurfTmByFlatContour) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRegion", LuaCreateSurfTmByRegion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByExtrusion", LuaCreateSurfTmByExtrusion) ;
@@ -1484,26 +843,12 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByScrewing", LuaCreateSurfTmByScrewing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectSwept", LuaCreateSurfTmRectSwept) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwept", LuaCreateSurfTmSwept) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTransSwept", LuaCreateSurfTmTransSwept) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRuled", LuaCreateSurfTmRuled) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySurfBezier", LuaCreateSurfTmBySurfBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByVolZmap", LuaCreateSurfTmByVolZmap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezier", LuaCreateSurfBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierRat", LuaCreateSurfBezierRational) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierLeaves", LuaCreateSurfBezierLeaves) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierTria2D", LuaCreateSurfBezierTria2D) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzSphere", LuaCreateBezierSphere) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByFlatContour", LuaCreateSurfBzByFlatContour) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByRegion", LuaCreateSurfBzByRegion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByExtrusion", LuaCreateSurfBzByExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByRegionExtrusion", LuaCreateSurfBzByRegionExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByScrewing", LuaCreateSurfBzByScrewing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByRevolve", LuaCreateSurfBzByRevolve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByPointCurve", LuaCreateSurfBzByPointCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzRuled", LuaCreateSurfBzRuled) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzRuledGuided", LuaCreateSurfBzRuledGuided) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzSkinned", LuaCreateSurfBzSkinned) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzSwept", LuaCreateSurfBzSwept) ;
return bOk ;
}
+3 -45
View File
@@ -14,7 +14,6 @@
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
@@ -55,42 +54,6 @@ LuaCreateVolZmapBox( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateVolZmapEmpty( lua_State* L)
{
// 6 o 7 o 8 parametri : ParentId, PtIni, dDimX, dDimY, dDimZ, dPrec [, bTriDex] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptIni ;
LuaCheckParam( L, 2, ptIni)
double dDimX ;
LuaCheckParam( L, 3, dDimX)
double dDimY ;
LuaCheckParam( L, 4, dDimY)
double dDimZ ;
LuaCheckParam( L, 5, dDimZ)
double dPrec ;
LuaCheckParam( L, 6, dPrec)
bool bTriDex = true ;
int nRefType = RTY_DEFAULT ;
if ( ! LuaGetParam( L, 7, bTriDex))
LuaGetParam( L, 7, nRefType) ;
else
LuaGetParam( L, 8, nRefType) ;
LuaClearStack( L) ;
// creo VZM parallelepipedo
int nId = ExeCreateVolZmapEmpty( nParentId, ptIni, dDimX, dDimY, dDimZ, dPrec, bTriDex, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateVolZmapByRegionExtrusion( lua_State* L)
@@ -121,7 +84,7 @@ LuaCreateVolZmapByRegionExtrusion( lua_State* L)
static int
LuaCreateVolZmapFromSurfTm( lua_State* L)
{
// 3 o 4 o 5 parametri : ParentId, StmId, dPrec [, bTriDex] [, dExtraBox]
// 3 o 4 parametri : ParentId, StmId, dPrec [, bTriDex]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nStmId ;
@@ -129,14 +92,10 @@ LuaCreateVolZmapFromSurfTm( lua_State* L)
double dPrec ;
LuaCheckParam( L, 3, dPrec)
bool bTriDex = true ;
double dExtraBox = 0 ;
if ( LuaGetParam( L, 4, bTriDex))
LuaGetParam( L, 5, dExtraBox) ;
else
LuaGetParam( L, 4, dExtraBox) ;
LuaGetParam( L, 4, bTriDex) ;
LuaClearStack( L) ;
// creo VZM da superficie trimesh
int nId = ExeCreateVolZmapFromSurfTm( nParentId, nStmId, dPrec, bTriDex, dExtraBox) ;
int nId = ExeCreateVolZmapFromSurfTm( nParentId, nStmId, dPrec, bTriDex) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -151,7 +110,6 @@ LuaInstallGdbCreateVol( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapBox", LuaCreateVolZmapBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapEmpty", LuaCreateVolZmapEmpty) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapByRegionExtrusion", LuaCreateVolZmapByRegionExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapFromSurfTm", LuaCreateVolZmapFromSurfTm) ;
return bOk ;
+4 -153
View File
@@ -57,25 +57,6 @@ LuaCurveLength( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveLengthAtParam( lua_State* L)
{
// 2 parametri : Id, dPar
int nId ;
LuaCheckParam( L, 1, nId)
double dPar ;
LuaCheckParam( L, 2, dPar) ;
LuaClearStack( L) ;
// recupero la lunghezza della curva
double dLen ;
if ( ExeCurveLengthAtParam( nId, dPar, &dLen))
LuaSetParam( L, dLen) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveParamAtLength( lua_State* L)
@@ -161,7 +142,7 @@ LuaCurveIsACircle( lua_State* L)
double dToler = EPS_SMALL ;
LuaGetParam( L, 2, dToler) ;
LuaClearStack( L) ;
// verifico se curva equivalente ad una circonferenza
// verifico se curva è equivalente ad una circonferenza
Point3d ptCen ;
Vector3d vtN ;
double dRad ;
@@ -185,7 +166,7 @@ LuaCurveIsARectangle( lua_State* L)
double dToler = EPS_SMALL ;
LuaGetParam( L, 2, dToler) ;
LuaClearStack( L) ;
// verifico se curva equivalente ad un rettangolo
// verifico se curva è equivalente ad un rettangolo
Point3d ptP ;
Vector3d vtL1 ;
Vector3d vtL2 ;
@@ -207,7 +188,7 @@ LuaCurveIsATrapezoid( lua_State* L)
double dToler = EPS_SMALL ;
LuaGetParam( L, 2, dToler) ;
LuaClearStack( L) ;
// verifico se curva equivalente ad un trapezio
// verifico se curva è equivalente ad un trapezio
Point3d ptP ;
Vector3d vtB1 ;
Vector3d vtL1 ;
@@ -261,23 +242,6 @@ LuaCurveArea( lua_State* L)
}
}
//----------------------------------------------------------------------------
static int
LuaCurveMaxOffset( lua_State* L)
{
// 2 parametri : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero la sua area senza eventuali buchi
double dMaxOffset ;
if ( ExeCurveMaxOffset( nId, dMaxOffset))
LuaSetParam( L, dMaxOffset) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveExtrusion( lua_State* L)
@@ -558,7 +522,7 @@ LuaCurveCompoNormVersor( lua_State* L)
int nRefId = nId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero il versore normale della curva semplice indicizzata (non nullo solo se arco)
// recupero l'angolo al centro della curva semplice indicizzata
Vector3d vtNorm ;
if ( ExeCurveCompoNormVersor( nId, nCrv, nRefId, vtNorm))
LuaSetParam( L, vtNorm) ;
@@ -567,112 +531,6 @@ LuaCurveCompoNormVersor( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveCompoGetTempProp( lua_State* L)
{
// 1 o 2 parametri : Id [, nPropInd]
int nId ;
LuaCheckParam( L, 1, nId)
int nPropInd = 0 ;
LuaGetParam( L, 2, nPropInd) ;
LuaClearStack( L) ;
// recupero il vettore delle proprietà temporanee di indice dato
INTVECTOR vProp ;
if ( ExeCurveCompoGetTempProp( nId, vProp, nPropInd))
LuaSetParam( L, vProp) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveCompoGetTempParam( lua_State* L)
{
// 1 o 2 parametri : Id [, nParamInd]
int nId ;
LuaCheckParam( L, 1, nId)
int nParamInd = 0 ;
LuaGetParam( L, 2, nParamInd) ;
LuaClearStack( L) ;
// recupero il vettore dei parametri temporanei di indice dato
DBLVECTOR vParam ;
if ( ExeCurveCompoGetTempParam( nId, vParam, nParamInd))
LuaSetParam( L, vParam) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaShowCurveBezierControlPoints( lua_State* L)
{
// 2 parametri : nCrvId, nDestGrpId
int nCrvId ;
LuaCheckParam( L, 1, nCrvId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
LuaClearStack( L) ;
int nCount = 0 ;
int nId = ExeShowCurveBezierControlPoints( nCrvId, nDestGrpId, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaCopyCompoSubCurve( lua_State* L)
{
// 3 parametri : nCrvId, nSubCrvToCopy, nDestGrpId
int nCrvId ;
LuaCheckParam( L, 1, nCrvId)
int nSubCrvToCopy ;
LuaCheckParam( L, 2, nSubCrvToCopy)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId)
LuaClearStack( L) ;
int nId = ExeCopyCompoSubCurve( nCrvId, nSubCrvToCopy, nDestGrpId) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCopyParamRange( lua_State* L)
{
// 4 parametri : nCrvId, dUStart, dUEnd, nDestGrpId
int nCrvId ;
LuaCheckParam( L, 1, nCrvId)
double dUStart ;
LuaCheckParam( L, 2, dUStart)
double dUEnd ;
LuaCheckParam( L, 3, dUEnd)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId)
LuaClearStack( L) ;
int nId = ExeCopyParamRange( nCrvId, dUStart, dUEnd, nDestGrpId) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbGetCurve( LuaMgr& luaMgr)
@@ -680,7 +538,6 @@ LuaInstallGdbGetCurve( LuaMgr& luaMgr)
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveDomain", LuaCurveDomain) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveLength", LuaCurveLength) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveLengthAtParam", LuaCurveLengthAtParam) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveParamAtLength", LuaCurveParamAtLength) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveParamAtPoint", LuaCurveParamAtPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveIsClosed", LuaCurveIsClosed) ;
@@ -690,7 +547,6 @@ LuaInstallGdbGetCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveIsATrapezoid", LuaCurveIsATrapezoid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveAreaXY", LuaCurveAreaXY) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveArea", LuaCurveArea) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveMaxOffset", LuaCurveMaxOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveExtrusion", LuaCurveExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveThickness", LuaCurveThickness) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSelfIntersCount", LuaCurveSelfIntersCount) ;
@@ -706,10 +562,5 @@ LuaInstallGdbGetCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoRadius", LuaCurveCompoRadius) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoAngCenter", LuaCurveCompoAngCenter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoNormVersor", LuaCurveCompoNormVersor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoGetTempProp", LuaCurveCompoGetTempProp) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoGetTempParam", LuaCurveCompoGetTempParam) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtShowCurveBezierControlPoints", LuaShowCurveBezierControlPoints) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyCompoSubCurve", LuaCopyCompoSubCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyParamRange", LuaCopyParamRange) ;
return bOk ;
}
-90
View File
@@ -1,90 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : LUA_GdbGetPocketing.cpp Data : 28.11.23 Versione : 2.5k6
// Contenuto : Funzioni di creazione percorsi di svuotatura o infill per LUA.
//
//
//
// Modifiche : 29.11.23 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
using namespace std ;
//----------------------------------------------------------------------------
static int
LuaPocketing( lua_State* L) {
// 7 parametri : nId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId
int nId ;
LuaCheckParam( L, 1, nId) ;
double dRad ;
LuaCheckParam( L, 2, dRad) ;
double dStep ;
LuaCheckParam( L, 3, dStep) ;
double dAngle ;
LuaCheckParam( L, 4, dAngle) ;
int nType ;
LuaCheckParam( L, 5, nType) ;
bool bSmooth ;
LuaCheckParam( L, 6, bSmooth) ;
int nDestGrpId ;
LuaCheckParam( L, 7, nDestGrpId) ;
LuaClearStack( L) ;
// calcolo delle curve elementari di svuotatura
int nFirstId = GDB_ID_NULL ;
int nCrvCount = 0 ;
bool bOk = ExePocketing( nId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId, nFirstId, nCrvCount) ;
if ( ! bOk)
LuaSetParam( L) ;
else
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCrvCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfFrGetZigZagInfill( lua_State* L)
{
// 6 parametri : nId, nDestGrpId, dSideStep, dAng, bSmooth, bRemoveOverlapLink
int nId ;
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
double dStep ;
LuaCheckParam( L, 3, dStep)
double dAng ;
LuaCheckParam( L, 4, dAng) ;
bool bSmooth ;
LuaCheckParam( L, 5, bSmooth) ;
bool bRemoveOverlapLink ;
LuaCheckParam( L, 6, bRemoveOverlapLink) ;
LuaClearStack( L) ;
// recupero i contorni della superficie
int nCount = 0 ;
int nNewId = ExeSurfFrGetZigZagInfill( nId, nDestGrpId, dStep, dAng, bSmooth, bRemoveOverlapLink, &nCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbGetPocketing( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPocketing", LuaPocketing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfFrZigZagInfill", LuaSurfFrGetZigZagInfill) ;
return bOk ;
}
+35 -276
View File
@@ -121,25 +121,6 @@ LuaSurfFrChunkCount( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfFrChunkMaxOffset( lua_State* L)
{
// 2 parametri : Id, nChunk
int nId ;
LuaCheckParam( L, 1, nId)
int nChunk ;
LuaCheckParam( L, 2, nChunk)
LuaClearStack( L) ;
// recupero la sua area senza eventuali buchi
double dMaxOffset ;
if ( ExeSurfFrChunkMaxOffset( nId, nChunk, dMaxOffset))
LuaSetParam( L, dMaxOffset) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfFrChunkSimpleClassify( lua_State* L)
@@ -256,6 +237,37 @@ LuaSurfFrRotateSimpleNoCollision( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfFrGetZigZagInfill( lua_State* L)
{
// 6 parametri : nId, nDestGrpId, dSideStep, dAng, bAllowStepCorrection, bInvert
int nId ;
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
double dStep ;
LuaCheckParam( L, 3, dStep)
double dAng ;
LuaCheckParam( L, 4, dAng) ;
bool bStepCorrection ;
LuaCheckParam( L, 5, bStepCorrection)
bool bInvert ;
LuaCheckParam( L, 6, bInvert)
LuaClearStack( L) ;
// recupero i contorni della superficie
int nCount = 0 ;
int nNewId = ExeSurfFrGetZigZagInfill( nId, nDestGrpId, dStep, dAng, bStepCorrection, bInvert, &nCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmVertexCount( lua_State* L)
@@ -350,27 +362,6 @@ LuaSurfTmGetNearestVertex( lua_State* L)
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmTriangleNormVersor( lua_State* L)
{
// 2 o 3 parametri : nId, nTria [, nRefId]
int nId ;
LuaCheckParam( L, 1, nId)
int nTria ;
LuaCheckParam( L, 2, nTria)
int nRefId = nId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero la normale del triangolo della superficie
Vector3d vtNorm ;
if ( ExeSurfTmTriangleNormVersor( nId, nTria, nRefId, vtNorm))
LuaSetParam( L, vtNorm) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmFacetFromTria( lua_State* L)
@@ -483,44 +474,6 @@ LuaSurfTmGetFacetBBoxRef( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetFacetOutlineInfo( 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 le informazioni
int nStatus ;
BOOLVECTOR vbOpen ;
INTVECTOR vnAdj ;
PNTVECTOR vptStart ;
VCT3DVECTOR vvtNorm ;
DBLVECTOR vdElev ;
DBLVECTOR vdLen ;
bool bOk = ExeSurfTmGetFacetOutlineInfo( nId, nFacet, nRefId, nStatus, vbOpen, vnAdj, vdLen, vptStart, vvtNorm, vdElev) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, nStatus) ;
LuaSetParam( L, vbOpen) ;
LuaSetParam( L, vnAdj) ;
LuaSetParam( L, vdLen) ;
LuaSetParam( L, vptStart) ;
LuaSetParam( L, vvtNorm) ;
LuaSetParam( L, vdElev) ;
return 7 ;
}
else {
LuaSetParam( L) ;
return 1 ;
}
}
//----------------------------------------------------------------------------
static int
LuaSurfTmFacetAdjacencies( lua_State* L)
@@ -672,58 +625,6 @@ LuaSurfTmFacetMinAreaRectangle( lua_State* L)
}
}
//----------------------------------------------------------------------------
static int
LuaSurfTmFacetElevationInBBox( lua_State* L)
{
// 3 o 4 o 5 parametri : Id, nFacet, b3Box [, bAcceptOutFacet] [, nRefId]
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
BBox3d b3Box ;
LuaCheckParam( L, 3, b3Box)
bool bAcceptOutFacet = false ;
int nRefId = nId ;
if ( ! LuaGetParam( L, 4, nRefId)) {
LuaGetParam( L, 4, bAcceptOutFacet) ;
LuaGetParam( L, 5, nRefId) ;
}
LuaClearStack( L) ;
// calcolo elevazione
double dElev ;
bool bOk = ExeSurfTmFacetElevationInBBox( nId, nFacet, b3Box, bAcceptOutFacet, nRefId, dElev) ;
if ( bOk)
LuaSetParam( L, dElev) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmFacetElevationInClosedSurfTm( lua_State* L)
{
// 3 o 4 parametri : nFacetStmId, nFacet, nClosedStmId [, bAcceptOutFacet]
int nFacetStmId ;
LuaCheckParam( L, 1, nFacetStmId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
int nClosedStmId ;
LuaCheckParam( L, 3, nClosedStmId)
bool bAcceptOutFacet = false ;
LuaGetParam( L, 4, bAcceptOutFacet) ;
LuaClearStack( L) ;
// calcolo elevazione
double dElev ;
bool bOk = ExeSurfTmFacetElevationInClosedSurfTm( nFacetStmId, nFacet, nClosedStmId, bAcceptOutFacet, dElev) ;
if ( bOk)
LuaSetParam( L, dElev) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmFacetOppositeSide( lua_State* L)
@@ -822,7 +723,7 @@ LuaExtractSurfTmLoops( lua_State* L)
static int
LuaGetSurfTmSilhouette( lua_State* L)
{
// 4 o 5 o 6 parametri : nId, vtDir, dToler, nDestGrpId [, nRefType [, bAllTria]]
// 4 o 5 parametri : nId, vtDir, dToler, nDestGrpId [, nRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Vector3d vtDir ;
@@ -832,15 +733,11 @@ LuaGetSurfTmSilhouette( lua_State* L)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId)
int nRefType = RTY_DEFAULT ;
bool bAllTria = false ;
if ( LuaGetParam( L, 5, nRefType))
LuaGetParam( L, 6, bAllTria) ;
else
LuaGetParam( L, 5, bAllTria) ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// recupero i contorni della superficie
int nCount = 0 ;
int nNewId = ExeGetSurfTmSilhouette( nId, vtDir, dToler, nDestGrpId, nRefType, &nCount, bAllTria) ;
int nNewId = ExeGetSurfTmSilhouette( nId, vtDir, dToler, nDestGrpId, nRefType, &nCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
@@ -850,38 +747,6 @@ LuaGetSurfTmSilhouette( lua_State* L)
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaGetSurfTmParSilhouettes( lua_State* L)
{
// 6 o 7 parametri : vIds, ptOn, vtN, vdDist, dToler, nDestGrpId [, nRefType]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
Point3d ptOn ;
LuaCheckParam( L, 2, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 3, vtN)
DBLVECTOR vdDist ;
LuaCheckParam( L, 4, vdDist)
double dToler ;
LuaCheckParam( L, 5, dToler)
int nDestGrpId ;
LuaCheckParam( L, 6, nDestGrpId)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ;
// recupero i contorni della superficie
int nCount = 0 ;
int nNewId = ExeGetSurfTmParSilhouettes( vIds, ptOn, vtN, vdDist, dToler, nDestGrpId, nRefType, &nCount) ;
// restituisco il risultato
if ( nCount >= 0)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaExtractSurfTmFacetLoops( lua_State* L)
@@ -906,28 +771,6 @@ LuaExtractSurfTmFacetLoops( lua_State* L)
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaExtractSurfTmTriaLoop( lua_State* L)
{
// 3 parametri : nId, nT, nDestGrpId
int nId ;
LuaCheckParam( L, 1, nId)
int nT ;
LuaCheckParam( L, 2, nT)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId)
LuaClearStack( L) ;
// recupero i contorni della superficie
int nNewId = ExeExtractSurfTmTriaLoop( nId, nT, nDestGrpId) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaCopySurfTmFacet( lua_State* L)
@@ -950,57 +793,6 @@ LuaCopySurfTmFacet( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetEdges( lua_State* L)
{
// 2 o 3 parametri : nId, nDestGrpId [, bSmoothAng]
int nId ;
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
bool bSmoothAng = true ;
LuaGetParam( L, 3, bSmoothAng) ;
LuaClearStack( L) ;
// calcolo gli spigoli della superficie
int nCount ;
int nFirstId = ExeSurfTmGetEdges( nId, nDestGrpId, bSmoothAng, &nCount) ;
// restituisco il risultato
if ( nFirstId != GDB_ID_NULL || nCount != -1) {
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetCurvature( lua_State* L)
{
// 2 parametri : nStmId, nIndV
int nStmId ;
LuaCheckParam( L, 1, nStmId) ;
int nIndVertex ;
LuaCheckParam( L, 2, nIndVertex) ;
LuaClearStack( L) ;
double dK1 = 0., dK2 = 0. ;
Vector3d vtK1 = V_NULL, vtK2 = V_NULL ;
bool bOk = ExeSurfTmGetCurvatures( nStmId, nIndVertex, dK1, vtK1, dK2, vtK2) ;
LuaSetParam( L, bOk) ;
if ( bOk) {
LuaSetParam( L, dK1) ;
LuaSetParam( L, vtK1) ;
LuaSetParam( L, dK2) ;
LuaSetParam( L, vtK2) ;
return 5 ;
}
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfBezierGetPoint( lua_State* L)
@@ -1236,30 +1028,6 @@ LuaExtractSurfBezierLoops( lua_State* L)
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaShowSurfBezierControlPoints( lua_State* L)
{
// 2 parametri : nCrvId, nDestGrpId
int nCrvId ;
LuaCheckParam( L, 1, nCrvId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
LuaClearStack( L) ;
int nCount = 0 ;
int nId = ExeShowSurfBezierControlPoints( nCrvId, nDestGrpId, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbGetSurf( LuaMgr& luaMgr)
@@ -1271,42 +1039,34 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrNormVersor", LuaSurfFrNormVersor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrGrossArea", LuaSurfFrGrossArea) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrChunkCount", LuaSurfFrChunkCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrChunkMaxOffset", LuaSurfFrChunkMaxOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrChunkSimpleClassify", LuaSurfFrChunkSimpleClassify) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrTestExternal", LuaSurfFrTestExternal) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfFrChunkLoops", LuaExtractSurfFrChunkLoops) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrMoveSimpleNoCollision", LuaSurfFrMoveSimpleNoCollision) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrRotateSimpleNoCollision", LuaSurfFrRotateSimpleNoCollision) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfFrZigZagInfill", LuaSurfFrGetZigZagInfill) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmVertexCount", LuaSurfTmVertexCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCount", LuaSurfTmFacetCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPartCount", LuaSurfTmPartCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetVertex", LuaSurfTmGetVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetNearestVertex", LuaSurfTmGetNearestVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTriangleNormVersor", LuaSurfTmTriangleNormVersor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetFromTria", LuaSurfTmFacetFromTria) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetAllVertInFacet", LuaSurfTmGetAllVertInFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBox", LuaSurfTmGetFacetBBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxGlob", LuaSurfTmGetFacetBBoxGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxRef", LuaSurfTmGetFacetBBoxRef) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetOutlineInfo", LuaSurfTmGetFacetOutlineInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetAdjacencies", LuaSurfTmFacetAdjacencies) ;
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( "EgtSurfTmFacetMinAreaRectangle", LuaSurfTmFacetMinAreaRectangle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetElevationInBBox", LuaSurfTmFacetElevationInBBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetElevationInClosedSurfTm", LuaSurfTmFacetElevationInClosedSurfTm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetOppositeSide", LuaSurfTmFacetOppositeSide) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetsContact", LuaSurfTmFacetsContact) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmLoops", LuaExtractSurfTmLoops) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfTmSilhouette", LuaGetSurfTmSilhouette) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfTmParSilhouettes", LuaGetSurfTmParSilhouettes) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmFacetLoops", LuaExtractSurfTmFacetLoops) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmTriaLoop", LuaExtractSurfTmTriaLoop) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopySurfTmFacet", LuaCopySurfTmFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetEdges", LuaSurfTmGetEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetCurvature", LuaSurfTmGetCurvature) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPoint", LuaSurfBezierGetPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointD1", LuaSurfBezierGetPointD1) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointNrmD1", LuaSurfBezierGetPointNrmD1) ;
@@ -1316,6 +1076,5 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetControlCurveU", LuaSurfBezierGetControlCurveU) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetControlCurveV", LuaSurfBezierGetControlCurveV) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfBezierLoops", LuaExtractSurfBezierLoops) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtShowSurfBezierControlPoints", LuaShowSurfBezierControlPoints) ;
return bOk ;
}
+1 -2
View File
@@ -211,7 +211,6 @@ LuaVolZmapGetDepth( lua_State* L)
}
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaVolZmapGetEdges( lua_State* L)
@@ -222,7 +221,7 @@ LuaVolZmapGetEdges( lua_State* L)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
LuaClearStack( L) ;
// calcolo gli spigoli del solido
// eseguo calcolo profondità dal punto lungo la direzione
int nCount ;
int nFirstId = ExeVolZmapGetEdges( nId, nDestGrpId, &nCount) ;
// restituisco il risultato
+5 -268
View File
@@ -19,7 +19,6 @@
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGkCalcPocketing.h"
using namespace std ;
@@ -60,19 +59,17 @@ LuaOffsetCurve( lua_State* L)
static int
LuaOffsetCurveAdv( lua_State* L)
{
// 2 o 3 o 4 parametri : Id, dDist [, nType] [, dLinTol]
// 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) ;
double dLinTol = 10 * EPS_SMALL ;
LuaGetParam( L, 4, dLinTol) ;
LuaClearStack( L) ;
// offset della curva
int nCount ;
int nNewId = ExeOffsetCurveAdv( nId, dDist, nType, &nCount, dLinTol) ;
int nNewId = ExeOffsetCurveAdv( nId, dDist, nType, &nCount) ;
if ( nCount >= 0) {
LuaSetParam( L, nNewId) ;
LuaSetParam( L, nCount) ;
@@ -105,18 +102,16 @@ LuaCurveMedialAxis( lua_State* L)
static int
LuaApproxCurve( lua_State* L)
{
// 2 o 3 o 4 parametri : Id, nApprType [, dLinTol [, dMaxSegmLen]]
// 2 o 3 parametri : Id, nApprType [, dLinTol]
int nId ;
LuaCheckParam( L, 1, nId)
int nApprType ;
LuaCheckParam( L, 2, nApprType)
double dLinTol = 0.01 ;
double dMaxSegmLen = INFINITO ;
if ( LuaGetParam( L, 3, dLinTol))
LuaGetParam( L, 4, dMaxSegmLen) ;
LuaGetParam( L, 3, dLinTol) ;
LuaClearStack( L) ;
// approssimazione della curva con rette
bool bOk = ExeApproxCurve( nId, nApprType, dLinTol, dMaxSegmLen) ;
bool bOk = ExeApproxCurve( nId, nApprType, dLinTol) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
@@ -586,22 +581,6 @@ LuaModifyArcRadius( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaModifyArcAngCenter( lua_State* L)
{
// 2 parametri : Id, dNewAngCenter
int nId ;
LuaCheckParam( L, 1, nId)
double dNewAngCenter ;
LuaCheckParam( L, 2, dNewAngCenter)
LuaClearStack( L) ;
// modifica dell'angolo al centro
bool bOk = ExeModifyArcAngCenter( nId, dNewAngCenter) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaModifyArcToExplementary( lua_State* L)
@@ -929,42 +908,6 @@ LuaRemoveCurveCompoUndercutOnY( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCurveCompoSetTempProp( lua_State* L)
{
// 3 parametri : Id, nCrv, nProp
int nId ;
LuaCheckParam( L, 1, nId)
int nCrv ;
LuaCheckParam( L, 2, nCrv)
int nProp ;
LuaCheckParam( L, 3, nProp)
LuaClearStack( L) ;
// imposto sulla curva della composita la proprietà temporanea
bool bOk = ExeCurveCompoSetTempProp( nId, nCrv, nProp) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCurveCompoSetTempParam( lua_State* L)
{
// 3 parametri : Id, nCrv, dParam
int nId ;
LuaCheckParam( L, 1, nId)
int nCrv ;
LuaCheckParam( L, 2, nCrv)
double dParam ;
LuaCheckParam( L, 3, dParam)
LuaClearStack( L) ;
// imposto sulla curva della composita il parametro temporaneo
bool bOk = ExeCurveCompoSetTempParam( nId, nCrv, dParam) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaChainCurvesInGroup( lua_State* L)
@@ -1001,200 +944,6 @@ LuaReorderCurvesInGroup( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaProjectCurveOnSurf( lua_State* L)
{
// 4, 5, 6, 7 o 8 parametri : nCurveId, vSurfId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromProj] [, nRefType]]
int nCurveId ;
LuaCheckParam( L, 1, nCurveId)
INTVECTOR vSurfId ;
LuaCheckParam( L, 2, vSurfId)
Vector3d vtDir ;
LuaCheckParam( L, 3, vtDir)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId)
double dLinTol = 0.01 ;
double dMaxSegmLen = INFINITO ;
bool bDirFromProj = false ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 5, dLinTol) &&
LuaGetParam( L, 6, dMaxSegmLen) &&
LuaGetParam( L, 7, bDirFromProj))
LuaGetParam( L, 8, nRefType) ;
LuaClearStack( L) ;
// proietto la curva su una o più superfici secondo la direzione data
bool bOk = ExeProjectCurveOnSurf( nCurveId, vSurfId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, nRefType) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaProjectCurveOnSurfExt( lua_State* L)
{
// 4, 5, 6 o 7 parametri : nCurveId, vSurfId, nGuideId, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromGuide]]
int nCurveId ;
LuaCheckParam( L, 1, nCurveId)
INTVECTOR vSurfId ;
LuaCheckParam( L, 2, vSurfId)
int nGuideId ;
LuaCheckParam( L, 3, nGuideId)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId)
double dLinTol = 0.01 ;
double dMaxSegmLen = INFINITO ;
bool bDirFromGuide = false ;
if ( LuaGetParam( L, 5, dLinTol) &&
LuaGetParam( L, 6, dMaxSegmLen))
LuaGetParam( L, 7, bDirFromGuide) ;
LuaClearStack( L) ;
// proietto la curva su una o più superfici secondo la direzione verso la guida
bool bOk = ExeProjectCurveOnSurfExt( nCurveId, vSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveGetVoronoi( lua_State* L)
{
// 2 o 3 parametri : Id/s, nDestGrpId [, nBound]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
int nBound = 3 ; // VORONOI_STD_BOUND
LuaGetParam( L, 3, nBound) ;
LuaClearStack( L) ;
// eseguo
int nCount = 0 ;
int nNewId = ExeCurveGetVoronoi( vIds, nDestGrpId, nBound, &nCount) ;
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveMedialAxisAdv( lua_State* L)
{
// 2 o 3 parametri : Id/s, nDestGrpId [, nSide]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
int nSide = 1 ; // WMAT_LEFT
LuaGetParam( L, 3, nSide) ;
LuaClearStack( L) ;
// eseguo
int nCount = 0 ;
int nNewId = ExeCurveGetMedialAxis( vIds, nDestGrpId, nSide, &nCount) ;
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveGetFatCurve( lua_State* L)
{
// 4 o 5 parametri : Id, nDestGrpId, dRad, bSquare [, bSquareMids]
int nId ;
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
double dRad ;
LuaCheckParam( L, 3, dRad)
bool bSquareEnds ;
LuaCheckParam( L, 4, bSquareEnds)
bool bSquareMids = bSquareEnds ;
LuaGetParam( L, 5, bSquareMids) ;
LuaClearStack( L) ;
// eseguo
int nCount = 0 ;
int nNewId = ExeCurveGetFatCurve( nId, nDestGrpId, dRad, bSquareEnds, bSquareMids, &nCount) ;
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveBezierIncreaseDegree( lua_State* L)
{
// 1 parametro : CrvId
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// eseguo
bool bOk = ExeCurveBezierIncreaseDegree( nId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveBezierDecreaseDegree( lua_State* L)
{
// 1 parametro : CrvId
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// eseguo
bool bOk = ExeCurveBezierDecreaseDegree( nId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveBezierApproxToNonRat( lua_State* L)
{
// 1 o 2 parametri : CrvId [, dTol]
int nId ;
LuaCheckParam( L, 1, nId)
double dTol = 10 * EPS_SMALL ;
LuaGetParam( L, 2, dTol) ;
LuaClearStack( L) ;
// eseguo
bool bOk = ExeCurveBezierApproxToNonRat( nId, dTol) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveBezierApproxWithCubicBeziers( lua_State* L)
{
// 1 o 2 parametri : CrvId [, dTol]
int nId ;
LuaCheckParam( L, 1, nId)
double dTol = 10 * EPS_SMALL ;
LuaGetParam( L, 2, dTol) ;
LuaClearStack( L) ;
// eseguo
bool bOk = ExeCurveBezierApproxWithCubicBeziers( nId, dTol) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
@@ -1230,7 +979,6 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurveAtCorners", LuaSplitCurveAtCorners) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurveAtSelfInters", LuaSplitCurveAtSelfInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcRadius", LuaModifyArcRadius) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcAngCenter", LuaModifyArcAngCenter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcToExplementary", LuaModifyArcToExplementary) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcByFlip", LuaModifyArcByFlip) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCloseCurveCompo", LuaCloseCurveCompo) ;
@@ -1249,18 +997,7 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeCurveCompo", LuaExplodeCurveCompo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMergeCurvesInCurveCompo", LuaMergeCurvesInCurveCompo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveCurveCompoUndercutOnY", LuaRemoveCurveCompoUndercutOnY) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoSetTempProp", LuaCurveCompoSetTempProp) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoSetTempParam", LuaCurveCompoSetTempParam) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtChainCurvesInGroup", LuaChainCurvesInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtReorderCurvesInGroup", LuaReorderCurvesInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurf", LuaProjectCurveOnSurf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfExt", LuaProjectCurveOnSurfExt) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveGetVoronoi", LuaCurveGetVoronoi) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveMedialAxisAdv", LuaCurveMedialAxisAdv) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveGetFatCurve", LuaCurveGetFatCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierIncreaseDeg", LuaCurveBezierIncreaseDegree) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierDecreaseDeg", LuaCurveBezierDecreaseDegree) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierApproxToNonRat", LuaCurveBezierApproxToNonRat) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtApproxBezierWithCubics", LuaCurveBezierApproxWithCubicBeziers) ;
return bOk ;
}
+19 -304
View File
@@ -18,12 +18,12 @@
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkSurfTriMeshAux.h"
#include "/EgtDev/Include/EGkGdbConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
using namespace std ;
//----------------------------------------------------------------------------
static int
LuaInvertSurf( lua_State* L)
@@ -62,16 +62,14 @@ LuaExplodeSurf( lua_State* L)
static int
LuaApproxSurf( lua_State* L)
{
// 1 o 2 parametri : Id [, dLinTol [, dTriaMinSide]]
// 1 o 2 parametri : Id [, dLinTol]
int nId ;
LuaCheckParam( L, 1, nId)
double dLinTol = LIN_TOL_SRF ;
double dTriaMinSide = 100 * EPS_SMALL ;
if ( LuaGetParam( L, 2, dLinTol))
LuaGetParam( L, 3, dTriaMinSide) ;
LuaGetParam( L, 2, dLinTol) ;
LuaClearStack( L) ;
// approssimazione della superficie
bool bOk = ExeApproxSurface( nId, dLinTol, dTriaMinSide) ;
bool bOk = ExeApproxSurface( nId, dLinTol) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -143,46 +141,6 @@ LuaSurfFrOffset( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfFrOffsetAdv( lua_State* L)
{
// 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) ;
// eseguo l'offset della regione
int nNewId = GDB_ID_NULL ;
bool bOk = ExeSurfFrOffsetAdv( nId, dDist, nType, nNewId) ;
if ( bOk)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfFrEraseChunk( lua_State* L)
{
// 2 parametri : Id, nChunk
int nId ;
LuaCheckParam( L, 1, nId)
int nChunk ;
LuaCheckParam( L, 2, nChunk)
LuaClearStack( L) ;
// eseguo l'offset della regione
bool bOk = ExeSurfFrEraseChunk( nId, nChunk) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmMoveVertex( lua_State* L)
@@ -207,30 +165,6 @@ LuaSurfTmMoveVertex( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmMoveFacet( lua_State* L)
{
// 3 o 4 o 5 parametri : nId, nFacet, vtMove [, nRefId] [, bUpdate]
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
Vector3d vtMove ;
LuaCheckParam( L, 3, vtMove)
int nRefType = RTY_DEFAULT ;
bool bUpdate = true ;
if ( LuaGetParam( L, 4, nRefType))
LuaGetParam( L, 5, bUpdate) ;
else
LuaGetParam( L, 4, bUpdate) ;
LuaClearStack( L) ;
// sposto la faccia di indice dato della trimesh
bool bOk = ExeSurfTmMoveFacet( nId, nFacet, vtMove, nRefType, bUpdate) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmToTriangles( lua_State* L)
@@ -399,6 +333,20 @@ LuaSurfTmIntersect( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmResetTwoColors( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// eseguo reset TFlag per annullare due colori
bool bOk = ExeSurfTmResetTwoColors( nId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmSplit( lua_State* L)
@@ -440,226 +388,6 @@ LuaSurfTmCut( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmSubtractProjectedFacesOnFace( lua_State* L)
{
// 3 o 4 o 5 parametri : nSurfId, nFaceInd, nDestGrpId [, vSurfsId] [, bOCFlag]
int nSurfId ;
LuaCheckParam( L, 1, nSurfId) ;
int nFaceInd ;
LuaCheckParam( L, 2, nFaceInd) ;
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
INTVECTOR vSurfsId ;
bool bOCFlag = true ;
if ( LuaGetParam( L, 4, vSurfsId))
LuaGetParam( L, 5, bOCFlag) ;
else
LuaGetParam( L, 4, bOCFlag) ;
LuaClearStack( L) ;
// sottraggo alla faccia scelta la proiezione delle altre TriMesh
int nNewId = GDB_ID_NULL;
bool bExistProjection = false ;
int nNewFaceNbr = 0 ;
bool bOk = ExeSurfTmSubtractProjectedFacesOnFace( nSurfId, nFaceInd, nDestGrpId, vSurfsId,
bOCFlag, bExistProjection, nNewId, nNewFaceNbr) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, bExistProjection) ;
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nNewFaceNbr) ;
return 4 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmSetFaceColor( lua_State* L)
{
// 3 parametri : Id, nFacet, nColor
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
int nColor ;
LuaCheckParam( L, 3, nColor)
LuaClearStack( L) ;
// imposto il colore alla faccia della superficie TM
bool bOk = ExeSurfTmSetFaceColor( nId, nFacet, nColor) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmGetTriaColor( lua_State* L)
{
// 2 parametri : Id, nTria
int nId ;
LuaCheckParam( L, 1, nId)
int nTria ;
LuaCheckParam( L, 2, nTria)
LuaClearStack( L) ;
// recupero il flag di colore del triangolo della superficie TM
int nColor ;
bool bOk = ExeSurfTmGetTriaColor( nId, nTria, nColor) ;
if ( bOk)
LuaSetParam( L, nColor) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmResetTwoColors( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// eseguo reset TFlag per annullare due colori
bool bOk = ExeSurfTmResetTwoColors( nId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmSetShowEdges( lua_State* L)
{
// 2 parametri : Id, bShow
int nId ;
LuaCheckParam( L, 1, nId)
bool bShow ;
LuaCheckParam( L, 2, bShow) ;
LuaClearStack( L) ;
// imposto flag visualizzazione spigoli vivi
bool bOk = ExeSurfTmSetShowEdges( nId, bShow) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmGetShowEdges( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero il flag di visualizzazione degli spigoli vivi della superficie TM
bool bShow ;
bool bOk = ExeSurfTmGetShowEdges( nId, bShow) ;
if ( bOk)
LuaSetParam( L, bShow) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmSetSmoothAng( lua_State* L)
{
// 2 parametri : nId, nCutterId
int nId ;
LuaCheckParam( L, 1, nId)
double dAngDeg ;
LuaCheckParam( L, 2, dAngDeg)
LuaClearStack( L) ;
// aggiorno lo smooth angle della superficie
bool bOk = ExeSurfTmSetSmoothAng( nId, dAngDeg) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmOffset( lua_State* L)
{
// 4 o 5 parametri : ParentId, vIds, dOffs, dLinTol [, nType]
int nParentId ;
LuaGetParam( L, 1, nParentId) ;
INTVECTOR vIds ;
LuaCheckParam( L, 2, vIds)
double dOffs ;
LuaCheckParam( L, 3, dOffs)
double dLinTol ;
LuaCheckParam( L, 4, dLinTol) ;
int nType = STMOFF_FILLET ;
LuaGetParam( L, 5, nType) ;
LuaClearStack( L) ;
// interseco la prima superficie con la seconda
int nId = ExeSurfTmOffset( nParentId, vIds, dOffs, dLinTol, nType) ;
LuaSetParam( L, nId) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmThickeningOffset( lua_State* L)
{
// 4 o 5 parametri : ParentId, vIds, dOffs, dLinTol [, nType]
int nParentId ;
LuaGetParam( L, 1, nParentId) ;
INTVECTOR vIds ;
LuaCheckParam( L, 2, vIds)
double dOffs ;
LuaCheckParam( L, 3, dOffs)
double dLinTol ;
LuaCheckParam( L, 4, dLinTol) ;
int nType = STMOFF_FILLET ;
LuaGetParam( L, 5, nType) ;
LuaClearStack( L) ;
// interseco la prima superficie con la seconda
int nId = ExeSurfTmThickeningOffset( nParentId, vIds, dOffs, dLinTol, nType) ;
LuaSetParam( L, nId) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCutSurfBzPlane( lua_State* L)
{
// 4 o 5 parametri : Id, ptOn, vtN, bSaveOnEq [, nRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptOn ;
LuaCheckParam( L, 2, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 3, vtN)
bool bSaveOnEq ;
LuaGetParam( L, 4, bSaveOnEq) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// taglio la superficie con ilpiano
bool bOk = ExeCutSurfBzPlane( nId, ptOn, vtN, bSaveOnEq, nRefType) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfBzTrim( lua_State* L)
{
// 2 parametri : nId, nCutterId
int nId ;
LuaCheckParam( L, 1, nId)
int nCutterId ;
LuaCheckParam( L, 2, nCutterId)
LuaClearStack( L) ;
// taglio la prima superficie in base alla seconda
bool bOk = ExeSurfBzTrim( nId, nCutterId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbModifySurf( LuaMgr& luaMgr)
@@ -672,10 +400,7 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrSubtract", LuaSurfFrSubtract) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrIntersect", LuaSurfFrIntersect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffsetAdv", LuaSurfFrOffsetAdv) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrEraseChunk", LuaSurfFrEraseChunk) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveVertex", LuaSurfTmMoveVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveFacet", LuaSurfTmMoveFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwapFacets", LuaSurfTmSwapFacets) ;
@@ -685,18 +410,8 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmAdd", LuaSurfTmAdd) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtract", LuaSurfTmSubtract) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmIntersect", LuaSurfTmIntersect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSplit", LuaSurfTmSplit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCut", LuaSurfTmCut) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtractProjectedFacesOnFace", LuaSurfTmSubtractProjectedFacesOnFace) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetFaceColor", LuaSurfTmSetFaceColor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetTriaColor", LuaSurfTmGetTriaColor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetShowEdges", LuaSurfTmSetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetShowEdges", LuaSurfTmGetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetSmoothAng", LuaSurfTmSetSmoothAng) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmOffset", LuaSurfTmOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmThickeningOffset", LuaSurfTmThickeningOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfBzPlane", LuaCutSurfBzPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzTrim", LuaSurfBzTrim) ;
return bOk ;
}
+5 -104
View File
@@ -56,23 +56,6 @@ LuaVolZmapChangeResolution( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaVolZmapSetShowEdges( lua_State* L)
{
// 2 parametri : Id, bShow
int nId ;
LuaCheckParam( L, 1, nId)
bool bShow ;
LuaCheckParam( L, 2, bShow) ;
LuaClearStack( L) ;
// imposto flag visualizzazione spigoli vivi
bool bOk = ExeVolZmapSetShowEdges( nId, bShow) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaRemoveVolZmapPart( lua_State* L)
@@ -152,7 +135,7 @@ LuaVolZmapSetAdvTool( lua_State* L)
static int
LuaVolZmapSetSawTool( lua_State* L)
{
// 7 o 8 parametri : vIds, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR [, nFlag]
// 7 o 8 parametri : vIds, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR, nFlag
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -181,7 +164,7 @@ LuaVolZmapSetSawTool( lua_State* L)
static int
LuaVolZmapSetGenTool( lua_State* L)
{
// 3 o 4 parametri : vIds, sToolName, ToolSectId [, nFlag]
// 3 o 4 parametri : vIds, sToolName, ToolSectId, nFlag
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -202,7 +185,7 @@ LuaVolZmapSetGenTool( lua_State* L)
static int
LuaVolZmapSetMortiserTool( lua_State* L)
{
// 6 o 7 parametri : Id, sToolName, dLen, dWidth, dThick, dCornR [, nFlag]
// 6 o 7 parametri : Id, sToolName, dLen, dWidth, dThick, dCornR, nFlag
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -229,7 +212,7 @@ LuaVolZmapSetMortiserTool( lua_State* L)
static int
LuaVolZmapSetChiselTool( lua_State* L)
{
// 5 o 6 parametri : vIds, sToolName, dLen, dWidth, dThick [, nFlag]
// 5 o 6 parametri : vIds, sToolName, dLen, dWidth, dThick, nFlag
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -250,31 +233,6 @@ LuaVolZmapSetChiselTool( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaVolZmapSetAdditiveTool( lua_State* L)
{
// 5 o 6 parametri : vIds, sToolName, dLen, dDiam, dCornR [, nFlag]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
LuaCheckParam( L, 2, sToolName)
double dLen ;
LuaCheckParam( L, 3, dLen)
double dDiam ;
LuaCheckParam( L, 4, dDiam)
double dCornR ;
LuaCheckParam( L, 5, dCornR)
int nFlag = 1 ;
LuaGetParam( L, 6, nFlag) ;
LuaClearStack( L) ;
// imposto utensile additivo a Zmap indicati
bool bOk = ExeVolZmapSetAdditiveTool( vIds, sToolName, dLen, dDiam, dCornR, nFlag, true) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaVolZmapResetTool( lua_State* L)
@@ -378,65 +336,13 @@ LuaCutVolZmapPlane( lua_State* L)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// taglio la superficie con il piano
// taglio la superficie con ilpiano
bool bOk = ExeCutVolZmapPlane( nId, ptOn, vtN, nRefType) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaUpdateVolZmapByAddingSurfTm( lua_State* L)
{
// 2 parametri : nVolZmapId, StmId,
int nVolZmapId ;
LuaCheckParam( L, 1, nVolZmapId) ;
int nStmId ;
LuaCheckParam( L, 2, nStmId) ;
LuaClearStack( L) ;
bool bOk = ExeUpdateVolZmapByAddingSurfTm( nVolZmapId, nStmId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaUniformVolZmap( lua_State* L)
{
// 2 o 3 o 4 parametri : nVolZmapId, dToler [, bExtensionFirst] [, nToolNum]
int nVolZmapId ;
LuaCheckParam( L, 1, nVolZmapId) ;
double dToler ;
LuaCheckParam( L, 2, dToler) ;
bool bExtensionFirst = true ;
LuaGetParam( L, 3, bExtensionFirst) ;
int nToolNum = 0 ;
LuaGetParam( L, 4, nToolNum) ;
LuaClearStack( L) ;
bool bOk = ExeUniformVolZmap( nVolZmapId, dToler, bExtensionFirst, nToolNum) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaVolZmapOffset( lua_State* L)
{
// 3 parametri : Id, dDist, nType
int nId ;
LuaCheckParam( L, 1, nId)
double dDist ;
LuaCheckParam( L, 2, dDist)
int nType = VolZmapOffset::FILLET ;
LuaGetParam( L, 3, nType) ;
LuaClearStack( L) ;
// eseguo l'offset della regione
bool bOk = ExeVolZMapOffset( nId, dDist, nType) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbModifyVol( LuaMgr& luaMgr)
@@ -444,7 +350,6 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeVolume", LuaExplodeVolume) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapChangeResolution", LuaVolZmapChangeResolution) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetShowEdges", LuaVolZmapSetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdvTool", LuaVolZmapSetAdvTool) ;
@@ -452,13 +357,9 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetGenTool", LuaVolZmapSetGenTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetMortiserTool", LuaVolZmapSetMortiserTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetChiselTool", LuaVolZmapSetChiselTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdditiveTool", LuaVolZmapSetAdditiveTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapResetTool", LuaVolZmapResetTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetToolOutline", LuaVolZmapGetToolOutline) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMillingStep", LuaVolZmapMillingStep) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutVolZmapPlane", LuaCutVolZmapPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateVolZmapByAddingSurfTm", LuaUpdateVolZmapByAddingSurfTm ) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtUniformVolZmap", LuaUniformVolZmap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapOffset", LuaVolZmapOffset) ;
return bOk ;
}
+24 -36
View File
@@ -42,13 +42,13 @@ LuaCopyAttributes( lua_State* L)
static int
LuaSetLevel( lua_State* L)
{
// 2 parametri : Ids, nLevel
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
// 2 parametri : nId, nLevel
int nId ;
LuaCheckParam( L, 1, nId)
int nLevel ;
LuaCheckParam( L, 2, nLevel)
// imposto lo stato
bool bOk = ExeSetLevel( vId, nLevel) ;
bool bOk = ExeSetLevel( nId, nLevel) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -111,14 +111,14 @@ LuaGetCalcLevel( lua_State* L)
static int
LuaSetMode( lua_State* L)
{
// 2 parametri : Ids, nMode
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
// 2 parametri : nId, nMode
int nId ;
LuaCheckParam( L, 1, nId)
int nMode ;
LuaCheckParam( L, 2, nMode)
LuaClearStack( L) ;
// imposto il modo
bool bOk = ExeSetMode( vId, nMode) ;
bool bOk = ExeSetMode( nId, nMode) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -179,7 +179,7 @@ LuaGetCalcMode( lua_State* L)
static int
LuaSetStatus( lua_State* L)
{
// 2 parametri : Ids, nStatus
// 2 parametri : Id, nStatus
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
int nStatus ;
@@ -247,14 +247,12 @@ LuaGetCalcStatus( lua_State* L)
static int
LuaSetMark( lua_State* L)
{
// 1 o 2 parametri : Id [, nMark]
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
int nMark = 1 ;
LuaGetParam( L, 2, nMark) ;
LuaClearStack( L) ;
// imposto l'evidenziazione
bool bOk = ExeSetMark( nId, nMark) ;
bool bOk = ExeSetMark( nId) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -521,8 +519,10 @@ LuaSetInfo( lua_State* L)
} break ;
case LUA_TTABLE :
{ Frame3d frVal ;
BBox3d b3Val ;
DBLVECTOR vdVal ; // va bene anche per Vector3d, Point3d, vnVal
BBox3d b3Val ;
Vector3d vtVal ; // va bene anche per Point3d
INTVECTOR vnVal ;
DBLVECTOR vdVal ;
STRVECTOR vsVal ;
if ( LuaGetParam( L, 3, frVal)) {
LuaClearStack( L) ;
@@ -531,7 +531,15 @@ LuaSetInfo( lua_State* L)
else if ( LuaGetParam( L, 3, b3Val)) {
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, b3Val) ;
}
}
else if ( LuaGetParam( L, 3, vtVal)) {
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, vtVal) ;
}
else if ( LuaGetParam( L, 3, vnVal)) {
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, vnVal) ;
}
else if ( LuaGetParam( L, 3, vdVal)) {
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, vdVal) ;
@@ -784,25 +792,6 @@ LuaGetTextureFrame( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetStipple( lua_State* L)
{
// 3 parametri : Id, nFactor, nPattern
int nId ;
LuaCheckParam( L, 1, nId)
int nFactor ;
LuaCheckParam( L, 2, nFactor)
int nPattern ;
LuaCheckParam( L, 3, nPattern)
LuaClearStack( L) ;
// setto stipple
bool bOk = ExeSetStipple( nId, nFactor, nPattern) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbObjAttribs( LuaMgr& luaMgr)
@@ -845,6 +834,5 @@ LuaInstallGdbObjAttribs( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveTextureData", LuaRemoveTextureData) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTextureName", LuaGetTextureName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTextureFrame", LuaGetTextureFrame) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetStipple", LuaSetStipple) ;
return bOk ;
}
+26 -98
View File
@@ -208,6 +208,31 @@ LuaGetPrev( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetNameInGroup( lua_State* L)
{
// 2 parametri : GroupId, sName
int nGroupId = GDB_ID_NULL ;
LuaGetParam( L, 1, nGroupId) ;
string sName ;
LuaGetParam( L, 2, sName) ;
LuaClearStack( L) ;
// recupero tutti gli oggetti del gruppo con il nome o suo inizio desiderato
INTVECTOR vId ;
int nId = ExeGetFirstNameInGroup( nGroupId, sName) ;
while ( nId != GDB_ID_NULL) {
vId.push_back ( nId) ;
nId = ExeGetNextName( nId, sName) ;
}
// restituisco il risultato
if ( ! vId.empty())
LuaSetParam( L, vId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetFirstNameInGroup( lua_State* L)
@@ -288,48 +313,6 @@ LuaGetPrevName( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetNameInGroup( lua_State* L)
{
// 2 parametri : GroupId, sName
int nGroupId = GDB_ID_NULL ;
LuaGetParam( L, 1, nGroupId) ;
string sName ;
LuaGetParam( L, 2, sName) ;
LuaClearStack( L) ;
// recupero tutti gli oggetti del gruppo con il nome o suo inizio desiderato
INTVECTOR vIds ;
bool bOk = ExeGetNameInGroup( nGroupId, sName, vIds) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vIds) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetInfoInGroup( lua_State* L)
{
// 2 parametri : GroupId, sKey
int nGroupId = GDB_ID_NULL ;
LuaGetParam( L, 1, nGroupId) ;
string sKey ;
LuaGetParam( L, 2, sKey) ;
LuaClearStack( L) ;
// recupero tutti gli oggetti con l'info richiesta
INTVECTOR vIds ;
bool bOk = ExeGetInfoInGroup( nGroupId, sKey, vIds) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vIds) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetFirstGroupInGroup( lua_State* L)
@@ -489,32 +472,6 @@ LuaCopy( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCopyEx( lua_State* L)
{
// 4 o 5 parametri : nSouCtx, SouId, nDestCtx, RefId [, nSonBeforeAfter]
int nSouCtx ;
LuaCheckParam( L, 1, nSouCtx)
int nSouId ;
LuaCheckParam( L, 2, nSouId)
int nDestCtx ;
LuaCheckParam( L, 3, nDestCtx)
int nRefId ;
LuaCheckParam( L, 4, nRefId)
int nSonBeforeAfter = GDB_LAST_SON ;
LuaGetParam( L, 5, nSonBeforeAfter) ;
LuaClearStack( L) ;
// eseguo la copia
int nNewId = ExeCopyEx( nSouCtx, nSouId, nDestCtx, nRefId, nSonBeforeAfter) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCopyGlob( lua_State* L)
@@ -537,32 +494,6 @@ LuaCopyGlob( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCopyGlobEx( lua_State* L)
{
// 4 o 5 parametri : nSouCtx, SouId, nDestCtx, RefId [, nSonBeforeAfter]
int nSouCtx ;
LuaCheckParam( L, 1, nSouCtx)
int nSouId ;
LuaCheckParam( L, 2, nSouId)
int nDestCtx ;
LuaCheckParam( L, 3, nDestCtx)
int nRefId ;
LuaCheckParam( L, 4, nRefId)
int nSonBeforeAfter = GDB_LAST_SON ;
LuaGetParam( L, 5, nSonBeforeAfter) ;
LuaClearStack( L) ;
// eseguo la copia
int nNewId = ExeCopyGlobEx( nSouCtx, nSouId, nDestCtx, nRefId, nSonBeforeAfter) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRelocate( lua_State* L)
@@ -701,12 +632,11 @@ LuaInstallGdbObjects( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNext", LuaGetNext) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastInGroup", LuaGetLastInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrev", LuaGetPrev) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNameInGroup", LuaGetNameInGroup) ;
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( "EgtGetNameInGroup", LuaGetNameInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetInfoInGroup", LuaGetInfoInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstGroupInGroup", LuaGetFirstGroupInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextGroup", LuaGetNextGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastGroupInGroup", LuaGetLastGroupInGroup) ;
@@ -715,9 +645,7 @@ LuaInstallGdbObjects( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetBBoxGlob", LuaGetBBoxGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetBBoxRef", LuaGetBBoxRef) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopy", LuaCopy) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyEx", LuaCopyEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyGlob", LuaCopyGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyGlobEx", LuaCopyGlobEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRelocate", LuaRelocate) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRelocateGlob", LuaRelocateGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGroupSwap", LuaGroupSwap) ;
-54
View File
@@ -277,21 +277,6 @@ LuaGetPrevLayer( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaIsGhostPart( lua_State* L)
{
// 1 parametro : nGhostId
int nGhostId ;
LuaCheckParam( L, 1, nGhostId)
LuaClearStack( L) ;
// verifico sia un segnaposto di pezzo messo in grezzo
bool bOk = ExeIsGhostPart( nGhostId) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetFirstGhostPart( lua_State* L)
@@ -469,42 +454,6 @@ LuaDuploList( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaDuploInRawCount( lua_State* L)
{
// 1 parametro : nSouId
int nSouId ;
LuaCheckParam( L, 1, nSouId)
LuaClearStack( L) ;
// recupero il numero di duplicati che sono riferiti da grezzi nei vari gruppi di lavoro del progetto
int nCount ;
bool bOk = ExeDuploInRawCount( nSouId, nCount) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nCount) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaDuploWithoutRawList( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero l'elenco dei duplicati
INTVECTOR vnDup ;
bool bOk = ExeDuploWithoutRawList( vnDup) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vnDup) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaDuploSetModified( lua_State* L)
@@ -656,7 +605,6 @@ LuaInstallGdbPartLayer( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextLayer", LuaGetNextLayer) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastLayer", LuaGetLastLayer) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevLayer", LuaGetPrevLayer) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtIsGhostPart", LuaIsGhostPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstGhostPart", LuaGetFirstGhostPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextGhostPart", LuaGetNextGhostPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseEmptyParts", LuaEraseEmptyParts) ;
@@ -668,8 +616,6 @@ LuaInstallGdbPartLayer( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploNew", LuaDuploNew) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploCount", LuaDuploCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploList", LuaDuploList) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploInRawCount", LuaDuploInRawCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploWithoutRawList", LuaDuploWithoutRawList) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploSetModified", LuaDuploSetModified) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploGetModified", LuaDuploGetModified) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploSetLocked", LuaDuploSetLocked) ;
+13 -165
View File
@@ -30,8 +30,7 @@
#include "/EgtDev/Include/EgtIniFile.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include <Windowsx.h>
#include <shlobj.h>
#include "Windowsx.h"
using namespace std ;
@@ -88,14 +87,12 @@ LuaEvalNumExpr( lua_State* L)
static int
LuaPause( lua_State* L)
{
// 1 o 2 parametri : numero di millisecondi [, bForced]
// 1 parametro : numero di millisecondi
int nTime ;
LuaCheckParam( L, 1, nTime)
bool bForced = false ;
LuaGetParam( L, 2, bForced) ;
LuaClearStack( L) ;
// se forzata o abilitata UI, controllo la durata della pausa e la eseguo
if ( bForced || ExeGetEnableUI()) {
// se abilitata UI, controllo la durata della pausa e la eseguo
if ( ExeGetEnableUI()) {
const int MIN_TIME = 0 ;
const int MAX_TIME = 10000 ;
if ( nTime < MIN_TIME)
@@ -109,24 +106,6 @@ LuaPause( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetKeyPressed( lua_State* L)
{
// 1 parametro : nKeyCode
int nKeyCode ;
LuaCheckParam( L, 1, nKeyCode)
LuaClearStack( L) ;
// se abilitata UI, controllo se il tasto indicato è premuto
bool bPressed = false ;
if ( ExeGetEnableUI()) {
bPressed = (( GetAsyncKeyState( nKeyCode) & 0x8000) != 0) ;
}
// restituisco il risultato
LuaSetParam( L, bPressed) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaStartCounter( lua_State* L)
@@ -199,11 +178,11 @@ LuaSplitStringPlus( lua_State* L)
// 2 parametri : sVal, sHea
string sVal ;
string sHea ;
bool bOk = LuaGetParam( L, 1, sVal) &&
LuaGetParam( L, 2, sHea) ;
bool bFound = LuaGetParam( L, 1, sVal) ;
LuaCheckParam( L, 2, sHea)
LuaClearStack( L) ;
// se ricevute stringhe, divido la prima in parti con intestazioni della seconda (che conservo)
if ( bOk) {
// se ricevuta stringa, la divido in parti conservandone le intestazioni
if ( bFound) {
STRVECTOR vsVal ;
TokenizePlus( sVal, sHea, vsVal) ;
// ritorno il risultato
@@ -215,25 +194,6 @@ LuaSplitStringPlus( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaReplaceString( lua_State* L)
{
// 3 parametri : sVal, sOld, sNew
string sVal ;
LuaCheckParam( L, 1, sVal)
string sOld ;
LuaCheckParam( L, 2, sOld)
string sNew ;
LuaCheckParam( L, 3, sNew)
LuaClearStack( L) ;
// eseguo sostituzione nella stringa della sequenza indicata dal secondo parametro con quella del terzo
int nRes = ReplaceString( sVal, sOld, sNew) ;
// restituisco il risultato
LuaSetParam( L, sVal) ;
LuaSetParam( L, nRes) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetVal( lua_State* L)
@@ -777,67 +737,6 @@ LuaCompareFilesLastWriteTime( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
int
CALLBACK DirectoryBoxProc( HWND hwndDlg, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
if ( uMsg == BFFM_INITIALIZED)
SendMessage( hwndDlg, BFFM_SETSELECTION, TRUE, lpData) ;
return 0 ;
}
//-------------------------------------------------------------------------------
static int
LuaDirectoryDialog( lua_State* L)
{
// 2 parametri : sText, sDir
string sText ;
LuaCheckParam( L, 1, sText)
string sDir ;
LuaCheckParam( L, 2, sDir)
LuaClearStack( L) ;
// se abilitata UI, emetto la finestra di dialogo
if ( ExeGetEnableUI()) {
// Converto i parametri nel formato wide
AtoWEX<MAX_PATH> wsText( sText.c_str()) ;
AtoWEX<MAX_PATH> wsDirName( sDir.c_str()) ;
// Converto L'/' in L'\\' nel nome directory proposto
for ( wchar_t* pC = wsDirName.m_psz ; *pC != L'\0' ; ++ pC) {
if ( *pC == L'/')
*pC = L'\\' ;
}
// Riempio la struttura dati per il dialogo
BROWSEINFO bi = { 0} ;
bi.hwndOwner = ExeGetMainWindowHandle() ;
bi.lpszTitle = LPWSTR( wsText) ;
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_USENEWUI ;
bi.lpfn = DirectoryBoxProc ;
bi.lParam = (LPARAM) LPWSTR( wsDirName) ;
// Visualizzo il dialogo
LPITEMIDLIST pIdl = SHBrowseForFolder( &bi) ;
if ( pIdl != NULL) {
// recupero la path della directory
WCHAR wPath[MAX_PATH] ;
if ( SHGetPathFromIDList( pIdl, wPath) != FALSE)
LuaSetParam( L, wstrztoA( wPath)) ;
else
LuaSetParam( L) ;
// free memory used
IMalloc* pImalloc = NULL ;
if ( SUCCEEDED( SHGetMalloc( &pImalloc))) {
pImalloc->Free( pIdl) ;
pImalloc->Release() ;
}
}
else
LuaSetParam( L) ;
}
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaExistsDirectory( lua_State* L)
@@ -1085,50 +984,6 @@ LuaGetMsg( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaVerifyKeyOption( lua_State* L)
{
// 1 parametro : nOptInd
int nOptInd ;
LuaCheckParam( L, 1, nOptInd)
LuaClearStack( L) ;
// verifico l'abilitazione dell'opzione (da chiave + licenza)
bool bOk = ExeVerifyKeyOption( nOptInd) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetDefaultFont( lua_State* L)
{
// 1 parametro : sDefaultFont
string sDefaultFont ;
LuaCheckParam( L, 1, sDefaultFont)
LuaClearStack( L) ;
// imposta il font di default
bool bOk = ExeSetFont( "", sDefaultFont) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetDefaultFont( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupera il font di cefault
string sDefaultFont ;
bool bOk = ExeGetDefaultFont( sDefaultFont) ;
if ( bOk)
LuaSetParam( L, sDefaultFont) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaWinExec( lua_State* L)
@@ -1160,10 +1015,9 @@ LuaCloseExe( lua_State* L)
LuaGetParam( L, 1, nExitCode) ;
LuaClearStack( L) ;
// eseguo chiusura forzata
if ( ExeOnTerminateProcess( nExitCode))
TerminateProcess( GetCurrentProcess(), abs( nExitCode)) ;
// restituisco il risultato (se arrivo qui vuol dire che non è consnetito terminare l'esecuzione)
LuaSetParam( L, false) ;
bool bOk = ( TerminateProcess( GetCurrentProcess(), abs( nExitCode)) != FALSE) ;
// restituisco il risultato (in realtà il programma si è già concluso)
LuaSetParam( L, bOk) ;
return 1 ;
}
@@ -1330,7 +1184,7 @@ CALLBACK DialogBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam
break ;
}
}
[[fallthrough]] ;
// continua di seguito
case IDCANCEL :
EndDialog( hwndDlg, wParam) ;
return TRUE ;
@@ -1386,13 +1240,11 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "print", MyPrint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtEvalNumExpr", LuaEvalNumExpr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPause", LuaPause) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetKeyPressed", LuaGetKeyPressed) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtStartCounter", LuaStartCounter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtStopCounter", LuaStopCounter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtNumToString", LuaNumToString) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitString", LuaSplitString) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitStringPlus", LuaSplitStringPlus) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtReplaceString", LuaReplaceString) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetVal", LuaSetVal) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetVal", LuaGetVal) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetUUID", LuaGetUUID) ;
@@ -1414,7 +1266,6 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseFile", LuaEraseFile) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtFindAllFiles", LuaFindAllFiles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCompareFilesLastWriteTime", LuaCompareFilesLastWriteTime) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDirectoryDialog", LuaDirectoryDialog) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsDirectory", LuaExistsDirectory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateDirectory", LuaCreateDirectory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtEmptyDirectory", LuaEmptyDirectory) ;
@@ -1430,14 +1281,11 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtIs64bit", LuaIs64bit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLanguage", LuaGetLanguage) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMsg", LuaGetMsg) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVerifyKeyOption", LuaVerifyKeyOption) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetDefaultFont", LuaSetDefaultFont) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetDefaultFont", LuaGetDefaultFont) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtWinExec", LuaWinExec) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCloseExe", LuaCloseExe) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateMutex", LuaCreateMutex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtReleaseMutex", LuaReleaseMutex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
return bOk ;
}
-81
View File
@@ -530,83 +530,6 @@ LuaBBoxLocToLoc( lua_State* L)
}
}
//-------------------------------------------------------------------------------
static int
LuaQuaternionFromAxisAngle( lua_State* L)
{
// 2 parametri : vtAx, dAngDeg
Vector3d vtAx ;
LuaCheckParam( L, 1, vtAx)
double dAngDeg ;
LuaCheckParam( L, 2, dAngDeg)
LuaClearStack( L) ;
// calcolo il quaternione che produce la rotazione equivalente
Quaternion qtQ = FromAxisAngle( vtAx, dAngDeg) ;
if ( ! qtQ.IsSmall())
LuaSetParam( L, qtQ) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaQuaternionToAxisAngle( lua_State* L)
{
// 1 parametro : Quaternion
Quaternion qtQ ;
LuaCheckParam( L, 1, qtQ)
LuaClearStack( L) ;
// calcolo l'asse e l'angolo di rotazione equivalenti
Vector3d vtAx ;
double dAngDeg ;
bool bOk = ToAxisAngle( qtQ, vtAx, dAngDeg) ;
if ( bOk) {
LuaSetParam( L, vtAx) ;
LuaSetParam( L, dAngDeg) ;
return 2 ;
}
else {
LuaSetParam( L) ;
return 1 ;
}
}
//-------------------------------------------------------------------------------
static int
LuaQuaternionFromFrame( lua_State* L)
{
// 1 parametro : Frame
Frame3d frFrame ;
LuaCheckParam( L, 1, frFrame)
LuaClearStack( L) ;
// calcolo il quaternione che produce l'orientamento di questo frame tramite rotazione dal globale
Quaternion qtQ = FromFrame( frFrame) ;
if ( ! qtQ.IsSmall())
LuaSetParam( L, qtQ) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaQuaternionToFrame( lua_State* L)
{
// 1 parametro : Quaternion
Quaternion qtQ ;
LuaCheckParam( L, 1, qtQ)
LuaClearStack( L) ;
// calcolo il frame equivalente come orientamento a quello globale ruotato dal quaternione
Frame3d frFrame ;
bool bOk = ToFrame( qtQ, frFrame) ;
if ( bOk)
LuaSetParam( L, frFrame) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGeoBase( LuaMgr& luaMgr)
@@ -634,9 +557,5 @@ LuaInstallGeoBase( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToGlob", LuaBBoxToGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToLoc", LuaBBoxToLoc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxLocToLoc", LuaBBoxLocToLoc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionFromAxisAngle", LuaQuaternionFromAxisAngle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionToAxisAngle", LuaQuaternionToAxisAngle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionFromFrame", LuaQuaternionFromFrame) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionToFrame", LuaQuaternionToFrame) ;
return bOk ;
}
-31
View File
@@ -111,36 +111,6 @@ LuaPointSurfTmDist( lua_State* L)
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaPointSurfBzDist( lua_State* L)
{
// 2 o 3 parametri : ptP, nSbzId, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
int nId ;
LuaCheckParam( L, 2, nId)
int nRefType = nId ;
LuaGetParam( L, 3, nRefType) ;
LuaClearStack( L) ;
// calcolo la distanza
double dDist ;
Point3d ptMin ;
Vector3d vtN ;
bool bOk = ExePointSurfBzDist( ptP, nId, nRefType, &dDist, ptMin, vtN) ;
if ( bOk) {
LuaSetParam( L, dDist) ;
LuaSetParam( L, ptMin) ;
LuaSetParam( L, vtN) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGeoDist( LuaMgr& luaMgr)
@@ -149,6 +119,5 @@ LuaInstallGeoDist( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtPointCurveDist", LuaPointCurveDist) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointCurveDistSide", LuaPointCurveDistSide) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointSurfTmDist", LuaPointSurfTmDist) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointSurfBzDist", LuaPointSurfBzDist) ;
return bOk ;
}
+129 -228
View File
@@ -20,41 +20,6 @@
using namespace std ;
//----------------------------------------------------------------------------
static int
LuaLineCurveInters( lua_State* L)
{
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir)
int nId ;
LuaCheckParam( L, 3, nId)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// recupero i punti di intersezione tra linea e curva
INTDBLVECTOR vInters ;
if ( ExeLineCurveInters( ptP, vtDir, nId, nRefType, vInters)) {
LuaSetParam( L, true) ;
INTVECTOR vType( vInters.size()) ;
DBLVECTOR vPar( vInters.size()) ;
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
vType[i] = vInters[i].first ;
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaLineBoxInters( lua_State* L)
@@ -88,6 +53,38 @@ LuaLineBoxInters( lua_State* L)
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneBoxInters( lua_State* L)
{
// 4 o 5 parametri : ptOn, vtN, b3Box, nDestGrpId [, nRefType]
Point3d ptOn ;
LuaCheckParam( L, 1, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
BBox3d b3Box ;
LuaCheckParam( L, 3, b3Box)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nSrfCount = 0 ;
int nNewId = ExePlaneBoxInters( ptOn, vtN, b3Box, nDestGrpId, nRefType, &nPntCount, &nCrvCount, &nSrfCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
LuaSetParam( L, nSrfCount) ;
return 4 ;
}
//----------------------------------------------------------------------------
static int
LuaLineSurfTmInters( lua_State* L)
@@ -123,136 +120,6 @@ LuaLineSurfTmInters( lua_State* L)
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaLineSurfBzInters( lua_State* L)
{
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir)
int nId ;
LuaCheckParam( L, 3, nId)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// recupero i punti di intersezione tra linea e superficie trimesh
INTDBLVECTOR vInters ;
if ( ExeLineSurfBzInters( ptP, vtDir, nId, nRefType, vInters)) {
LuaSetParam( L, true) ;
INTVECTOR vType( vInters.size()) ;
DBLVECTOR vPar( vInters.size()) ;
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
vType[i] = vInters[i].first ;
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaLineVolZmapInters( lua_State* L)
{
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir)
int nId ;
LuaCheckParam( L, 3, nId)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// eseguo calcolo intersezione
INTDBLVECTOR vInters ;
if ( ExeLineVolZmapInters( ptP, vtDir, nId, nRefType, vInters)) {
LuaSetParam( L, true) ;
INTVECTOR vType( vInters.size()) ;
DBLVECTOR vPar( vInters.size()) ;
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
vType[i] = vInters[i].first ;
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneCurveInters( lua_State* L)
{
// 4 o 5 parametri : ptOn, vtN, nId, nDestGrpId [, nRefType]
Point3d ptOn ;
LuaCheckParam( L, 1, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
int nId ;
LuaCheckParam( L, 3, nId)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nCount = 0 ;
int nNewId = ExePlaneCurveInters( ptOn, vtN, nId, nDestGrpId, nRefType, &nCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneBoxInters( lua_State* L)
{
// 4 o 5 parametri : ptOn, vtN, b3Box, nDestGrpId [, nRefType]
Point3d ptOn ;
LuaCheckParam( L, 1, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
BBox3d b3Box ;
LuaCheckParam( L, 3, b3Box)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nSrfCount = 0 ;
int nNewId = ExePlaneBoxInters( ptOn, vtN, b3Box, nDestGrpId, nRefType, &nPntCount, &nCrvCount, &nSrfCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
LuaSetParam( L, nSrfCount) ;
return 4 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneSurfTmInters( lua_State* L)
@@ -321,32 +188,59 @@ LuaParPlanesSurfTmInters( lua_State* L)
//----------------------------------------------------------------------------
static int
LuaPlaneVolZmapInters( lua_State* L)
LuaSurfTmSurfTmInters( lua_State* L)
{
// 4 o 5 parametri : ptP, vtN, nId, nDestGrpId [, nRefType]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
// 3 o 4 parametri : Id1, nId2, nDestGrpId [, dToler]
int nId1 ;
LuaCheckParam( L, 1, nId1)
int nId2 ;
LuaCheckParam( L, 2, nId2)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
double dToler = 20 * EPS_SMALL ;
LuaGetParam( L, 4, dToler) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nSrfCount = 0 ;
int nNewId = ExeSurfTmSurfTmInters( nId1, nId2, nDestGrpId, dToler, &nPntCount, &nCrvCount, &nSrfCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
LuaSetParam( L, nSrfCount) ;
return 4 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneCurveInters( lua_State* L)
{
// 4 o 5 parametri : ptOn, vtN, nId, nDestGrpId [, nRefType]
Point3d ptOn ;
LuaCheckParam( L, 1, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
int nId ;
LuaCheckParam( L, 3, nId)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId)
LuaCheckParam( L, 4, nDestGrpId) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo calcolo intersezione
int nCount ;
int nFirstId = ExePlaneVolZmapInters( ptP, vtN, nId, nDestGrpId, nRefType, &nCount) ;
// eseguo l'intersezione
int nCount = 0 ;
int nNewId = ExePlaneCurveInters( ptOn, vtN, nId, nDestGrpId, nRefType, &nCount) ;
// restituisco il risultato
if ( nFirstId != GDB_ID_NULL) {
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
}
else {
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L) ;
}
LuaSetParam( L, nCount) ;
return 2 ;
}
@@ -378,58 +272,68 @@ LuaCurveCurveInters( lua_State* L)
//----------------------------------------------------------------------------
static int
LuaCurveSurfTmInters( lua_State* L)
LuaLineVolZmapInters( lua_State* L)
{
// 3 parametri : nCrvId, nStmId, nDestGrpId
int nCrvId ;
LuaCheckParam( L, 1, nCrvId)
int nStmId ;
LuaCheckParam( L, 2, nStmId)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir)
int nId ;
LuaCheckParam( L, 3, nId)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nNewId = ExeCurveSurfTmInters( nCrvId, nStmId, nDestGrpId, &nPntCount, &nCrvCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
// eseguo calcolo intersezione
INTDBLVECTOR vInters ;
if ( ExeLineVolZmapInters( ptP, vtDir, nId, nRefType, vInters)) {
LuaSetParam( L, true) ;
INTVECTOR vType( vInters.size()) ;
DBLVECTOR vPar( vInters.size()) ;
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
vType[i] = vInters[i].first ;
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmSurfTmInters( lua_State* L)
LuaPlaneVolZmapInters( lua_State* L)
{
// 3 o 4 parametri : Id1, nId2, nDestGrpId [, dToler]
int nId1 ;
LuaCheckParam( L, 1, nId1)
int nId2 ;
LuaCheckParam( L, 2, nId2)
// 4 o 5 parametri : ptP, vtN, nId, nDestGrpId [, nRefType]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
int nId ;
LuaCheckParam( L, 3, nId)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
double dToler = 20 * EPS_SMALL ;
LuaGetParam( L, 4, dToler) ;
LuaCheckParam( L, 4, nDestGrpId)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nSrfCount = 0 ;
int nNewId = ExeSurfTmSurfTmInters( nId1, nId2, nDestGrpId, dToler, &nPntCount, &nCrvCount, &nSrfCount) ;
// eseguo calcolo intersezione
int nCount ;
int nFirstId = ExePlaneVolZmapInters( ptP, vtN, nId, nDestGrpId, nRefType, &nCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
if ( nFirstId != GDB_ID_NULL) {
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
LuaSetParam( L, nSrfCount) ;
return 4 ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
@@ -437,18 +341,15 @@ bool
LuaInstallGeoInters( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineCurveInters", LuaLineCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineBoxInters", LuaLineBoxInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfTmInters", LuaLineSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfBzInters", LuaLineSurfBzInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineVolZmapInters", LuaLineVolZmapInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneCurveInters", LuaPlaneCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneBoxInters", LuaPlaneBoxInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfTmInters", LuaLineSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneSurfTmInters", LuaPlaneSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtParPlanesSurfTmInters", LuaParPlanesSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneVolZmapInters", LuaPlaneVolZmapInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCurveInters", LuaCurveCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSurfTmInters", LuaCurveSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneCurveInters", LuaPlaneCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCurveInters", LuaCurveCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineVolZmapInters", LuaLineVolZmapInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneVolZmapInters", LuaPlaneVolZmapInters) ;
return bOk ;
}
}
+8 -10
View File
@@ -312,16 +312,16 @@ LuaSaveFile( lua_State* L)
static int
LuaSaveObjToFile( lua_State* L)
{
// 2 o 3 parametri : vId, path del file [, flag]
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
// 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( vId, sFilePath, nFlag) ;
bool bOk = ExeSaveObjToFile( nId, sFilePath, nFlag) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -331,18 +331,16 @@ LuaSaveObjToFile( lua_State* L)
static int
LuaSaveMachGroupToFile( lua_State* L)
{
// 2, 3 o 4 parametri : nMGroupId, [ vPlusId,] sFilePath [, nFlag]
// 2 o 3 parametri : nMGroupId, path del file [, flag]
int nMGroupId ;
LuaCheckParam( L, 1, nMGroupId)
INTVECTOR vPlusId ;
int nOffs = ( LuaGetParam( L, 2, vPlusId) ?1 : 0) ;
string sFilePath ;
LuaCheckParam( L, 2 + nOffs, sFilePath)
LuaCheckParam( L, 2, sFilePath)
int nFlag = GDB_SV_CMPTXT ;
LuaGetParam( L, 3 + nOffs, nFlag) ;
LuaGetParam( L, 3, nFlag) ;
LuaClearStack( L) ;
// copio il gruppo nel file
bool bOk = ExeSaveMachGroupToFile( nMGroupId, vPlusId, sFilePath, nFlag) ;
bool bOk = ExeSaveMachGroupToFile( nMGroupId, sFilePath, nFlag) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
+56 -442
View File
@@ -15,7 +15,6 @@
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EMkToolConst.h"
#include "/EgtDev/Include/EMkMachiningConst.h"
#include "/EgtDev/Include/EGkGdbConst.h"
@@ -263,24 +262,6 @@ LuaRemoveMachGroup( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaChangeMachGroupName( lua_State* L)
{
// 2 parametri : identificativo del gruppo, nuovo nome
int nMGroupInd ;
LuaCheckParam( L, 1, nMGroupInd)
string sNewName ;
LuaCheckParam( L, 2, sNewName)
LuaClearStack( L) ;
// cambio il nome della macchinata
string sName ;
bool bOk = ExeChangeMachGroupName( nMGroupInd, sNewName) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetMachGroupName( lua_State* L)
@@ -558,20 +539,22 @@ LuaAddRawPartWithPart( lua_State* L)
static int
LuaModifyRawPart( lua_State* L)
{
// 5 parametri : nRawId, nCrvId, dOverMat, dHeight, cCol
// 6 parametri : nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol
int nRawId ;
LuaCheckParam( L, 1, nRawId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId)
double dOverMat ;
LuaCheckParam( L, 3, dOverMat)
double dZmin ;
LuaCheckParam( L, 4, dZmin)
double dHeight ;
LuaCheckParam( L, 4, dHeight)
LuaCheckParam( L, 5, dHeight)
Color cCol ;
LuaCheckParam( L, 5, cCol)
LuaCheckParam( L, 6, cCol)
LuaClearStack( L) ;
// modifico le dimensioni del grezzo
bool bOk = ExeModifyRawPart( nRawId, nCrvId, dOverMat, dHeight, cCol) ;
bool bOk = ExeModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -1079,53 +1062,6 @@ LuaChangeTable( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaMoveDispAxis( lua_State* L)
{
// 2 parametri : sName, dPos
string sName ;
LuaCheckParam( L, 1, sName)
double dPos ;
LuaCheckParam( L, 2, dPos)
LuaClearStack( L) ;
// muovo l'asse nella nuova posizione
bool bOk = ExeMoveDispAxis( sName, dPos) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRemoveDispAxis( lua_State* L)
{
// 1 parametro : sName
string sName ;
LuaCheckParam( L, 1, sName)
LuaClearStack( L) ;
// rimuovo il movimento dell'asse
bool bOk = ExeRemoveDispAxis( sName) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaKeepAllDispAxes( lua_State* L)
{
// 1 parametro : nSouPhase
int nSouPhase ;
LuaCheckParam( L, 1, nSouPhase) ;
LuaClearStack( L) ;
// confermo i movimenti degli assi di disposizione nella fase corrente della macchinata corrente
bool bOk = ExeKeepAllDispAxes( nSouPhase) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaAddFixture( lua_State* L)
@@ -1140,7 +1076,7 @@ LuaAddFixture( lua_State* L)
if ( LuaGetParam( L, 3, dAngRotDeg))
LuaGetParam( L, 4, dMov) ;
LuaClearStack( L) ;
// aggiungo la ventosa nella posizione indicata
// metto l'asse nella nuova posizione
int nId = ExeAddFixture( sName, ptPos, dAngRotDeg, dMov) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
@@ -1250,23 +1186,6 @@ LuaRotateFixture( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetFixtureLink( lua_State* L)
{
// 2 parametri : nFxtId, sTaLink
int nFxtId ;
LuaCheckParam( L, 1, nFxtId)
string sTaLink ;
LuaCheckParam( L, 2, sTaLink)
LuaClearStack( L) ;
// aggancio il bloccaggio ad asse tavola
bool bOk= ExeSetFixtureLink( nFxtId, sTaLink) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaMoveFixtureMobile( lua_State* L)
@@ -1284,23 +1203,6 @@ LuaMoveFixtureMobile( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetFixtureMobile( lua_State* L)
{
// 2 parametri : nFxtId, dMov
int nFxtId ;
LuaCheckParam( L, 1, nFxtId)
double dMov ;
LuaCheckParam( L, 2, dMov)
LuaClearStack( L) ;
// imposto il movimento della parte mobile del bloccaggio
bool bOk= ExeSetFixtureMobile( nFxtId, dMov) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
// Tools database
//-------------------------------------------------------------------------------
@@ -1709,22 +1611,6 @@ LuaTdbGetCurrToolThLength( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaTdbIsCurrToolStandardDraw( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero lo stato
bool bStandard ;
bool bOk = ExeTdbCurrToolIsStandardDraw( bStandard) ;
if ( bOk)
LuaSetParam( L, bStandard) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaTdbGetCurrToolDraw( lua_State* L)
@@ -1848,12 +1734,10 @@ LuaFindToolInCurrSetup( lua_State* L)
string sTool ;
LuaGetParam( L, 1, sTool) ;
LuaClearStack( L) ;
// verifico attrezzaggio utensile e ne recupero l'eventuale posizione
string sTcPos ;
bool bOk = ExeGetToolSetupPosInCurrSetup( sTool, sTcPos) ;
// verifico l'attrezzaggio della macchinata corrente
bool bOk = ExeFindToolInCurrSetup( sTool) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, sTcPos) ;
return 2 ;
return 1 ;
}
//-----------------------------------------------------------------------------
@@ -2285,12 +2169,10 @@ LuaGetPrevOperation( lua_State* L)
static int
LuaGetFirstActiveOperation( lua_State* L)
{
// nessuno o 1 parametro : [bNeedMachNotEmpty]
bool bNeedMachNotEmpty = false ;
LuaGetParam( L, 1, bNeedMachNotEmpty) ;
// nessun parametro
LuaClearStack( L) ;
// recupero la prima operazione attiva della macchinata corrente
int nId = ExeGetFirstActiveOperation( bNeedMachNotEmpty) ;
int nId = ExeGetFirstActiveOperation() ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -2303,14 +2185,12 @@ LuaGetFirstActiveOperation( lua_State* L)
static int
LuaGetNextActiveOperation( lua_State* L)
{
// 1 o 2 parametri : nId [, bNeedMachNotEmpty]
// 1 parametro : nId
int nId ;
LuaCheckParam( L, 1, nId)
bool bNeedMachNotEmpty = false ;
LuaGetParam( L, 2, bNeedMachNotEmpty) ;
LuaClearStack( L) ;
// recupero la successiva operazione attiva della macchinata corrente
int nNextId = ExeGetNextActiveOperation( nId, bNeedMachNotEmpty) ;
int nNextId = ExeGetNextActiveOperation( nId) ;
// restituisco il risultato
if ( nNextId != GDB_ID_NULL)
LuaSetParam( L, nNextId) ;
@@ -2323,12 +2203,10 @@ LuaGetNextActiveOperation( lua_State* L)
static int
LuaGetLastActiveOperation( lua_State* L)
{
// nessuno o 1 parametro : [bNeedMachNotEmpty]
bool bNeedMachNotEmpty = false ;
LuaGetParam( L, 1, bNeedMachNotEmpty) ;
// nessun parametro
LuaClearStack( L) ;
// recupero l'ultima operazione attiva della macchinata corrente
int nId = ExeGetLastActiveOperation( bNeedMachNotEmpty) ;
int nId = ExeGetLastActiveOperation() ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -2341,14 +2219,12 @@ LuaGetLastActiveOperation( lua_State* L)
static int
LuaGetPrevActiveOperation( lua_State* L)
{
// 1 o 2 parametri : nId [, bNeedMachNotEmpty]
// 1 parametro : nId
int nId ;
LuaCheckParam( L, 1, nId)
bool bNeedMachNotEmpty = false ;
LuaGetParam( L, 2, bNeedMachNotEmpty) ;
LuaClearStack( L) ;
// recupero la precedente operazione attiva della macchinata corrente
int nNextId = ExeGetPrevActiveOperation( nId, bNeedMachNotEmpty) ;
int nNextId = ExeGetPrevActiveOperation( nId) ;
// restituisco il risultato
if ( nNextId != GDB_ID_NULL)
LuaSetParam( L, nNextId) ;
@@ -2445,14 +2321,12 @@ LuaGetOperationId( lua_State* L)
static int
LuaIsOperationEmpty( lua_State* L)
{
// 1 o 2 parametri : nId [, nEmptyType]
// 1 parametro : nId
int nId ;
LuaCheckParam( L, 1, nId)
int nEmptyType = EMP_NEED_GEOM ;
LuaGetParam( L, 2, nEmptyType) ;
LuaClearStack( L) ;
// recupero lo stato della operazione indicata della macchinata corrente
bool bOk = ExeIsOperationEmpty( nId, nEmptyType) ;
bool bOk = ExeIsOperationEmpty( nId) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -2702,34 +2576,6 @@ LuaSpecialUpdateDisposition( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetDispositionToolData( lua_State* L)
{
// 1 parametro : nId
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero dati dell'eventuale utensile associato alla disposizione
string sName ;
string sHead ;
int nExit ;
string sTcPos ;
bool bOk = ExeGetDispositionToolData( nId, sName, sHead, nExit, sTcPos) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, sName) ;
LuaSetParam( L, sHead) ;
LuaSetParam( L, nExit) ;
LuaSetParam( L, sTcPos) ;
return 4 ;
}
else {
LuaSetParam( L) ;
return 1 ;
}
}
//-------------------------------------------------------------------------------
// Machinings
//-------------------------------------------------------------------------------
@@ -3018,31 +2864,12 @@ LuaGetMachiningGeometry( lua_State* L)
//-------------------------------------------------------------------------------
static int
LuaGetMachiningSkippedGeometry( lua_State* L)
LuaIsMachiningEmpty( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero gli indici della geometria non lavorata della lavorazione corrente
SELVECTOR vSel ;
bool bOk = ExeGetMachiningSkippedGeometry( vSel) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vSel) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaIsMachiningEmpty( lua_State* L)
{
// nessuno o 1 parametro : [nEmptyType]
int nEmptyType = EMP_NEED_GEOM ;
LuaGetParam( L, 1, nEmptyType) ;
LuaClearStack( L) ;
// recupero lo stato della lavorazione corrente
bool bEmpty = ExeIsMachiningEmpty( nEmptyType) ;
bool bEmpty = ExeIsMachiningEmpty() ;
// restituisco il risultato
LuaSetParam( L, bEmpty) ;
return 1 ;
@@ -3150,18 +2977,14 @@ LuaGetClEntFlag( lua_State* L)
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero il flag
int nFlag, nFlag2 ;
bool bOk = ExeGetClEntFlag( nEntId, nFlag, nFlag2) ;
int nFlag ;
bool bOk = ExeGetClEntFlag( nEntId, nFlag) ;
// restituisco il risultato
if ( bOk) {
if ( bOk)
LuaSetParam( L, nFlag) ;
LuaSetParam( L, nFlag2) ;
}
else {
else
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
return 1 ;
}
//-----------------------------------------------------------------------------
@@ -3183,63 +3006,6 @@ LuaGetClEntIndex( lua_State* L)
return 1 ;
}
//-----------------------------------------------------------------------------
static int
LuaGetClEntAxesStatus( lua_State* L)
{
// 1 parametro : nEntId
int nEntId ;
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero lo stato del movimento assi
int nStatus ;
bool bOk = ExeGetClEntAxesStatus( nEntId, nStatus) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nStatus) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-----------------------------------------------------------------------------
static int
LuaGetClEntAxesMask( lua_State* L)
{
// 1 parametro : nEntId
int nEntId ;
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero la mascheratura del movimento assi (valida solo in rapido)
int nMask ;
bool bOk = ExeGetClEntAxesMask( nEntId, nMask) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nMask) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-----------------------------------------------------------------------------
static int
LuaGetClEntAxesVal( lua_State* L)
{
// 1 parametro : nEntId
int nEntId ;
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero il valore degli assi
DBLVECTOR vAxes ;
bool bOk = ExeGetClEntAxesVal( nEntId, vAxes) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vAxes) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
// Simulation
//-------------------------------------------------------------------------------
@@ -3328,21 +3094,6 @@ LuaSimSetUiStatus( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSimEnableToolTipTrace( lua_State* L)
{
// 1 parametro : bEnable
bool bEnable ;
LuaCheckParam( L, 1, bEnable)
LuaClearStack( L) ;
// imposto abilitazione disegno traccia della punta utensile
bool bOk = ExeSimEnableToolTipTrace( bEnable) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSimGetAxisInfoPos( lua_State* L)
@@ -3560,19 +3311,26 @@ LuaSetRotAxisBlock( lua_State* L)
//-------------------------------------------------------------------------------
static int
LuaGetCalcTable( lua_State* L)
LuaGetRotAxisBlocked( lua_State* L)
{
// nessun parametro
// 1 parametro : nInd ( 0-based)
int nInd ;
LuaCheckParam( L, 1, nInd)
LuaClearStack( L) ;
// recupero la tavola correnti
string sTable ;
bool bOk = ExeGetCalcTable( sTable) ;
// recupero dati bloccaggio asse in posizione nInd
string sAxis ;
double dVal ;
bool bOk = ExeGetRotAxisBlocked( nInd, sAxis, dVal) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, sTable) ;
else
if ( bOk) {
LuaSetParam( L, sAxis) ;
LuaSetParam( L, dVal) ;
}
else {
LuaSetParam( L) ;
return 1 ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
@@ -3600,47 +3358,6 @@ LuaGetCalcTool( lua_State* L)
return 3 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetAllCurrAxesNames( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// imposto l'utensile corrente per il calcolo
STRVECTOR vAxName ;
bool bOk = ExeGetAllCurrAxesNames( vAxName) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vAxName) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetRotAxisBlocked( lua_State* L)
{
// 1 parametro : nInd ( 0-based)
int nInd ;
LuaCheckParam( L, 1, nInd)
LuaClearStack( L) ;
// recupero dati bloccaggio asse in posizione nInd
string sAxis ;
double dVal ;
bool bOk = ExeGetRotAxisBlocked( nInd, sAxis, dVal) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, sAxis) ;
LuaSetParam( L, dVal) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetCalcAngles( lua_State* L)
@@ -3686,13 +3403,13 @@ LuaGetCalcPositions( lua_State* L)
break ;
}
LuaClearStack( L) ;
// calcolo gli assi lineari dalla posizione e dagli angoli
double dX ; double dY ; double dZ ;
bool bOk = ExeGetCalcPositions( ptP, vAng, dX, dY, dZ) ;
// imposto la tavola corrente per il calcolo
int nStat ; double dX ; double dY ; double dZ ;
bool bOk = ExeGetCalcPositions( ptP, vAng, nStat, dX, dY, dZ) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, bOk) ;
LuaSetParam( L, 0) ; // assegnato per compatibilità
LuaSetParam( L, nStat) ;
LuaSetParam( L, dX) ;
LuaSetParam( L, dY) ;
LuaSetParam( L, dZ) ;
@@ -3704,39 +3421,11 @@ LuaGetCalcPositions( lua_State* L)
}
}
//-------------------------------------------------------------------------------
static int
LuaGetRobotAngles( lua_State* L)
{
// da 3 parametri : ptP, vtTool, vtAux
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtTool ;
LuaCheckParam( L, 2, vtTool)
Vector3d vtAux ;
LuaCheckParam( L, 3, vtAux)
LuaClearStack( L) ;
// imposto la tavola corrente per il calcolo
DBLVECTOR vAng1, vAng2 ;
bool bOk = ExeGetRobotAngles( ptP, vtTool, vtAux, vAng1, vAng2) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, bOk) ;
LuaSetParam( L, vAng1) ;
LuaSetParam( L, vAng2) ;
return 3 ;
}
else {
LuaSetParam( L, bOk) ;
return 1 ;
}
}
//-------------------------------------------------------------------------------
static int
LuaGetCalcTipFromPositions( lua_State* L)
{
// da 3 a 10 parametri : dX, dY, dZ [, dAngR1] [, dAngR2] [, dAngR3] [, dAngR4] [, dAngR5] [, dAngR6] [, bBottom]
// da 5 a 8 parametri : dX, dY, dZ, dAngA [, dAngB] [, dAngC] [, dAngD], bBottom
double dX ;
LuaCheckParam( L, 1, dX)
double dY ;
@@ -3745,15 +3434,15 @@ LuaGetCalcTipFromPositions( lua_State* L)
LuaCheckParam( L, 3, dZ)
DBLVECTOR vAng ;
int i ;
for ( i = 4 ; i <= 9 ; ++ i) {
for ( i = 4 ; i <= 7 ; ++ i) {
double dAng ;
if ( LuaGetParam( L, i, dAng))
vAng.emplace_back( dAng) ;
else
break ;
}
bool bBottom = false ;
LuaGetParam( L, i, bBottom) ;
bool bBottom ;
LuaCheckParam( L, i, bBottom)
LuaClearStack( L) ;
// calcolo il tip utensile dagli assi macchina
Point3d ptTip ;
@@ -3770,9 +3459,9 @@ LuaGetCalcTipFromPositions( lua_State* L)
static int
LuaGetCalcToolDirFromAngles( lua_State* L)
{
// da 0 a 6 parametri : [dAngR1] [, dAngR2] [, dAngR3] [, dAngR4] [, dAngR5] [, dAngR6]
// da 1 a 4 parametri : dAngA, dAngB, dAngC, dAngD
DBLVECTOR vAng ;
for ( int i = 1 ; i <= 6 ; ++ i) {
for ( int i = 1 ; i <= 4 ; ++ i) {
double dAng ;
if ( LuaGetParam( L, i, dAng))
vAng.emplace_back( dAng) ;
@@ -3795,9 +3484,9 @@ LuaGetCalcToolDirFromAngles( lua_State* L)
static int
LuaGetCalcAuxDirFromAngles( lua_State* L)
{
// da 0 a 6 parametri : [dAngR1] [, dAngR2] [, dAngR3] [, dAngR4] [, dAngR5] [, dAngR6]
// da 1 a 4 parametri : dAngA, dAngB, dAngC, dAngD
DBLVECTOR vAng ;
for ( int i = 1 ; i <= 6 ; ++ i) {
for ( int i = 1 ; i <= 4 ; ++ i) {
double dAng ;
if ( LuaGetParam( L, i, dAng))
vAng.emplace_back( dAng) ;
@@ -3952,26 +3641,6 @@ LuaGetHeadExitCount( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetExitId( lua_State* L)
{
// 2 parametri : sHead, nExit
string sHead ;
LuaCheckParam( L, 1, sHead)
int nExit ;
LuaCheckParam( L, 2, nExit)
LuaClearStack( L) ;
// recupero l'identificativo dell'Uscita della Testa indicata della macchina
int nId = ExeGetExitId( sHead, nExit) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetTcPosId( lua_State* L)
@@ -4028,25 +3697,6 @@ LuaGetAxisType( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetAxisDir( lua_State* L)
{
// 1 parametro : sAxis
string sAxis ;
LuaCheckParam( L, 1, sAxis)
LuaClearStack( L) ;
// recupero la direzione dell'asse
Vector3d vtDir ;
bool bOk = ExeGetAxisDir( sAxis, vtDir) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vtDir) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetAxisInvert( lua_State* L)
@@ -4102,23 +3752,6 @@ LuaGetAllTablesNames( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetAllAxesNames( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero l'elenco degli assi della macchina corrente
STRVECTOR vNames ;
bool bOk = ExeGetAllAxesNames( vNames) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vNames) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetAllHeadsNames( lua_State* L)
@@ -4372,7 +4005,6 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachGroup", LuaAddMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyMachGroup", LuaCopyMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveMachGroup", LuaRemoveMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeMachGroupName", LuaChangeMachGroupName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupName", LuaGetMachGroupName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupMachineName", LuaGetMachGroupMachineName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupId", LuaGetMachGroupId) ;
@@ -4421,9 +4053,6 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTableArea", LuaGetTableArea) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTableAreaOffset", LuaGetTableAreaOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeTable", LuaChangeTable) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMoveDispAxis", LuaMoveDispAxis) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveDispAxis", LuaRemoveDispAxis) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtKeepAllDispAxes", LuaKeepAllDispAxes) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAddFixture", LuaAddFixture) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtKeepFixture", LuaKeepFixture) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveFixture", LuaRemoveFixture) ;
@@ -4431,9 +4060,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextFixture", LuaGetNextFixture) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMoveFixture", LuaMoveFixture) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRotateFixture", LuaRotateFixture) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetFixtureLink", LuaSetFixtureLink) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMoveFixtureMobile", LuaMoveFixtureMobile) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetFixtureMobile", LuaSetFixtureMobile) ;
// Tools database
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbGetToolNewName", LuaTdbGetToolNewName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbAddTool", LuaTdbAddTool) ;
@@ -4453,7 +4080,6 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbGetCurrToolMaxDepth", LuaTdbGetCurrToolMaxDepth) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbGetCurrToolThDiam", LuaTdbGetCurrToolThDiam) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbGetCurrToolThLength", LuaTdbGetCurrToolThLength) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbIsCurrToolStandardDraw", LuaTdbIsCurrToolStandardDraw) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbGetCurrToolDraw", LuaTdbGetCurrToolDraw) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbReload", LuaTdbReload) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbSave", LuaTdbSave) ;
@@ -4512,7 +4138,6 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPhaseDisposition", LuaGetPhaseDisposition) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSpecialApplyDisposition", LuaSpecialApplyDisposition) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSpecialUpdateDisposition", LuaSpecialUpdateDisposition) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetDispositionToolData", LuaGetDispositionToolData) ;
// Machinings
bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachining", LuaAddMachining) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateMachining", LuaCreateMachining) ;
@@ -4527,7 +4152,6 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateMachining", LuaUpdateMachining) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningParam", LuaGetMachiningParam) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningGeometry", LuaGetMachiningGeometry) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningSkippedGeometry", LuaGetMachiningSkippedGeometry) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtIsMachiningEmpty", LuaIsMachiningEmpty) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningStartPoint", LuaGetMachiningStartPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningEndPoint", LuaGetMachiningEndPoint) ;
@@ -4537,9 +4161,6 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntMove", LuaGetClEntMove) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntFlag", LuaGetClEntFlag) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntIndex", LuaGetClEntIndex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesStatus", LuaGetClEntAxesStatus) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesMask", LuaGetClEntAxesMask) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesVal", LuaGetClEntAxesVal) ;
// Simulation
bOk = bOk && luaMgr.RegisterFunction( "EgtSimInit", LuaSimInit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimStart", LuaSimStart) ;
@@ -4547,7 +4168,6 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSimHome", LuaSimHome) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimSetStep", LuaSimSetStep) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimSetUiStatus", LuaSimSetUiStatus) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimEnableToolTipTrace", LuaSimEnableToolTipTrace) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimGetAxisInfoPos", LuaSimGetAxisInfoPos) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimGetToolInfo", LuaSimGetToolInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimGetOperationInfo", LuaSimGetOperationInfo) ;
@@ -4563,28 +4183,22 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisId", LuaGetAxisId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadId", LuaGetHeadId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadExitCount", LuaGetHeadExitCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetExitId", LuaGetExitId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTcPosId", LuaGetTcPosId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisToken", LuaGetAxisToken) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisType", LuaGetAxisType) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisDir", LuaGetAxisDir) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisInvert", LuaGetAxisInvert) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisOffset", LuaGetAxisOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllTablesNames", LuaGetAllTablesNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllAxesNames", LuaGetAllAxesNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllHeadsNames", LuaGetAllHeadsNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllTcPosNames", LuaGetAllTcPosNames) ;
// Machine Calc
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTable", LuaSetCalcTable) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTool", LuaSetCalcTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetRotAxisBlock", LuaSetRotAxisBlock) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTable", LuaGetCalcTable) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTool", LuaGetCalcTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllCurrAxesNames", LuaGetAllCurrAxesNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRotAxisBlocked", LuaGetRotAxisBlocked) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTool", LuaGetCalcTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAngles", LuaGetCalcAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcPositions", LuaGetCalcPositions) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRobotAngles", LuaGetRobotAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTipFromPositions", LuaGetCalcTipFromPositions) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcToolDirFromAngles", LuaGetCalcToolDirFromAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAuxDirFromAngles", LuaGetCalcAuxDirFromAngles) ;
-240
View File
@@ -1,240 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : LUA_MachOpt.cpp Data : 02.04.25 Versione : 2.7c1
// Contenuto : Funzioni per Ottimizzare i tempi tra le lavorazioni per LUA.
//
//
//
// Modifiche : 02.04.25 RE 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
LuaOptMachInit( lua_State* L)
{
// Nessun parametro
LuaClearStack( L) ;
// Inizializzo il calcolatore per minimizzare i tempi tra le lavorazioni
bool bOk = ExeOptMachInit() ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachTerminate( lua_State* L)
{
// Nessun parametro
LuaClearStack( L) ;
// Termino il calcolatore per minimizzare i tempi tra le lavorazioni
bool bOk = ExeOptMachTerminate() ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachAddTool( lua_State* L)
{
// Definizione 9 parametri (3 obbligatori)
int nId ;
LuaCheckParam( L, 1, nId) ;
double dTLoad ;
LuaCheckParam( L, 2, dTLoad) ;
double dTUnload ;
LuaCheckParam( L, 3, dTUnload) ;
double dTC_X = 0. ;
bool bTC_X = LuaGetParam( L, 4, dTC_X) ;
double dTC_Y = 0. ;
bool bTC_Y = LuaGetParam( L, 5, dTC_Y) ;
double dTC_Z = 0. ;
bool bTC_Z = LuaGetParam( L, 6, dTC_Z) ;
double dTC_A = 0. ;
bool bTC_A = LuaGetParam( L, 7, dTC_A) ;
double dTC_B = 0. ;
bool bTC_B = LuaGetParam( L, 8, dTC_B) ;
double dTC_C = 0. ;
bool bTC_C = LuaGetParam( L, 9, dTC_C) ;
LuaClearStack( L) ;
// Aggiungo la Lavorazione
bool bOk = ExeOptMachAddTool( nId, dTC_X, dTC_Y, dTC_Z, dTC_A, dTC_B, dTC_C,
bTC_X, bTC_Y, bTC_Z, bTC_A, bTC_B, bTC_C,
dTLoad, dTUnload) ;
// Rstituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachAddMachining( lua_State* L)
{
// Definizione 5 parametri
int nId ;
LuaCheckParam( L, 1, nId) ;
int nToolId ;
LuaCheckParam( L, 2, nToolId) ;
int nGroup ;
LuaCheckParam( L, 3, nGroup) ;
DBLVECTOR vAxStart ;
LuaCheckParam( L, 4, vAxStart) ;
DBLVECTOR vAxEnd ;
LuaCheckParam( L, 5, vAxEnd) ;
LuaClearStack( L) ;
// Completamento valori assi
while ( vAxStart.size() < 6)
vAxStart.push_back( 0) ;
while ( vAxEnd.size() < 6)
vAxEnd.push_back( 0) ;
// Aggiungo la Lavorazione
bool bOk = ExeOptMachAddMachining( nId, nToolId, nGroup,
vAxStart[0], vAxStart[1], vAxStart[2], vAxStart[3], vAxStart[4], vAxStart[5],
vAxEnd[0], vAxEnd[1], vAxEnd[2], vAxEnd[3], vAxEnd[4], vAxEnd[5]) ;
// Rstituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachSetFirstMachining( lua_State* L)
{
// 1 parametro : nId
int nId = 0 ;
LuaCheckParam( L, 1, nId) ;
LuaClearStack( L) ;
// Imposto la prima lavorazione
bool bOk = ExeOptMachSetFirstMachining( nId) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------
static int
LuaOptMachSetLastMachining( lua_State* L)
{
// 1 parametro : nId
int nId = 0 ;
LuaCheckParam( L, 1, nId) ;
LuaClearStack( L) ;
// Imposto la prima lavorazione
bool bOk = ExeOptMachSetLastMachining( nId) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------
static int
LuaOptMachSetFeeds( lua_State* L)
{
// 2 Parametri : dFeedL, dFeedA
double dFeedL = 1. ;
LuaCheckParam( L, 1, dFeedL) ;
double dFeedA = 1. ;
LuaCheckParam( L, 2, dFeedA) ;
LuaClearStack( L) ;
// Imposto le Feeds
bool bOk = ExeOptMachSetFeeds( dFeedL, dFeedA) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachAddDependence( lua_State* L)
{
// 2 parametri : nIdPrev, nIdSucc
int nIdPrev = 0 ; int nIdNext = 0 ;
LuaCheckParam( L, 1, nIdPrev) ;
LuaCheckParam( L, 2, nIdNext) ;
LuaClearStack( L) ;
// Imposto Dipendenza obbligatoria
bool bOk = ExeOptMachAddDependence( nIdPrev, nIdNext) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachAddSuggestedDependence( lua_State* L)
{
// 2 parametri : nIdPrev, nIdSucc
int nIdPrev = 0 ; int nIdNext = 0 ;
LuaCheckParam( L, 1, nIdPrev) ;
LuaCheckParam( L, 2, nIdNext) ;
LuaClearStack( L) ;
// Imposto Dipendenza suggerita
bool bOk = ExeOptMachAddSuggestedDependence( nIdPrev, nIdNext) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachSetAllGroupDependencesAsMandatory( lua_State* L)
{
// 1 Parametro : bAllMendatory
bool bAllMendatory = false ;
LuaCheckParam( L, 1, bAllMendatory) ;
LuaClearStack( L) ;
// Imposto il Flag
bool bOk = ExeOptMachSetAllGroupDependencesAsMandatory( bAllMendatory) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachGetResult( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// eseguo calcolo di minimo percorso
INTVECTOR vOrder ;
bool bOk = ExeOptMachGetResult( vOrder) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vOrder) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallMachiningOptimization( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachInit", LuaOptMachInit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachTerminate", LuaOptMachTerminate) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachAddTool", LuaOptMachAddTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachAddMachining", LuaOptMachAddMachining) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetFirstMachining", LuaOptMachSetFirstMachining) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetLastMachining", LuaOptMachSetLastMachining) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetFeeds", LuaOptMachSetFeeds) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachAddDependence", LuaOptMachAddDependence) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachAddSuggestedDependence", LuaOptMachAddSuggestedDependence) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetAllGroupsDependencesAsMandatory", LuaOptMachSetAllGroupDependencesAsMandatory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachGetResult", LuaOptMachGetResult) ;
return bOk ;
}
-39
View File
@@ -340,21 +340,6 @@ LuaAutoNestSetInterpartGap( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaAutoNestSetShearGap( lua_State* L)
{
// 1 parametro : dShearGap
double dShearGap ;
LuaCheckParam( L, 1, dShearGap)
LuaClearStack( L) ;
// imposto shear gap
bool bOk = ExeAutoNestSetShearGap( dShearGap) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaAutoNestSetReportFile( lua_State* L)
@@ -481,28 +466,6 @@ LuaAutoNestGetOneResult( lua_State* L)
}
}
//-------------------------------------------------------------------------------
static int
LuaAutoNestCalcShearSequence( lua_State* L)
{
// 1 parametro : nNesting
int nNesting ;
LuaCheckParam( L, 1, nNesting)
LuaClearStack( L) ;
// calcolo shear sequence
PNTVECTOR vPtStart, vPtEnd ;
bool bOk = ExeAutoNestCalcShearSequence( nNesting, vPtStart, vPtEnd) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
if ( bOk) {
LuaSetParam( L, vPtStart) ;
LuaSetParam( L, vPtEnd) ;
return 3 ;
}
else
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallNesting( LuaMgr& luaMgr)
@@ -525,7 +488,6 @@ LuaInstallNesting( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetStripYconstraintToPart", LuaAutoNestSetStripYconstraintToPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetStripXconstraintToPart", LuaAutoNestSetStripXconstraintToPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetInterpartGap", LuaAutoNestSetInterpartGap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetShearGap", LuaAutoNestSetShearGap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetReportFile", LuaAutoNestSetReportFile) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestCompute", LuaAutoNestCompute) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestCancelComputation", LuaAutoNestCancelComputation) ;
@@ -533,7 +495,6 @@ LuaInstallNesting( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestPrintResults", LuaAutoNestPrintResults) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestGetResults", LuaAutoNestGetResults) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestGetOneResult", LuaAutoNestGetOneResult) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestCalcShearSequence", LuaAutoNestCalcShearSequence) ;
return bOk ;
}
-214
View File
@@ -1,214 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : LUA_Redis.cpp Data : 17.09.25 Versione : 2.7i3
// Contenuto : Funzioni per interfacciarsi con server Redis.
//
//
//
// Modifiche : 17.09.25 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkLuaAux.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaRedisConnect( lua_State* L)
{
// 1 parametro : sConnection
string sConnection ;
LuaCheckParam( L, 1, sConnection)
LuaClearStack( L) ;
// Imposto la connessione
int nIdConnection = 0 ;
bool bOk = ExeRedisConnect( sConnection, nIdConnection) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, nIdConnection) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisDisconnect( lua_State* L)
{
// 1 parametro : nIdConnection
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
LuaClearStack( L) ;
// Imposto la connessione
bool bOk = ExeRedisDisconnect( nIdConnection) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisSetValFromKey( lua_State* L)
{
// 3 parametri : nIdConnection, sKey, sVal
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sKey ;
LuaCheckParam( L, 2, sKey) ;
string sVal ;
LuaCheckParam( L, 3, sVal) ;
LuaClearStack( L) ;
// Imposto il valore della chiave
bool bOk = ExeRedisSetValFromKey( nIdConnection, sKey, sVal) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisGetValFromKey( lua_State* L)
{
// 2 parametri : nIdConnection, sKey
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sKey ;
LuaCheckParam( L, 2, sKey)
LuaClearStack( L) ;
// Recupero il valore della chiave
string sVal, sType ;
bool bOk = ExeRedisGetValFromKey( nIdConnection, sKey, sVal) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, sVal) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisAsyncConnect( lua_State* L)
{
// 2 parametri : sConnection
string sConnection ;
LuaCheckParam( L, 1, sConnection)
LuaClearStack( L) ;
// Imposto la connessione
int nIdConnection = -1 ;
bool bOk = ExeRedisAsyncConnect( sConnection, nIdConnection) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, nIdConnection) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisAsyncDiconnect( lua_State* L)
{
// 1 parametro : nIdConnection
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
LuaClearStack( L) ;
// Imposto la connessione
bool bOK = ExeRedisAsyncDisconnect( nIdConnection) ;
// Restituisco il risultato
LuaSetParam( L, bOK) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisAsyncPublish( lua_State* L)
{
// 3 parametri : nIdConnection, sChannel, sMessage
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sChannel ;
LuaCheckParam( L, 2, sChannel) ;
string sMessage ;
LuaCheckParam( L, 3, sMessage) ;
LuaClearStack( L) ;
// Pubblico il messaggio sul canale
bool bOk = ExeRedisAsyncPublish( nIdConnection, sChannel, sMessage) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//--------------------------------------------------------------------------------
static int
LuaRedisAsyncSubscribe( lua_State* L)
{
// 2 parametri : nIdConnection, sChannel
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sChannel ;
LuaCheckParam( L, 2, sChannel) ;
LuaClearStack( L) ;
// Iscrizione al canale
bool bOk = ExeRedisAsyncSubscribe( nIdConnection, sChannel) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//--------------------------------------------------------------------------------
static int
LuaRedisAsyncUnsubscribe( lua_State* L)
{
// 2 parametri : nIdConnection, sChannel
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sChannel ;
LuaCheckParam( L, 2, sChannel) ;
LuaClearStack( L) ;
// Disiscrizione
bool bOk = ExeRedisAsyncUnsubscribe( nIdConnection, sChannel) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisAsyncSubscribeOneMessage( lua_State* L)
{
// 3 parametri : nIdConnection, sChannel, dMaxTimeOut
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sChannel ;
LuaCheckParam( L, 2, sChannel) ;
double dMaxTimeOut = 0. ;
LuaCheckParam( L, 3, dMaxTimeOut) ;
LuaClearStack( L) ;
// Eseguo funzione speciale di iscrizione - attesa messaggio - disiscrizione
string sMessage ;
bool bOk = ExeRedisAsyncSubscribeOneMessage( nIdConnection, sChannel, dMaxTimeOut, sMessage) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, sMessage) ;
return 2 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallRedis( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisConnect", LuaRedisConnect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisDisconnect", LuaRedisDisconnect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisSetValFromKey", LuaRedisSetValFromKey) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisGetValFromKey", LuaRedisGetValFromKey) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncConnect", LuaRedisAsyncConnect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncDisconnect", LuaRedisAsyncDiconnect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncPublish", LuaRedisAsyncPublish) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncSubscribe", LuaRedisAsyncSubscribe) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncUnsubscribe", LuaRedisAsyncUnsubscribe) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncSubscribeOneMessage", LuaRedisAsyncSubscribeOneMessage) ;
return bOk ;
}
-110
View File
@@ -175,21 +175,6 @@ LuaZoomObject( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetViewOrizzOffsStep( lua_State* L)
{
// 1 parametro : nDirOffsStep
int nDirOffsStep ;
LuaCheckParam( L, 1, nDirOffsStep)
LuaClearStack( L) ;
// imposto offset angolare orizzontale a step di 90° per direzione di vista
bool bOk = ExeSetViewOrizzOffsStep( nDirOffsStep) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetView( lua_State* L)
@@ -243,60 +228,6 @@ LuaSetViewCenter( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetViewOrizzOffsStep( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero offset angolare orizzontale a step di 90° per direzione di vista
int nDirOffsStep ;
bool bOk = ExeGetViewOrizzOffsStep( &nDirOffsStep) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nDirOffsStep) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetView( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero direzione di vista
int nViewDir ;
bool bOk = ExeGetView( &nViewDir) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nViewDir) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetGenericView( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero angoli della direzione di vista
double dAngVertDeg ;
double dAngHorizDeg ;
bool bOk = ExeGetGenericView( &dAngVertDeg, &dAngHorizDeg) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, dAngVertDeg) ;
LuaSetParam( L, dAngHorizDeg) ;
}
else
LuaSetParam( L) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetImage( lua_State* L)
@@ -322,42 +253,6 @@ LuaGetImage( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetImageEx( lua_State* L)
{
// 11 argomenti : nDriver, b2Buff, nColorBits, nDepthBits, nShowMode, colBackTop, colBackBottom, nCameraDir, nWidth, nHeight, sFile
int nDriver ;
LuaCheckParam( L, 1, nDriver)
bool b2Buff ;
LuaCheckParam( L, 2, b2Buff)
int nColorBits ;
LuaCheckParam( L, 3, nColorBits)
int nDepthBits ;
LuaCheckParam( L, 4, nDepthBits)
int nShowMode ;
LuaCheckParam( L, 5, nShowMode)
Color colBackTop ;
LuaCheckParam( L, 6, colBackTop)
Color colBackBottom ;
LuaCheckParam( L, 7, colBackBottom)
int nCameraDir ;
LuaCheckParam( L, 8, nCameraDir)
int nWidth ;
LuaCheckParam( L, 9, nWidth)
int nHeight ;
LuaCheckParam( L, 10, nHeight)
string sFile ;
LuaCheckParam( L, 11, sFile)
LuaClearStack( L) ;
// creo e salvo una immagine della scena
bool bOk = ExeGetImageEx( nDriver, b2Buff, nColorBits, nDepthBits, nShowMode,
colBackTop, colBackBottom, nCameraDir, nWidth, nHeight, sFile) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallScene( LuaMgr& luaMgr)
@@ -372,14 +267,9 @@ LuaInstallScene( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomRadius", LuaZoomRadius) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtZoom", LuaZoom) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomObject", LuaZoomObject) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewOrizzOffsStep", LuaSetViewOrizzOffsStep) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetView", LuaSetView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetGenericView", LuaSetGenericView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewCenter", LuaSetViewCenter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetViewOrizzOffsStep", LuaGetViewOrizzOffsStep) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetView", LuaGetView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetGenericView", LuaGetGenericView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImage", LuaGetImage) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImageEx", LuaGetImageEx) ;
return bOk ;
}
+1 -1
View File
@@ -160,7 +160,7 @@ LuaSpSetZzOwStep( lua_State* L)
LuaCheckParam( L, 1, dStep)
LuaClearStack( L) ;
// imposto lo step per tipologie ZigZag e OneWay
bool bOk = ExeSpSetZzOwStep( dStep) ;
bool bOk = ExeSpSetZzOwStep( dStep) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
-202
View File
@@ -1,202 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : LUA_TestObjSurface.cpp Data : 24.03.24 Versione : 2.6c2
// Contenuto : Funzioni di verifica intersezione tra oggetti e superfici.
// Oggetti = Box, Sfere, Cilindri, Coni, RectPrismoid, SurfTriMesh
// Superfici = SurfTriMesh, ( Bezier).
//
// Modifiche : 24.03.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGnStringUtils.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaTestBoxSurface( lua_State* L)
{
// 4 o 5 parametri : frBox, vtDiag, nSurfId, dSafeDist [, nRefType]
Frame3d frBox ;
LuaCheckParam( L, 1, frBox)
Vector3d vtDiag ;
LuaCheckParam( L, 2, vtDiag)
int nSurfId ;
LuaCheckParam( L, 3, nSurfId)
double dSafeDist ;
LuaCheckParam( L, 4, dSafeDist)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo verifica di collisione
int nRes = ExeTestBoxSurface( frBox, vtDiag, nSurfId, dSafeDist, nRefType) ;
// restituisco il risultato
if ( nRes >= 0)
LuaSetParam( L, ( nRes != 0)) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaTestRectPrismoidSurface( lua_State* L)
{
// 8 o 9 parametri : frBox, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, nSurfId, dSafeDist [, nRefType]
Frame3d frBox ;
LuaCheckParam( L, 1, frBox)
double dBaseLenX ;
LuaCheckParam( L, 2, dBaseLenX)
double dBaseLenY ;
LuaCheckParam( L, 3, dBaseLenY)
double dTopLenX ;
LuaCheckParam( L, 4, dTopLenX)
double dTopLenY ;
LuaCheckParam( L, 5, dTopLenY)
double dHeight ;
LuaCheckParam( L, 6, dHeight)
int nSurfId ;
LuaCheckParam( L, 7, nSurfId)
double dSafeDist ;
LuaCheckParam( L, 8, dSafeDist)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 9, nRefType) ;
LuaClearStack( L) ;
// eseguo verifica di collisione
int nRes = ExeTestRectPrismoidSurface( frBox, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, nSurfId, dSafeDist, nRefType) ;
// restituisco il risultato
if ( nRes >= 0)
LuaSetParam( L, ( nRes != 0)) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaTestCylSurface( lua_State* L)
{
// 5 o 6 parametri : frCyl, dR, dH, nSurfId, dSafeDist [, nRefType]
Frame3d frCyl ;
LuaCheckParam( L, 1, frCyl)
double dR ;
LuaCheckParam( L, 2, dR)
double dH ;
LuaCheckParam( L, 3, dH)
int nSurfId ;
LuaCheckParam( L, 4, nSurfId)
double dSafeDist ;
LuaCheckParam( L, 5, dSafeDist)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 6, nRefType) ;
LuaClearStack( L) ;
// eseguo verifica di collisione
int nRes = ExeTestCylSurface( frCyl, dR, dH, nSurfId, dSafeDist, nRefType) ;
// restituisco il risultato
if ( nRes >= 0)
LuaSetParam( L, ( nRes != 0)) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaTestConeSurface( lua_State* L)
{
// 6 o 7 parametri : frCone, dR1, dR2, dH, nSurfId, dSafeDist [, nRefType]
Frame3d frCone ;
LuaCheckParam( L, 1, frCone)
double dR1 ;
LuaCheckParam( L, 2, dR1)
double dR2 ;
LuaCheckParam( L, 3, dR2)
double dH ;
LuaCheckParam( L, 4, dH)
int nSurfId ;
LuaCheckParam( L, 5, nSurfId)
double dSafeDist ;
LuaCheckParam( L, 6, dSafeDist)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ;
// eseguo verifica di collisione
int nRes = ExeTestConeSurface( frCone, dR1, dR2, dH, nSurfId, dSafeDist, nRefType) ;
// restituisco il risultato
if ( nRes >= 0)
LuaSetParam( L, ( nRes != 0)) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaTestSpheSurface( lua_State* L)
{
// 4 o 5 parametri : ptCen, dRad, nSurfId, dSafeDist [, nRefType]
Point3d ptCen ;
LuaCheckParam( L, 1, ptCen)
double dR ;
LuaCheckParam( L, 2, dR)
int nSurfId ;
LuaCheckParam( L, 3, nSurfId)
double dSafeDist ;
LuaCheckParam( L, 4, dSafeDist)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo verifica di collisione
int nRes = ExeTestSpheSurface( ptCen, dR, nSurfId, dSafeDist, nRefType) ;
// restituisco il risultato
if ( nRes >= 0)
LuaSetParam( L, ( nRes != 0)) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaTestSurfaceSurface( lua_State* L)
{
// 3 parametri : nSurf1Id, nSurf2Id, dSafeDist
int nSurf1Id ;
LuaCheckParam( L, 1, nSurf1Id)
int nSurf2Id ;
LuaCheckParam( L, 2, nSurf2Id)
double dSafeDist ;
LuaCheckParam( L, 3, dSafeDist)
LuaClearStack( L) ;
// eseguo verifica di interferenza
int nRes = ExeTestSurfaceSurface( nSurf1Id, nSurf2Id, dSafeDist) ;
// restituisco il risultato
if ( nRes >= 0)
LuaSetParam( L, ( nRes != 0)) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallTestObjSurface( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTestBoxSurface", LuaTestBoxSurface) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTestRectPrismoidSurface", LuaTestRectPrismoidSurface) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTestCylSurface", LuaTestCylSurface) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTestConeSurface", LuaTestConeSurface) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTestSpheSurface", LuaTestSpheSurface) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTestSurfaceSurface", LuaTestSurfaceSurface) ;
return bOk ;
}
+1 -15
View File
@@ -163,22 +163,8 @@ PictureObj::Load( const STRVECTOR& vString, int nBaseGdbId)
string sOut = "Error loading image " + sOtherPath ;
LOG_ERROR( GetLogger(), sOut.c_str())
}
return true ;
}
// provo dalla path della macchina corrente
string sMachineDir ;
if ( ExeGetCurrMachineDir( sMachineDir)) {
string sOtherPath = sMachineDir + "\\" + GetFileName( m_sPath) ;
if ( ExistsFile( sOtherPath)) {
if ( ! ExeLoadTexture( m_sName, sOtherPath, 0, m_dDimX, m_dDimY, TXR_CLAMP)) {
string sOut = "Error loading image " + sOtherPath ;
LOG_ERROR( GetLogger(), sOut.c_str())
}
return true ;
}
}
// altrimenti errore
{
else {
string sOut = "Error missing image " + sOtherPath ;
LOG_ERROR( GetLogger(), sOut.c_str())
}
+1 -3
View File
@@ -4,7 +4,6 @@
//
#define VS_VERSION_INFO 1
#define IDD_LUADLG 101
#define IDD_LUASCENE 102
#define IDC_TEXT1 1001
#define IDC_TEXT2 1002
#define IDC_TEXT3 1003
@@ -37,7 +36,6 @@
#define IDC_CHECK6 1036
#define IDC_CHECK7 1037
#define IDC_CHECK8 1038
#define IDC_PICTURE1 1041
// Next default values for new objects
//
@@ -46,6 +44,6 @@
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1030
#define _APS_NEXT_SYMED_VALUE 115
#define _APS_NEXT_SYMED_VALUE 113
#endif
#endif
+5 -7
View File
@@ -28,10 +28,8 @@
#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/Lua54" EGTLIBVER ".lib")
#pragma comment( lib, EGTEXTDIR "hiredis/Lib/hiredis" EGTLIBVER ".lib")
#pragma comment( lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")
#pragma comment( lib, "ws2_32.lib")
#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/Lua54" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")