Compare commits
302 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ff02fe0fe | |||
| 52cb174832 | |||
| d3a6f99ba5 | |||
| e31fcee338 | |||
| 4746474864 | |||
| 7cefd64b2a | |||
| 8a51d5e3a5 | |||
| d32fdc5417 | |||
| ccaaa5bd22 | |||
| 00e6d24f2e | |||
| 2d4d4ddf03 | |||
| cfcb844923 | |||
| e9f368a85f | |||
| 1abcac8aa4 | |||
| a9b5d9627a | |||
| 41790f7d57 | |||
| c33cbe7b9f | |||
| 35455e011e | |||
| 1d9ecd9b78 | |||
| 6c2437831d | |||
| d87b349788 | |||
| 1141af30d7 | |||
| 4a34b2e45d | |||
| bdd0e89b78 | |||
| 4b8f8ee87e | |||
| 5314a1926b | |||
| 0699f7ffd1 | |||
| a6e3732296 | |||
| 6b6fd884a0 | |||
| e96bcefcc3 | |||
| 7412a3085f | |||
| e1b2c93f22 | |||
| 2687fd90dc | |||
| 7af8d0ae41 | |||
| b010769af6 | |||
| fec60b2ea7 | |||
| 6056ac41cd | |||
| 4925444552 | |||
| dc759d5eb3 | |||
| bc167e8832 | |||
| 6356d67034 | |||
| 0da1798029 | |||
| 71009205b5 | |||
| 7b48821c00 | |||
| 9611421fbc | |||
| 5723c92e09 | |||
| e9f38149ac | |||
| 9d611b80a8 | |||
| 09dd6cc2f7 | |||
| 7bb53a0e3f | |||
| d55f02a7b2 | |||
| 50dcd97857 | |||
| f5f9b9813d | |||
| 039f261f0c | |||
| d6c79cbf78 | |||
| 7cf368e518 | |||
| e68153fb70 | |||
| f2dc3876b0 | |||
| ab3681e209 | |||
| 11c47c4394 | |||
| 54a1a882de | |||
| c306967cb2 | |||
| 23a46d56cd | |||
| 2aa7669c7b | |||
| 5a8d472ddf | |||
| fb188d566e | |||
| b1fcb75e4f | |||
| 116e7c0061 | |||
| e0c2b9dacd | |||
| 0e8f8d0502 | |||
| 9a719b94cf | |||
| c50ecf7d53 | |||
| 6ca16a587c | |||
| fb29be348a | |||
| d256c5f5ea | |||
| 0ea77e1e6a | |||
| e1c468a0df | |||
| 740d3817de | |||
| ea4cc8a368 | |||
| 37a4fce4ae | |||
| b68dd72cf6 | |||
| 57d01e7f4c | |||
| 9d64ca5d39 | |||
| e177fd8ccd | |||
| 50d92d366d | |||
| f698451c4c | |||
| 0d0a99d91e | |||
| cf95041887 | |||
| 6f8e37c9ee | |||
| 2407fef277 | |||
| f0de82dd96 | |||
| 1cf4310cd9 | |||
| 22b9c46fb4 | |||
| 8e79cda146 | |||
| 8131fd64e0 | |||
| ee55f97b3a | |||
| d41edd344a | |||
| 5a998a5d13 | |||
| 14f471bbf9 | |||
| 6ce68192a2 | |||
| 8010d19c06 | |||
| 2b3574cefc | |||
| 8fcf079126 | |||
| ffcd014ec3 | |||
| 8b23085328 | |||
| 8901525ac8 | |||
| 4247a6893f | |||
| 36572eb1e4 | |||
| 78ad752545 | |||
| 0a5fd7262b | |||
| e450aea667 | |||
| a85ef8fe2d | |||
| f2fa332cc1 | |||
| bb8ef04733 | |||
| 4c7de36ba0 | |||
| 16930e4c4e | |||
| 248aa6f948 | |||
| ab5223c4f5 | |||
| a206a58ffe | |||
| cd5a82324b | |||
| 0ce7384fcc | |||
| 85af19455b | |||
| b1f606e821 | |||
| 55aca40285 | |||
| cc3aab12ec | |||
| 592056897b | |||
| dd423355da | |||
| a4de699814 | |||
| 32f18ca9f7 | |||
| 98bc4fa40c | |||
| bbe59a3d90 | |||
| 3d3098ed0b | |||
| 6c762b1b8e | |||
| e8e8dbbf8d | |||
| 4a98a0a25e | |||
| 04d3af8d62 | |||
| 24d355f08a | |||
| c736496b6a | |||
| 953c9f956e | |||
| 77bded7c68 | |||
| cc75866f3e | |||
| b02a00ef6b | |||
| 8d7fdeb0c2 | |||
| 54c761d722 | |||
| 901d6f7107 | |||
| 0f039b809b | |||
| c36ce0a26f | |||
| 92a6b54666 | |||
| af170b7597 | |||
| 9c5f48be88 | |||
| 362c845ed3 | |||
| 092896750c | |||
| 3ce5ce7a6b | |||
| bc99212f79 | |||
| 7279684119 | |||
| 142091b113 | |||
| 553e2e980d | |||
| c9111ba2ff | |||
| c9f3051cd3 | |||
| fc8ee49c11 | |||
| 028e4af506 | |||
| a3e7d7e372 | |||
| ab9eb54224 | |||
| dbc2365a68 | |||
| 025af8a9aa | |||
| 2c1d4ee259 | |||
| cfedb7de7d | |||
| 3a31abedce | |||
| 1901133b00 | |||
| 0f48db648a | |||
| 6d02a2e6cf | |||
| 9be9b80b8e | |||
| 55e34f9297 | |||
| 784e53f580 | |||
| b0f819dc69 | |||
| 034635ae1d | |||
| 5f8961860a | |||
| ff50f8a808 | |||
| f75fc31c7e | |||
| b1255891c0 | |||
| d4366e214c | |||
| 483dae5c1b | |||
| 719564783e | |||
| 30e483cc05 | |||
| 1ecd5bb756 | |||
| dde9956064 | |||
| 397572fe4b | |||
| 1dc2a65ff9 | |||
| d31c72f4f5 | |||
| 17dcb43683 | |||
| 67fa0dd6f0 | |||
| 6c410ecd95 | |||
| af9ab7ce30 | |||
| 1b0e89fec9 | |||
| 5da9e0a1dd | |||
| 057e9b1169 | |||
| 81d86f99eb | |||
| a55fe51fde | |||
| 0c70756a0f | |||
| 9d12c2bede | |||
| d2ac67e03c | |||
| 2524c3d9a5 | |||
| c3a472473d | |||
| 315cedb3a2 | |||
| 92935c762d | |||
| d43be7f3c0 | |||
| 5019148f9d | |||
| ebefa77e84 | |||
| 7b02f83880 | |||
| e9404b11cf | |||
| 0a645512f2 | |||
| 32565dbc3a | |||
| f7a8981491 | |||
| 1b8b5266f2 | |||
| 9a6482d4cf | |||
| da68acdc6d | |||
| 64b7e47d1c | |||
| 4a2c0904fe | |||
| a5d9ede6ee | |||
| 829961033e | |||
| 1aec3526bf | |||
| 9a62d76115 | |||
| c602a4f2ac | |||
| 9a2a906c96 | |||
| a3f32536d0 | |||
| b87d9ce4dd | |||
| e1b2f0caaf | |||
| 8290f47a80 | |||
| e3213299aa | |||
| 6214ff5926 | |||
| ea83cb985d | |||
| 7e9005a009 | |||
| bcefcc65fd | |||
| 7672783be9 | |||
| bbc7a31157 | |||
| 3faae6b3df | |||
| e463ba5500 | |||
| 5e8004ac4b | |||
| 6f118b80bf | |||
| a3bcc57f31 | |||
| e8b664002e | |||
| 1cc3d4bdbb | |||
| 9135fe039f | |||
| cd6258031f | |||
| b46d3449de | |||
| d6cd16b860 | |||
| 2fc0e4994d | |||
| 9bc89dfc35 | |||
| ddbc2a81e6 | |||
| 560d7af700 | |||
| ee585114fd | |||
| 94814adf67 | |||
| 387c10b72c | |||
| fd5566fceb | |||
| 450097fdca | |||
| 7f4b18567b | |||
| f735b1ea46 | |||
| 5d7206528b | |||
| 9a61f93e7e | |||
| 5420a212aa | |||
| c1dd1cfb53 | |||
| 6d619351e4 | |||
| 9023508027 | |||
| b327853564 | |||
| f7922678ec | |||
| 9bc1f2d55c | |||
| 3de9f5c1c3 | |||
| 40d784806b | |||
| 3d6a6071a9 | |||
| 7d04a27151 | |||
| e138020432 | |||
| 99675027ac | |||
| 517249b59d | |||
| 0d9e35580e | |||
| b3aa7518f8 | |||
| 7a522541da | |||
| b84940378c | |||
| f680c20b18 | |||
| f95caff7d8 | |||
| 8304298122 | |||
| 7b7ca66c6a | |||
| 4be2039c00 | |||
| 717107cc2d | |||
| 00dcccfe24 | |||
| 217ce9b589 | |||
| 8fba665c27 | |||
| dcae61ef24 | |||
| 37c6e26a43 | |||
| 7aeabafeb7 | |||
| 16b7208962 | |||
| 7c6c48b8b8 | |||
| 2f3d1a84ef | |||
| 2eeb25584c | |||
| c65a29fc2b | |||
| fb4b13c258 | |||
| f10cbcca39 | |||
| 41929b4a8b | |||
| d08de0dce8 | |||
| 13e9eea977 | |||
| 2221934f3c | |||
| 0424900a2b | |||
| 7b991f4526 |
@@ -42,6 +42,7 @@ 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" ;
|
||||
@@ -50,6 +51,8 @@ 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_CREATEEXPORTDXF = "CreateExportDxf" ;
|
||||
static const char* EEX_CREATEEXPORTSTL = "CreateExportStl" ;
|
||||
@@ -183,6 +186,21 @@ 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)
|
||||
@@ -303,6 +321,36 @@ 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)
|
||||
|
||||
+7
-2
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2021
|
||||
// EgalTech 2015-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DllExchange.h Data : 27.08.21 Versione : 2.3h2
|
||||
// File : DllExchange.h Data : 28.02.25 Versione : 2.7b2
|
||||
// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtExchange.
|
||||
//
|
||||
//
|
||||
@@ -24,6 +24,8 @@ class IImportCsf ;
|
||||
class IImportDxf ;
|
||||
class IImportPnt ;
|
||||
class IImportStl ;
|
||||
class IImportOff ;
|
||||
class IImportPly ;
|
||||
class IImport3MF ;
|
||||
class IExportDxf ;
|
||||
class IExportStl ;
|
||||
@@ -41,6 +43,7 @@ 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) ;
|
||||
@@ -49,6 +52,8 @@ IImportCsf* MyCreateImportCsf( void) ;
|
||||
IImportDxf* MyCreateImportDxf( void) ;
|
||||
IImportPnt* MyCreateImportPnt( void) ;
|
||||
IImportStl* MyCreateImportStl( void) ;
|
||||
IImportOff* MyCreateImportOff( void) ;
|
||||
IImportPly* MyCreateImportPly( void) ;
|
||||
IImport3MF* MyCreateImport3MF( void) ;
|
||||
IExportDxf* MyCreateExportDxf( void) ;
|
||||
IExportStl* MyCreateExportStl( void) ;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2023
|
||||
// EgalTech 2014-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE.h Data : 05.02.23 Versione : 2.5a6
|
||||
// File : EXE.h Data : 15.05.24 Versione : 2.6e4
|
||||
// Contenuto : Dichiarazioni locali per moduli EXE.
|
||||
//
|
||||
//
|
||||
@@ -26,6 +26,7 @@ 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) ;
|
||||
@@ -43,3 +44,6 @@ bool ExeInsertDuplo( int nInsGrp) ;
|
||||
//----------------------------------------------------------------------------
|
||||
bool ExeCreateMutex( const std::string& sMutexName) ;
|
||||
bool ExeReleaseMutex( void) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool ExeSetModified( int nCtx) ;
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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 ;
|
||||
}
|
||||
+42
-4
@@ -216,6 +216,44 @@ 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)
|
||||
@@ -266,17 +304,17 @@ ExeBeamShowSolid( int nPartId, bool bShow)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeBeamGetBuildingIsOn( void)
|
||||
ExeBeamGetBuildingIsOn( int nAssGrpId)
|
||||
{
|
||||
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
||||
VERIFY_BEAMMGR( pBeamMgr, false)
|
||||
// verifico se assemblaggio attivato
|
||||
return pBeamMgr->GetBuildingIsOn() ;
|
||||
return pBeamMgr->GetBuildingIsOn( nAssGrpId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeBeamShowBuilding( bool bShow)
|
||||
ExeBeamShowBuilding( int nAssGrpId, bool bShow)
|
||||
{
|
||||
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
||||
VERIFY_BEAMMGR( pBeamMgr, false)
|
||||
@@ -285,7 +323,7 @@ ExeBeamShowBuilding( bool bShow)
|
||||
if ( bOldEnabModif)
|
||||
ExeDisableModified() ;
|
||||
// attivo o disattivo la visualizzazione l'assemblaggio
|
||||
bool bOk = pBeamMgr->ShowBuilding( bShow) ;
|
||||
bool bOk = pBeamMgr->ShowBuilding( nAssGrpId, bShow) ;
|
||||
// ripristino possibilità di alterare il flag di modifica
|
||||
if ( bOldEnabModif)
|
||||
ExeEnableModified() ;
|
||||
|
||||
+14
-6
@@ -175,16 +175,23 @@ 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
|
||||
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 ;
|
||||
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 ;
|
||||
}
|
||||
// porto nel riferimento della superficie
|
||||
PL.LocToLoc( frCrv, frSurf) ;
|
||||
// porto i dati geometrici in locale alla superficie
|
||||
@@ -198,7 +205,8 @@ 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
|
||||
PL.RemoveAlignedPoints( 0.8 * dLinTol) ;
|
||||
if ( dLinTol > 0)
|
||||
PL.RemoveAlignedPoints( 0.8 * dLinTol) ;
|
||||
// creo una curva composita a partire dalla polilinea
|
||||
PtrOwner< ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL))
|
||||
|
||||
+98
-12
@@ -15,6 +15,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "LUA_Base.h"
|
||||
#include "AuxTools.h"
|
||||
#include "DllExchange.h"
|
||||
#include "DllExch3dm.h"
|
||||
@@ -29,6 +30,8 @@
|
||||
#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/EExExportDxf.h"
|
||||
#include "/EgtDev/Include/EExExportStl.h"
|
||||
#include "/EgtDev/Include/EExExport3MF.h"
|
||||
@@ -77,6 +80,10 @@ ExeGetFileType( const string& sFilePath)
|
||||
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")
|
||||
@@ -85,8 +92,6 @@ 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")
|
||||
@@ -125,7 +130,9 @@ ExeGetFileType( const string& sFilePath)
|
||||
bool
|
||||
ExeSetBtlAuxDir( const string& sBtlAuxDir)
|
||||
{
|
||||
return MySetBtlAuxDir( sBtlAuxDir) ;
|
||||
bool bOk1 = MySetBtlAuxDir( sBtlAuxDir) ;
|
||||
bool bOk2 = MySetBtlLuaData( LuaGetLuaLibsDir(), LuaGetLastRequire()) ;
|
||||
return ( bOk1 && bOk2) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -369,20 +376,95 @@ ExeImportStl( const string& sFilePath, double dScaleFactor)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeImport3MF( const string& sFilePath)
|
||||
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)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
bool bOk = true ;
|
||||
// importo il file 3MF
|
||||
// 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()) ;
|
||||
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
|
||||
PtrOwner<IImport3MF> pImp3MF( MyCreateImport3MF()) ;
|
||||
bOk = bOk && ! IsNull( pImp3MF) ;
|
||||
// eseguo l'importazione
|
||||
bOk = bOk && pImp3MF->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId) ;
|
||||
bOk = bOk && pImp3MF->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, nFlag) ;
|
||||
// aggiorno stato file corrente
|
||||
if ( pGseCtx->m_sFilePath.empty())
|
||||
pGseCtx->m_sFilePath = sFilePath ;
|
||||
@@ -408,10 +490,11 @@ ExeImport3dm( const string& sFilePath)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
bool bOk = true ;
|
||||
// se necessario, carico libreria exchange 3dm opzionale
|
||||
if ( ! IsLoadedExch3dmDll() && LoadExch3dmDll( GetLogger(), ExeGetKey(), ExeGetNetHwKey()))
|
||||
LOG_INFO( GetLogger(), MyGetEE3Version())
|
||||
// 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()) ;
|
||||
bool bOk = true ;
|
||||
// preparo l'importatore
|
||||
PtrOwner<IImport3dm> pImp3dm( MyCreateImport3dm()) ;
|
||||
bOk = bOk && ! IsNull( pImp3dm) ;
|
||||
@@ -639,8 +722,11 @@ ExeExport3dm( int nId, const string& sFilePath, int nFilter)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// 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
|
||||
PtrOwner<IExport3dm> pExp3dm( MyCreateExport3dm()) ;
|
||||
bOk = bOk && ! IsNull( pExp3dm) ;
|
||||
|
||||
+52
-69
@@ -1665,6 +1665,55 @@ 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)
|
||||
@@ -2013,12 +2062,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) ;
|
||||
@@ -2585,69 +2634,3 @@ CalcExtrusion( IGeomDB* pGeomDB, int nParentId, int nRefType)
|
||||
vtExtr.LocToLoc( pGeomDB->GetGridFrame(), frEnt) ;
|
||||
return vtExtr ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
MyCreateCurveBezierForm( int nParentId, int nCrvId)
|
||||
{
|
||||
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) ;
|
||||
int nType = pCurve->GetType() ;
|
||||
PtrOwner<ICurve> pCrv ;
|
||||
switch ( nType ) {
|
||||
case CRV_LINE :
|
||||
pCrv.Set( LineToBezierCurve( GetCurveLine( pCurve))) ;
|
||||
break ;
|
||||
case CRV_ARC :
|
||||
pCrv.Set( ArcToBezierCurve( GetCurveArc( pCurve))) ;
|
||||
break ;
|
||||
case CRV_BEZIER :
|
||||
pCrv.Set( BezierToBasicBezierCurve( GetCurveBezier( pCurve))) ;
|
||||
break ;
|
||||
case CRV_COMPO :
|
||||
pCrv.Set( CompositeToBezierCurve( GetCurveComposite( pCurve))) ;
|
||||
break ;
|
||||
default :
|
||||
break ;
|
||||
}
|
||||
// setto l'estrusione
|
||||
pCrv->SetExtrusion( vtExtr) ;
|
||||
// aggiungo la curva in forma di Bezier al DB
|
||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrv)) ;
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateCurveBezierForm( int nParentId, int nCrvId)
|
||||
{
|
||||
// eseguo
|
||||
int nId = MyCreateCurveBezierForm( nParentId, nCrvId) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtCreateCurveBezierForm(" + IdToString( nParentId) + "," +
|
||||
IdToString( nCrvId) + "," +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nId ;
|
||||
}
|
||||
|
||||
+1155
-43
File diff suppressed because it is too large
Load Diff
+46
-63
@@ -45,7 +45,16 @@ ExeCreateVolZmap( int nParentId, const Point3d& ptIni, double dDimX, double dDim
|
||||
// creo lo Zmap nel suo riferimento intrinseco
|
||||
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
|
||||
bOk = bOk && ! IsNull( pVZM) ;
|
||||
bOk = bOk && pVZM->Create( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex) ;
|
||||
if ( bOk) {
|
||||
int nError = 0 ;
|
||||
bOk = pVZM->Create( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex, &nError) ;
|
||||
if ( ! bOk) {
|
||||
if ( nError == 1)
|
||||
ExeOutLog( "EgtVolZmapBox too big for a 32-bit system") ;
|
||||
else
|
||||
ExeOutLog( "EgtVolZmapBox error number : " + ToString( nError)) ;
|
||||
}
|
||||
}
|
||||
// lo porto nel riferimento locale
|
||||
bOk = bOk && pVZM->ToGlob( frBox) ;
|
||||
// inserisco lo Zmap nel DB
|
||||
@@ -88,7 +97,16 @@ int ExeCreateVolZmapEmpty( int nParentId, const Point3d& ptIni, double dDimX, do
|
||||
// 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) ;
|
||||
if ( bOk) {
|
||||
int nError = 0 ;
|
||||
bOk = pVZM->CreateEmpty( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex, &nError) ;
|
||||
if ( ! bOk) {
|
||||
if ( nError == 1)
|
||||
ExeOutLog( "EgtVolZmapEmpty too big for a 32-bit system") ;
|
||||
else
|
||||
ExeOutLog( "EgtVolZmapEmpty error number : " + ToString( nError)) ;
|
||||
}
|
||||
}
|
||||
// lo porto nel riferimento locale
|
||||
bOk = bOk && pVZM->ToGlob( frBox) ;
|
||||
// inserisco lo Zmap nel DB
|
||||
@@ -130,7 +148,16 @@ ExeCreateVolZmapByRegionExtrusion( int nParentId, int nSfrId, double dDimZ, doub
|
||||
// creo lo Zmap nel suo riferimento intrinseco
|
||||
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
|
||||
bOk = bOk && ! IsNull( pVZM) ;
|
||||
bOk = bOk && pVZM->CreateFromFlatRegion( *pSfr, dDimZ, dPrec, bTriDex) ;
|
||||
if ( bOk) {
|
||||
int nError = 0 ;
|
||||
bOk = pVZM->CreateFromFlatRegion( *pSfr, dDimZ, dPrec, bTriDex, &nError) ;
|
||||
if ( ! bOk) {
|
||||
if ( nError == 1)
|
||||
ExeOutLog( "EgtVolZmapByRegionExtrusion too big for a 32-bit system") ;
|
||||
else
|
||||
ExeOutLog( "EgtVolZmapByRegionExtrusion error number : " + ToString( nError)) ;
|
||||
}
|
||||
}
|
||||
// lo porto nel riferimento di destinazione
|
||||
bOk = bOk && pVZM->LocToLoc( frSfr, frDest) ;
|
||||
// inserisco lo Zmap nel DB
|
||||
@@ -152,7 +179,7 @@ ExeCreateVolZmapByRegionExtrusion( int nParentId, int nSfrId, double dDimZ, doub
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDex)
|
||||
ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDex, double dExtraBox)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
@@ -169,7 +196,16 @@ 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) ;
|
||||
if ( bOk) {
|
||||
int nError = 0 ;
|
||||
bOk = pVZM->CreateFromTriMesh( *pStm, dPrec, bTriDex, dExtraBox, &nError) ;
|
||||
if ( ! bOk) {
|
||||
if ( nError == 1)
|
||||
ExeOutLog( "EgtVolZmapFromSurfTm too big for a 32-bit system") ;
|
||||
else
|
||||
ExeOutLog( "EgtVolZmapFromSurfTm error number : " + ToString( nError)) ;
|
||||
}
|
||||
}
|
||||
// lo porto nel riferimento di destinazione
|
||||
bOk = bOk && pVZM->LocToLoc( frStm, frDest) ;
|
||||
// inserisco lo Zmap nel DB
|
||||
@@ -177,67 +213,14 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtVolZmapFromTriMesh(" + IdToString( nParentId) + "," +
|
||||
ToString( nStmId) + "," +
|
||||
ToString( dPrec) + "," +
|
||||
( bTriDex ? "true" : "false") + ")" +
|
||||
string sLua = "EgtVolZmapFromSurfTm(" + IdToString( nParentId) + "," +
|
||||
ToString( nStmId) + "," +
|
||||
ToString( dPrec) + "," +
|
||||
( bTriDex ? "true" : "false") + "," +
|
||||
ToString( dExtraBox) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// 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)
|
||||
{
|
||||
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) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtUniformZmap(" + ToString( nVolZmapId) + "," +
|
||||
ToString( dToler) + ")"
|
||||
" -- bOk =" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
+241
-28
@@ -16,9 +16,13 @@
|
||||
#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"
|
||||
@@ -27,7 +31,8 @@
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkIntersCurves.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
@@ -59,6 +64,21 @@ 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)
|
||||
@@ -162,7 +182,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)) ;
|
||||
}
|
||||
|
||||
@@ -207,6 +227,8 @@ 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 ;
|
||||
@@ -292,7 +314,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)) ;
|
||||
}
|
||||
|
||||
@@ -368,7 +390,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) ;
|
||||
@@ -616,6 +638,9 @@ ExeCurveCompoRadius( int nId, int nSimpCrv, double& dRad)
|
||||
case CRV_BEZIER :
|
||||
dRad = -2 ;
|
||||
break ;
|
||||
default :
|
||||
dRad = -3 ;
|
||||
break ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
@@ -645,6 +670,9 @@ ExeCurveCompoAngCenter( int nId, int nSimpCrv, double& dAngCen)
|
||||
case CRV_BEZIER :
|
||||
dAngCen = 0 ;
|
||||
break ;
|
||||
default :
|
||||
dAngCen = 0 ;
|
||||
break ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
@@ -674,6 +702,9 @@ 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) ;
|
||||
@@ -681,33 +712,215 @@ ExeCurveCompoNormVersor( int nId, int nSimpCrv, int nRefId, Vector3d& vtNorm)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeShowBezierCurveControlPoints( int nCrvId, int* pnCount)
|
||||
ExeCurveCompoGetTempProp( int nId, INTVECTOR& vProp, int nPropInd)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva di bezier
|
||||
const ICurveBezier* pCrvBezier = GetCurveBezier( pGeomDB->GetGeoObj( nCrvId)) ;
|
||||
if ( pCrvBezier == nullptr || pCrvBezier->GetType() != CRV_BEZIER)
|
||||
// recupero la curva composita
|
||||
const ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCompo == nullptr)
|
||||
return false ;
|
||||
int nParent = pGeomDB->GetParentId( nCrvId) ;
|
||||
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)) ;
|
||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParent, pGeoPt) ;
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nId ;
|
||||
if ( nId != GDB_ID_NULL)
|
||||
++nCount ;
|
||||
// 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() ;
|
||||
}
|
||||
// restituisco i risultati
|
||||
if ( pnCount != nullptr)
|
||||
*pnCount = nCount ;
|
||||
return nFirstId ;
|
||||
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 == nullptr || ( 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 ;
|
||||
}
|
||||
@@ -23,7 +23,7 @@ using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId,
|
||||
ExePocketing( int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId,
|
||||
int& nFirstId, int& nCrvCount)
|
||||
{
|
||||
// database geometrico
|
||||
@@ -59,7 +59,8 @@ ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType
|
||||
|
||||
// eseguo Pocketing
|
||||
ICRVCOMPOPOVECTOR vCrvCompoRes ;
|
||||
bool bOk = CalcPocketing( pSfr, dRad, dStep, dAngle, nType, bSmooth, vCrvCompoRes) ;
|
||||
bool bOk = CalcPocketing( pSfr, dRad, 0, dStep, dAngle, 5., nType, bSmooth, true, false, false, true, false, true, P_INVALID, nullptr, false,
|
||||
dStep, 0, INFINITO, 0, 0, INFINITO, false, 0., 0., vCrvCompoRes) ;
|
||||
nFirstId = GDB_ID_NULL ;
|
||||
nCrvCount = int( vCrvCompoRes.size()) ;
|
||||
if ( bOk && nCrvCount > 0) {
|
||||
|
||||
+418
-67
@@ -21,6 +21,7 @@
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
@@ -29,10 +30,11 @@
|
||||
#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"
|
||||
@@ -46,9 +48,6 @@ ExeSurfArea( int nId, double& dArea)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( &dArea == nullptr)
|
||||
return false ;
|
||||
// recupero la superficie
|
||||
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ;
|
||||
// ne restituisco l'area
|
||||
@@ -63,7 +62,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()) ;
|
||||
}
|
||||
|
||||
@@ -73,12 +72,9 @@ ExeSurfVolume( int nId, double& dVol)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( &dVol == nullptr)
|
||||
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)) ;
|
||||
}
|
||||
|
||||
@@ -104,9 +100,6 @@ ExeSurfFrGrossArea( int nId, double& dArea)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( &dArea == nullptr)
|
||||
return false ;
|
||||
// recupero la Regione
|
||||
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
|
||||
// ne restituisco l'area senza eventuali buchi
|
||||
@@ -118,24 +111,26 @@ bool
|
||||
ExeSurfFrTestExternal( int nId1, int nId2, double dMinDist)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la prima superficie FlatRegion
|
||||
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
|
||||
const ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
|
||||
if ( pSfr1 == nullptr)
|
||||
return false ;
|
||||
// se richiesta distanza di sicurezza, ne faccio l'offset
|
||||
PtrOwner<ISurfFlatRegion> pSfr1O( pSfr1->Clone()) ;
|
||||
if ( IsNull( pSfr1O))
|
||||
return false ;
|
||||
if ( dMinDist > 10 * EPS_SMALL)
|
||||
pSfr1O->Offset( dMinDist, ICurve::OFF_FILLET) ;
|
||||
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) ;
|
||||
}
|
||||
// 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) ;
|
||||
@@ -143,9 +138,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 < pSfr1O->GetChunkCount() ; ++ i) {
|
||||
for ( int i = 0 ; i < pSfr1->GetChunkCount() ; ++ i) {
|
||||
for ( int j = 0 ; j < pSfr2L->GetChunkCount() ; ++ j) {
|
||||
if ( pSfr1O->GetChunkSimpleClassification( i, *pSfr2L, j) != REGC_OUT)
|
||||
if ( pSfr1->GetChunkSimpleClassification( i, *pSfr2L, j) != REGC_OUT)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -159,8 +154,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 < pSfr1O->GetChunkCount() ; ++ i) {
|
||||
PtrOwner<ICurve> pCrv1( pSfr1O->GetLoop( i, 0)) ;
|
||||
for ( int i = 0 ; i < pSfr1->GetChunkCount() ; ++ i) {
|
||||
PtrOwner<ICurve> pCrv1( pSfr1->GetLoop( i, 0)) ;
|
||||
if ( pCrv1 == nullptr)
|
||||
return false ;
|
||||
IntersCurveCurve ccInt( *pCrv1, *pCrv2L) ;
|
||||
@@ -168,7 +163,8 @@ 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_NULL)
|
||||
if ( cClass.nClass == CRVC_IN || cClass.nClass == CRVC_ON_M ||
|
||||
cClass.nClass == CRVC_ON_P || cClass.nClass == CRVC_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -178,34 +174,17 @@ ExeSurfFrTestExternal( int nId1, int nId2, double dMinDist)
|
||||
else if ( nType2 == GEO_PNT3D) {
|
||||
// recupero il punto
|
||||
IGeoPoint3d* pGeoPt = GetGeoPoint3d( pGeomDB->GetGeoObj( nId2)) ;
|
||||
Point3d pt = pGeoPt->GetPoint() ;
|
||||
Point3d ptP = pGeoPt->GetPoint() ;
|
||||
// porto il punto in locale
|
||||
Frame3d frPt ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId2, frPt))
|
||||
return false ;
|
||||
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 ;
|
||||
ptP.LocToLoc( frPt, frSurf1) ;
|
||||
// determino se interno (comprende la frontiera)
|
||||
bool bInside ;
|
||||
if ( ! IsPointInsideSurfFr( ptP, pSfr1, 0, bInside))
|
||||
return false ;
|
||||
return ( ! bInside) ;
|
||||
}
|
||||
// altrimenti non valida
|
||||
else
|
||||
@@ -226,6 +205,17 @@ ExeSurfFrChunkCount( int nId)
|
||||
return pSfr->GetChunkCount() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfFrChunkMaxOffset( int nId, int nChunk, double& dMaxOffset)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, 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)
|
||||
@@ -259,6 +249,65 @@ ExeSurfFrChunkSimpleClassify( int nId1, int nChunk1, int nId2, int nChunk2, doub
|
||||
return nRes ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Resultati restituiti : REGC_NULL ( errore), REGC_OUT ( Chunks esterni), REGC_INTERS ( Chunk che si intersecano)
|
||||
int
|
||||
ExeSurfFlatRegionInterference( int nId1, int nChunk1, int nId2, int nChunk2, double dToler)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la prima superficie FlatRegion
|
||||
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
|
||||
bool bOk = ( pSfr1 != nullptr) ;
|
||||
// recupero il riferimento della superficie
|
||||
Frame3d frSurf1 ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId1, frSurf1) ;
|
||||
// recupero la seconda superficie FlatRegion
|
||||
const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ;
|
||||
bOk = bOk && ( pSfr2 != nullptr) ;
|
||||
// recupero il riferimento della superficie
|
||||
Frame3d frSurf2 ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId2, frSurf2) ;
|
||||
// se riferimenti diversi, porto una copia della seconda nel riferimento della prima
|
||||
const ISurfFlatRegion* pSfr2L = pSfr2 ;
|
||||
PtrOwner<ISurfFlatRegion> pTmp ;
|
||||
if ( bOk && ( abs( dToler) > EPS_SMALL || ! AreSameFrame( frSurf1, frSurf2))) {
|
||||
pTmp.Set( pSfr2->Clone()) ;
|
||||
bOk = ( ! IsNull( pTmp)) ;
|
||||
bOk = bOk && pTmp->LocToLoc( frSurf2, frSurf1) ;
|
||||
pTmp->Offset( - abs( dToler), ICurve::OFF_FILLET) ;
|
||||
pSfr2L = pTmp ;
|
||||
}
|
||||
// verifico interferenza del Chunk della prima regione rispetto a quello della seconda
|
||||
int nRes = REGC_NULL ;
|
||||
if ( bOk) {
|
||||
bool bInterference = false ;
|
||||
bOk = pSfr1->CheckChunkInterference( nChunk1, *pSfr2L, nChunk2, bInterference) ;
|
||||
if ( bOk)
|
||||
nRes = ( bInterference ? REGC_INTERS : REGC_OUT) ;
|
||||
}
|
||||
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)
|
||||
@@ -353,6 +402,20 @@ ExeSurfTmPartCount( int nId)
|
||||
return pStm->GetPartCount() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmGetPartAndShellFromFacet( int nIdSurfTm, int nIdFacet, int& nPart, int& nShell)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie trimesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nIdSurfTm)) ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
// recupero la parte e la shell a cui appartiene la faccia passata
|
||||
return pStm->GetPartAndShellFromFacet( nIdFacet, nPart, nShell) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmGetVertex( int nId, int nVert, int nRefId, Point3d& ptVert)
|
||||
@@ -380,11 +443,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 ;
|
||||
@@ -392,6 +455,26 @@ 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)
|
||||
@@ -431,11 +514,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)
|
||||
@@ -453,11 +536,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)
|
||||
@@ -555,7 +638,7 @@ ExeSurfTmFacetElevationInBBox( int nId, int nFacet, const BBox3d& b3Box, bool bA
|
||||
else if ( nRefId == GDB_ID_GRID)
|
||||
frBox = pGeomDB->GetGridFrame() ;
|
||||
else {
|
||||
// nRefId può essere un gruppo o una entità
|
||||
// nRefId può essere un gruppo o una entità
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nRefId, frBox) &&
|
||||
! pGeomDB->GetGlobFrame( nRefId, frBox))
|
||||
return false ;
|
||||
@@ -663,7 +746,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() ;
|
||||
@@ -913,6 +996,108 @@ ExeGetSurfTmSilhouette( int nId, const Vector3d& vtDir, double dToler, int nDest
|
||||
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) + ")" +
|
||||
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultati
|
||||
if ( pnCount != nullptr)
|
||||
*pnCount = nCount ;
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeExtractSurfTmFacetLoops( int nId, int nFacet, int nDestGrpId, int* pnCount)
|
||||
@@ -972,6 +1157,59 @@ 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)
|
||||
@@ -1084,7 +1322,8 @@ ExeSurfTmGetFacetBBoxRef( int nId, int nFacet, int nFlag, const Frame3d& frRef,
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmGetFacetOutlineInfo( int nId, int nFacet, int nRefId,
|
||||
int& nStatus, BOOLVECTOR& vbOpen, INTVECTOR& vnAdj, DBLVECTOR& vdLen, VCT3DVECTOR& vvtNorm, DBLVECTOR& vdElev)
|
||||
int& nStatus, BOOLVECTOR& vbOpen, INTVECTOR& vnAdj, DBLVECTOR& vdLen,
|
||||
PNTVECTOR& vptStart, VCT3DVECTOR& vvtNorm, DBLVECTOR& vdElev)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
@@ -1129,6 +1368,7 @@ ExeSurfTmGetFacetOutlineInfo( int nId, int nFacet, int nRefId,
|
||||
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
|
||||
@@ -1158,12 +1398,15 @@ ExeSurfTmGetFacetOutlineInfo( int nId, int nFacet, int nRefId,
|
||||
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
|
||||
@@ -1230,6 +1473,47 @@ ExeSurfTmGetEdges( int nId, int nDestGrpId, bool bSmoothAng, int* pnCount)
|
||||
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)
|
||||
@@ -1331,7 +1615,7 @@ ExeSurfBezierGetPointNrmD1( int nSurfId, double dU, double dV, int nUsd, int nVs
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
static int
|
||||
MySurfBezierGetCurveUV( int nSurfId, bool bIsU, double dPar, int nDestGrpId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
@@ -1352,7 +1636,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) ;
|
||||
@@ -1362,7 +1646,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()) ;
|
||||
@@ -1416,6 +1700,30 @@ ExeSurfBezierGetCurveV( int nSurfId, double dU, int nDestGrpId)
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfBezierParamsFromPoint( int nSurfId, const Point3d& ptOnSurf, int nRefId, double& dU, double& dV)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie di Bezier
|
||||
const ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nSurfId)) ;
|
||||
if ( pSbz == nullptr)
|
||||
return false ;
|
||||
// porto il punto Near nel riferimento dell'entità
|
||||
Point3d ptOnSurfL = ptOnSurf ;
|
||||
if ( ! InvTransformPoint( pGeomDB, nSurfId, nRefId, ptOnSurfL))
|
||||
return false ;
|
||||
// determino i parametri corrispondenti al punto
|
||||
Point3d ptParam ;
|
||||
if ( ! pSbz->UnprojectPoint( ptOnSurfL, ptParam, P_INVALID))
|
||||
return false ;
|
||||
dU = ptParam.x ;
|
||||
dV = ptParam.y ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfBezierGetInfo( int nSurfId, int& nDegU, int& nDegV, int& nSpanU, int& nSpanV, bool& bIsRat, bool& bTrimmed)
|
||||
@@ -1466,7 +1774,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))
|
||||
@@ -1479,7 +1787,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()) ;
|
||||
@@ -1493,7 +1801,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 ;
|
||||
}
|
||||
@@ -1545,6 +1853,8 @@ 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) ;
|
||||
@@ -1555,7 +1865,7 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
ICRVCOMPOPOVECTOR vCC ;
|
||||
pSbz->GetLoops( vCC , true) ;
|
||||
pSbz->GetLoops( vCC, true) ;
|
||||
for ( int i = 0 ; i < int( vCC.size()) ; ++i) {
|
||||
if ( IsNull( vCC[i]) || ! vCC[i]->IsValid())
|
||||
continue ;
|
||||
@@ -1586,4 +1896,45 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
|
||||
if ( pnCount != nullptr)
|
||||
*pnCount = nCount ;
|
||||
return nFirstId ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeShowSurfBezierControlPoints( int nSrfId, int nDestGrpId, int* pnCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la superficie di bezier
|
||||
IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nSrfId) ;
|
||||
if ( pGeoObj == nullptr || 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 ;
|
||||
}
|
||||
|
||||
+726
-344
File diff suppressed because it is too large
Load Diff
+235
-42
@@ -23,7 +23,7 @@
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkCurveLocal.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMeshAux.h"
|
||||
#include "/EgtDev/Include/EGkSurfBezier.h"
|
||||
#include "/EgtDev/Include/EGkSurfLocal.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
@@ -102,6 +102,33 @@ 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
|
||||
@@ -297,7 +324,7 @@ ExeSurfFrSubtract( int nId1, int nId2)
|
||||
// eseguo la sottrazione della seconda superficie dalla prima
|
||||
bOk = bOk && pSfr1->Subtract( *pSfr2L) ;
|
||||
// se il risultato è vuoto, cancello la FlatRegion
|
||||
if ( bOk && ! pSfr1->IsValid())
|
||||
if ( bOk && ! pSfr1->IsValid())
|
||||
pGeomDB->Erase( nId1) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
@@ -329,7 +356,7 @@ ExeSurfFrIntersect( int nId1, int nId2)
|
||||
// eseguo l'intersezione tra le due superfici
|
||||
bOk = bOk && pSfr1->Intersect( *pSfr2L) ;
|
||||
// se il risultato è vuoto, cancello la FlatRegion
|
||||
if ( bOk && ! pSfr1->IsValid())
|
||||
if ( bOk && ! pSfr1->IsValid())
|
||||
pGeomDB->Erase( nId1) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
@@ -354,7 +381,7 @@ ExeSurfFrOffset( int nId, double dDist, int nType)
|
||||
// eseguo l'offset
|
||||
bOk = bOk && pSfr->Offset( dDist, nType) ;
|
||||
// se il risultato è vuoto, cancello la FlatRegion
|
||||
if ( bOk && ! pSfr->IsValid())
|
||||
if ( bOk && ! pSfr->IsValid())
|
||||
pGeomDB->Erase( nId) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
@@ -373,7 +400,7 @@ bool
|
||||
ExeSurfFrOffsetAdv( int nId, double dDist, int nType, int& nNewId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie FlatRegion
|
||||
ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pSfr == nullptr)
|
||||
@@ -394,6 +421,32 @@ ExeSurfFrOffsetAdv( int nId, double dDist, int nType, int& nNewId)
|
||||
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)
|
||||
@@ -692,41 +745,6 @@ ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSave
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
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 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq)
|
||||
@@ -1167,7 +1185,182 @@ ExeSurfTmGetShowEdges( int nId, bool& bShow)
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pStm != nullptr) ;
|
||||
// recupero lo stato di visualizzazione degli spigoli vivi
|
||||
bShow = ( bOk && pStm->GetShowEdges()) ;
|
||||
if ( bOk)
|
||||
bShow = pStm->GetShowEdges() ;
|
||||
else
|
||||
bShow = false ;
|
||||
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 ;
|
||||
// imposto l'angolo discriminante degli spigoli vivi
|
||||
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 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmGetSmoothAng( int nId, double& dAngDeg)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie trimesh
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pStm != nullptr) ;
|
||||
// recupero l'angolo discriminante degli spigoli vivi
|
||||
if ( bOk)
|
||||
dAngDeg = pStm->GetSmoothAngle() ;
|
||||
else
|
||||
dAngDeg = 0 ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static double
|
||||
GetStmOffsPrec( double dOffs, double dLinTol)
|
||||
{
|
||||
return max( min( abs( dOffs) / 4., 10. * 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 ;
|
||||
}
|
||||
|
||||
@@ -1207,7 +1400,7 @@ ExeSurfBzTrim( int nId, int nCutterId)
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmCut(" + ToString( nId) + "," +
|
||||
string sLua = "EgtSurfBzCut(" + ToString( nId) + "," +
|
||||
ToString( nCutterId) + "," +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
|
||||
@@ -142,6 +142,23 @@ ExeVolZmapSetShowEdges( int nId, bool bShow)
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeVolZmapGetShowEdges( int nId, bool& bShow)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero lo Zmap
|
||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pVZM != nullptr) ;
|
||||
// leggo lo stato di visualizzazione degli spigoli vivi
|
||||
if ( bOk)
|
||||
bShow = pVZM->GetShowEdges() ;
|
||||
else
|
||||
bShow = false ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRemoveVolZmapPart( int nId, int nPart)
|
||||
@@ -535,3 +552,113 @@ 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 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeUpdateVolZmapByAddingSurfTm( int nVolZmapId, int nStmId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// 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
|
||||
ExeVolZmapMakeUniform( int nVolZmapId, double dToler, bool bExtensionFirst, int nToolNum)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// 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 = "EgtVolZmapMakeUniform(" + ToString( nVolZmapId) + "," +
|
||||
ToString( dToler) + "," +
|
||||
( bExtensionFirst ? "true" : "false") +
|
||||
ToString( nToolNum) + ")"
|
||||
" -- bOk =" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeVolZMapRemoveFins( int nVolZMapId, const Vector3d& vtDir, double dThick, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false) ;
|
||||
// Recupero lo ZMap
|
||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nVolZMapId)) ;
|
||||
bool bOk = ( pVZM != nullptr) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nVolZMapId, frLoc) ;
|
||||
// porto in locale la normale al piano
|
||||
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frLoc) ;
|
||||
// Aggiorno lo ZMap mediante rimozione delle alette
|
||||
bOk = bOk && pVZM->RemoveFins( vtDirL, dThick) ;
|
||||
// Se richiesto salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtVolZMapRemoveFins(" + ToString( nVolZMapId) + "," +
|
||||
ToString( vtDir) + "," +
|
||||
ToString( dThick) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- bOk =" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
+106
-10
@@ -38,13 +38,56 @@ ExeCopyAttributes( int nSouId, int nDestId)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetLevel( int nId, int nLevel)
|
||||
ExeSetLevel( const INTVECTOR& vIds, int nLevel)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// imposto il livello
|
||||
bool bOk = pGeomDB->SetLevel( nId, nLevel) ;
|
||||
// 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
|
||||
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 ;
|
||||
}
|
||||
|
||||
@@ -88,13 +131,56 @@ ExeGetCalcLevel( int nId, int* pnLevel)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetMode( int nId, int nMode)
|
||||
ExeSetMode( const INTVECTOR& vIds, int nMode)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// imposto il modo
|
||||
bool bOk = pGeomDB->SetMode( nId, nMode) ;
|
||||
// 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
|
||||
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 ;
|
||||
}
|
||||
|
||||
@@ -149,11 +235,11 @@ ExeSetStatus( const INTVECTOR& vIds, int nStat)
|
||||
int nCurrLayerId = ExeGetCurrLayer() ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
bool bOk = true ;
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vIds) && bOk ; ++ i) {
|
||||
// impostazione stato
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// imposto il modo
|
||||
// imposto lo stato
|
||||
if ( ! pGeomDB->SetStatus( nId, nStat))
|
||||
bOk = false ;
|
||||
// se nascosto pezzo corrente o layer corrente
|
||||
@@ -232,12 +318,12 @@ ExeGetCalcStatus( int nId, int* pnStat)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetMark( int nId)
|
||||
ExeSetMark( int nId, int nMark)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// imposto l'evidenziazione
|
||||
bool bOk = pGeomDB->SetMark( nId) ;
|
||||
bool bOk = pGeomDB->SetMark( nId, nMark) ;
|
||||
// non produce modifica perchè mark ignorato in salvataggio
|
||||
return bOk ;
|
||||
}
|
||||
@@ -826,3 +912,13 @@ 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) ;
|
||||
}
|
||||
|
||||
+135
-40
@@ -18,6 +18,7 @@
|
||||
#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"
|
||||
@@ -219,6 +220,43 @@ 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)
|
||||
@@ -263,16 +301,39 @@ ExeCopy( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtCopy(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
else
|
||||
sLua = "EgtCopy(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
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) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
@@ -293,22 +354,68 @@ ExeCopyGlob( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
else
|
||||
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
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) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeDuplicateGeomDB( int nSouCtx, int nDestCtx, bool bSkipTemp)
|
||||
{
|
||||
// recupero i due GeomDB
|
||||
IGeomDB* pSouGeomDB = GetGeomDB( nSouCtx) ;
|
||||
VERIFY_GEOMDB( pSouGeomDB, GDB_ID_NULL)
|
||||
IGeomDB* pDstGeomDB = GetGeomDB( nDestCtx) ;
|
||||
VERIFY_GEOMDB( pDstGeomDB, GDB_ID_NULL)
|
||||
// eseguo la duplicazione del primo GeomDB nel secondo
|
||||
bool bOk = DuplicateGeomDB( pSouGeomDB, pDstGeomDB, bSkipTemp) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtDuplicateGeomDB(" + ToString( nSouCtx) + "," +
|
||||
ToString( nDestCtx) + "," +
|
||||
( bSkipTemp ? "true" : "false") + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRelocate( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
@@ -321,16 +428,10 @@ ExeRelocate( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
else
|
||||
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
string sLua = "EgtRelocate(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
@@ -349,16 +450,10 @@ ExeRelocateGlob( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
else
|
||||
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
string sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
|
||||
+43
-11
@@ -35,6 +35,7 @@
|
||||
#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>
|
||||
@@ -58,9 +59,9 @@ static string s_sNestKey ;
|
||||
static string s_sLockId ;
|
||||
static string s_sIniFile ;
|
||||
static bool s_bEnableUI = true ;
|
||||
static pfOnTerminateProcess s_pFunOnTerminateProcess = nullptr ;
|
||||
static pfProcEvents s_pFunProcEvents = nullptr ;
|
||||
static pfOutText s_pFunOutText = nullptr ;
|
||||
static psfOnTerminateProcess s_pFunOnTerminateProcess = nullptr ;
|
||||
static psfProcEvents s_pFunProcEvents = nullptr ;
|
||||
static psfOutText s_pFunOutText = nullptr ;
|
||||
static HWND s_hMainWnd = nullptr ;
|
||||
static string s_sTempDir ;
|
||||
|
||||
@@ -117,9 +118,8 @@ ExeInit( int nDebug, const string& sLogFile, const string& sLogMsg)
|
||||
if ( LoadExchangeDll( s_pGenLog, s_sKey, s_bNetHwKey))
|
||||
LOG_INFO( s_pGenLog, MyGetEExVersion())
|
||||
|
||||
// carico libreria exchange 3dm opzionale
|
||||
if ( LoadExch3dmDll( s_pGenLog, s_sKey, s_bNetHwKey))
|
||||
LOG_INFO( s_pGenLog, MyGetEE3Version())
|
||||
// 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))
|
||||
@@ -210,7 +210,7 @@ ExeExit( void)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetOnTerminateProcess( pfOnTerminateProcess pFun)
|
||||
ExeSetOnTerminateProcess( psfOnTerminateProcess pFun)
|
||||
{
|
||||
s_pFunOnTerminateProcess = pFun ;
|
||||
return ( pFun != nullptr) ;
|
||||
@@ -352,12 +352,44 @@ 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 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetFont( const string& sNfeFontDir, const string& sDefaultFont)
|
||||
{
|
||||
// inizializzazioni gestore font Nfe
|
||||
InitFontManager( sNfeFontDir, 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) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -657,7 +689,7 @@ ExeMessageBox( const string& sText, const string& sTitle, int nType)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetProcessEvents( pfProcEvents pFun)
|
||||
ExeSetProcessEvents( psfProcEvents pFun)
|
||||
{
|
||||
s_pFunProcEvents = pFun ;
|
||||
SetEGkProcessEvents( pFun) ;
|
||||
@@ -676,7 +708,7 @@ ExeProcessEvents( int nProg, int nPause)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetOutText( pfOutText pFun)
|
||||
ExeSetOutText( psfOutText pFun)
|
||||
{
|
||||
s_pFunOutText = pFun ;
|
||||
return ( pFun != nullptr) ;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkDistPointSurfBz.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -122,3 +123,38 @@ 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 ;
|
||||
}
|
||||
+86
-35
@@ -47,8 +47,8 @@
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
MyLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, const int nId, const int nRefType,
|
||||
static bool
|
||||
MyLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
|
||||
INTDBLVECTOR& vInters)
|
||||
{
|
||||
vInters.clear() ;
|
||||
@@ -71,7 +71,7 @@ MyLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, const int nId, con
|
||||
if ( ! CrvLoc->GetLocalBBox( b3Crv))
|
||||
return false ;
|
||||
b3Crv.Expand( 100 * EPS_SMALL) ;
|
||||
// definisco la linea (punto e direzione sono gi� nel riferimento di calcolo)
|
||||
// definisco la linea (punto e direzione sono già nel riferimento di calcolo)
|
||||
double dLen = 2 * floor( b3Crv.MaxDistFromPoint( ptP)) ;
|
||||
double dOffs = -dLen / 2 ;
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||
@@ -127,7 +127,7 @@ MyLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, const int nId, con
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, const int nId, const int nRefType,
|
||||
ExeLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
|
||||
INTDBLVECTOR& vInters)
|
||||
{
|
||||
// eseguo
|
||||
@@ -161,7 +161,7 @@ ExeLineBoxInters( const Point3d& ptP, const Vector3d& vtDir, const BBox3d& b3Box
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ ExeLineSurfTmInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRe
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ ExeLineSurfBzInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRe
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -359,15 +359,27 @@ MyAddPlaneIntersResultToGeomDB( IGeomDB* pGeomDB, const PNTVECTOR& vPnt, const B
|
||||
}
|
||||
// Inserisco le curve nel DB (dopo averle concatenate)
|
||||
ChainCurves chainC ;
|
||||
chainC.Init( false, dToler, int( vBpt.size())) ;
|
||||
chainC.Init( false, dToler, int( vBpt.size())) ;
|
||||
DBLVECTOR vdLen ; vdLen.reserve( vBpt.size()) ;
|
||||
for ( int i = 0 ; i < int( vBpt.size()) ; ++ i) {
|
||||
Vector3d vtDir = vBpt[i].second - vBpt[i].first ;
|
||||
vdLen.emplace_back( vtDir.Len()) ;
|
||||
vtDir.Normalize() ;
|
||||
if ( ! chainC.AddCurve( i + 1, vBpt[i].first, vtDir, vBpt[i].second, vtDir))
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
// recupero i percorsi concatenati
|
||||
// il punto di inizio viene scelto come lo start di un tratto più lungo della tolleranza in modo da evitare casi problematici
|
||||
// del chain in cui percorsi formati da tratti di lunghezza inferiore alla tolleranza vengono individuati erroneamente come chiusi
|
||||
// interrompendo il loro concatenamento con le altre curve
|
||||
Point3d ptNear = ( vBpt.empty() ? ORIG : vBpt[0].first) ;
|
||||
for ( int i = 0 ; i < int( vdLen.size()) ; ++ i) {
|
||||
if ( vdLen[i] > 2 * dToler) {
|
||||
ptNear = vBpt[i].first ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
INTVECTOR vId ;
|
||||
while ( chainC.GetChainFromNear( ptNear, false, vId)) {
|
||||
// creo una curva composita
|
||||
@@ -390,6 +402,8 @@ MyAddPlaneIntersResultToGeomDB( IGeomDB* pGeomDB, const PNTVECTOR& vPnt, const B
|
||||
pLine->Set( ptStart, ptEnd) &&
|
||||
pCrvCompo->AddCurve( Release( pLine), true, dToler)) ;
|
||||
ptNear = ( bAdded ? ptEnd : ptStart) ;
|
||||
// rendo invalida la sua lunghezza per non ritrovarlo come tratto iniziale del percorso successivo
|
||||
vdLen[nInd] = -1 ;
|
||||
}
|
||||
// se lunghezza curva inferiore a 5 volte la tolleranza, la ignoro
|
||||
double dCrvLen ;
|
||||
@@ -421,6 +435,13 @@ MyAddPlaneIntersResultToGeomDB( IGeomDB* pGeomDB, const PNTVECTOR& vPnt, const B
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nNewId ;
|
||||
++ nCrvCount ;
|
||||
// scelgo il nuovo punto di inizio
|
||||
for ( int i = 0 ; i < int( vdLen.size()) ; ++ i) {
|
||||
if ( vdLen[i] > 2 * dToler) {
|
||||
ptNear = vBpt[i].first ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Inserisco i triangoli nel DB (dopo averli uniti in una superficie trimesh)
|
||||
StmFromTriangleSoup StmFts ;
|
||||
@@ -454,8 +475,8 @@ MyAddPlaneIntersResultToGeomDB( IGeomDB* pGeomDB, const PNTVECTOR& vPnt, const B
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
MyPlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, const int nDestGrpId, const int nRefType, int& nCount)
|
||||
static int
|
||||
MyPlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDestGrpId, int nRefType, int& nCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
@@ -546,13 +567,13 @@ MyPlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, con
|
||||
EPS_SMALL, nPntCount, nCrvCount, nTmp) ;
|
||||
nCount = nPntCount + nCrvCount ;
|
||||
|
||||
// restituisco l'identificativo della prima entit� creata
|
||||
// restituisco l'identificativo della prima entità creata
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExePlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, const int nDestGrpId, const int nRefType, int* pnCount)
|
||||
ExePlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDestGrpId, int nRefType, int* pnCount)
|
||||
{
|
||||
// eseguo
|
||||
int nCount{ 0} ;
|
||||
@@ -575,7 +596,7 @@ ExePlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, co
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -746,7 +767,7 @@ MyPlaneBoxInters( const Point3d& ptOn, const Vector3d& vtN, const BBox3d& b3Box,
|
||||
nFirstId = nNewId ;
|
||||
++ nSrfCount ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -779,7 +800,7 @@ ExePlaneBoxInters( const Point3d& ptOn, const Vector3d& vtN, const BBox3d& b3Box
|
||||
", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -818,7 +839,7 @@ MyPlaneSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDes
|
||||
// inserisco il risultato dell'intersezione nel DB
|
||||
int nFirstId = MyAddPlaneIntersResultToGeomDB( pGeomDB, vPnt, vBpt, vTria, frSurf, frDest, nId, nDestGrpId, plPlane.GetVersN(), dToler,
|
||||
nPntCount, nCrvCount, nSrfCount) ;
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -852,7 +873,7 @@ ExePlaneSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe
|
||||
", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -941,7 +962,7 @@ ExeParPlanesSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, const DBLVEC
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -977,7 +998,7 @@ MyPlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe
|
||||
PtrOwner<ICurve> pCrv( Release( vpLoop[i])) ;
|
||||
if ( IsNull( pCrv))
|
||||
continue ;
|
||||
pCrv->ToLoc( frDest) ;
|
||||
pCrv->LocToLoc( frLoc, frDest) ;
|
||||
// inserisco la curva composita nel gruppo destinazione
|
||||
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, ::Release( pCrv)) ;
|
||||
if ( nNewId == GDB_ID_NULL)
|
||||
@@ -986,7 +1007,7 @@ MyPlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe
|
||||
nFirstId = nNewId ;
|
||||
++ nCount ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -1010,13 +1031,13 @@ ExePlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nD
|
||||
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& nPntCount, int& nCrvCount)
|
||||
static int
|
||||
MyCurveCurveInters( int nId1, int nId2, int nDestGrpId, int& nPntCount, int& nCrvCount, bool bOnly3D)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
@@ -1032,14 +1053,24 @@ MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& n
|
||||
CurveLocal Crv1Loc( pGeomDB, nId1, frDest) ;
|
||||
CurveLocal Crv2Loc( pGeomDB, nId2, frDest) ;
|
||||
|
||||
if( Crv1Loc.Get() == nullptr || Crv2Loc.Get() == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// intersezione fra le curve nel piano XY locale
|
||||
IntersCurveCurve intCC( *Crv1Loc, *Crv2Loc, true) ;
|
||||
int nInters = intCC.GetIntersCount() ;
|
||||
int nInters = 0 ;
|
||||
if ( ! bOnly3D)
|
||||
nInters = intCC.GetIntersCount() ;
|
||||
else
|
||||
nInters = intCC.GetInters3DCount() ;
|
||||
|
||||
// recupero i punti risultanti
|
||||
for ( int i = 0 ; i < nInters ; i++) {
|
||||
IntCrvCrvInfo aInfo ;
|
||||
intCC.GetIntCrvCrvInfo( i, aInfo) ;
|
||||
IntCrvCrvInfo aInfo ;
|
||||
if( ! bOnly3D)
|
||||
intCC.GetIntCrvCrvInfo( i, aInfo) ;
|
||||
else
|
||||
intCC.GetInt3DCrvCrvInfo( i, aInfo) ;
|
||||
// verifico se punto
|
||||
if ( ! aInfo.bOverlap) {
|
||||
PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ;
|
||||
@@ -1060,7 +1091,10 @@ MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& n
|
||||
// recupero le curve risultanti
|
||||
for ( int i = 0 ; i < nInters ; i++) {
|
||||
IntCrvCrvInfo aInfo ;
|
||||
intCC.GetIntCrvCrvInfo( i, aInfo) ;
|
||||
if( ! bOnly3D)
|
||||
intCC.GetIntCrvCrvInfo( i, aInfo) ;
|
||||
else
|
||||
intCC.GetInt3DCrvCrvInfo( i, aInfo) ;
|
||||
// verifico se curva
|
||||
if ( aInfo.bOverlap) {
|
||||
PtrOwner<ICurve> pCrvRes( Crv1Loc->CopyParamRange( aInfo.IciA[0].dU, aInfo.IciA[1].dU)) ;
|
||||
@@ -1082,11 +1116,11 @@ MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& n
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int* pnPntCount, int* pnCrvCount)
|
||||
ExeCurveCurveInters( int nId1, int nId2, int nDestGrpId, int* pnPntCount, int* pnCrvCount, bool bOnly3D)
|
||||
{
|
||||
// eseguo
|
||||
int nPntCount{ 0}, nCrvCount{ 0} ;
|
||||
int nFirstId = MyCurveCurveInters( nId1, nId2, nDestGrpId, nPntCount, nCrvCount) ;
|
||||
int nFirstId = MyCurveCurveInters( nId1, nId2, nDestGrpId, nPntCount, nCrvCount, bOnly3D) ;
|
||||
// aggiorno contatori
|
||||
if ( nFirstId != GDB_ID_NULL) {
|
||||
if ( pnPntCount != nullptr)
|
||||
@@ -1104,7 +1138,7 @@ ExeCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int*
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -1127,7 +1161,7 @@ GetCurveSurfTmIntersType( int nFlag)
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
MyCurveSurfTmInters( const int nCrvId, const int nId2, const int nDestGrpId, int& nPntCount, int& nCrvCount)
|
||||
MyCurveSurfTmInters( int nCrvId, int nId2, int nDestGrpId, int& nPntCount, int& nCrvCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
@@ -1209,7 +1243,7 @@ MyCurveSurfTmInters( const int nCrvId, const int nId2, const int nDestGrpId, int
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCurveSurfTmInters( const int nCrvId, const int nStmId, const int nDestGrpId, int* pnPntCount, int* pnCrvCount)
|
||||
ExeCurveSurfTmInters( int nCrvId, int nStmId, int nDestGrpId, int* pnPntCount, int* pnCrvCount)
|
||||
{
|
||||
// eseguo
|
||||
int nPntCount{ 0}, nCrvCount{ 0} ;
|
||||
@@ -1364,7 +1398,7 @@ MySurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
|
||||
const ISurfTriMesh* pStm2L = GetSurfTriMesh( Surf2Loc) ;
|
||||
if ( pStm2L == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// eseguo l'intersezione (gi� espressa nel riferimento destinazione)
|
||||
// eseguo l'intersezione (già espressa nel riferimento destinazione)
|
||||
PNTVECTOR vPnt ;
|
||||
BIPNTVECTOR vBpt ;
|
||||
TRIA3DVECTOR vTria ;
|
||||
@@ -1420,7 +1454,7 @@ MySurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
|
||||
nFirstId = nNewId ;
|
||||
++ nSrfCount ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -1452,6 +1486,23 @@ ExeSurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
|
||||
", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeBBoxOverlap( const BBox3d& bboxA, const Frame3d& frA, const BBox3d& bboxB, const Frame3d& frB)
|
||||
{
|
||||
bool bRes = Overlaps( bboxA, frA, bboxB, frB) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "ExeBBoxOverlap(" + ToString( bboxA) + "," +
|
||||
ToString( frA) + "," +
|
||||
ToString( bboxB) + "," +
|
||||
ToString( frB) + ")" ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bRes ;
|
||||
}
|
||||
+28
-21
@@ -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,12 +85,19 @@ 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
|
||||
if ( pGObj->GetType() == GEO_VECT3D) {
|
||||
else if ( pGObj->GetType() == GEO_VECT3D) {
|
||||
// recupero il geo-vettore
|
||||
const IGeoVector3d* pGV = GetGeoVector3d( pGObj) ;
|
||||
// assegno il punto
|
||||
@@ -122,7 +129,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 ;
|
||||
@@ -154,7 +161,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 ;
|
||||
@@ -194,7 +201,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 ;
|
||||
@@ -234,7 +241,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 ;
|
||||
@@ -257,11 +264,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 ;
|
||||
@@ -269,7 +276,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))
|
||||
@@ -290,7 +297,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 ;
|
||||
@@ -298,11 +305,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 ;
|
||||
@@ -313,7 +320,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 ;
|
||||
@@ -332,7 +339,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()) ;
|
||||
@@ -341,11 +348,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 ;
|
||||
@@ -362,7 +369,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 ;
|
||||
@@ -400,7 +407,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 ;
|
||||
@@ -424,7 +431,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 ;
|
||||
@@ -448,7 +455,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 ;
|
||||
|
||||
+83
-25
@@ -226,6 +226,18 @@ 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)
|
||||
@@ -387,7 +399,7 @@ ExeInsertFile( const string& sFilePath)
|
||||
class CamStatus
|
||||
{
|
||||
public :
|
||||
CamStatus( void) : m_nCurrMachGroup( GDB_ID_NULL), m_nCurrPhase( 0) {
|
||||
CamStatus( void) : m_nCurrMachGroup( GDB_ID_NULL), m_nCurrPhase( 0), m_nCurrMachining( GDB_ID_NULL) {
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
if ( pMachMgr == nullptr)
|
||||
return ;
|
||||
@@ -405,14 +417,19 @@ class CamStatus
|
||||
m_vIdStat.push_back( ( bShow ? nId : - nId)) ;
|
||||
nId = pMachMgr->GetNextOperation( nId) ;
|
||||
}
|
||||
pMachMgr->ResetCurrMachGroup() ;
|
||||
}
|
||||
~CamStatus( void) {
|
||||
Restore() ;
|
||||
}
|
||||
void Restore( void) {
|
||||
if ( m_nCurrMachGroup == GDB_ID_NULL)
|
||||
return ;
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
if ( pMachMgr == nullptr)
|
||||
return ;
|
||||
if ( m_nCurrMachGroup == GDB_ID_NULL)
|
||||
return ;
|
||||
pMachMgr->SetCurrMachGroup( m_nCurrMachGroup) ;
|
||||
m_nCurrMachGroup = GDB_ID_NULL ;
|
||||
if ( m_nCurrPhase == 0)
|
||||
return ;
|
||||
pMachMgr->SetCurrPhase( m_nCurrPhase, true) ;
|
||||
@@ -437,7 +454,6 @@ ExeSaveFile( const string& sFilePath, int nFlag)
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
// se ero in CAM, esco dopo averne salvato lo stato
|
||||
CamStatus CurrCamStatus ;
|
||||
ExeResetCurrMachGroup() ;
|
||||
// imposto path corrente del file
|
||||
pGseCtx->m_sFilePath = sFilePath ;
|
||||
// salvo il file
|
||||
@@ -463,33 +479,62 @@ ExeSaveFile( const string& sFilePath, int nFlag)
|
||||
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( int nId, const string& sFilePath, int nFlag)
|
||||
ExeSaveObjToFile( const INTVECTOR& vId, const string& sFilePath, int nFlag)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
// 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 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 ero in CAM, non esco <---
|
||||
// copio l'oggetto nel file
|
||||
bool bOk = pGeomDB->Save( nId, sFilePath, nFlag) ;
|
||||
bool bOk = pGeomDB->Save( vId, sFilePath, nFlag) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSaveObjToFile(" + ToString( nId) + ",'" +
|
||||
StringToLuaString( sFilePath) + "'," +
|
||||
NgeTypeToString( nFlag) + ")" +
|
||||
string sLua = "EgtSaveObjToFile({" + ToString( vId) + "},'" +
|
||||
StringToLuaString( sFilePath) + "'," +
|
||||
NgeTypeToString( nFlag) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
@@ -499,7 +544,7 @@ ExeSaveObjToFile( int nId, const string& sFilePath, int nFlag)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSaveMachGroupToFile( int nMGroupId, const string& sFilePath, int nFlag)
|
||||
ExeSaveMachGroupToFile( int nMGroupId, const INTVECTOR& vPlusId, const string& sFilePath, int nFlag)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
@@ -513,12 +558,21 @@ ExeSaveMachGroupToFile( int nMGroupId, const string& sFilePath, int nFlag)
|
||||
ExeDisableModified() ;
|
||||
// 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 = "" ;
|
||||
if ( pMachMgr->SetCurrMachGroup( nMGroupId)) {
|
||||
bOk = bOk && pMachMgr->SetCurrMachGroup( nMGroupId) ;
|
||||
if ( bOk) {
|
||||
// aggiungo gruppo di lavoro
|
||||
vId.emplace_back( nMGroupId) ;
|
||||
// aggiungo pezzi
|
||||
@@ -552,8 +606,11 @@ ExeSaveMachGroupToFile( int nMGroupId, const string& sFilePath, int nFlag)
|
||||
// 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
|
||||
bool bOk = pGeomDB->Save( vId, sFilePath, nFlag) ;
|
||||
bOk = bOk && pGeomDB->Save( vId, sFilePath, nFlag) ;
|
||||
// eventuale ripristino dati fotografia
|
||||
if ( nPhotoId != GDB_ID_NULL)
|
||||
ExeChangePhotoPath( nPhotoId, sPhotoOriPath) ;
|
||||
@@ -566,7 +623,8 @@ ExeSaveMachGroupToFile( int nMGroupId, const string& sFilePath, int nFlag)
|
||||
SetCmdLog( bPrevCmdLog) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSaveMachGroupToFile(" + ToString( nMGroupId) + ",'" +
|
||||
string sLua = "EgtSaveMachGroupToFile(" + ToString( nMGroupId) + ",{" +
|
||||
ToString( vPlusId) + "},'" +
|
||||
StringToLuaString( sFilePath) + "'," +
|
||||
NgeTypeToString( nFlag) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
|
||||
+346
-37
@@ -21,10 +21,13 @@
|
||||
#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 ;
|
||||
@@ -556,12 +559,12 @@ ExeModifyRawPart( int nRawId, Point3d ptOrig, double dLength, double dWidth, dou
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol)
|
||||
ExeModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dHeight, Color cCol)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// modifico grezzo indicato nella macchinata corrente
|
||||
bool bOk = pMachMgr->ModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ;
|
||||
bool bOk = pMachMgr->ModifyRawPart( nRawId, nCrvId, dOverMat, dHeight, cCol) ;
|
||||
ExeSetModified() ;
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
@@ -995,7 +998,7 @@ ExeGetTableAreaOffset( int nInd, BBox3d& b3AreaOffs)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// recupero l'estensione dell'area utile con offset della tavola corrente della macchinata corrente
|
||||
// recupero l'estensione dell'area utile con offset della fase corrente della tavola corrente della macchinata corrente
|
||||
return pMachMgr->GetTableAreaOffset( nInd, b3AreaOffs) ;
|
||||
}
|
||||
|
||||
@@ -1019,6 +1022,64 @@ 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)
|
||||
@@ -1030,10 +1091,10 @@ ExeAddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg, dou
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtAddFixture(" + sName + ",{" +
|
||||
ToString( ptPos) + "}," +
|
||||
ToString( dAngRotDeg) + "," +
|
||||
ToString( dMov) + ")" +
|
||||
string sLua = "EgtAddFixture('" + StringToLuaString( sName) + "',{" +
|
||||
ToString( ptPos) + "}," +
|
||||
ToString( dAngRotDeg) + "," +
|
||||
ToString( dMov) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
@@ -1136,13 +1197,33 @@ ExeRotateFixture( int nFxtId, double dDeltaAngDeg)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// ruoto il dispositivo di presa dell'angolo indicato
|
||||
// vario la rotazione del 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) + "})" +
|
||||
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) + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
@@ -1156,7 +1237,7 @@ ExeMoveFixtureMobile( int nFxtId, double dDeltaMove)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// ruoto il dispositivo di presa dell'angolo indicato
|
||||
// varia il movimento della parte mobile della morsa della quantità indicata
|
||||
bool bOk = pMachMgr->MoveFixtureMobile( nFxtId, dDeltaMove) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
@@ -1170,6 +1251,26 @@ 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
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -1472,6 +1573,21 @@ 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)
|
||||
@@ -1585,6 +1701,16 @@ ExeImportSetup( const string& sName)
|
||||
return pMachMgr->ImportSetup( sName) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeExistsCurrSetup( void)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// eseguo la verifica
|
||||
return pMachMgr->ExistsCurrSetup() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeVerifyCurrSetup( STRVECTOR& vsErrors)
|
||||
@@ -1990,42 +2116,42 @@ ExeGetPrevOperation( int nId)
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetFirstActiveOperation( void)
|
||||
ExeGetFirstActiveOperation( bool bNeedMachNotEmpty)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
||||
// recupero la prima operazione attiva della macchinata corrente
|
||||
return pMachMgr->GetFirstActiveOperation() ;
|
||||
return pMachMgr->GetFirstActiveOperation( bNeedMachNotEmpty) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetNextActiveOperation( int nId)
|
||||
ExeGetNextActiveOperation( int nId, bool bNeedMachNotEmpty)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
||||
// recupero la successiva operazione attiva della macchinata corrente
|
||||
return pMachMgr->GetNextActiveOperation( nId) ;
|
||||
return pMachMgr->GetNextActiveOperation( nId, bNeedMachNotEmpty) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetLastActiveOperation( void)
|
||||
ExeGetLastActiveOperation( bool bNeedMachNotEmpty)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// recupero l'ultima operazione attiva della macchinata corrente
|
||||
return pMachMgr->GetLastActiveOperation() ;
|
||||
return pMachMgr->GetLastActiveOperation( bNeedMachNotEmpty) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetPrevActiveOperation( int nId)
|
||||
ExeGetPrevActiveOperation( int nId, bool bNeedMachNotEmpty)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
||||
// recupero la precedente operazione attiva della macchinata corrente
|
||||
return pMachMgr->GetPrevActiveOperation( nId) ;
|
||||
return pMachMgr->GetPrevActiveOperation( nId, bNeedMachNotEmpty) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -2090,12 +2216,12 @@ ExeGetOperationId( const string& sName)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeIsOperationEmpty( int nId)
|
||||
ExeIsOperationEmpty( int nId, int nEmptyType)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// recupero lo stato dell'operazione indicata della macchinata corrente
|
||||
return pMachMgr->IsOperationEmpty( nId) ;
|
||||
return pMachMgr->IsOperationEmpty( nId, nEmptyType) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -2351,6 +2477,16 @@ 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
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -2612,6 +2748,16 @@ ExeUpdateMachining( bool bPostApply)
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeChangePreviewMachiningToolShow( int nLookFlag)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// impostazione tipo visualizzazione anteprima utensile su lavorazione
|
||||
return pMachMgr->ChangePreviewMachiningToolShow( nLookFlag) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExePreparePreviewMachiningTool( void)
|
||||
@@ -2634,12 +2780,22 @@ ExeRemovePreviewMachiningTool( void)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExePreviewMachiningTool( int nEntId, int nFlag)
|
||||
ExeGetPreviewMachiningToolStepCount( void)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
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)
|
||||
// visualizzazione anteprima utensile su lavorazione
|
||||
return pMachMgr->PreviewMachiningTool( nEntId, nFlag) ;
|
||||
return pMachMgr->PreviewMachiningTool( nEntId, nStep) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -2694,12 +2850,22 @@ ExeGetMachiningGeometry( SELVECTOR& vIds)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeIsMachiningEmpty( void)
|
||||
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)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// restituisco lo stato della lavorazione corrente
|
||||
return pMachMgr->IsMachiningEmpty() ;
|
||||
return pMachMgr->IsMachiningEmpty( nEmptyType) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -2722,6 +2888,26 @@ ExeGetMachiningEndPoint( Point3d& ptEnd)
|
||||
return pMachMgr->GetMachiningEndPoint( ptEnd) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetMachiningStartAxes( bool bSkipClimb, DBLVECTOR& vAxVal)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// restituisco quanto cercato
|
||||
return pMachMgr->GetMachiningStartAxes( bSkipClimb, vAxVal) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetMachiningEndAxes( bool bSkipRise, DBLVECTOR& vAxVal)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// restituisco quanto cercato
|
||||
return pMachMgr->GetMachiningEndAxes( bSkipRise, vAxVal) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeApplyAllMachinings( bool bRecalc, bool bStopOnFirstErr, string& sErrList)
|
||||
@@ -2914,13 +3100,33 @@ ExeGetClEntIndex( int nEntId, int& nIndex)
|
||||
return pMachMgr->GetClEntIndex( nEntId, nIndex) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetClEntFeed( int nEntId, double& dFeed)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// recupero la feed
|
||||
return pMachMgr->GetClEntFeed( nEntId, dFeed) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
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
|
||||
// recupero la mascheratura del movimento assi (valida solo in rapido)
|
||||
return pMachMgr->GetClEntAxesMask( nEntId, nMask) ;
|
||||
}
|
||||
|
||||
@@ -2934,6 +3140,36 @@ ExeGetClEntAxesVal( int nEntId, DBLVECTOR& vAxes)
|
||||
return pMachMgr->GetClEntAxesVal( nEntId, vAxes) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetClEntTDir( int nEntId, Vector3d& vtTDir)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false) ;
|
||||
// recupero TDir
|
||||
return pMachMgr->GetClEntTDir( nEntId, vtTDir) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetClEntCDir( int nEntId, Vector3d& vtCDir)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false) ;
|
||||
// recupero CDir
|
||||
return pMachMgr->GetClEntCDir( nEntId, vtCDir) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetClEntADir( int nEntId, Vector3d& vtADir)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false) ;
|
||||
// recupero ADir
|
||||
return pMachMgr->GetClEntADir( nEntId, vtADir) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Simulazione
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -2996,6 +3232,16 @@ 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)
|
||||
@@ -3066,8 +3312,15 @@ ExeGenerate( const string& sCncFile, const string& sInfo)
|
||||
ReplaceString( sDir, "/", "\\") ;
|
||||
// recupero il nome
|
||||
string sNcName ;
|
||||
if ( ! ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sNcName))
|
||||
sNcName = GetFileTitleEgt( sProjPath) + ".cnc" ;
|
||||
if ( ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sNcName))
|
||||
sNcName = GetFileName( sNcName) ;
|
||||
else {
|
||||
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( GetFileName( sProjPath), sExt) ;
|
||||
}
|
||||
// creo la path completa
|
||||
sMyCncFile = sDir + "\\" + sNcName ;
|
||||
}
|
||||
@@ -3093,8 +3346,10 @@ ExeEstimate( const string& sEstFile, const string& sInfo)
|
||||
ReplaceString( sDir, "/", "\\") ;
|
||||
// recupero il nome
|
||||
string sEstName ;
|
||||
if ( ! ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sEstName))
|
||||
sEstName = GetFileTitleEgt( sProjPath) ;
|
||||
if ( ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sEstName))
|
||||
sEstName = GetFileName( sEstName) ;
|
||||
else
|
||||
sEstName = GetFileName( sProjPath) ;
|
||||
sEstName = ChangeFileExtension( sEstName, ".html") ;
|
||||
// creo la path completa
|
||||
sMyEstFile = sDir + "\\" + sEstName ;
|
||||
@@ -3124,7 +3379,9 @@ ExeSimulate( int& nErr, string& sError)
|
||||
nErr = SHE_NONE ;
|
||||
sError = "" ;
|
||||
// disabilito UI
|
||||
ExeSetEnableUI( false) ;
|
||||
bool bPrevEnableUI = ExeGetEnableUI() ;
|
||||
if ( bPrevEnableUI)
|
||||
ExeSetEnableUI( false) ;
|
||||
// avvio simulazione
|
||||
if ( ! pMachMgr->SimInit() || ! pMachMgr->SimStart( true) || ! pMachMgr->SimStart( false)) {
|
||||
// inutile continuare con simulazione se avvio non riuscito
|
||||
@@ -3186,7 +3443,8 @@ ExeSimulate( int& nErr, string& sError)
|
||||
// terminazione simulazione
|
||||
pMachMgr->SimExit() ;
|
||||
// riabilito UI
|
||||
ExeSetEnableUI( true) ;
|
||||
if ( bPrevEnableUI)
|
||||
ExeSetEnableUI( true) ;
|
||||
return ( nErr == 0) ;
|
||||
}
|
||||
|
||||
@@ -3212,6 +3470,16 @@ ExeSetCalcTool( const string& sTool, const string& sHead, int nExit)
|
||||
return pMachMgr->SetCalcTool( sTool, sHead, nExit) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetCalcSolCh( int nScc, bool bExact)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// imposto il criterio di scelta della soluzione e se deve essere rispettato esattamente
|
||||
return pMachMgr->SetCalcSolCh( nScc, bExact) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetRotAxisBlock( const string& sAxis, double dVal)
|
||||
@@ -3242,6 +3510,16 @@ ExeGetCalcTool( string& sTool, string& sHead, int& nExit)
|
||||
return ( pMachMgr->GetCalcTool( sTool) && pMachMgr->GetCalcHead( sHead) && pMachMgr->GetCalcExit( nExit)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetCalcSolCh( int& nScc, bool& bExact)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// recupero il criterio di scelta della soluzione e se deve essere rispettato esattamente
|
||||
return pMachMgr->GetCalcSolCh( nScc, bExact) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetAllCurrAxesNames( STRVECTOR& vAxName)
|
||||
@@ -3287,23 +3565,34 @@ ExeGetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
|
||||
int& nStat, double& dX, double& dY, double& dZ)
|
||||
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, nStat, dX, dY, dZ) ;
|
||||
return pMachMgr->GetCalcPositions( ptP, dAngA, dAngB, dX, dY, dZ) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
int& nStat, double& dX, double& dY, double& dZ)
|
||||
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, nStat, dX, dY, dZ) ;
|
||||
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) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -3358,6 +3647,16 @@ ExeVerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB,
|
||||
return pMachMgr->VerifyOutstroke( dX, dY, dZ, dAngA, dAngB, nStat) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeVerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// verifica l'extracorsa degli assi
|
||||
return pMachMgr->VerifyOutstroke( dX, dY, dZ, vAng, true, nStat) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetOutstrokeInfo( string& sInfo)
|
||||
@@ -3461,6 +3760,16 @@ 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)
|
||||
|
||||
+191
@@ -0,0 +1,191 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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
|
||||
ExeOptMachSetOptimizationForGroups( bool bOptForGroups)
|
||||
{
|
||||
// Se oggetto non istanziato, errore
|
||||
if ( IsNull( s_pMO))
|
||||
return false ;
|
||||
// Imposto il Flag
|
||||
return ( s_pMO->SetOptimizationForGroups( bOptForGroups)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeOptMachSetOpenBound( bool bStartVsEnd, int nFlag, double dX, double dY, double dZ)
|
||||
{
|
||||
// Se oggetto non istanziato, errore
|
||||
if ( IsNull( s_pMO))
|
||||
return false ;
|
||||
// Imposto il Flag
|
||||
return ( s_pMO->SetOpenBound( bStartVsEnd, nFlag, dX, dY, dZ)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeOptMachSetOpenBoundForGroups( int nGroup, bool bStartVsEnd, int nFlag, double dX, double dY, double dZ)
|
||||
{
|
||||
// Se oggetto non istanziato, errore
|
||||
if ( IsNull( s_pMO))
|
||||
return false ;
|
||||
// Impsto il Flag
|
||||
return ( s_pMO->SetOpenBoundForGroups( nGroup, bStartVsEnd, nFlag, dX, dY, dZ)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeOptMachCalculate( INTVECTOR& vIds)
|
||||
{
|
||||
vIds.clear() ;
|
||||
// Se oggetto non instanziato, errore
|
||||
if ( IsNull( s_pMO))
|
||||
return false ;
|
||||
// Recupero i risultati
|
||||
return ( s_pMO->Calculate( vIds)) ;
|
||||
}
|
||||
@@ -16,13 +16,13 @@
|
||||
class IGeomDB ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int GetFlatPartRegion( IGeomDB* pGeomDB, int nId) ;
|
||||
int GetFlatPartUpRegion( IGeomDB* pGeomDB, int nId) ;
|
||||
int GetFlatPartDownRegion( IGeomDB* pGeomDB, int nId) ;
|
||||
bool GetFlatPartCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ;
|
||||
bool GetFlatPartDownCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ;
|
||||
bool GetFlatPartInterpartGap(IGeomDB* pGeomDB, int nId, double& dGap);
|
||||
int GetFlatPartFromRegion( IGeomDB* pGeomDB, int nId) ;
|
||||
int GetFlatPartFromCut( IGeomDB* pGeomDB, int nId) ;
|
||||
int GetGeometryFromCut( IGeomDB* pGeomDB, IMachMgr* pMachMgr, int nId) ;
|
||||
bool GetFlatPartApproxContour( IGeomDB* pGeomDB, int nId, PolyLine& PL) ;
|
||||
int GetFlatPartRegion( IGeomDB* pGeomDB, int nId) ;
|
||||
int GetFlatPartUpRegion( IGeomDB* pGeomDB, int nId) ;
|
||||
int GetFlatPartDownRegion( IGeomDB* pGeomDB, int nId) ;
|
||||
bool GetFlatPartCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ;
|
||||
bool GetFlatPartDownCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ;
|
||||
bool GetFlatPartInterpartGap(IGeomDB* pGeomDB, int nId, double& dGap);
|
||||
int GetFlatPartFromRegion( IGeomDB* pGeomDB, int nId) ;
|
||||
int GetFlatPartFromCut( IGeomDB* pGeomDB, int nId) ;
|
||||
INTVECTOR GetGeometryFromCut( IGeomDB* pGeomDB, IMachMgr* pMachMgr, int nId) ;
|
||||
bool GetFlatPartApproxContour( IGeomDB* pGeomDB, int nId, PolyLine& PL) ;
|
||||
|
||||
+18
-1
@@ -19,7 +19,6 @@
|
||||
#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"
|
||||
@@ -258,6 +257,15 @@ 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)
|
||||
@@ -339,3 +347,12 @@ 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) ;
|
||||
}
|
||||
|
||||
+15
-10
@@ -89,6 +89,10 @@ 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 ;
|
||||
}
|
||||
@@ -2180,24 +2184,25 @@ GetFlatPartFromCut( IGeomDB* pGeomDB, int nId)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
INTVECTOR
|
||||
GetGeometryFromCut( IGeomDB* pGeomDB, IMachMgr* pMachMgr, int nId)
|
||||
{
|
||||
INTVECTOR vnIds ;
|
||||
if ( pGeomDB == nullptr || pMachMgr == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
return vnIds ;
|
||||
// verifico appartenga ad una lavorazione
|
||||
int nMchId ;
|
||||
if ( ! pGeomDB->GetInfo( pGeomDB->GetParentId( pGeomDB->GetParentId( nId)), "MId", nMchId))
|
||||
return GDB_ID_NULL ;
|
||||
return vnIds ;
|
||||
// recupero la geometria di applicazione della lavorazione (deve essere una sola)
|
||||
if ( ! pMachMgr->SetCurrMachining( nMchId))
|
||||
return GDB_ID_NULL ;
|
||||
SELVECTOR vIds ;
|
||||
pMachMgr->GetMachiningGeometry( vIds) ;
|
||||
if ( vIds.size() == 1)
|
||||
return vIds[0].nId ;
|
||||
else
|
||||
return GDB_ID_NULL ;
|
||||
return vnIds ;
|
||||
SELVECTOR vSelIds ;
|
||||
pMachMgr->GetMachiningGeometry( vSelIds) ;
|
||||
vnIds.reserve( vSelIds.size()) ;
|
||||
for ( const SelData& mySelData : vSelIds)
|
||||
vnIds.emplace_back( mySelData.nId) ;
|
||||
return vnIds ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+10
-10
@@ -143,7 +143,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
|
||||
// confronto la regione di attacco della lavorazione con le regioni degli altri pezzi
|
||||
for ( int nMchRegId : vMchLiReg) {
|
||||
for ( int nOthRegId : vOthReg) {
|
||||
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
|
||||
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
|
||||
nResult |= FMI_LI ;
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
|
||||
if ( vMchDwnLiReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
|
||||
int nMchRegId = ( ( vMchDwnLiReg[i] != GDB_ID_NULL) ? vMchDwnLiReg[i] : vMchLiReg[i]) ;
|
||||
int nOthRegId = ( ( vOthDwnReg[j] != GDB_ID_NULL) ? vOthDwnReg[j] : vOthReg[j]) ;
|
||||
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
|
||||
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
|
||||
nResult |= FMI_LI ;
|
||||
}
|
||||
}
|
||||
@@ -160,7 +160,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
|
||||
// confronto la regione ridotta della lavorazione con le regioni degli altri pezzi
|
||||
for ( int nMchRegId : vMchRReg) {
|
||||
for ( int nOthRegId : vOthReg) {
|
||||
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
|
||||
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
|
||||
nResult |= FMI_RM ;
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
|
||||
if ( vMchDwnRReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
|
||||
int nMchRegId = ( ( vMchDwnRReg[i] != GDB_ID_NULL) ? vMchDwnRReg[i] : vMchRReg[i]) ;
|
||||
int nOthRegId = ( ( vOthDwnReg[j] != GDB_ID_NULL) ? vOthDwnReg[j] : vOthReg[j]) ;
|
||||
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
|
||||
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
|
||||
nResult |= FMI_RM ;
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
|
||||
// confronto la regione di uscita della lavorazione con le regioni degli altri pezzi
|
||||
for ( int nMchRegId : vMchLoReg) {
|
||||
for ( int nOthRegId : vOthReg) {
|
||||
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
|
||||
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
|
||||
nResult |= FMI_LO ;
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
|
||||
if ( vMchDwnLoReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
|
||||
int nMchRegId = ( ( vMchDwnLoReg[i] != GDB_ID_NULL) ? vMchDwnLoReg[i] : vMchLoReg[i]) ;
|
||||
int nOthRegId = ( ( vOthDwnReg[j] != GDB_ID_NULL) ? vOthDwnReg[j] : vOthReg[j]) ;
|
||||
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
|
||||
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
|
||||
nResult |= FMI_LO ;
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,7 @@ ExeVerifyCutAsSplitting( int nMchId)
|
||||
pMachMgr->MachiningPreview( true) ;
|
||||
// verifico interferenza
|
||||
int nRes ;
|
||||
if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE)
|
||||
if ( ExeVerifyMachining( nMchId, nRes) && ( nRes == FMI_NONE || nRes == FMI_LO))
|
||||
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)
|
||||
if ( ExeVerifyMachining( nMchId, nRes) && ( nRes == FMI_NONE || nRes == FMI_LO))
|
||||
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)
|
||||
if ( ExeVerifyMachining( nMchId, nRes) && ( nRes == FMI_NONE || nRes == FMI_LI))
|
||||
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)
|
||||
if ( ExeVerifyMachining( nMchId, nRes) && ( nRes == FMI_NONE || nRes == FMI_LI))
|
||||
nResult += CAR_LO_OK ;
|
||||
}
|
||||
// verifico se taglio non passante
|
||||
|
||||
+331
-132
@@ -22,8 +22,10 @@
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGkCAvSimpleSurfFrMove.h"
|
||||
#include "/EgtDev/Include/EGkCAvSurfFrMove.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EMkMachiningGeoConst.h"
|
||||
#include "/EgtDev/Include/EGkIntervals.h"
|
||||
@@ -32,6 +34,7 @@
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// collisioni semplici
|
||||
struct SCollInfoEx : public SCollInfo
|
||||
{
|
||||
int nIdM ; // identificativo della regione mobile
|
||||
@@ -43,7 +46,7 @@ struct SCollInfoEx : public SCollInfo
|
||||
nIdF( GDB_ID_NULL), bIsCutF( false) {}
|
||||
SCollInfoEx( const SCollInfo& Sou) : SCollInfo( Sou), nIdM( GDB_ID_NULL), bIsCutM( false),
|
||||
nIdF( GDB_ID_NULL), bIsCutF( false) {}
|
||||
} ;
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const double SPESS = 100 ;
|
||||
@@ -92,7 +95,7 @@ ExeCreateOutRegion( int nParentId, double dXmin, double dYmin, double dXmax, dou
|
||||
dYmax < dYmin + GAP + 2 * EPS_SMALL)
|
||||
return false ;
|
||||
|
||||
// se già esiste, posso uscire
|
||||
// se già esiste, posso uscire
|
||||
int nBoxId = pGeomDB->GetFirstNameInGroup( nParentId, NST_SHEET_OUTREG) ;
|
||||
if ( nBoxId != GDB_ID_NULL)
|
||||
return true ;
|
||||
@@ -149,7 +152,7 @@ ExeCreateOutRegion( int nParentId, int nOutCrvId)
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
|
||||
// se già esiste, posso uscire
|
||||
// se già esiste, posso uscire
|
||||
int nBoxId = pGeomDB->GetFirstNameInGroup( nParentId, NST_SHEET_OUTREG) ;
|
||||
if ( nBoxId != GDB_ID_NULL)
|
||||
return true ;
|
||||
@@ -187,7 +190,7 @@ ExeCreateOutRegion( int nParentId, int nOutCrvId)
|
||||
BBox3d b3Box ;
|
||||
pCompo->GetLocalBBox( b3Box) ;
|
||||
b3Box.Expand( SPESS, SPESS, 0) ;
|
||||
// determino il punto più vicino al massimo del box e lo faccio diventare il nuovo inizio
|
||||
// determino il punto più vicino al massimo del box e lo faccio diventare il nuovo inizio
|
||||
int nFlag ;
|
||||
double dU ;
|
||||
DistPointCurve distPC( b3Box.GetMax(), *pCompo) ;
|
||||
@@ -250,7 +253,7 @@ ExeCreateReferenceRegion( int nParentId, int nOutCrvId, bool bBottomUp)
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
|
||||
// se già esiste, posso uscire
|
||||
// se già esiste, posso uscire
|
||||
int nRegId = pGeomDB->GetFirstNameInGroup( nParentId, NST_REFERENCE_REG) ;
|
||||
if ( nRegId != GDB_ID_NULL)
|
||||
return true ;
|
||||
@@ -283,7 +286,7 @@ ExeCreateReferenceRegion( int nParentId, int nOutCrvId, bool bBottomUp)
|
||||
// ne ricavo il bbox
|
||||
BBox3d b3Box ;
|
||||
PL.GetLocalBBox( b3Box) ;
|
||||
// cerco i punti più vicini ai quattro vertici (0=BL, 1=BR, 2=TR, 3=TL)
|
||||
// cerco i punti più vicini ai quattro vertici (0=BL, 1=BR, 2=TR, 3=TL)
|
||||
double dU[4] = { -1, -1, -1, -1} ;
|
||||
double dMinSqDist[4] = { SQ_INFINITO, SQ_INFINITO, SQ_INFINITO, SQ_INFINITO} ;
|
||||
Point3d ptVert[4] ;
|
||||
@@ -391,7 +394,7 @@ ExeCreateDamagedRegion( int nParentId, int nDmgCrvId)
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
|
||||
// verifico se esiste già la regione associata
|
||||
// verifico se esiste già la regione associata
|
||||
int nRegId = pGeomDB->GetFirstNameInGroup( nParentId, NST_DAMAGED_REG) ;
|
||||
while ( nRegId != GDB_ID_NULL) {
|
||||
// recupero l'indice della curva di origine
|
||||
@@ -710,7 +713,7 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
|
||||
// box delle regioni dei pezzi rispetto al box dell'esterno
|
||||
if ( ! b3Region.EnclosesXY( b3RegCluster))
|
||||
return false ;
|
||||
// regioni dei pezzi rispetto alla regione dell'esterno
|
||||
// regioni dei pezzi rispetto alla regione dell'esterno (controllo semplice)
|
||||
for ( int nRegId : vReg) {
|
||||
if ( ExeSurfFrChunkSimpleClassify( nRegId, 0, nBoxId, 0) != REGC_OUT)
|
||||
return false ;
|
||||
@@ -721,7 +724,7 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Verifico con l'eventuale regione di riferimento
|
||||
// Verifico con l'eventuale regione di riferimento (controllo semplice)
|
||||
// recupero la regione
|
||||
int nRefReg = pGeomDB->GetFirstNameInGroup( nGroupId, NST_REFERENCE_REG) ;
|
||||
if ( pGeomDB->ExistsInfo( nRefReg, KEY_NST_OFF))
|
||||
@@ -749,17 +752,17 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
|
||||
vDmgReg.emplace_back( nId) ;
|
||||
nId = pGeomDB->GetNextName( nId, NST_DAMAGED_REG) ;
|
||||
}
|
||||
// regioni dei pezzi rispetto alle regioni delle aree danneggiate
|
||||
// regioni dei pezzi rispetto alle regioni delle aree danneggiate (controllo completo)
|
||||
for ( int nRegId : vReg) {
|
||||
for ( int nDmgRegId : vDmgReg) {
|
||||
if ( ExeSurfFrChunkSimpleClassify( nRegId, 0, nDmgRegId, 0) != REGC_OUT)
|
||||
if ( ExeSurfFlatRegionInterference( nRegId, 0, nDmgRegId, 0) != REGC_OUT)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
for ( int nDwnRegId : vDwnReg) {
|
||||
if ( nDwnRegId != GDB_ID_NULL) {
|
||||
for ( int nDmgRegId : vDmgReg) {
|
||||
if ( ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nDmgRegId, 0) != REGC_OUT)
|
||||
if ( ExeSurfFlatRegionInterference( nDwnRegId, 0, nDmgRegId, 0) != REGC_OUT)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -800,59 +803,62 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
|
||||
nId2 = ( bInRoot ? ExeGetNextPart( nId2, true) : ExeGetNextGroup( nId2)) ;
|
||||
}
|
||||
|
||||
// Eseguo verifiche
|
||||
// Eseguo verifiche (controllo completo)
|
||||
// regioni dei pezzi
|
||||
for ( size_t i = 0 ; i < vReg.size() ; ++ i) {
|
||||
// verifico con le regioni degli altri pezzi (sempre regioni standard)
|
||||
for ( int i = 0 ; i < ssize( vReg) ; ++ i) {
|
||||
// verifico con le regioni degli altri pezzi
|
||||
for ( int nOthRegId : vOthReg) {
|
||||
if ( ExeSurfFrChunkSimpleClassify( vReg[i], 0, nOthRegId, 0) != REGC_OUT)
|
||||
if ( ExeSurfFlatRegionInterference( vReg[i], 0, nOthRegId, 0) != REGC_OUT)
|
||||
return false ;
|
||||
}
|
||||
// e con le regioni dei tagli degli altri pezzi (se esistono le regioni up devo usarle)
|
||||
int nRegUpId = ((vUpReg[i] == GDB_ID_NULL) ? vReg[i] : vUpReg[i]) ;
|
||||
int nRegUpId = ( ( vUpReg[i] == GDB_ID_NULL) ? vReg[i] : vUpReg[i]) ;
|
||||
for ( int nOthCutRegId : vOthCutReg) {
|
||||
if ( ExeSurfFrChunkSimpleClassify( nRegUpId, 0, nOthCutRegId, 0) != REGC_OUT)
|
||||
if ( ExeSurfFlatRegionInterference( nRegUpId, 0, nOthCutRegId, 0) != REGC_OUT)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// regioni sotto dei pezzi
|
||||
for ( size_t i = 0 ; i < vDwnReg.size() ; ++ i) {
|
||||
|
||||
// regioni sotto dei pezzi (controllo completo)
|
||||
for ( int i = 0 ; i < ssize( vDwnReg) ; ++ i) {
|
||||
// verifico con le regioni sotto degli altri pezzi
|
||||
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
|
||||
for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
|
||||
if ( vDwnReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
|
||||
int nDwnRegId = ( vDwnReg[i] != GDB_ID_NULL ? vDwnReg[i] : vReg[i]) ;
|
||||
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
|
||||
if ( ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
|
||||
if ( ExeSurfFlatRegionInterference( nDwnRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// e con le regioni sotto dei tagli degli altri pezzi
|
||||
for ( size_t j = 0 ; j < vOthDwnCutReg.size() ; ++ j) {
|
||||
for ( int j = 0 ; j < ssize( vOthDwnCutReg) ; ++ j) {
|
||||
if ( vDwnReg[i] != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
|
||||
int nDwnRegId = ( vDwnReg[i] != GDB_ID_NULL ? vDwnReg[i] : vReg[i]) ;
|
||||
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
|
||||
if ( ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nOthDwnCutRegId, 0) != REGC_OUT)
|
||||
if ( ExeSurfFlatRegionInterference( nDwnRegId, 0, nOthDwnCutRegId, 0) != REGC_OUT)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// regioni delle lavorazioni dei pezzi
|
||||
for ( int nCutRegId : vCutReg) {
|
||||
// le confronto con le regioni degli altri pezzi
|
||||
for ( size_t j = 0 ; j < vOthReg.size() ; ++ j) {
|
||||
int nOthUpRegId = (( vOthUpReg[j] == GDB_ID_NULL) ? vOthReg[j] : vOthUpReg[j]) ;
|
||||
if ( ExeSurfFrChunkSimpleClassify( nCutRegId, 0, nOthUpRegId, 0) != REGC_OUT)
|
||||
// le confronto con le regioni degli altri pezzi (controllo completo)
|
||||
for ( int j = 0 ; j < ssize( vOthReg) ; ++ j) {
|
||||
int nOthUpRegId = ( ( vOthUpReg[j] == GDB_ID_NULL) ? vOthReg[j] : vOthUpReg[j]) ;
|
||||
if ( ExeSurfFlatRegionInterference( nCutRegId, 0, nOthUpRegId, 0) != REGC_OUT)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
// regioni sotto delle lavorazioni dei pezzi
|
||||
for ( size_t i = 0 ; i < vDwnCutReg.size() ; ++ i) {
|
||||
// le confronto con le regioni sotto degli altri pezzi
|
||||
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
|
||||
for ( int i = 0 ; i < ssize( vDwnCutReg) ; ++ i) {
|
||||
// le confronto con le regioni sotto degli altri pezzi (controllo completo)
|
||||
for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
|
||||
if ( vDwnCutReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
|
||||
int nDwnCutRegId = ( vDwnCutReg[i] != GDB_ID_NULL ? vDwnCutReg[i] : vCutReg[i]) ;
|
||||
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
|
||||
if ( ExeSurfFrChunkSimpleClassify( nDwnCutRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
|
||||
if ( ExeSurfFlatRegionInterference( nDwnCutRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1031,14 +1037,14 @@ ExePackPartCluster( const INTVECTOR& vIds, bool bReducedCut, bool bBottomUp)
|
||||
double dRegClDimY = b3RegCluster.GetMax().y - b3RegCluster.GetMin().y ;
|
||||
Point3d ptOrig = b3RegCluster.GetMin() ;
|
||||
|
||||
// Determino punto più in basso a sinistra del cluster
|
||||
// Determino punto più in basso a sinistra del cluster
|
||||
Point3d ptBL = b3RegCluster.GetMax() ;
|
||||
double dDimBottom = 0 ;
|
||||
for ( int nId : vTrueIds) {
|
||||
// recupero l'approssimazione lineare del contorno del pezzo ( in globale)
|
||||
PolyLine PL ;
|
||||
if ( GetFlatPartApproxContour( pGeomDB, nId, PL)) {
|
||||
// cerco il punto più in basso a sinistra
|
||||
// cerco il punto più in basso a sinistra
|
||||
Point3d ptP ;
|
||||
bool bFound = PL.GetFirstPoint( ptP) ;
|
||||
while ( bFound) {
|
||||
@@ -1163,6 +1169,7 @@ UpdateCollId( double dLen, double dPrevLen, int nId1, int nId2, bool bIsCut1, bo
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Collisione semplice
|
||||
static bool
|
||||
MySurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, SCollInfo& scInfo)
|
||||
{
|
||||
@@ -1170,23 +1177,27 @@ MySurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la prima superficie FlatRegion
|
||||
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
|
||||
bool bOk = ( pSfr1 != nullptr) ;
|
||||
if ( pSfr1 == nullptr)
|
||||
return false ;
|
||||
// recupero il riferimento della superficie
|
||||
Frame3d frSurf1 ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId1, frSurf1) ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId1, frSurf1))
|
||||
return false ;
|
||||
// recupero la seconda superficie FlatRegion
|
||||
const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ;
|
||||
bOk = bOk && ( pSfr2 != nullptr) ;
|
||||
if ( pSfr2 == nullptr)
|
||||
return false ;
|
||||
// recupero il riferimento della superficie
|
||||
Frame3d frSurf2 ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId2, frSurf2) ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId2, frSurf2))
|
||||
return false ;
|
||||
// se riferimenti diversi, porto una copia della seconda nel riferimento della prima
|
||||
const ISurfFlatRegion* pSfr2L = pSfr2 ;
|
||||
PtrOwner<ISurfFlatRegion> pTmp ;
|
||||
if ( ! AreSameFrame( frSurf1, frSurf2)) {
|
||||
pTmp.Set( pSfr2->Clone()) ;
|
||||
bOk = bOk && ! IsNull( pTmp) ;
|
||||
bOk = bOk && pTmp->LocToLoc( frSurf2, frSurf1) ;
|
||||
if ( IsNull( pTmp) || ! pTmp->LocToLoc( frSurf2, frSurf1))
|
||||
return false ;
|
||||
pSfr2L = pTmp ;
|
||||
}
|
||||
// porto in locale alla prima superficie il versore di movimento
|
||||
@@ -1194,21 +1205,71 @@ MySurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double
|
||||
vtDirL.ToLoc( frSurf1) ;
|
||||
// calcolo massima lunghezza di traslazione della prima regione senza semplice collisione con la seconda
|
||||
CAvSimpleSurfFrMove ScdSfrMove( *pSfr1, *pSfr2L) ;
|
||||
bOk = bOk && ScdSfrMove.Translate( vtDirL, dLen) ;
|
||||
if ( bOk) {
|
||||
scInfo = ScdSfrMove.GetSCollInfo() ;
|
||||
if ( scInfo.nType != SCI_NONE) {
|
||||
scInfo.ptP1.ToGlob( frSurf1) ;
|
||||
scInfo.vtDirM.ToGlob( frSurf1) ;
|
||||
scInfo.vtDirF.ToGlob( frSurf1) ;
|
||||
}
|
||||
if ( scInfo.nType == SCI_LINE_LINE)
|
||||
scInfo.ptP2.ToGlob( frSurf1) ;
|
||||
if ( ! ScdSfrMove.Translate( vtDirL, dLen))
|
||||
return false ;
|
||||
scInfo = ScdSfrMove.GetSCollInfo() ;
|
||||
if ( scInfo.nType != SCI_NONE) {
|
||||
scInfo.ptP1.ToGlob( frSurf1) ;
|
||||
scInfo.vtDirM.ToGlob( frSurf1) ;
|
||||
scInfo.vtDirF.ToGlob( frSurf1) ;
|
||||
}
|
||||
return bOk ;
|
||||
if ( scInfo.nType == SCI_LINE_LINE)
|
||||
scInfo.ptP2.ToGlob( frSurf1) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Collisione completa
|
||||
static bool
|
||||
MySurfFrMoveNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, SCollInfo& cInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la prima superficie FlatRegion
|
||||
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
|
||||
if ( pSfr1 == nullptr)
|
||||
return false ;
|
||||
// recupero il riferimento della superficie
|
||||
Frame3d frSurf1 ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId1, frSurf1))
|
||||
return false ;
|
||||
// recupero la seconda superficie FlatRegion
|
||||
const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ;
|
||||
if ( pSfr2 == nullptr)
|
||||
return false ;
|
||||
// recupero il riferimento della superficie
|
||||
Frame3d frSurf2 ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId2, frSurf2))
|
||||
return false ;
|
||||
// se riferimenti diversi, porto una copia della seconda nel riferimento della prima
|
||||
const ISurfFlatRegion* pSfr2L = pSfr2 ;
|
||||
PtrOwner<ISurfFlatRegion> pTmp ;
|
||||
if ( ! AreSameFrame( frSurf1, frSurf2)) {
|
||||
pTmp.Set( pSfr2->Clone()) ;
|
||||
if ( IsNull( pTmp) || ! pTmp->LocToLoc( frSurf2, frSurf1))
|
||||
return false ;
|
||||
pSfr2L = pTmp ;
|
||||
}
|
||||
// porto in locale alla prima superficie il versore di movimento
|
||||
Vector3d vtDirL = vtDir ;
|
||||
vtDirL.ToLoc( frSurf1) ;
|
||||
// calcolo massima lunghezza di traslazione della prima regione senza collisione con la seconda
|
||||
CAvSurfFrMove cdSfrMove( *pSfr1, *pSfr2L) ;
|
||||
if ( ! cdSfrMove.Translate( vtDirL, dLen))
|
||||
return false ;
|
||||
cInfo = cdSfrMove.GetCollInfo() ;
|
||||
if ( cInfo.nType != SCI_NONE) {
|
||||
cInfo.ptP1.ToGlob( frSurf1) ;
|
||||
cInfo.vtDirM.ToGlob( frSurf1) ;
|
||||
cInfo.vtDirF.ToGlob( frSurf1) ;
|
||||
}
|
||||
if ( cInfo.nType == SCI_LINE_LINE)
|
||||
cInfo.ptP2.ToGlob( frSurf1) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Traslazione con CAvSurfFr
|
||||
static bool
|
||||
MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster, bool bReducedCut, Vector3d& vtMove)
|
||||
{
|
||||
@@ -1293,67 +1354,67 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
|
||||
bOk = false ;
|
||||
break ;
|
||||
}
|
||||
// la confronto con il box
|
||||
// la confronto con il box (collisione semplice)
|
||||
MySurfFrMoveSimpleNoCollision( nRegId, nBoxId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nBoxId, false, false, scInfoCurr) ;
|
||||
// la confronto con la regione di riferimento
|
||||
// la confronto con la regione di riferimento (collisione semplice)
|
||||
if ( nRefReg != GDB_ID_NULL) {
|
||||
MySurfFrMoveSimpleNoCollision( nRegId, nRefReg, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nRefReg, false, false, scInfoCurr) ;
|
||||
}
|
||||
// la confronto con le aree danneggiate
|
||||
// la confronto con le aree danneggiate (collisione completa)
|
||||
for ( int nDmgRegId : vDmgReg) {
|
||||
MySurfFrMoveSimpleNoCollision( nRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nDmgRegId, false, false, scInfoCurr) ;
|
||||
}
|
||||
// la confronto con le regioni degli altri pezzi
|
||||
// la confronto con le regioni degli altri pezzi (collisione completa)
|
||||
for ( int nOthRegId : vOthReg) {
|
||||
MySurfFrMoveSimpleNoCollision( nRegId, nOthRegId, vtDir, dLen, scInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nRegId, nOthRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nOthRegId, false, false, scInfoCurr) ;
|
||||
}
|
||||
// e con le regioni dei tagli degli altri pezzi
|
||||
// recupero regione in alto del pezzo
|
||||
// recupero regione in alto del pezzo (collisione completa)
|
||||
int nUpRegId = GetFlatPartUpRegion( pGeomDB, nTrueId) ;
|
||||
int nTestRegId = (( nUpRegId == GDB_ID_NULL) ? nRegId : nUpRegId) ;
|
||||
for ( int nOthCutRegId : vOthCutReg) {
|
||||
MySurfFrMoveSimpleNoCollision( nTestRegId, nOthCutRegId, vtDir, dLen, scInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nTestRegId, nOthCutRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nTestRegId, nOthCutRegId, false, true, scInfoCurr) ;
|
||||
}
|
||||
// -----------------------------------------
|
||||
// recupero regione in basso del pezzo
|
||||
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nTrueId) ;
|
||||
// la confronto con il box
|
||||
// la confronto con il box (collisone semplice)
|
||||
if ( nDwnRegId != GDB_ID_NULL) {
|
||||
MySurfFrMoveSimpleNoCollision( nDwnRegId, nBoxId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nBoxId, false, false, scInfoCurr) ;
|
||||
}
|
||||
// la confronto con la regione di riferimento
|
||||
// la confronto con la regione di riferimento (collisione completa)
|
||||
if ( nDwnRegId != GDB_ID_NULL && nRefReg != GDB_ID_NULL) {
|
||||
MySurfFrMoveSimpleNoCollision( nDwnRegId, nRefReg, vtDir, dLen, scInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nDwnRegId, nRefReg, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nRefReg, false, false, scInfoCurr) ;
|
||||
}
|
||||
// la confronto con le aree danneggiate
|
||||
// la confronto con le aree danneggiate (collisione completa)
|
||||
if ( nDwnRegId != GDB_ID_NULL) {
|
||||
for ( int nDmgRegId : vDmgReg) {
|
||||
MySurfFrMoveSimpleNoCollision( nDwnRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nDwnRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nDmgRegId, false, false, scInfoCurr) ;
|
||||
}
|
||||
}
|
||||
// la confronto con le regioni in basso degli altri pezzi
|
||||
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
|
||||
// la confronto con le regioni in basso degli altri pezzi (collisione completa)
|
||||
for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
|
||||
if ( nDwnRegId != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
|
||||
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
|
||||
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
|
||||
MySurfFrMoveSimpleNoCollision( nTmpDwnRegId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nTmpDwnRegId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnRegId, false, false, scInfoCurr) ;
|
||||
}
|
||||
}
|
||||
// e con le regioni in basso dei tagli degli altri pezzi
|
||||
for ( size_t j = 0 ; j < vOthDwnCutReg.size() ; ++ j) {
|
||||
// e con le regioni in basso dei tagli degli altri pezzi (collisione completa)
|
||||
for ( int j = 0 ; j < ssize( vOthDwnCutReg) ; ++ j) {
|
||||
if ( nDwnRegId != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
|
||||
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
|
||||
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
|
||||
MySurfFrMoveSimpleNoCollision( nTmpDwnRegId, nOthDwnCutRegId, vtDir, dLen, scInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nTmpDwnRegId, nOthDwnCutRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnCutRegId, false, true, scInfoCurr) ;
|
||||
}
|
||||
}
|
||||
@@ -1364,11 +1425,11 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
|
||||
bOk = false ;
|
||||
break ;
|
||||
}
|
||||
// le confronto con le regioni degli altri pezzi
|
||||
// le confronto con le regioni degli altri pezzi (collisione completa)
|
||||
for ( int nCrId : vCrId) {
|
||||
for ( size_t k = 0 ; k < vOthReg.size() ; ++ k) {
|
||||
for ( int k = 0 ; k < ssize( vOthReg) ; ++ k) {
|
||||
int nOthRegId = ( vOthUpReg[k] == GDB_ID_NULL ? vOthReg[k] : vOthUpReg[k]) ;
|
||||
MySurfFrMoveSimpleNoCollision( nCrId, nOthRegId, vtDir, dLen, scInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nCrId, nOthRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nCrId, nOthRegId, true, false, scInfoCurr) ;
|
||||
}
|
||||
}
|
||||
@@ -1379,13 +1440,13 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
|
||||
bOk = false ;
|
||||
break ;
|
||||
}
|
||||
// le confronto con le regioni in basso degli altri pezzi
|
||||
for ( size_t j = 0 ; j < vDwnCrId.size() ; ++ j) {
|
||||
for ( size_t k = 0 ; k < vOthDwnReg.size() ; ++ k) {
|
||||
// le confronto con le regioni in basso degli altri pezzi (collisione completa)
|
||||
for ( int j = 0 ; j < ssize( vDwnCrId) ; ++ j) {
|
||||
for ( int k = 0 ; k < ssize( vOthDwnReg) ; ++ k) {
|
||||
if ( vDwnCrId[j] != GDB_ID_NULL || vOthDwnReg[k] != GDB_ID_NULL) {
|
||||
int nTmpDwnCrId = ( vDwnCrId[j] != GDB_ID_NULL ? vDwnCrId[j] : vCrId[j]) ;
|
||||
int nOthDwnRegId = ( vOthDwnReg[k] != GDB_ID_NULL ? vOthDwnReg[k] : vOthReg[k]) ;
|
||||
MySurfFrMoveSimpleNoCollision( nTmpDwnCrId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
|
||||
MySurfFrMoveNoCollision( nTmpDwnCrId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnCrId, nOthDwnRegId, true, false, scInfoCurr) ;
|
||||
}
|
||||
}
|
||||
@@ -1419,7 +1480,7 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
|
||||
}
|
||||
}
|
||||
|
||||
// Se movimento risultante nullo, non faccio alcunché
|
||||
// Se movimento risultante nullo, non faccio alcunché
|
||||
vtMoveXY = vtDir * dLen ;
|
||||
if ( vtMoveXY.IsSmall())
|
||||
return true ;
|
||||
@@ -1464,7 +1525,7 @@ ExeMovePartCluster( const INTVECTOR& vIds, bool bReducedCut, Vector3d& vtMove)
|
||||
vtMove = vtM ;
|
||||
return true ;
|
||||
}
|
||||
// altrimenti, riprovo con tagli standard
|
||||
// altrimenti, riprovo con tagli standard
|
||||
else {
|
||||
// annullo il movimento
|
||||
for ( int nId : vTrueIds)
|
||||
@@ -1475,7 +1536,50 @@ ExeMovePartCluster( const INTVECTOR& vIds, bool bReducedCut, Vector3d& vtMove)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
MySurfFrRotateNoCollision( int nId1, int nId2, const Point3d& ptCen, double& dAngDeg, SCollInfo& cInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la prima superficie FlatRegion
|
||||
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
|
||||
if ( pSfr1 == nullptr)
|
||||
return false ;
|
||||
// recupero il riferimento della superficie
|
||||
Frame3d frSurf1 ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId1, frSurf1))
|
||||
return false ;
|
||||
// recupero la seconda superficie FlatRegion
|
||||
const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ;
|
||||
if ( pSfr2 == nullptr)
|
||||
return false ;
|
||||
// recupero il riferimento della superficie
|
||||
Frame3d frSurf2 ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId2, frSurf2))
|
||||
return false ;
|
||||
// se riferimenti diversi, porto una copia della seconda nel riferimento della prima
|
||||
const ISurfFlatRegion* pSfr2L = pSfr2 ;
|
||||
PtrOwner<ISurfFlatRegion> pTmp ;
|
||||
if ( ! AreSameFrame( frSurf1, frSurf2)) {
|
||||
pTmp.Set( pSfr2->Clone()) ;
|
||||
if ( IsNull( pTmp) || ! pTmp->LocToLoc( frSurf2, frSurf1))
|
||||
return false ;
|
||||
pSfr2L = pTmp ;
|
||||
}
|
||||
// porto in locale alla prima superficie il punto di rotazione
|
||||
Point3d ptCenL = ptCen ;
|
||||
ptCenL.ToLoc( frSurf1) ;
|
||||
// calcolo massima lunghezza di traslazione della prima regione senza collisione con la seconda
|
||||
CAvSurfFrMove cdSfrMove( *pSfr1, *pSfr2L) ;
|
||||
if ( ! cdSfrMove.Rotate( ptCenL, dAngDeg))
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Rotazione con CAvSurfFr
|
||||
bool
|
||||
MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Cluster, bool bReducedCut,
|
||||
const Point3d& ptCen, double& dRotAngDeg)
|
||||
@@ -1553,21 +1657,21 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
bOk = false ;
|
||||
break ;
|
||||
}
|
||||
// la confronto con il box
|
||||
// la confronto con il box (collisione semplice)
|
||||
ExeSurfFrRotateSimpleNoCollision( nRegId, nBoxId, ptCen, dAng, RTY_GLOB) ;
|
||||
// la confronto con la regione di riferimento
|
||||
// la confronto con la regione di riferimento (collisione semplice)
|
||||
if ( nRefReg != GDB_ID_NULL) {
|
||||
ExeSurfFrRotateSimpleNoCollision( nRegId, nRefReg, ptCen, dAng, RTY_GLOB) ;
|
||||
}
|
||||
// la confronto con le aree danneggiate
|
||||
// la confronto con le aree danneggiate (collisione completa)
|
||||
for ( int nDmgRegId : vDmgReg) {
|
||||
ExeSurfFrRotateSimpleNoCollision( nRegId, nDmgRegId, ptCen, dAng, RTY_GLOB) ;
|
||||
MySurfFrRotateNoCollision( nRegId, nDmgRegId, ptCen, dAng, s_scInfo) ;
|
||||
}
|
||||
// la confronto con le regioni degli altri pezzi
|
||||
// la confronto con le regioni degli altri pezzi (collisione completa)
|
||||
for ( int nOthRegId : vOthReg) {
|
||||
ExeSurfFrRotateSimpleNoCollision( nRegId, nOthRegId, ptCen, dAng, RTY_GLOB) ;
|
||||
MySurfFrRotateNoCollision( nRegId, nOthRegId, ptCen, dAng, s_scInfo) ;
|
||||
}
|
||||
// e con le regioni dei tagli degli altri pezzi
|
||||
// e con le regioni dei tagli degli altri pezzi (collisione completa)
|
||||
// recupero regione in alto del pezzo
|
||||
int nUpRegId = GetFlatPartUpRegion( pGeomDB, nTrueId) ;
|
||||
int nTestRegId = (( nUpRegId == GDB_ID_NULL) ? nRegId : nUpRegId) ;
|
||||
@@ -1577,33 +1681,33 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
// -----------------------------------------
|
||||
// recupero regione in basso del pezzo
|
||||
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nTrueId) ;
|
||||
// la confronto con il box
|
||||
// la confronto con il box (collisione semplice)
|
||||
if ( nDwnRegId != GDB_ID_NULL)
|
||||
ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nBoxId, ptCen, dAng, RTY_GLOB) ;
|
||||
// la confronto con la regione di riferimento
|
||||
// la confronto con la regione di riferimento (collisione semplice)
|
||||
if ( nRefReg != GDB_ID_NULL) {
|
||||
ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nRefReg, ptCen, dAng, RTY_GLOB) ;
|
||||
}
|
||||
// la confronto con le aree danneggiate
|
||||
// la confronto con le aree danneggiate (collisione completa)
|
||||
if ( nDwnRegId != GDB_ID_NULL) {
|
||||
for ( int nDmgRegId : vDmgReg) {
|
||||
ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nDmgRegId, ptCen, dAng, RTY_GLOB) ;
|
||||
MySurfFrRotateNoCollision( nDwnRegId, nDmgRegId, ptCen, dAng, s_scInfo) ;
|
||||
}
|
||||
}
|
||||
// la confronto con le regioni in basso degli altri pezzi
|
||||
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
|
||||
// la confronto con le regioni in basso degli altri pezzi (collisione completa)
|
||||
for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
|
||||
if ( nDwnRegId != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
|
||||
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
|
||||
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
|
||||
ExeSurfFrRotateSimpleNoCollision( nTmpDwnRegId, nOthDwnRegId, ptCen, dAng, RTY_GLOB) ;
|
||||
MySurfFrRotateNoCollision( nTmpDwnRegId, nOthDwnRegId, ptCen, dAng, s_scInfo) ;
|
||||
}
|
||||
}
|
||||
// e con le regioni in basso dei tagli degli altri pezzi
|
||||
for ( size_t j = 0 ; j < vOthDwnCutReg.size() ; ++ j) {
|
||||
// e con le regioni in basso dei tagli degli altri pezzi (collisione completa)
|
||||
for ( int j = 0 ; j < ssize( vOthDwnCutReg) ; ++ j) {
|
||||
if ( nDwnRegId != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
|
||||
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
|
||||
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
|
||||
ExeSurfFrRotateSimpleNoCollision( nTmpDwnRegId, nOthDwnCutRegId, ptCen, dAng, RTY_GLOB) ;
|
||||
MySurfFrRotateNoCollision( nTmpDwnRegId, nOthDwnCutRegId, ptCen, dAng, s_scInfo) ;
|
||||
}
|
||||
}
|
||||
// -----------------------------------------
|
||||
@@ -1613,11 +1717,11 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
bOk = false ;
|
||||
break ;
|
||||
}
|
||||
// le confronto con le regioni degli altri pezzi
|
||||
// le confronto con le regioni degli altri pezzi (collisione completa)
|
||||
for ( int nCrId : vCrId) {
|
||||
for ( size_t k = 0 ; k < vOthReg.size() ; ++ k) {
|
||||
for ( int k = 0 ; k < ssize( vOthReg) ; ++ k) {
|
||||
int nOthRegId = ( vOthUpReg[k] == GDB_ID_NULL ? vOthReg[k] : vOthUpReg[k]) ;
|
||||
ExeSurfFrRotateSimpleNoCollision( nCrId, nOthRegId, ptCen, dAng, RTY_GLOB) ;
|
||||
MySurfFrRotateNoCollision( nCrId, nOthRegId, ptCen, dAng, s_scInfo) ;
|
||||
}
|
||||
}
|
||||
// -----------------------------------------
|
||||
@@ -1627,13 +1731,13 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
bOk = false ;
|
||||
break ;
|
||||
}
|
||||
// le confronto con le regioni in basso degli altri pezzi
|
||||
for ( size_t j = 0 ; j < vDwnCrId.size() ; ++ j) {
|
||||
for ( size_t k = 0 ; k < vOthDwnReg.size() ; ++ k) {
|
||||
// le confronto con le regioni in basso degli altri pezzi (collisione completa)
|
||||
for ( int j = 0 ; j < ssize( vDwnCrId) ; ++ j) {
|
||||
for ( int k = 0 ; k < ssize( vOthDwnReg) ; ++ k) {
|
||||
if ( vDwnCrId[j] != GDB_ID_NULL || vOthDwnReg[k] != GDB_ID_NULL) {
|
||||
int nTmpDwnCrId = ( vDwnCrId[j] != GDB_ID_NULL ? vDwnCrId[j] : vCrId[j]) ;
|
||||
int nOthDwnRegId = ( vOthDwnReg[k] != GDB_ID_NULL ? vOthDwnReg[k] : vOthReg[k]) ;
|
||||
ExeSurfFrRotateSimpleNoCollision( nTmpDwnCrId, nOthDwnRegId, ptCen, dAng, RTY_GLOB) ;
|
||||
MySurfFrRotateNoCollision( nTmpDwnCrId, nOthDwnRegId, ptCen, dAng, s_scInfo) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1643,7 +1747,7 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
if ( ! bOk)
|
||||
return false ;
|
||||
|
||||
// Se movimento risultante nullo, non faccio alcunché
|
||||
// Se movimento risultante nullo, non faccio alcunché
|
||||
dRotAngDeg = dAng ;
|
||||
if ( abs( dAng) < EPS_ANG_SMALL)
|
||||
return true ;
|
||||
@@ -1686,7 +1790,7 @@ GetObstacleTangent( Vector3d& vtTang)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
GetMovingTangent( Vector3d& vtTang)
|
||||
GetMovingTangent( Vector3d& vtTang)
|
||||
{
|
||||
if ( s_scInfo.nType != SCI_LINE_PNT && s_scInfo.nType != SCI_LINE_LINE)
|
||||
return false ;
|
||||
@@ -1733,7 +1837,7 @@ ExeAlignPartClusterOnCollision( const INTVECTOR& vIds, bool bReducedCut, bool& b
|
||||
Point3d ptCntL = s_scInfo.ptP1 ;
|
||||
ptCntL.ToLoc( frSfr) ;
|
||||
// cerco le direzioni tangenti prima e dopo il punto di contatto sulle parti mobili
|
||||
PtrOwner<ICurve> pCrv( pSfr->GetLoop( s_scInfo.nChunkM, 0)) ;
|
||||
PtrOwner<ICurve> pCrv( pSfr->GetLoop( s_scInfo.nChunkM, s_scInfo.nLoopM)) ;
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
double dU ;
|
||||
@@ -1760,7 +1864,7 @@ ExeAlignPartClusterOnCollision( const INTVECTOR& vIds, bool bReducedCut, bool& b
|
||||
string sOut = "vtTp=(" + ToString( vtTp) + ") vtTn=(" + ToString( vtTn) + ")" ;
|
||||
LOG_INFO( GetLogger(), sOut.c_str()) ;
|
||||
}
|
||||
// ruoto dalla parte dell'angolo più piccolo (componente più grande)
|
||||
// ruoto dalla parte dell'angolo più piccolo (componente più grande)
|
||||
double dRotAngDeg = ( abs( vtTp * s_scInfo.vtDirF) > abs( vtTn * s_scInfo.vtDirF)) ? 90 : - 90 ;
|
||||
// provo a ruotare sul punto di collisione in senso orario
|
||||
Point3d ptCen = s_scInfo.ptP1 ;
|
||||
@@ -1784,6 +1888,7 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
|
||||
// cerco i due tagli in collisione
|
||||
int nCutM = GDB_ID_NULL ;
|
||||
int nGeoM = GDB_ID_NULL ;
|
||||
INTVECTOR vnGeoM, vnGeoF ;
|
||||
Point3d ptStartM, ptEndM ;
|
||||
Vector3d vtDirM ;
|
||||
Frame3d frGeoM ;
|
||||
@@ -1792,13 +1897,38 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
|
||||
Point3d ptStartF, ptEndF ;
|
||||
Vector3d vtDirF ;
|
||||
Frame3d frGeoF ;
|
||||
// se mobile è già un taglio, ne ricavo i dati
|
||||
// se mobile è già un taglio, ne ricavo i dati
|
||||
if ( s_scInfo.bIsCutM) {
|
||||
if ( s_scInfo.nIdM == GDB_ID_NULL)
|
||||
return false ;
|
||||
nCutM = s_scInfo.nIdM ;
|
||||
nGeoM = GetGeometryFromCut( pGeomDB, pMachMgr, nCutM) ;
|
||||
ICurveLine* pLineM = GetCurveLine( pGeomDB->GetGeoObj( nGeoM)) ;
|
||||
if ( nCutM == GDB_ID_NULL || nGeoM == GDB_ID_NULL ||
|
||||
pLineM == nullptr || ! pGeomDB->GetGlobFrame( nGeoM, frGeoM))
|
||||
vnGeoM = GetGeometryFromCut( pGeomDB, pMachMgr, nCutM) ;
|
||||
if ( vnGeoM.empty())
|
||||
return false ;
|
||||
ICurveLine* pLineM = nullptr ;
|
||||
// se ho un solo taglio, allora è quello
|
||||
if ( ssize( vnGeoM) == 1) {
|
||||
pLineM = GetCurveLine( pGeomDB->GetGeoObj( vnGeoM[0])) ;
|
||||
nGeoM = vnGeoM[0] ;
|
||||
}
|
||||
// se più tagli, cerco quello più vicino alla linea corrente
|
||||
else {
|
||||
double dMinSqDist = INFINITO ;
|
||||
for ( int i = 0 ; i < ssize( vnGeoM) ; ++ i) {
|
||||
Frame3d frCurrGeoM ;
|
||||
ICurveLine* pCurrLineM = GetCurveLine( pGeomDB->GetGeoObj( vnGeoM[i])) ;
|
||||
if ( pCurrLineM == nullptr || ! pGeomDB->GetGlobFrame( vnGeoM[i], frCurrGeoM))
|
||||
return false ;
|
||||
double dCurrSqDist ;
|
||||
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeoM), *pCurrLineM).GetSqDist( dCurrSqDist) ;
|
||||
if ( dCurrSqDist < dMinSqDist) {
|
||||
dMinSqDist = dCurrSqDist ;
|
||||
pLineM = pCurrLineM ;
|
||||
nGeoM = vnGeoM[i] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( pLineM == nullptr || ! pGeomDB->GetGlobFrame( nGeoM, frGeoM))
|
||||
return false ;
|
||||
ptStartM = pLineM->GetStart() ;
|
||||
ptStartM.ToGlob( frGeoM) ;
|
||||
@@ -1807,13 +1937,36 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
|
||||
vtDirM = ptEndM - ptStartM ;
|
||||
vtDirM.Normalize() ;
|
||||
}
|
||||
// se fisso è già un taglio, ne ricavo i dati
|
||||
// se fisso è già un taglio, ne ricavo i dati
|
||||
if ( s_scInfo.bIsCutF) {
|
||||
if ( s_scInfo.nChunkF == GDB_ID_NULL)
|
||||
return false ;
|
||||
nCutF = s_scInfo.nIdF ;
|
||||
nGeoF = GetGeometryFromCut( pGeomDB, pMachMgr, nCutF) ;
|
||||
vnGeoF = GetGeometryFromCut( pGeomDB, pMachMgr, nCutF) ;
|
||||
ICurveLine* pLineF = GetCurveLine( pGeomDB->GetGeoObj( nGeoF)) ;
|
||||
if ( nCutF == GDB_ID_NULL || nGeoF == GDB_ID_NULL ||
|
||||
pLineF == nullptr || ! pGeomDB->GetGlobFrame( nGeoF, frGeoF))
|
||||
// se ho un solo taglio, allora è quello
|
||||
if ( ssize( vnGeoF) == 1) {
|
||||
pLineF = GetCurveLine( pGeomDB->GetGeoObj( vnGeoF[0])) ;
|
||||
nGeoF = vnGeoF[0] ;
|
||||
}
|
||||
// se più tagli, cerco quello più vicino alla linea corrente
|
||||
else {
|
||||
double dMinSqDist = INFINITO ;
|
||||
for ( int i = 0 ; i < ssize( vnGeoF) ; ++ i) {
|
||||
Frame3d frCurrGeoF ;
|
||||
ICurveLine* pCurrLineF = GetCurveLine( pGeomDB->GetGeoObj( vnGeoF[i])) ;
|
||||
if ( pCurrLineF == nullptr || ! pGeomDB->GetGlobFrame( vnGeoF[i], frCurrGeoF))
|
||||
return false ;
|
||||
double dCurrSqDist ;
|
||||
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeoF), *pCurrLineF).GetSqDist( dCurrSqDist) ;
|
||||
if ( dCurrSqDist < dMinSqDist) {
|
||||
dMinSqDist = dCurrSqDist ;
|
||||
pLineF = pCurrLineF ;
|
||||
nGeoF = vnGeoF[i] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( pLineF == nullptr || ! pGeomDB->GetGlobFrame( nGeoF, frGeoF))
|
||||
return false ;
|
||||
ptStartF = pLineF->GetStart() ;
|
||||
ptStartF.ToGlob( frGeoF) ;
|
||||
@@ -1838,8 +1991,31 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
|
||||
BBox3d b3Temp ;
|
||||
pGeomDB->GetGlobalBBox( nId, b3Temp) ;
|
||||
if ( b3Temp.OverlapsXY( b3CutM)) {
|
||||
int nGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ;
|
||||
ICurveLine* pLine = GetCurveLine( pGeomDB->GetGeoObj( nGeom)) ;
|
||||
int nGeom = GDB_ID_NULL ;
|
||||
INTVECTOR vnGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ;
|
||||
ICurveLine* pLine = nullptr ;
|
||||
// se ho un solo taglio, allora è quello
|
||||
if ( ssize( vnGeom) == 1) {
|
||||
pLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[0])) ;
|
||||
nGeom = vnGeom[0] ;
|
||||
}
|
||||
// se ho più tagli, cerco quello più vicino alla linea corrente
|
||||
else {
|
||||
double dMinSqDist = INFINITO ;
|
||||
for ( int i = 0 ; i < ssize( vnGeom) ; ++ i) {
|
||||
Frame3d frCurrGeo ;
|
||||
ICurveLine* pCurrLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[i])) ;
|
||||
if ( pCurrLine == nullptr || ! pGeomDB->GetGlobFrame( vnGeom[i], frCurrGeo))
|
||||
return false ;
|
||||
double dCurrSqDist ;
|
||||
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeo), *pCurrLine).GetSqDist( dCurrSqDist) ;
|
||||
if ( dCurrSqDist < dMinSqDist) {
|
||||
dMinSqDist = dCurrSqDist ;
|
||||
pLine = pCurrLine ;
|
||||
nGeom = vnGeom[i] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( nGeom == GDB_ID_NULL || pLine == nullptr || ! pGeomDB->GetGlobFrame( nGeom, frGeoF))
|
||||
continue ;
|
||||
ptStartF = pLine->GetStart() ;
|
||||
@@ -1872,8 +2048,31 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
|
||||
BBox3d b3Temp ;
|
||||
pGeomDB->GetGlobalBBox( nId, b3Temp) ;
|
||||
if ( b3Temp.OverlapsXY( b3CutF)) {
|
||||
int nGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ;
|
||||
ICurveLine* pLine = GetCurveLine( pGeomDB->GetGeoObj( nGeom)) ;
|
||||
int nGeom = GDB_ID_NULL ;
|
||||
INTVECTOR vnGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ;
|
||||
ICurveLine* pLine = nullptr ;
|
||||
// se ho un solo taglio, allora è quello
|
||||
if ( ssize( vnGeom) == 1) {
|
||||
pLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[0])) ;
|
||||
nGeom = vnGeom[0] ;
|
||||
}
|
||||
// se ho più tagli, cerco quello più vicino alla linea corrente
|
||||
else {
|
||||
double dMinSqDist = INFINITO ;
|
||||
for ( int i = 0 ; i < ssize( vnGeom) ; ++ i) {
|
||||
Frame3d frCurrGeo ;
|
||||
ICurveLine* pCurrLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[0])) ;
|
||||
if ( pCurrLine == nullptr || ! pGeomDB->GetGlobFrame( vnGeom[i], frCurrGeo))
|
||||
return false ;
|
||||
double dCurrSqDist ;
|
||||
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeo), *pCurrLine).GetSqDist( dCurrSqDist) ;
|
||||
if ( dCurrSqDist < dMinSqDist) {
|
||||
dMinSqDist = dCurrSqDist ;
|
||||
pLine = pCurrLine ;
|
||||
nGeom = vnGeom[i] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( nGeom == GDB_ID_NULL || pLine == nullptr || ! pGeomDB->GetGlobFrame( nGeom, frGeoM))
|
||||
continue ;
|
||||
ptStartM = pLine->GetStart() ;
|
||||
@@ -1950,9 +2149,9 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
|
||||
dMoveMn = CrossXY( ptStartF - ptEndM, vtDirFp) / dDenom ;
|
||||
}
|
||||
}
|
||||
// pareggio la parte più vicina, se almeno una sotto soglia
|
||||
// pareggio la parte più vicina, se almeno una sotto soglia
|
||||
if ( abs( dMoveMp) < dMaxMove || abs( dMoveMn) < dMaxMove) {
|
||||
// calcolo movimento necessario, se nullo già a posto
|
||||
// calcolo movimento necessario, se nullo già a posto
|
||||
Vector3d vtMove = (( abs( dMoveMp) < abs( dMoveMn)) ? dMoveMp : dMoveMn) * vtDirF ;
|
||||
if ( vtMove.IsSmall()) {
|
||||
bMoved = false ;
|
||||
@@ -1977,7 +2176,7 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
|
||||
pGeomDB->GetRefBBox( nCutM, frCutF, b3CutM) ;
|
||||
double dStartDelta = b3CutF.GetMin().x - b3CutM.GetMin().x ;
|
||||
double dEndDelta = b3CutF.GetMax().x - b3CutM.GetMax().x ;
|
||||
// pareggio la parte più vicina, se sotto soglia
|
||||
// pareggio la parte più vicina, se sotto soglia
|
||||
if ( abs( dStartDelta) > dMaxMove && abs( dEndDelta) > dMaxMove)
|
||||
return false ;
|
||||
Vector3d vtMove = (( abs( dStartDelta) < abs( dEndDelta)) ? dStartDelta : dEndDelta) * vtDirF ;
|
||||
@@ -2079,7 +2278,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
|
||||
// Avvio nesting automatico
|
||||
ExeAutoNestStart() ;
|
||||
|
||||
// Modalità ghigliottina incompatibile con tagli completi
|
||||
// Modalità ghigliottina incompatibile con tagli completi
|
||||
if ( ! bReducedCut)
|
||||
bGuillotineMode = false ;
|
||||
|
||||
@@ -2102,11 +2301,11 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
|
||||
nDamId = pGeomDB->GetNextName( nDamId, NST_DAMAGED_REG) ;
|
||||
}
|
||||
|
||||
// Modalità ghigliottina incompatibile con pannelli non rettangolari
|
||||
// Modalità ghigliottina incompatibile con pannelli non rettangolari
|
||||
if ( ! bIsRect)
|
||||
bGuillotineMode = false ;
|
||||
|
||||
// Assegno le aree occupate dai pezzi già nestati
|
||||
// Assegno le aree occupate dai pezzi già nestati
|
||||
bool bPartAlreadyNested = false ;
|
||||
BBox3d b3Sheet ;
|
||||
pGeomDB->GetGlobalBBox( nRefReg, b3Sheet) ;
|
||||
@@ -2132,18 +2331,18 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
|
||||
GetFlatPartDownCutRegions( pGeomDB, nId, bReducedCut, vCutReg) ;
|
||||
for ( int nRegId : vCutReg)
|
||||
ExeAutoNestAddDefectToSheet( nSheetId, nRegId) ;
|
||||
// dichiaro ci sono pezzi già nestati
|
||||
// dichiaro ci sono pezzi già nestati
|
||||
bPartAlreadyNested = true ;
|
||||
}
|
||||
}
|
||||
nId = ( bInRoot ? ExeGetNextPart( nId, true) : ExeGetNextGroup( nId)) ;
|
||||
}
|
||||
|
||||
// Pezzi già nestati incompatibili con ghigliottina
|
||||
// Pezzi già nestati incompatibili con ghigliottina
|
||||
if ( bPartAlreadyNested)
|
||||
bGuillotineMode = false ;
|
||||
|
||||
// Se richiesta modalità ghigliottina
|
||||
// Se richiesta modalità ghigliottina
|
||||
if ( bGuillotineMode) {
|
||||
// cerco il gap necessario tra le parti
|
||||
double dGap = 0 ;
|
||||
@@ -2153,7 +2352,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
|
||||
if ( GetFlatPartInterpartGap( pGeomDB, nPartId, dCurrGap) && dCurrGap > dGap)
|
||||
dGap = dCurrGap ;
|
||||
}
|
||||
// se non trovato disabilito richiesta modalità ghigliottina
|
||||
// se non trovato disabilito richiesta modalità ghigliottina
|
||||
if ( dGap < EPS_SMALL)
|
||||
bGuillotineMode = false ;
|
||||
// altrimenti lo imposto
|
||||
@@ -2161,7 +2360,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
|
||||
ExeAutoNestSetInterpartGap( dGap) ;
|
||||
}
|
||||
|
||||
// Se richiesto e abilitato, imposto modalità ghigliottina
|
||||
// Se richiesto e abilitato, imposto modalità ghigliottina
|
||||
if ( bGuillotineMode)
|
||||
ExeAutoNestSetGuillotineMode() ;
|
||||
|
||||
@@ -2177,7 +2376,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
|
||||
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nPartId) ;
|
||||
if ( nDwnRegId != GDB_ID_NULL)
|
||||
ExeAutoNestAddAnotherOutlineToPart( nPartId, nDwnRegId) ;
|
||||
// se non è ghigliottina imposto le regioni dei tagli (con ghigliottina si usa il gap)
|
||||
// se non è ghigliottina imposto le regioni dei tagli (con ghigliottina si usa il gap)
|
||||
if ( ! bGuillotineMode) {
|
||||
// recupero regioni dei tagli del pezzo
|
||||
INTVECTOR vCutReg ;
|
||||
|
||||
+1713
File diff suppressed because it is too large
Load Diff
+216
-9
@@ -16,10 +16,14 @@
|
||||
#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 ;
|
||||
|
||||
@@ -109,12 +113,12 @@ ExeSetLineAttribs( int nWidth)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetMarkAttribs( Color MarkCol)
|
||||
ExeSetMarkAttribs( Color MarkCol, Color Mark2Col)
|
||||
{
|
||||
IEGrScene* pScene = GetCurrScene() ;
|
||||
VERIFY_SCENE( pScene, false)
|
||||
// imposto il colore del Mark
|
||||
return pScene->SetMark( MarkCol) ;
|
||||
return ( pScene->SetMark( MarkCol) && pScene->SetMark2( Mark2Col)) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -210,6 +214,31 @@ 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)
|
||||
@@ -228,6 +257,7 @@ ExeDraw( void)
|
||||
// se interfaccia disabilitata, esco subito
|
||||
if ( ! ExeGetEnableUI())
|
||||
return true ;
|
||||
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, false)
|
||||
// eseguo disegno
|
||||
@@ -237,6 +267,21 @@ ExeDraw( void)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRedraw( void)
|
||||
{
|
||||
// se interfaccia disabilitata, esco subito
|
||||
if ( ! ExeGetEnableUI())
|
||||
return true ;
|
||||
|
||||
IEGrScene* pScene = GetCurrScene() ;
|
||||
VERIFY_SCENE( pScene, false)
|
||||
// forzo ridisegno
|
||||
pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSelect( int nWinX, int nWinY, int nSelW, int nSelH, int* pnSel)
|
||||
@@ -430,17 +475,44 @@ 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)
|
||||
// imposto stato
|
||||
pScene->SetShowTriaAdvanced( bAdvanced) ;
|
||||
// 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 ;
|
||||
}
|
||||
if ( bRedraw)
|
||||
pScene->RedrawWindow() ;
|
||||
return TRUE ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -453,17 +525,50 @@ 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)
|
||||
// imposto stato
|
||||
pScene->SetShowZmap( nMode) ;
|
||||
// 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 ;
|
||||
}
|
||||
if ( bRedraw)
|
||||
pScene->RedrawWindow() ;
|
||||
return TRUE ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -471,7 +576,7 @@ int
|
||||
ExeGetShowZmap( void)
|
||||
{
|
||||
IEGrScene* pScene = GetCurrScene() ;
|
||||
VERIFY_SCENE( pScene, false)
|
||||
VERIFY_SCENE( pScene, -1)
|
||||
// recupero lo stato
|
||||
return pScene->GetShowZmap() ;
|
||||
}
|
||||
@@ -493,6 +598,10 @@ 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)
|
||||
|
||||
@@ -653,6 +762,10 @@ ExeSetViewOrizzOffsStep( int 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
|
||||
@@ -887,3 +1000,97 @@ 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 = ( s_nDriver == 1 ? 512 : 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() ;
|
||||
if ( ! pGseCtx->m_pScene->GetImage( s_nShowMode, s_colBackTop, s_colBackBottom, s_nWidth, s_nHeight, s_sImageFile))
|
||||
s_nContext = -s_nContext ;
|
||||
MyResetGroupObjGraphics( pGseCtx->m_pGeomDB, GDB_ID_ROOT) ;
|
||||
EndDialog( hwndDlg, wParam) ;
|
||||
}
|
||||
else {
|
||||
s_nContext = 0 ;
|
||||
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( abs( s_nContext)) ;
|
||||
if ( pGseCtx != nullptr) {
|
||||
delete pGseCtx->m_pScene ;
|
||||
pGseCtx->m_pScene = nullptr ;
|
||||
}
|
||||
s_nContext = 0 ;
|
||||
return bOk ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ MyTestSpheSurfTm( const Point3d& ptCen, double dR, int nSurfTmId, double dSafeDi
|
||||
return -1 ;
|
||||
// porto in locale alla superficie il centro della sfera
|
||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ;
|
||||
// verifico l'a collisione'interferenza
|
||||
// verifico l'interferenza
|
||||
return ( TestSpheSurfTm( ptCenL, dR, *pStm, dSafeDist) ? 1 : 0) ;
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ ExeTestSpheSurface( const Point3d& ptCen, double dR, int nSurfId, double dSafeDi
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
MyTestSurfTmSurfTm( int nSurfTm1Id, int nSurfTm2Id, double dSafeDist)
|
||||
MyTestSurfTmSurfTm( int nSurfTm1Id, int nSurfTm2Id, double dSafeDist, bool bTestEnclosion)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, -1)
|
||||
@@ -288,26 +288,27 @@ MyTestSurfTmSurfTm( int nSurfTm1Id, int nSurfTm2Id, double dSafeDist)
|
||||
const ISurfTriMesh* pStm2 = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTm2Id)) ;
|
||||
if ( pStm2 == nullptr)
|
||||
return -1 ;
|
||||
// verifico l'a collisione'interferenza
|
||||
return ( TestSurfTmSurfTm( *pStm1, *pStm2, dSafeDist) ? 1 : 0) ;
|
||||
// verifico l'interferenza
|
||||
return ( TestSurfTmSurfTm( *pStm1, *pStm2, dSafeDist, bTestEnclosion) ? 1 : 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeTestSurfaceSurface( int nSurf1Id, int nSurf2Id, double dSafeDist)
|
||||
ExeTestSurfaceSurface( int nSurf1Id, int nSurf2Id, double dSafeDist, bool bTestEnclosion)
|
||||
{
|
||||
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
|
||||
nRes = MyTestSurfTmSurfTm( nSurf1Id, nSurf2Id, dSafeDist, bTestEnclosion) ;
|
||||
// è 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) + ")" +
|
||||
ToString( dSafeDist) + "," +
|
||||
( bTestEnclosion ? "true" : "false") + ")" +
|
||||
" -- Res=" + ToString( nRes) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,898 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2025-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_Trimming.cpp Data : 25.10.25 Versione : 2.7j3
|
||||
// Funzioni per le lavorazioni di Trimming.
|
||||
//
|
||||
// Modifiche : 23.10.25 RE Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "DllExchange.h"
|
||||
#include "GeoTools.h"
|
||||
#include "AuxTools.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EGkSurfLocal.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkTrimming.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include <unordered_map>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTrimmingGetHoleBorder( int nParentId, const INTVECTOR& vSurfIds, const INTVECTOR& vOtherSurfIds,
|
||||
double dSurfLinTol, double dSurfAngTol, double dEdgeLinTol, double dEdgeAngTol,
|
||||
double dEdgeThick, int& nFirstId, int& nCount)
|
||||
{
|
||||
// Verifica database geometrico
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
|
||||
// Inizializzo i valori di ritorno
|
||||
nFirstId = GDB_ID_NULL ;
|
||||
nCount = 0 ;
|
||||
|
||||
// Se non ho geometrie da ricercare, non faccio nulla
|
||||
if ( vSurfIds.empty())
|
||||
return true ;
|
||||
|
||||
// Recupero le superfici da cui estrarre i bordi
|
||||
CISURFPVECTOR vpSurfs ; vpSurfs.reserve( vSurfIds.size()) ;
|
||||
for ( int i = 0 ; i < ssize( vSurfIds) ; ++ i) {
|
||||
int nSurfId = vSurfIds[i] ;
|
||||
// Recupero l'entità
|
||||
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nSurfId) ;
|
||||
if ( pGeoObj != nullptr) {
|
||||
// Recupero il Tipo
|
||||
int nType = pGeoObj->GetType() ;
|
||||
if ( nType == SRF_TRIMESH || nType == SRF_BEZIER) {
|
||||
// Recupero la superficie
|
||||
const ISurf* pSurf = GetSurf( pGeoObj) ;
|
||||
if ( pSurf != nullptr && pSurf->IsValid())
|
||||
vpSurfs.emplace_back( pSurf) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Se non ho superfici non faccio nulla
|
||||
if ( vpSurfs.empty())
|
||||
return false ;
|
||||
|
||||
// Calcolo il Centroide delle superfici complessive
|
||||
Point3d ptRef = P_INVALID ;
|
||||
if ( ! vOtherSurfIds.empty()) {
|
||||
int nToTSurf = 0 ;
|
||||
for ( int nOtherSurfId : vOtherSurfIds) {
|
||||
// Recupero l'entità
|
||||
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nOtherSurfId) ;
|
||||
if ( pGeoObj != nullptr) {
|
||||
// Recupero il Tipo
|
||||
int nType = pGeoObj->GetType() ;
|
||||
if ( nType == SRF_TRIMESH || nType == SRF_BEZIER) {
|
||||
// Recupero la superficie
|
||||
const ISurf* pSurf = GetSurf( pGeoObj) ;
|
||||
if ( pSurf != nullptr && pSurf->IsValid()) {
|
||||
// Recupero il Centroide
|
||||
Point3d ptCentroid ;
|
||||
pSurf->GetCentroid( ptCentroid) ;
|
||||
if ( ! ptRef.IsValid())
|
||||
ptRef = ptCentroid ;
|
||||
else
|
||||
ptRef += ptCentroid ;
|
||||
++ nToTSurf ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( nToTSurf > 0) {
|
||||
for ( const ISurf* pSurf : vpSurfs) {
|
||||
Point3d ptCentroid ;
|
||||
pSurf->GetCentroid( ptCentroid) ;
|
||||
if ( ! ptRef.IsValid())
|
||||
ptRef = ptCentroid ;
|
||||
else
|
||||
ptRef += ptCentroid ;
|
||||
++ nToTSurf ;
|
||||
}
|
||||
ptRef /= nToTSurf ;
|
||||
}
|
||||
}
|
||||
|
||||
// Recupero i Bordi per fori ed asole
|
||||
ICRVCOMPOPOVECTOR vHoleBorders ;
|
||||
bool bOk = GetTrimmingHoleBorders( vpSurfs, ptRef, dSurfLinTol, dSurfAngTol, dEdgeLinTol, dEdgeAngTol,
|
||||
dEdgeThick, vHoleBorders) ;
|
||||
if ( bOk) {
|
||||
// Inserisco le curve nel DB e imposto i parametri di ritorno
|
||||
bool bFirst = true ;
|
||||
for ( int i = 0 ; bOk && i < ssize( vHoleBorders) ; ++ i) {
|
||||
// Verifico che sia valida
|
||||
if ( ! IsNull( vHoleBorders[i]) && vHoleBorders[i]->IsValid()) {
|
||||
int nCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vHoleBorders[i])) ;
|
||||
bOk = ( nCrvId != GDB_ID_NULL) ;
|
||||
if ( bOk) {
|
||||
++ nCount ;
|
||||
if ( bFirst) {
|
||||
nFirstId = nCrvId ;
|
||||
bFirst = false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ExeSetModified() ;
|
||||
// Se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTrimmingGetHoleBorder(" + ToString( nParentId) + "," +
|
||||
ToString( vSurfIds) + "," +
|
||||
ToString( dSurfLinTol) + "," +
|
||||
ToString( dSurfAngTol) + "," +
|
||||
ToString( dEdgeLinTol) + "," +
|
||||
ToString( dEdgeAngTol) + "," +
|
||||
ToString( dEdgeThick) + ")" +
|
||||
" bOk=" + ToString( bOk) +
|
||||
" nNewSurfId=" + ToString( nFirstId) + ", nCount= " + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
int
|
||||
ExeTrimmingGetSurfTmFaceAdj( int nParentId, int nSurfId, int nTria, const Point3d& ptTria,
|
||||
double dAngTol, double dSize, double dSizeTol)
|
||||
{
|
||||
// Verifica database geometrico
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
|
||||
// Recupero la superficie TriMesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
|
||||
bool bOk = ( pStm != nullptr && pStm->IsValid()) ;
|
||||
|
||||
// Recupero la superficie formata dai triangoli di adiacenza
|
||||
int nNewSurfId = GDB_ID_NULL ;
|
||||
if ( bOk) {
|
||||
PtrOwner<ISurfTriMesh> pStmAdjFace( CreateSurfTriMesh()) ;
|
||||
bOk = ( ! IsNull( pStmAdjFace) && pStmAdjFace->AdjustTopology()) ;
|
||||
bOk = GetTrimmingStmAdjTria( pStm, nTria, ptTria, dAngTol, dSize, dSizeTol, pStmAdjFace) ;
|
||||
bOk = ( ! IsNull( pStmAdjFace) && pStmAdjFace->IsValid() && pStmAdjFace->GetTriangleCount() > 0) ;
|
||||
// Inserisco la Superficie nel DB geometrico
|
||||
if ( bOk) {
|
||||
nNewSurfId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmAdjFace)) ;
|
||||
bOk = ( nNewSurfId != GDB_ID_NULL) ;
|
||||
}
|
||||
}
|
||||
|
||||
ExeSetModified() ;
|
||||
// Se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTrimmingGetSurfTmFromFaceAdj(" + ToString( nParentId) + "," +
|
||||
ToString( nSurfId) + "," +
|
||||
ToString( nTria) + "," +
|
||||
"{ " + ToString( ptTria.x) + "," +
|
||||
ToString( ptTria.y) + "," +
|
||||
ToString( ptTria.z) + "}," +
|
||||
ToString( dAngTol) + ")" +
|
||||
" nNewSurfId=" + ToString( nNewSurfId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
return nNewSurfId ;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
int
|
||||
ExeTrimmingGetSurfTmFromStmFaces( int nParentId, int nSurfId, const INTVECTOR& vFaces)
|
||||
{
|
||||
// Verifica database geometrico
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
|
||||
// Recupero il riferimento del gruppo di destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nParentId, frDest))
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// Recupero la superficie TriMesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
|
||||
if ( pStm == nullptr || ! pStm->IsValid())
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// Verifico che le facce appartengano alla superficie
|
||||
if ( vFaces.empty())
|
||||
return CMD_ID_NULL ;
|
||||
for ( int nF = 0 ; nF < int( vFaces.size()) ; ++ nF) {
|
||||
double dArea = 0. ;
|
||||
if ( ! pStm->GetFacetArea( vFaces[nF], dArea))
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
// Definisco la superficie
|
||||
StmFromTriangleSoup TriaSoup ;
|
||||
TriaSoup.Start() ;
|
||||
for ( int nF = 0 ; nF < int( vFaces.size()) ; ++ nF) {
|
||||
INTVECTOR vT ;
|
||||
if ( ! pStm->GetAllTriaInFacet( vFaces[nF], vT))
|
||||
return GDB_ID_NULL ;
|
||||
for ( int nT = 0 ; nT < int( vT.size()) ; ++ nT) {
|
||||
Triangle3d Tria ;
|
||||
if ( ! pStm->GetTriangle( vT[nT], Tria) || ! TriaSoup.AddTriangle( Tria))
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
}
|
||||
TriaSoup.End() ;
|
||||
PtrOwner<ISurfTriMesh> pStmTria( TriaSoup.GetSurf()) ;
|
||||
if ( IsNull( pStmTria) || ! pStmTria->IsValid() || pStmTria->GetTriangleCount() == 0)
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// Aggiungo la superficie al DB
|
||||
int nNewSurfId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmTria)) ;
|
||||
|
||||
ExeSetModified() ;
|
||||
// Se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "TrimmingGetSurfTmFromStmFaces(" + ToString( nParentId) + "," +
|
||||
ToString( nSurfId) + "," +
|
||||
ToString( vFaces) + ")" +
|
||||
" -- nId=" + ToString( nNewSurfId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
return nNewSurfId ;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTrimmingGetAdjSurfs( const INTVECTOR& vSurfId, const INTVECTOR& vOtherSurfId, double dLinTol,
|
||||
double dAngTol, double dAngFaceTol, INTVECTOR& vResId)
|
||||
{
|
||||
// Verifica database geometrico
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
|
||||
// Recupero le superfici di Riferimento
|
||||
CISURFPVECTOR vRefSurf ; vRefSurf.reserve( vSurfId.size()) ;
|
||||
bool bOk = true ;
|
||||
for ( int i = 0 ; bOk && i < int( vSurfId.size()) ; ++ i) {
|
||||
const ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( vSurfId[i])) ;
|
||||
bOk = ( pSurf != nullptr && pSurf->IsValid()) ;
|
||||
vRefSurf.emplace_back( pSurf) ;
|
||||
}
|
||||
|
||||
// Recupero le superfici complessive, escludendo eventualmente quelle di riferimento se presenti
|
||||
CISURFPVECTOR vOtherSurf ; vOtherSurf.reserve( vOtherSurfId.size()) ;
|
||||
INTVECTOR vIds ;
|
||||
for ( int i = 0 ; bOk && i < int( vOtherSurfId.size()) ; ++ i) {
|
||||
if ( find( vSurfId.begin(), vSurfId.end(), vOtherSurfId[i]) == vSurfId.end()) {
|
||||
const ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( vOtherSurfId[i])) ;
|
||||
bOk = ( pSurf != nullptr && pSurf->IsValid()) ;
|
||||
vOtherSurf.emplace_back( pSurf) ;
|
||||
vIds.push_back( vOtherSurfId[i]) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Recupero le facce adiancenti nella tolleranza richiesta
|
||||
INTVECTOR vMyInds ;
|
||||
bOk = bOk && GetTrimmingAdjSurfs( vRefSurf, vOtherSurf, dLinTol, dAngTol, dAngFaceTol, vMyInds) ;
|
||||
if ( bOk) {
|
||||
for ( int myInd : vMyInds)
|
||||
vResId.push_back( vIds[myInd]) ;
|
||||
}
|
||||
|
||||
ExeSetModified() ;
|
||||
// Se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTrimmingGetAdjSurfs(" + ToString( vSurfId) + "," +
|
||||
ToString( vOtherSurfId) + "," +
|
||||
ToString( dAngTol) + ")" +
|
||||
" -- bOk=" + ToString( bOk) + ",vResId=" + ToString( vResId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTrimmingGetBorders( int nParentId, const SELVECTOR& vIds, double dSurfLinTol, double dSurfAngTol,
|
||||
double dLinTol, double dAngTol, int& nFirstId, int& nCount)
|
||||
{
|
||||
// Verifica database geometrico
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
|
||||
// Parametri da restituire
|
||||
nFirstId = GDB_ID_NULL ;
|
||||
nCount = 0 ;
|
||||
|
||||
// vIds : vettore di { nId = SurfId, nSubId = nSurfFace }
|
||||
// Controllo che vIds non sia vuoto
|
||||
bool bOk = ( ! vIds.empty()) ;
|
||||
// Recupero il riferimento della prima superficie
|
||||
Frame3d frSurf ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( vIds[0].nId, frSurf) ;
|
||||
// Recupero il riferimento dei gruppi di destinazione
|
||||
Frame3d frDest ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nParentId, frDest) ;
|
||||
// Recupero gli Id univoci delle superfici selezionate
|
||||
INTSET setUniqueId ;
|
||||
for ( const SelData& nIds : vIds)
|
||||
setUniqueId.insert( nIds.nId) ;
|
||||
// Recupero le superfici e le porto tutte in locale alla prima
|
||||
unordered_map<int, int> uMapPos ; uMapPos.reserve( setUniqueId.size()) ;
|
||||
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( setUniqueId.size()) ;
|
||||
CISURFPVECTOR vpSurf ; vpSurf.reserve( setUniqueId.size()) ;
|
||||
int nSurf = 0 ;
|
||||
for ( auto nIter = setUniqueId.begin() ; bOk && nIter != setUniqueId.end() ; ++ nIter) {
|
||||
vSurfL.emplace_back( pGeomDB, *nIter, frSurf) ;
|
||||
bOk = ( vSurfL.back().Get() != nullptr) ;
|
||||
vpSurf.emplace_back( vSurfL.back().Get()) ;
|
||||
uMapPos[*nIter] = nSurf ;
|
||||
++ nSurf ;
|
||||
}
|
||||
// Recupero il vettore di Selezione associato non più agli Id delle superficie ma alle loro posizioni nel vettore
|
||||
SELVECTOR vFaces ; vFaces.reserve( vIds.size()) ;
|
||||
for ( int i = 0 ; bOk && i < int( vIds.size()) ; ++ i)
|
||||
vFaces.emplace_back( uMapPos[vIds[i].nId], vIds[i].nSub) ;
|
||||
|
||||
// Calcolo le curve di Edge grezze ( quindi i tratti lineari)
|
||||
ICRVCOMPOPOVECTOR vRawEdges ;
|
||||
bOk = bOk && GetTrimmingRawEdges( vpSurf, vFaces, dSurfLinTol, dSurfAngTol, vRawEdges) &&
|
||||
( ! vRawEdges.empty()) ;
|
||||
|
||||
// Calcolo le curve di Edge approssimate mediante curve di Bezier
|
||||
ICRVCOMPOPOVECTOR vBezierEdges ;
|
||||
bOk = bOk && GetTrimmingBezierEdges( vRawEdges, dLinTol, dAngTol, vBezierEdges) ;
|
||||
nCount = int( vBezierEdges.size()) ;
|
||||
if ( bOk) {
|
||||
// Scorro i gli Edges ottenuti
|
||||
for ( int nCrv = 0 ; bOk && nCrv < nCount ; ++ nCrv) {
|
||||
vBezierEdges[nCrv]->ToLoc( frDest) ;
|
||||
// Inserisco la curva nel DB Geometrico
|
||||
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vBezierEdges[nCrv])) ;
|
||||
bOk = ( nCurrId != GDB_ID_NULL) ;
|
||||
if ( nCrv == 0)
|
||||
nFirstId = nCurrId ;
|
||||
}
|
||||
}
|
||||
|
||||
ExeSetModified() ;
|
||||
// Se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTrimmingGetBorders(" + IdToString( nParentId) + "," +
|
||||
ToString( dSurfLinTol) + "," +
|
||||
ToString( dSurfAngTol) + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
ToString( dAngTol) + ")" ;
|
||||
sLua += " -- bOk=" + ToString( bOk) +
|
||||
" -- FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTrimmingGetBordersByNormals( int nParentId, const SELVECTOR& vIds, double dSurfLinTol,
|
||||
double dSurfAngTol, double dLinTol, double dAngTol, double dThick,
|
||||
int& nFirstId, int& nCount)
|
||||
{
|
||||
// Verifica database geometrico
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
|
||||
// Parametri da restituire
|
||||
nFirstId = GDB_ID_NULL ;
|
||||
nCount = 0 ;
|
||||
|
||||
// vIds : vettore di { nId = SurfId, nSubId = nSurfFace }
|
||||
// Controllo che vIds non sia vuoto
|
||||
bool bOk = ( ! vIds.empty()) ;
|
||||
// Recupero il riferimento della prima superficie
|
||||
Frame3d frSurf ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( vIds[0].nId, frSurf) ;
|
||||
// Recupero il riferimento dei gruppi di destinazione
|
||||
Frame3d frDest ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nParentId, frDest) ;
|
||||
// Recupero gli Id univoci delle superfici selezionate
|
||||
INTSET setUniqueId ;
|
||||
for ( const SelData& nIds : vIds)
|
||||
setUniqueId.insert( nIds.nId) ;
|
||||
// Recupero le superfici e le porto tutte in locale alla prima
|
||||
unordered_map<int, int> uMapPos ; uMapPos.reserve( setUniqueId.size()) ;
|
||||
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( setUniqueId.size()) ;
|
||||
CISURFPVECTOR vpSurf ; vpSurf.reserve( setUniqueId.size()) ;
|
||||
int nSurf = 0 ;
|
||||
for ( auto nIter = setUniqueId.begin() ; bOk && nIter != setUniqueId.end() ; ++ nIter) {
|
||||
vSurfL.emplace_back( pGeomDB, *nIter, frSurf) ;
|
||||
bOk = ( vSurfL.back().Get() != nullptr) ;
|
||||
vpSurf.emplace_back( vSurfL.back().Get()) ;
|
||||
uMapPos[*nIter] = nSurf ;
|
||||
++ nSurf ;
|
||||
}
|
||||
// Recupero il vettore di Selezione associato non più agli Id delle superficie ma alle loro posizioni nel vettore
|
||||
SELVECTOR vFaces ; vFaces.reserve( vIds.size()) ;
|
||||
for ( int i = 0 ; bOk && i < int( vIds.size()) ; ++ i)
|
||||
vFaces.emplace_back( uMapPos[vIds[i].nId], vIds[i].nSub) ;
|
||||
|
||||
// Calcolo le curve di Edge approssimate mediante curve di Bezier
|
||||
ICRVCOMPOPOVECTOR vBezierEdges ;
|
||||
bOk = bOk && GetTrimmingFinalBorders( vpSurf, vFaces, dSurfLinTol, dSurfAngTol, dLinTol, dAngTol, dThick, vBezierEdges) ;
|
||||
if ( bOk) {
|
||||
nCount = int( vBezierEdges.size()) ;
|
||||
// Scorro i gli Edges ottenuti
|
||||
for ( int nCrv = 0 ; bOk && nCrv < nCount ; ++ nCrv) {
|
||||
vBezierEdges[nCrv]->ToLoc( frDest) ;
|
||||
// Inserisco la curva nel DB Geometrico
|
||||
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vBezierEdges[nCrv])) ;
|
||||
bOk = ( nCurrId != GDB_ID_NULL) ;
|
||||
if ( nCrv == 0)
|
||||
nFirstId = nCurrId ;
|
||||
}
|
||||
}
|
||||
|
||||
ExeSetModified() ;
|
||||
// Se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTrimmingGetBordersByNormals(" + IdToString( nParentId) + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
ToString( dAngTol) + ")" ;
|
||||
sLua += " -- bOk=" + ToString( bOk) +
|
||||
" -- FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTrimmingGetFinalBorders( int nParentId, const INTVECTOR& vCrvBezierId, double dLinTol, double dAngTol,
|
||||
const PNTVECTOR& vBrkPts, double dThick, double dThickTol,
|
||||
int& nFirstId, int& nCount)
|
||||
{
|
||||
// Verifica database geometrico
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
|
||||
// Parametri da restituire
|
||||
nFirstId = GDB_ID_NULL ;
|
||||
nCount = 0 ;
|
||||
|
||||
// Recupero il riferimento del gruppo di destinazione
|
||||
Frame3d frDest ;
|
||||
bool bOk = ( pGeomDB->GetGlobFrame( nParentId, frDest)) ;
|
||||
|
||||
// Recupero le curve di Bordo approssimate come Bezier
|
||||
ICRVCOMPOPOVECTOR vCompoBezierEdges ; vCompoBezierEdges.reserve( vCrvBezierId.size()) ;
|
||||
for ( int nCrv = 0 ; bOk && nCrv < int( vCrvBezierId.size()) ; ++ nCrv) {
|
||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( vCrvBezierId[nCrv])) ;
|
||||
bOk = ( pCrv != nullptr && pCrv->IsValid()) ;
|
||||
if ( bOk) {
|
||||
PtrOwner<ICurveComposite> pCompoRawEdges( ConvertCurveToComposite( pCrv->Clone())) ;
|
||||
bOk = ( ! IsNull( pCompoRawEdges) && pCompoRawEdges->IsValid() &&
|
||||
vCompoBezierEdges.emplace_back( Release( pCompoRawEdges))) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Converto i punti in coppie di punti ( se dispari l'ultimo viene ignorato)
|
||||
BIPNTVECTOR vBreakingPts ; vBreakingPts.reserve( int( int( vBrkPts.size()) / 2)) ;
|
||||
for ( int nPt = 0 ; bOk && nPt < int( vBrkPts.size()) - 1 ; nPt += 2)
|
||||
vBreakingPts.emplace_back( make_pair( vBrkPts[nPt], vBrkPts[nPt+1])) ;
|
||||
if ( int( vBrkPts.size()) % 2 != 0)
|
||||
LOG_INFO( GetCmdLogger(), "Warning in EgtExtractSurfFrChunkLoops : Odd number of breaking points") ;
|
||||
|
||||
// Calcolo le curve di Edge
|
||||
bOk = bOk && GetTrimmingFinalBorders( vCompoBezierEdges, dLinTol, dAngTol, vBreakingPts, dThick, dThickTol) ;
|
||||
nCount = int( vCompoBezierEdges.size()) ;
|
||||
if ( bOk) {
|
||||
// Scorro i gli Edges ottenuti
|
||||
for ( int nCrv = 0 ; bOk && nCrv < nCount ; ++ nCrv) {
|
||||
vCompoBezierEdges[nCrv]->ToLoc( frDest) ;
|
||||
// Inserisco la curva nel DB Geometrico
|
||||
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vCompoBezierEdges[nCrv])) ;
|
||||
bOk = ( nCurrId != GDB_ID_NULL) ;
|
||||
if ( nCrv == 0)
|
||||
nFirstId = nCurrId ;
|
||||
}
|
||||
ExeSetModified() ;
|
||||
}
|
||||
|
||||
// Se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTrimmingGetFinalBorders(" + IdToString( nParentId) + "," +
|
||||
ToString( vCrvBezierId) + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
ToString( dAngTol) + "," ;
|
||||
sLua += "{" ;
|
||||
for ( int nP = 0 ; nP < int( vBrkPts.size()) ; ++ nP) {
|
||||
sLua += "(" + ToString( vBrkPts[nP].x) + ", " + ToString( vBrkPts[nP].y) + ", " + ToString( vBrkPts[nP].z) + ")" +
|
||||
( nP != int( vBrkPts.size()) - 1 ? "," : "") ;
|
||||
}
|
||||
sLua += "}" ;
|
||||
sLua += ToString( dThick) + "," + ToString( dThickTol) + ")" ;
|
||||
sLua += " -- bOk=" + ToString( bOk) +
|
||||
" -- FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
int
|
||||
ExeTrimmingGetRuledBezier( int nParentId, const INTVECTOR& vIds, int nEdge1Id, int nEdge2Id, double dLinTol,
|
||||
const INTVECTOR& vnLineId)
|
||||
{
|
||||
// Verifica database geometrico
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
|
||||
// Aggiusto la tolleranza lineare se necessario
|
||||
double dMyLinTol = Clamp( dLinTol, EPS_SMALL, 1e5 * EPS_SMALL) ;
|
||||
|
||||
// Recupero il riferimento dei gruppi di destinazione
|
||||
Frame3d frDest ;
|
||||
bool bOk = pGeomDB->GetGlobFrame( nParentId, frDest) ;
|
||||
|
||||
// Recupero la prima curva
|
||||
const ICurve* pCrvEdge1 = GetCurve( pGeomDB->GetGeoObj( nEdge1Id)) ;
|
||||
bOk = bOk && ( pCrvEdge1 != nullptr && pCrvEdge1->IsValid()) ;
|
||||
|
||||
// Recupero la seconda curva
|
||||
const ICurve* pCrvEdge2 = GetCurve( pGeomDB->GetGeoObj( nEdge2Id)) ;
|
||||
bOk = bOk && ( pCrvEdge2 != nullptr && pCrvEdge2->IsValid()) ;
|
||||
|
||||
// Se ci sono delle superfici di riferimento
|
||||
CISURFPVECTOR vpSurf ; vpSurf.reserve( vIds.size()) ;
|
||||
if ( ! vIds.empty()) {
|
||||
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vIds.size()) ;
|
||||
// Recupero il riferimento della prima superficie
|
||||
Frame3d frSurf ;
|
||||
bOk = bOk && ( pGeomDB->GetGlobFrame( vIds[0], frSurf)) ;
|
||||
// Porto le altre nel riferimento della prima
|
||||
for ( int nSurf = 0 ; bOk && nSurf < int( vIds.size()) ; ++ nSurf) {
|
||||
vSurfL.emplace_back( pGeomDB, vIds[nSurf], frSurf) ;
|
||||
if ( vSurfL.back().Get() == nullptr) {
|
||||
bOk = false ;
|
||||
break ;
|
||||
}
|
||||
vpSurf.emplace_back( vSurfL.back().Get()) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Recupero i punti di sincronizzazione ( se presenti)
|
||||
BIPNTVECTOR vSyncPoints ; vSyncPoints.reserve( pGeomDB->GetGroupObjs( vnLineId.size())) ;
|
||||
for ( int i = 0 ; bOk && i < ssize( vnLineId) ; ++ i) {
|
||||
// Recupero la Curva
|
||||
const ICurve* pLine = GetCurve( pGeomDB->GetGeoObj( vnLineId[i])) ;
|
||||
bOk = bOk && ( pLine != nullptr && pLine->IsValid()) ;
|
||||
if ( bOk) {
|
||||
// Recupero gli Estremi
|
||||
Point3d ptStart ; pLine->GetStartPoint( ptStart) ;
|
||||
Point3d ptEnd ; pLine->GetEndPoint( ptEnd) ;
|
||||
// Mi assicuro che gli estremi siano sulle curve di Bordo e orientati correttamente ( nel caso inverto)
|
||||
double dSqDistS1 = INFINITO ;
|
||||
if ( ! DistPointCurve( ptStart, *pCrvEdge1).GetSqDist( dSqDistS1))
|
||||
continue ;
|
||||
if ( dSqDistS1 < dLinTol * dLinTol) {
|
||||
double dSqDistE2 = INFINITO ;
|
||||
if ( ! DistPointCurve( ptEnd, *pCrvEdge2).GetSqDist( dSqDistE2) ||
|
||||
dSqDistE2 > dLinTol * dLinTol)
|
||||
continue ;
|
||||
}
|
||||
else {
|
||||
double dSqDistS2 = INFINITO ;
|
||||
if ( ! DistPointCurve( ptStart, *pCrvEdge2).GetSqDist( dSqDistS2) ||
|
||||
dSqDistS2 > dLinTol * dLinTol)
|
||||
continue ;
|
||||
double dSqDistE1 = INFINITO ;
|
||||
if ( ! DistPointCurve( ptEnd, *pCrvEdge1).GetSqDist( dSqDistE1) ||
|
||||
dSqDistE1 > dLinTol * dLinTol)
|
||||
continue ;
|
||||
swap( ptStart, ptEnd) ;
|
||||
}
|
||||
vSyncPoints.emplace_back( make_pair( ptStart, ptEnd)) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Recupero la superficie Bezier rigata
|
||||
PtrOwner<ISurfBezier> pSurfBzRuled ;
|
||||
if ( bOk) {
|
||||
pSurfBzRuled.Set( GetTrimmingRuledBezier( vpSurf, pCrvEdge1, pCrvEdge2, dMyLinTol, vSyncPoints)) ;
|
||||
bOk = bOk && ( ! IsNull( pSurfBzRuled) && pSurfBzRuled->IsValid()) ;
|
||||
}
|
||||
|
||||
// Inserisco la curva nel DB Geometrico
|
||||
int nSurfBzId = GDB_ID_NULL ;
|
||||
if ( bOk) {
|
||||
pSurfBzRuled->ToLoc( frDest) ;
|
||||
nSurfBzId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSurfBzRuled)) ;
|
||||
bOk = bOk && ( nSurfBzId != GDB_ID_NULL) ;
|
||||
}
|
||||
|
||||
ExeSetModified() ;
|
||||
// Se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTrimmingGetRuledBezier(" + ToString( nParentId) + "," +
|
||||
ToString( vIds) + "," +
|
||||
ToString( nEdge1Id) + "," +
|
||||
ToString( nEdge2Id) + "," +
|
||||
ToString( dLinTol) + ")" +
|
||||
" -- bOk=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
// Restituisco il risultato
|
||||
return nSurfBzId ;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTrimmingInterpolateSyncLines( int nParentId, int nSync1Id, int nSync2Id, int nBorder1Id,
|
||||
int nBorder2Id, double dEdgeLinTol, double dEdgeAngTol,
|
||||
int& nFirstId, int& nCount)
|
||||
{
|
||||
// Verifica database geometrico
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
|
||||
// Reset parametri di ritorno
|
||||
nFirstId = GDB_ID_NULL ;
|
||||
nCount = 0 ;
|
||||
|
||||
// Aggiusto la tolleranza lineare e angolare se necessario
|
||||
double dMyEdgeLinTol = Clamp( dEdgeLinTol, EPS_SMALL, 1e5 * EPS_SMALL) ;
|
||||
double dMyEdgeAngTol = Clamp( dEdgeAngTol, EPS_ANG_SMALL, 60.) ;
|
||||
|
||||
// recupero le due curve di sincronizzazione
|
||||
const ICurve* pSync1 = GetCurve( pGeomDB->GetGeoObj( nSync1Id)) ;
|
||||
const ICurve* pSync2 = GetCurve( pGeomDB->GetGeoObj( nSync2Id)) ;
|
||||
bool bOk = ( pSync1 != nullptr && pSync1->IsValid() &&
|
||||
pSync2 != nullptr && pSync2->IsValid()) ;
|
||||
|
||||
// Recupero le due curve di bordo
|
||||
const ICurve* pCrvEdge1 = GetCurve( pGeomDB->GetGeoObj( nBorder1Id)) ;
|
||||
const ICurve* pCrvEdge2 = GetCurve( pGeomDB->GetGeoObj( nBorder2Id)) ;
|
||||
bOk = bOk && ( pCrvEdge1 != nullptr && pCrvEdge1->IsValid()) ;
|
||||
bOk = bOk && ( pCrvEdge2 != nullptr && pCrvEdge2->IsValid()) ;
|
||||
|
||||
// Calcolo le Curve di sincornizzazione Interpolate
|
||||
BIPNTVECTOR vSyncPoints ;
|
||||
bOk = bOk && GetTrimmingSyncInterpolation( pCrvEdge1, pCrvEdge2, pSync1, pSync2, dMyEdgeLinTol,
|
||||
dMyEdgeAngTol, vSyncPoints) ;
|
||||
if ( bOk && ! vSyncPoints.empty()) {
|
||||
// Inserisco le curve di sincronizzazione nel DB
|
||||
// [orientate da pCrvEdge1 a pCrvEdge2]
|
||||
for ( int i = 0 ; bOk && i < ssize( vSyncPoints) ; ++ i) {
|
||||
PtrOwner<ICurveLine> pSyncLine( CreateCurveLine()) ;
|
||||
bOk = ( ! IsNull( pSyncLine) && pSyncLine->Set( vSyncPoints[i].first, vSyncPoints[i].second)) ;
|
||||
if ( bOk) {
|
||||
if ( pCrvEdge1->IsPointOn( vSyncPoints[i].second, dMyEdgeLinTol))
|
||||
pSyncLine->Invert() ;
|
||||
int nSyncId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSyncLine)) ;
|
||||
bOk = ( nSyncId != CMD_ID_NULL) ;
|
||||
if ( i == 0)
|
||||
nFirstId = nSyncId ;
|
||||
}
|
||||
}
|
||||
nCount = ssize( vSyncPoints) ;
|
||||
}
|
||||
|
||||
ExeSetModified() ;
|
||||
// Se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTrimmingInterpolateSyncLines(" + ToString( nParentId) + "," +
|
||||
ToString( nSync1Id) + "," +
|
||||
ToString( nSync2Id) + "," +
|
||||
ToString( nBorder1Id) + "," +
|
||||
ToString( nBorder2Id) + "," +
|
||||
ToString( dEdgeLinTol) + "," +
|
||||
ToString( dEdgeAngTol) + ")" +
|
||||
" -- bOk=" + ToString( bOk) +
|
||||
" -- nFirstId=" + ToString( nFirstId) + " nCount=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTrimmingGetSurfBzSyncPoints( int nParentId, int nEdge1Id, int nEdge2Id, double dLinTol,
|
||||
double dAngTol, int nLineNbr, bool bShowOnCorners,
|
||||
int& nFirstId, int& nCount)
|
||||
{
|
||||
// Verifica database geometrico
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
|
||||
// Imposto i parametri di ritorno
|
||||
nFirstId = GDB_ID_NULL ;
|
||||
nCount = 0 ;
|
||||
|
||||
// Se non devo visualizzare alcuna linea, non faccio nulla
|
||||
if ( nLineNbr <= 0 && ! bShowOnCorners)
|
||||
return true ;
|
||||
|
||||
// Se necessario aggiusto le tolleranze
|
||||
double dMyLinTol = Clamp( dLinTol, EPS_SMALL, 1e5 * EPS_SMALL) ;
|
||||
double dMyAngTol = Clamp( dAngTol, EPS_ANG_SMALL, ANG_RIGHT) ;
|
||||
|
||||
// Recupero il riferimento del gruppo di destinazione
|
||||
Frame3d frDest ;
|
||||
bool bOk = ( pGeomDB->GetGlobFrame( nParentId, frDest)) ;
|
||||
|
||||
// Recupero le due Curve di bordo
|
||||
const ICurve* pCrvEdge1 = GetCurve( pGeomDB->GetGeoObj( nEdge1Id)) ;
|
||||
const ICurve* pCrvEdge2 = GetCurve( pGeomDB->GetGeoObj( nEdge2Id)) ;
|
||||
bOk = bOk && ( pCrvEdge1 != nullptr && pCrvEdge1->IsValid() &&
|
||||
pCrvEdge2 != nullptr && pCrvEdge2->IsValid()) ;
|
||||
|
||||
// Verifico che le curve siano entrambe Aperte o entrambe Chiuse
|
||||
bOk = bOk && ( pCrvEdge1->IsClosed() == pCrvEdge2->IsClosed()) ;
|
||||
|
||||
// Recupero i punti di sincronizzazione
|
||||
BIPNTVECTOR vSyncPoints ;
|
||||
bOk = bOk && GetTrimmingSurfBzSyncPoints( pCrvEdge1, pCrvEdge2, dMyLinTol, vSyncPoints) &&
|
||||
( ! vSyncPoints.empty()) ;
|
||||
int nToTSyncLines = ssize( vSyncPoints) ;
|
||||
|
||||
// Ogni punto di sincronizzazione deve avere gli estremi sulle curve di Bordo
|
||||
for ( int i = 0 ; bOk && i < ssize( vSyncPoints) ; ++ i) {
|
||||
double dSqDistStart = INFINITO, dSqDistEnd = INFINITO ;
|
||||
bOk = ( DistPointCurve( vSyncPoints[i].first, *pCrvEdge1).GetSqDist( dSqDistStart) &&
|
||||
dSqDistStart < dMyLinTol * dMyLinTol &&
|
||||
DistPointCurve( vSyncPoints[i].second, *pCrvEdge2).GetSqDist( dSqDistEnd) &&
|
||||
dSqDistEnd < dMyLinTol * dMyLinTol) ;
|
||||
}
|
||||
|
||||
if ( bOk) {
|
||||
INTSET setInds ;
|
||||
// Se devo visualizzare più linee di quante ne ho ricavate, allora le devo visualizzare tutte
|
||||
if ( nLineNbr >= nToTSyncLines) {
|
||||
for ( int i = 0 ; i < nToTSyncLines ; ++ i)
|
||||
setInds.insert( i) ;
|
||||
}
|
||||
// Altrimenti
|
||||
else {
|
||||
// Se voglio visualizzare gli Spigoli
|
||||
if ( bShowOnCorners) {
|
||||
for ( int nL = 0 ; bOk && nL < nToTSyncLines ; ++ nL) {
|
||||
// Controllo se punto su spigolo della curva
|
||||
double dU = 0. ;
|
||||
Vector3d vtTanPrev, vtTanAft ;
|
||||
Point3d ptUseless ;
|
||||
bOk = ( pCrvEdge1->GetParamAtPoint( vSyncPoints[nL].first, dU, dMyLinTol) &&
|
||||
pCrvEdge1->GetPointD1D2( dU, ICurve::FROM_MINUS, ptUseless, &vtTanPrev) &&
|
||||
pCrvEdge1->GetPointD1D2( dU, ICurve::FROM_PLUS, ptUseless, &vtTanAft)) ;
|
||||
if ( ! bOk)
|
||||
break ;
|
||||
vtTanPrev.Normalize() ;
|
||||
vtTanAft.Normalize() ;
|
||||
if ( vtTanPrev * vtTanAft < cos( ( dMyAngTol + EPS_ANG_SMALL) * DEGTORAD)) {
|
||||
setInds.insert( nL) ;
|
||||
continue ;
|
||||
}
|
||||
bOk = ( pCrvEdge2->GetParamAtPoint( vSyncPoints[nL].second, dU, dMyLinTol) &&
|
||||
pCrvEdge2->GetPointD1D2( dU, ICurve::FROM_MINUS, ptUseless, &vtTanPrev) &&
|
||||
pCrvEdge2->GetPointD1D2( dU, ICurve::FROM_PLUS, ptUseless, &vtTanAft)) ;
|
||||
if ( ! bOk)
|
||||
break ;
|
||||
vtTanPrev.Normalize() ;
|
||||
vtTanAft.Normalize() ;
|
||||
if ( vtTanPrev * vtTanAft < cos( ( dMyAngTol + EPS_ANG_SMALL) * DEGTORAD)) {
|
||||
setInds.insert( nL) ;
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Se devo mostrare alcune Linee
|
||||
if ( bOk && nLineNbr > 0) {
|
||||
bool bBothOpen = ( ! pCrvEdge1->IsClosed() && ! pCrvEdge2->IsClosed()) ;
|
||||
bool bBothClosed = ( ! bBothOpen) ;
|
||||
int nLastIdx = nToTSyncLines - 1 ;
|
||||
if ( bBothClosed) {
|
||||
int nLine = nLineNbr ;
|
||||
if ( nLine == 1)
|
||||
setInds.insert( 0) ;
|
||||
else {
|
||||
int nMaxIndex = nToTSyncLines - 2 ;
|
||||
for ( int i = 0 ; i < nLine ; ++ i) {
|
||||
double dT = double( i) / double( nLine) ;
|
||||
int nIdx = int( 0.5 + dT * nMaxIndex) ;
|
||||
setInds.insert( nIdx) ;
|
||||
}
|
||||
setInds.erase( nLastIdx) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
int nInternal = nLineNbr ;
|
||||
setInds.insert( 0) ;
|
||||
setInds.insert( nLastIdx) ;
|
||||
int nMaxIndex = nLastIdx ;
|
||||
for ( int i = 0; i < nInternal ; ++ i) {
|
||||
double dT = double( i + 1) / double( nInternal + 1) ;
|
||||
int nIdx = int( 0.5 + dT * nMaxIndex) ;
|
||||
setInds.insert( nIdx) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Visualizzo i segmenti lineari di sincronizzazione per ogni indice ricavato
|
||||
bool bFirst = true ;
|
||||
for ( auto Iter = setInds.begin() ; bOk && Iter != setInds.end() ; ++ Iter) {
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||
bOk = ( ! IsNull( pLine) && pLine->Set( vSyncPoints[*Iter].first, vSyncPoints[*Iter].second)) ;
|
||||
if ( bOk) {
|
||||
int nLineId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pLine)) ;
|
||||
bOk = ( nLineId != GDB_ID_NULL) ;
|
||||
if ( bFirst) {
|
||||
nFirstId = nLineId ;
|
||||
bFirst = false ;
|
||||
}
|
||||
++ nCount ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ExeSetModified() ;
|
||||
// Se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTrimmingGetSurfBzSyncPoints(" + ToString( nParentId) + "," +
|
||||
ToString( nEdge1Id) + "," +
|
||||
ToString( nEdge2Id) + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
ToString( nFirstId) + "," +
|
||||
ToString( nCount) + ")" +
|
||||
" -- bOk=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
int
|
||||
ExeRegolarizeSurfaceLocally( int nParentId, int nSurfId, int nSyncStartId, int nSyncEndId, double dLinTol, int nType)
|
||||
{
|
||||
bool bOk = true ;
|
||||
// Verifica database geometrico
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
|
||||
// recupero la superficie
|
||||
ISurfBezier* pSurfBez = GetSurfBezier( GetSurf( pGeomDB->GetGeoObj( nSurfId))) ;
|
||||
|
||||
// recupero le due isocurve
|
||||
const ICurve* pSyncStart = GetCurveLine( GetCurve( pGeomDB->GetGeoObj( nSyncStartId))) ;
|
||||
const ICurve* pSyncEnd = GetCurveLine( GetCurve( pGeomDB->GetGeoObj( nSyncEndId))) ;
|
||||
Point3d ptS1 ; pSyncStart->GetStartPoint( ptS1) ;
|
||||
Point3d ptE1 ; pSyncStart->GetEndPoint( ptE1) ;
|
||||
BIPOINT bpIsoStart( ptS1, ptE1) ;
|
||||
Point3d ptS2 ; pSyncEnd->GetStartPoint( ptS2) ;
|
||||
Point3d ptE2 ; pSyncEnd->GetEndPoint( ptE2) ;
|
||||
BIPOINT bpIsoEnd( ptS2, ptE2) ;
|
||||
|
||||
PtrOwner<ISurfBezier> pNewSurf( RegolarizeBordersLocally( pSurfBez, bpIsoStart, bpIsoEnd, dLinTol, nType)) ;
|
||||
if ( IsNull( pNewSurf))
|
||||
return GDB_ID_NULL ;
|
||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pNewSurf)) ;
|
||||
|
||||
return nId ;
|
||||
}
|
||||
+6
-5
@@ -36,7 +36,6 @@ const int STR_DIM = 50 ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static HINSTANCE s_hModule = nullptr ;
|
||||
static char s_szEXeNameVer[STR_DIM] ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL APIENTRY
|
||||
@@ -71,10 +70,12 @@ DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
|
||||
const char*
|
||||
GetEXeVersion( void)
|
||||
{
|
||||
std::string sVer ;
|
||||
|
||||
GetModuleVersion( s_hModule, sVer) ;
|
||||
sprintf_s( s_szEXeNameVer, STR_DIM, "%s%s", EXE_STR, sVer.c_str()) ;
|
||||
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()) ;
|
||||
}
|
||||
|
||||
return s_szEXeNameVer ;
|
||||
}
|
||||
|
||||
Binary file not shown.
+7
-2
@@ -1,6 +1,8 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
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
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EgtExecutor", "EgtExecutor.vcxproj", "{DF654897-F85B-4108-A621-F2C4AB099A48}"
|
||||
EndProject
|
||||
Global
|
||||
@@ -23,4 +25,7 @@ Global
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {30B63942-DD1D-428A-BFD1-E603299B17B6}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
+15
-7
@@ -22,14 +22,14 @@
|
||||
<ProjectGuid>{DF654897-F85B-4108-A621-F2C4AB099A48}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>EgtExecutor</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.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>v141_xp</PlatformToolset>
|
||||
<PlatformToolset>v143</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>v141_xp</PlatformToolset>
|
||||
<PlatformToolset>v143</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>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</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>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</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>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -201,7 +201,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
||||
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@@ -251,6 +251,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<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" />
|
||||
@@ -264,6 +265,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<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" />
|
||||
@@ -291,9 +293,11 @@ 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_Trimming.cpp" />
|
||||
<ClCompile Include="EXE_TscExec.cpp" />
|
||||
<ClCompile Include="AuxTools.cpp" />
|
||||
<ClCompile Include="DllExchange.cpp" />
|
||||
@@ -304,6 +308,7 @@ 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" />
|
||||
@@ -314,10 +319,13 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<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="LUA_Trimming.cpp" />
|
||||
<ClCompile Include="PictureObj.cpp" />
|
||||
<ClCompile Include="LUA_Base.cpp" />
|
||||
<ClCompile Include="LUA_GdbCreateCurve.cpp" />
|
||||
|
||||
@@ -407,6 +407,30 @@
|
||||
<ClCompile Include="LUA_TestObjSurface.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Lua_Trimming.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_Trimming.cpp">
|
||||
<Filter>File di origine\EXE</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
@@ -20,9 +20,9 @@
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
AdjustId( int nId)
|
||||
AdjustId( int nId, int nCtx)
|
||||
{
|
||||
GseContext* pCtx = GetCurrGseContext() ;
|
||||
GseContext* pCtx = ( nCtx == 0 ? GetCurrGseContext() : GetGseContext( nCtx));
|
||||
VERIFY_CTX( pCtx, GDB_ID_NULL)
|
||||
if ( nId == GDB_ID_CURRPART)
|
||||
return pCtx->m_nCurrPart ;
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ class IGeomDB ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Sistemo Id per pezzo o layer correnti
|
||||
int AdjustId( int nId) ;
|
||||
int AdjustId( int nId, int nCtx = 0) ;
|
||||
// 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2024
|
||||
// EgalTech 2014-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA.h Data : 24.03.24 Versione : 2.6c2
|
||||
// File : LUA.h Data : 03.11.25 Versione : 2.7k1
|
||||
// Contenuto : Dichiarazioni locali per moduli LUA.
|
||||
//
|
||||
//
|
||||
@@ -129,6 +129,17 @@ 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) ;
|
||||
|
||||
//---------------------------------- Trimming ----------------------------------
|
||||
bool LuaInstallTrimming( LuaMgr& luaMgr) ;
|
||||
|
||||
@@ -178,10 +178,27 @@ 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 ;
|
||||
}
|
||||
if ( ! LuaInstallTrimming( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallTrimming (LuaInstallEgtFunctions)")
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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 ;
|
||||
}
|
||||
+66
-8
@@ -21,6 +21,21 @@
|
||||
|
||||
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)
|
||||
@@ -151,7 +166,7 @@ LuaBeamGetSideData( lua_State* L)
|
||||
int nSide ;
|
||||
LuaCheckParam( L, 1, nSide)
|
||||
LuaClearStack( L) ;
|
||||
// imposto le dimensioni al pezzo corrente
|
||||
// restituisce i dati della faccia indicata del pezzo corrente
|
||||
Frame3d frRef ;
|
||||
double dLength, dWidth, dHeight ;
|
||||
bool bOk = ExeBeamGetSideData( nSide, frRef, dLength, dWidth, dHeight) ;
|
||||
@@ -173,7 +188,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 [, nCrv, nCrv2] [, bUpdate]
|
||||
// 9 o 10 o 11 o 12 parametri : nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar, vsUAtt [, nCrv] [, nCrv2] [, bUpdate]
|
||||
int nGroup ;
|
||||
LuaCheckParam( L, 1, nGroup)
|
||||
int nProc ;
|
||||
@@ -198,6 +213,8 @@ 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) ;
|
||||
@@ -215,7 +232,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 [, nCrv, nCrv2] [, bUpdate]
|
||||
// 10 o 11 o 12 o 13 parametri : nGeomId, nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar, vsUAtt [, nCrv, nCrv2] [, bUpdate]
|
||||
int nGeomId ;
|
||||
LuaCheckParam( L, 1, nGeomId)
|
||||
int nGroup ;
|
||||
@@ -242,6 +259,8 @@ 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) ;
|
||||
@@ -291,6 +310,38 @@ 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)
|
||||
@@ -347,10 +398,12 @@ LuaBeamShowSolid( lua_State* L)
|
||||
static int
|
||||
LuaBeamGetBuildingIsOn( lua_State* L)
|
||||
{
|
||||
// Nessun parametro
|
||||
// 1 o nessun parametro : [nAssGrpId]
|
||||
int nAssGrpId = GDB_ID_NULL ;
|
||||
LuaGetParam( L, 1, nAssGrpId) ;
|
||||
LuaClearStack( L) ;
|
||||
// restituisco identificativo del solido della trave
|
||||
bool bOk = ExeBeamGetBuildingIsOn() ;
|
||||
bool bOk = ExeBeamGetBuildingIsOn( nAssGrpId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -360,12 +413,14 @@ LuaBeamGetBuildingIsOn( lua_State* L)
|
||||
static int
|
||||
LuaBeamShowBuilding( lua_State* L)
|
||||
{
|
||||
// 1 parametro : bShow
|
||||
// 1 o 2 parametri : [nAssGrpId,] bShow
|
||||
int nAssGrpId = GDB_ID_NULL ;
|
||||
int nPar = ( LuaGetParam( L, 1, nAssGrpId) ? 2 : 1) ;
|
||||
bool bShow ;
|
||||
LuaCheckParam( L, 1, bShow)
|
||||
LuaCheckParam( L, nPar, bShow)
|
||||
LuaClearStack( L) ;
|
||||
// attivo o disattivo la visualizzazione l'assemblaggio
|
||||
bool bOk = ExeBeamShowBuilding( bShow) ;
|
||||
bool bOk = ExeBeamShowBuilding( nAssGrpId, bShow) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -376,6 +431,7 @@ 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) ;
|
||||
@@ -389,6 +445,8 @@ 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) ;
|
||||
|
||||
+41
-3
@@ -156,14 +156,50 @@ LuaImportStl( lua_State* L)
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaImport3MF( lua_State* L)
|
||||
LuaImportOff( 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 = ExeImport3MF( sFilePath) ;
|
||||
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]
|
||||
string sFilePath ;
|
||||
LuaCheckParam( L, 1, sFilePath)
|
||||
int nFlag = 0 ;
|
||||
LuaGetParam( L, 2, nFlag) ;
|
||||
LuaClearStack( L) ;
|
||||
// apro il file
|
||||
bool bOk = ExeImport3MF( sFilePath, nFlag) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -332,6 +368,8 @@ 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) ;
|
||||
|
||||
+22
-21
@@ -728,6 +728,27 @@ 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)
|
||||
@@ -1091,26 +1112,6 @@ LuaCreateCirclesAlongCurve( lua_State* L)
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveBezierForm( lua_State* L)
|
||||
{
|
||||
// 2 parametri : ParentId, nCrvId
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nCrvId ;
|
||||
LuaCheckParam( L, 2, nCrvId)
|
||||
|
||||
// creo la versione bezier della curva
|
||||
int nId = ExeCreateCurveBezierForm( nParentId, nCrvId) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
|
||||
@@ -1142,6 +1143,7 @@ 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) ;
|
||||
@@ -1155,6 +1157,5 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromApothem", LuaCreatePolygonFromApothem) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromSide", LuaCreatePolygonFromSide) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCirclesAlongCurve", LuaCreateCirclesAlongCurve) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierForm", LuaCreateCurveBezierForm) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
+531
-10
@@ -15,6 +15,7 @@
|
||||
#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"
|
||||
@@ -171,6 +172,24 @@ LuaCreateSurfFrFatCurve( lua_State* 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) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmPlaneInBBox( lua_State* L)
|
||||
@@ -399,6 +418,60 @@ 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)
|
||||
@@ -451,6 +524,72 @@ LuaCreateSurfTmRectangle( lua_State* 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)
|
||||
@@ -509,11 +648,9 @@ LuaCreateSurfTmByExtrusion( lua_State* L)
|
||||
Vector3d vtExtr ;
|
||||
LuaCheckParam( L, 3, vtExtr)
|
||||
double dLinTol = LIN_TOL_SRF ;
|
||||
LuaGetParam( L, 4, dLinTol) ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 4, dLinTol))
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
else
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM estrudendo uno o più percorsi, se piani si possono mettere i tappi
|
||||
int nId = ExeCreateSurfTmByExtrusion( nParentId, vCrvIds, vtExtr,
|
||||
@@ -819,6 +956,29 @@ LuaCreateSurfTmByVolZmap( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfShell( lua_State* L)
|
||||
{
|
||||
// 4 parametri : nParentId, nSurfId, dThick, dLinTol
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId) ;
|
||||
int nSurfId ;
|
||||
LuaCheckParam( L, 2, nSurfId) ;
|
||||
double dThick ;
|
||||
LuaCheckParam( L, 3, dThick) ;
|
||||
double dLinTol ;
|
||||
LuaCheckParam( L, 4, dLinTol) ;
|
||||
// creo la STM
|
||||
int nId = ExeCreateSurfShell( nParentId, nSurfId, dThick, dLinTol) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfBezier( lua_State* L)
|
||||
@@ -891,21 +1051,27 @@ LuaCreateSurfBezierRational( lua_State* L)
|
||||
static int
|
||||
LuaCreateSurfBezierLeaves( lua_State* L)
|
||||
{
|
||||
// 2, 3 o 4 parametri : ParentId, nId [, nTextHeight] [, bShowTrim]
|
||||
// 2, 3 o 4 parametri : ParentId, nId [, nTextHeight] [, bShowTrim] [, bRefined]
|
||||
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
|
||||
bool bRefined = false ;
|
||||
// testo più due booleani o solo due booleani
|
||||
if ( LuaGetParam( L, 3, nTextHeight)) {
|
||||
if ( LuaGetParam( L, 4, bShowTrim))
|
||||
LuaGetParam( L, 5, bRefined) ;
|
||||
}
|
||||
else {
|
||||
LuaGetParam( L, 3, bShowTrim) ;
|
||||
LuaGetParam( L, 4, bRefined) ;
|
||||
}
|
||||
LuaClearStack( L) ;
|
||||
// creo la superficie
|
||||
int nCount = 0 ;
|
||||
int nId = ExeCreateSurfBezierLeaves( nParentId, nSurfBzId, nTextHeight, bShowTrim, &nCount) ;
|
||||
int nId = ExeCreateSurfBezierLeaves( nParentId, nSurfBzId, nTextHeight, bShowTrim, bRefined, &nCount) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL) {
|
||||
LuaSetParam( L, nId) ;
|
||||
@@ -977,6 +1143,344 @@ LuaCreateBezierSphere( lua_State* 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) ;
|
||||
BIPNTVECTOR vGuides ;
|
||||
|
||||
// creo una surf bezier come rigata tra le due curve passate, usando le isocurve nel layer nLayIso
|
||||
int nId = ExeCreateSurfBzRuledGuided( nParentId, nCrvId1, nCrvId2, vGuides, bCapEnds, dLinTol, nLayGuides) ;
|
||||
// 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)
|
||||
@@ -988,6 +1492,7 @@ 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) ;
|
||||
@@ -996,8 +1501,12 @@ 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) ;
|
||||
@@ -1011,10 +1520,22 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByVolZmap", LuaCreateSurfTmByVolZmap) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmShell", LuaCreateSurfShell) ;
|
||||
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( "EgtCreateBezierSphere", LuaCreateBezierSphere) ;
|
||||
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 ;
|
||||
}
|
||||
|
||||
+8
-36
@@ -14,6 +14,7 @@
|
||||
//--------------------------- 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"
|
||||
@@ -120,7 +121,7 @@ LuaCreateVolZmapByRegionExtrusion( lua_State* L)
|
||||
static int
|
||||
LuaCreateVolZmapFromSurfTm( lua_State* L)
|
||||
{
|
||||
// 3 o 4 parametri : ParentId, StmId, dPrec [, bTriDex]
|
||||
// 3 o 4 o 5 parametri : ParentId, StmId, dPrec [, bTriDex] [, dExtraBox]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nStmId ;
|
||||
@@ -128,10 +129,14 @@ LuaCreateVolZmapFromSurfTm( lua_State* L)
|
||||
double dPrec ;
|
||||
LuaCheckParam( L, 3, dPrec)
|
||||
bool bTriDex = true ;
|
||||
LuaGetParam( L, 4, bTriDex) ;
|
||||
double dExtraBox = 0 ;
|
||||
if ( LuaGetParam( L, 4, bTriDex))
|
||||
LuaGetParam( L, 5, dExtraBox) ;
|
||||
else
|
||||
LuaGetParam( L, 4, dExtraBox) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo VZM da superficie trimesh
|
||||
int nId = ExeCreateVolZmapFromSurfTm( nParentId, nStmId, dPrec, bTriDex) ;
|
||||
int nId = ExeCreateVolZmapFromSurfTm( nParentId, nStmId, dPrec, bTriDex, dExtraBox) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
@@ -140,37 +145,6 @@ LuaCreateVolZmapFromSurfTm( lua_State* L)
|
||||
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)
|
||||
{
|
||||
// 1 o 2 parametri : nVolZmapId [, dToler]
|
||||
int nVolZmapId ;
|
||||
LuaCheckParam( L, 1, nVolZmapId) ;
|
||||
double dToler = EPS_SMALL ;
|
||||
LuaGetParam( L, 2, dToler) ;
|
||||
LuaClearStack( L) ;
|
||||
bool bOk = ExeUniformVolZmap( nVolZmapId, dToler) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbCreateVol( LuaMgr& luaMgr)
|
||||
@@ -180,7 +154,5 @@ LuaInstallGdbCreateVol( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapEmpty", LuaCreateVolZmapEmpty) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapByRegionExtrusion", LuaCreateVolZmapByRegionExtrusion) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapFromSurfTm", LuaCreateVolZmapFromSurfTm) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateVolZmapByAddingSurfTm", LuaUpdateVolZmapByAddingSurfTm ) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtUniformZmap", LuaUniformVolZmap) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
+134
-8
@@ -57,6 +57,25 @@ 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)
|
||||
@@ -142,7 +161,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 ;
|
||||
@@ -166,7 +185,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 ;
|
||||
@@ -188,7 +207,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 ;
|
||||
@@ -242,6 +261,23 @@ 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)
|
||||
@@ -522,7 +558,7 @@ LuaCurveCompoNormVersor( lua_State* L)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 3, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero l'angolo al centro della curva semplice indicizzata
|
||||
// recupero il versore normale della curva semplice indicizzata (non nullo solo se arco)
|
||||
Vector3d vtNorm ;
|
||||
if ( ExeCurveCompoNormVersor( nId, nCrv, nRefId, vtNorm))
|
||||
LuaSetParam( L, vtNorm) ;
|
||||
@@ -533,14 +569,54 @@ LuaCurveCompoNormVersor( lua_State* L)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaShowBezierCurveControlPoint( lua_State* L)
|
||||
LuaCurveCompoGetTempProp( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nCrvId
|
||||
// 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 = ExeShowBezierCurveControlPoints( nCrvId, &nCount) ;
|
||||
int nId = ExeShowCurveBezierControlPoints( nCrvId, nDestGrpId, &nCount) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL) {
|
||||
LuaSetParam( L, nId) ;
|
||||
@@ -553,6 +629,50 @@ LuaShowBezierCurveControlPoint( lua_State* 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)
|
||||
@@ -560,6 +680,7 @@ 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) ;
|
||||
@@ -569,6 +690,7 @@ 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) ;
|
||||
@@ -584,6 +706,10 @@ 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( "EgtShowBezierCurveControlPoints", LuaShowBezierCurveControlPoint) ;
|
||||
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 ;
|
||||
}
|
||||
|
||||
+207
-8
@@ -48,7 +48,7 @@ LuaSurfIsClosed( lua_State* L)
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// verifico se è superficie chiusa
|
||||
// verifico se � superficie chiusa
|
||||
bool bOk = ExeSurfIsClosed( nId) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -121,6 +121,25 @@ 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)
|
||||
@@ -199,7 +218,7 @@ LuaSurfFrMoveSimpleNoCollision( lua_State* L)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico quale è la massima traslazione possibile
|
||||
// verifico quale � la massima traslazione possibile
|
||||
double dLen = vtMove.Len() ;
|
||||
Vector3d vtDir = ( dLen > EPS_SMALL ? vtMove / dLen : V_NULL) ;
|
||||
bool bOk = ExeSurfFrMoveSimpleNoCollision( nId1, nId2, vtDir, dLen, nRefType) ;
|
||||
@@ -227,7 +246,7 @@ LuaSurfFrRotateSimpleNoCollision( lua_State* L)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico quale è la massima (in valore assoluto) rotazione possibile
|
||||
// verifico quale � la massima (in valore assoluto) rotazione possibile
|
||||
bool bOk = ExeSurfFrRotateSimpleNoCollision( nId1, nId2, ptCen, dAngDeg, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
@@ -282,6 +301,25 @@ LuaSurfTmPartCount( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmGetPartAndShellFromFacet( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id SurfTm, Id Facet
|
||||
int nIdSurfTm ;
|
||||
LuaCheckParam( L, 1, nIdSurfTm)
|
||||
int nIdFacet ;
|
||||
LuaCheckParam( L, 2, nIdFacet)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il numero di parti della superficie trimesh
|
||||
int nPart = - 1 ;
|
||||
int nShell = - 1 ;
|
||||
ExeSurfTmGetPartAndShellFromFacet( nIdSurfTm, nIdFacet, nPart, nShell) ;
|
||||
LuaSetParam( L, nPart) ;
|
||||
LuaSetParam( L, nShell) ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmGetVertex( lua_State* L)
|
||||
@@ -316,7 +354,7 @@ LuaSurfTmGetNearestVertex( lua_State* L)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 3, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il vertice più vicino della superficie
|
||||
// recupero il vertice pi� vicino della superficie
|
||||
int nVert ;
|
||||
Point3d ptVert ;
|
||||
bool bOk = ExeSurfTmGetNearestVertex( nId, ptNear, nRefId, nVert, ptVert) ;
|
||||
@@ -331,6 +369,27 @@ 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)
|
||||
@@ -459,19 +518,21 @@ LuaSurfTmGetFacetOutlineInfo( lua_State* L)
|
||||
int nStatus ;
|
||||
BOOLVECTOR vbOpen ;
|
||||
INTVECTOR vnAdj ;
|
||||
PNTVECTOR vptStart ;
|
||||
VCT3DVECTOR vvtNorm ;
|
||||
DBLVECTOR vdElev ;
|
||||
DBLVECTOR vdLen ;
|
||||
bool bOk = ExeSurfTmGetFacetOutlineInfo( nId, nFacet, nRefId, nStatus, vbOpen, vnAdj, vdLen, vvtNorm, vdElev) ;
|
||||
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 6 ;
|
||||
return 7 ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L) ;
|
||||
@@ -514,7 +575,7 @@ LuaSurfTmFacetNearestEndPoint( lua_State* L)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 4, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto End più vicino della faccia della superficie trimesh
|
||||
// recupero il punto End pi� vicino della faccia della superficie trimesh
|
||||
Point3d ptEnd ;
|
||||
Vector3d vtN ;
|
||||
if ( ExeSurfTmFacetNearestEndPoint( nId, nFacet, ptNear, nRefId, ptEnd, vtN)) {
|
||||
@@ -542,7 +603,7 @@ LuaSurfTmFacetNearestMidPoint( lua_State* L)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 4, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto Mid più vicino della faccia della superficie trimesh
|
||||
// recupero il punto Mid pi� vicino della faccia della superficie trimesh
|
||||
Point3d ptMid ;
|
||||
Vector3d vtN ;
|
||||
if ( ExeSurfTmFacetNearestMidPoint( nId, nFacet, ptNear, nRefId, ptMid, vtN)) {
|
||||
@@ -808,6 +869,38 @@ 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)
|
||||
@@ -832,6 +925,28 @@ 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)
|
||||
@@ -881,6 +996,30 @@ LuaSurfTmGetEdges( lua_State* 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)
|
||||
@@ -1020,6 +1159,34 @@ LuaSurfBezierGetCurveV( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfBezParamsFromPoint( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : nSurfId, ptOnSurf [, nRefId]
|
||||
int nSurfId ;
|
||||
LuaCheckParam( L, 1, nSurfId)
|
||||
Point3d ptOnSurf ;
|
||||
LuaCheckParam( L, 2, ptOnSurf)
|
||||
int nRefId = nSurfId ;
|
||||
LuaGetParam( L, 3, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero le coordinate parametriche del punto
|
||||
double dU = - 1 ;
|
||||
double dV = - 1 ;
|
||||
bool bOk = ExeSurfBezierParamsFromPoint( nSurfId, ptOnSurf, nRefId, dU, dV) ;
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, dU) ;
|
||||
LuaSetParam( L, dV) ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L) ;
|
||||
LuaSetParam( L) ;
|
||||
}
|
||||
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfBezierGetInfo( lua_State* L)
|
||||
@@ -1116,6 +1283,30 @@ 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)
|
||||
@@ -1127,6 +1318,7 @@ 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) ;
|
||||
@@ -1135,8 +1327,10 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmVertexCount", LuaSurfTmVertexCount) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCount", LuaSurfTmFacetCount) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPartCount", LuaSurfTmPartCount) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetPartAndShellFromFacet", LuaSurfTmGetPartAndShellFromFacet) ;
|
||||
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) ;
|
||||
@@ -1155,17 +1349,22 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
|
||||
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) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetCurveU", LuaSurfBezierGetCurveU) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetCurveV", LuaSurfBezierGetCurveV) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezParamsFromPoint", LuaSurfBezParamsFromPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetInfo", LuaSurfBezierGetInfo) ;
|
||||
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 ;
|
||||
}
|
||||
|
||||
+192
-86
@@ -409,7 +409,7 @@ LuaTrimExtendCurveByLen( lua_State* L)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// taglio o allungo la curva nell'estremo più vicino al punto
|
||||
// taglio o allungo la curva nell'estremo più vicino al punto
|
||||
bool bOk = ExeTrimExtendCurveByLen( nId, dLen, ptNear, nRefType) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -586,6 +586,22 @@ 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)
|
||||
@@ -741,7 +757,7 @@ LuaRemoveCurveCompoCurve( lua_State* L)
|
||||
// 1 o 2 parametri : Id [, bLast]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
bool bLast ;
|
||||
bool bLast = true ;
|
||||
LuaGetParam( L, 2, bLast) ;
|
||||
LuaClearStack( L) ;
|
||||
// rimuovo prima o ultima curva della composita
|
||||
@@ -913,20 +929,62 @@ LuaRemoveCurveCompoUndercutOnY( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveCompoSetTempProp( lua_State* L)
|
||||
{
|
||||
// 3 parametri : Id, nCrv, nProp [, nPropInd]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nCrv ;
|
||||
LuaCheckParam( L, 2, nCrv)
|
||||
int nProp ;
|
||||
LuaCheckParam( L, 3, nProp)
|
||||
int nPropInd = 0 ;
|
||||
LuaGetParam( L, 4, nPropInd) ;
|
||||
LuaClearStack( L) ;
|
||||
// imposto sulla curva della composita la proprietà temporanea
|
||||
bool bOk = ExeCurveCompoSetTempProp( nId, nCrv, nProp, nPropInd) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveCompoSetTempParam( lua_State* L)
|
||||
{
|
||||
// 3 parametri : Id, nCrv, dParam [, nParamInd]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nCrv ;
|
||||
LuaCheckParam( L, 2, nCrv)
|
||||
double dParam ;
|
||||
LuaCheckParam( L, 3, dParam)
|
||||
int nParamInd = 0 ;
|
||||
LuaGetParam( L, 4, nParamInd) ;
|
||||
LuaClearStack( L) ;
|
||||
// imposto sulla curva della composita il parametro temporaneo
|
||||
bool bOk = ExeCurveCompoSetTempParam( nId, nCrv, dParam, nParamInd) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaChainCurvesInGroup( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : nGroupId, ptNear [, nRefType]
|
||||
// 2, 3 o 4 parametri : nGroupId, ptNear [, nRefType] [, dToler]
|
||||
int nGroupId ;
|
||||
LuaCheckParam( L, 1, nGroupId)
|
||||
Point3d ptNear ;
|
||||
LuaCheckParam( L, 2, ptNear)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
double dToler = 10 * EPS_SMALL ;
|
||||
LuaGetParam( L, 4, dToler) ;
|
||||
LuaClearStack( L) ;
|
||||
// concateno le curve nel gruppo (senza fonderle in una curva composita)
|
||||
bool bOk = ExeChainCurvesInGroup( nGroupId, ptNear, nRefType) ;
|
||||
bool bOk = ExeChainCurvesInGroup( nGroupId, ptNear, nRefType, dToler) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
@@ -935,55 +993,83 @@ LuaChainCurvesInGroup( lua_State* L)
|
||||
static int
|
||||
LuaReorderCurvesInGroup( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : nGroupId, ptNear [, nRefType]
|
||||
// 2, 3 o 4 parametri : nGroupId, ptNear [, nRefType] [, dToler]
|
||||
int nGroupId ;
|
||||
LuaCheckParam( L, 1, nGroupId)
|
||||
Point3d ptNear ;
|
||||
LuaCheckParam( L, 2, ptNear)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
double dToler = 10 * EPS_SMALL ;
|
||||
LuaGetParam( L, 4, dToler) ;
|
||||
LuaClearStack( L) ;
|
||||
// riordino le curve nel gruppo (senza fonderle in una curva composita)
|
||||
bool bOk = ExeReorderCurvesInGroup( nGroupId, ptNear, nRefType) ;
|
||||
bool bOk = ExeReorderCurvesInGroup( nGroupId, ptNear, nRefType, dToler) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaProjectCurveOnSurfTm( lua_State* L)
|
||||
LuaProjectCurveOnSurf( lua_State* L)
|
||||
{
|
||||
// 4, 5, 6 o 7 parametri : nCurveId, nSurfTmId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, nRefType]]
|
||||
// 3, 4 o 5 parametri : nCurveId, vSurfId, nDestGrpId [, dLinTol [, dMaxSegmLen]]
|
||||
int nCurveId ;
|
||||
LuaCheckParam( L, 1, nCurveId)
|
||||
int nSurfTmId ;
|
||||
LuaCheckParam( L, 2, nSurfTmId)
|
||||
INTVECTOR vSurfId ;
|
||||
LuaCheckParam( L, 2, vSurfId)
|
||||
int nDestGrpId ;
|
||||
LuaCheckParam( L, 3, nDestGrpId)
|
||||
double dLinTol = 0.01 ;
|
||||
double dMaxSegmLen = INFINITO ;
|
||||
if ( LuaGetParam( L, 4, dLinTol))
|
||||
LuaGetParam( L, 5, dMaxSegmLen) ;
|
||||
LuaClearStack( L) ;
|
||||
// proietto la curva su una o più superfici a minima distanza
|
||||
bool bOk = ExeProjectCurveOnSurf( nCurveId, vSurfId, nDestGrpId, dLinTol, dMaxSegmLen) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaProjectCurveOnSurfDir( lua_State* L)
|
||||
{
|
||||
// 4, 5, 6, 7 o 8 parametri : nCurveId, vSurfId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromProj] [,bFromVsTo] [, 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 ;
|
||||
bool bFromVsTo = true ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 5, dLinTol) &&
|
||||
LuaGetParam( L, 6, dMaxSegmLen))
|
||||
LuaGetParam( L, 7, nRefType) ;
|
||||
LuaGetParam( L, 6, dMaxSegmLen) &&
|
||||
LuaGetParam( L, 7, bDirFromProj) &&
|
||||
LuaGetParam( L, 8, bFromVsTo))
|
||||
LuaGetParam( L, 9, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// proietto la curva su una trimesh secondo la direzione data
|
||||
bool bOk = ExeProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, nRefType) ;
|
||||
// proietto la curva su una o più superfici secondo la direzione data
|
||||
bool bOk = ExeProjectCurveOnSurfDir( nCurveId, vSurfId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, bFromVsTo, nRefType) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaProjectCurveOnSurfTmExt( lua_State* L)
|
||||
LuaProjectCurveOnSurfExt( lua_State* L)
|
||||
{
|
||||
// 4, 5, 6 o 7 parametri : nCurveId, nSurfTmId, nGuideId, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromGuide]]
|
||||
// 4, 5, 6 o 7 parametri : nCurveId, vSurfId, nGuideId, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromGuide] [,bFromVsTo]]
|
||||
int nCurveId ;
|
||||
LuaCheckParam( L, 1, nCurveId)
|
||||
int nSurfTmId ;
|
||||
LuaCheckParam( L, 2, nSurfTmId)
|
||||
INTVECTOR vSurfId ;
|
||||
LuaCheckParam( L, 2, vSurfId)
|
||||
int nGuideId ;
|
||||
LuaCheckParam( L, 3, nGuideId)
|
||||
int nDestGrpId ;
|
||||
@@ -991,64 +1077,14 @@ LuaProjectCurveOnSurfTmExt( lua_State* L)
|
||||
double dLinTol = 0.01 ;
|
||||
double dMaxSegmLen = INFINITO ;
|
||||
bool bDirFromGuide = false ;
|
||||
bool bFromVsTo = true ;
|
||||
if ( LuaGetParam( L, 5, dLinTol) &&
|
||||
LuaGetParam( L, 6, dMaxSegmLen))
|
||||
LuaGetParam( L, 7, bDirFromGuide) ;
|
||||
LuaGetParam( L, 6, dMaxSegmLen) &&
|
||||
LuaGetParam( L, 7, bDirFromGuide))
|
||||
LuaGetParam( L, 8, bFromVsTo) ;
|
||||
LuaClearStack( L) ;
|
||||
// proietto la curva su una trimesh secondo la direzione data
|
||||
bool bOk = ExeProjectCurveOnSurfTmExt( nCurveId, nSurfTmId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaProjectCurveOnSurfBz( lua_State* L)
|
||||
{
|
||||
// 4, 5, 6 o 7 parametri : nCurveId, nSurfBzId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, nRefType]]
|
||||
int nCurveId ;
|
||||
LuaCheckParam( L, 1, nCurveId)
|
||||
int nSurfBzId ;
|
||||
LuaCheckParam( L, 2, nSurfBzId)
|
||||
Vector3d vtDir ;
|
||||
LuaCheckParam( L, 3, vtDir)
|
||||
int nDestGrpId ;
|
||||
LuaCheckParam( L, 4, nDestGrpId)
|
||||
double dLinTol = 0.01 ;
|
||||
double dMaxSegmLen = INFINITO ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 5, dLinTol) &&
|
||||
LuaGetParam( L, 6, dMaxSegmLen))
|
||||
LuaGetParam( L, 7, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// proietto la curva su una trimesh secondo la direzione data
|
||||
bool bOk = ExeProjectCurveOnSurfBz( nCurveId, nSurfBzId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, nRefType) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaProjectCurveOnSurfBzExt( lua_State* L)
|
||||
{
|
||||
// 4, 5, 6 o 7 parametri : nCurveId, nSurfBzId, nGuideId, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromGuide]]
|
||||
int nCurveId ;
|
||||
LuaCheckParam( L, 1, nCurveId)
|
||||
int nSurfBzId ;
|
||||
LuaCheckParam( L, 2, nSurfBzId)
|
||||
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 trimesh secondo la direzione data
|
||||
bool bOk = ExeProjectCurveOnSurfBzExt( nCurveId, nSurfBzId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
|
||||
// proietto la curva su una o più superfici secondo la direzione verso la guida
|
||||
bool bOk = ExeProjectCurveOnSurfExt( nCurveId, vSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide, bFromVsTo) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
@@ -1057,9 +1093,9 @@ LuaProjectCurveOnSurfBzExt( lua_State* L)
|
||||
static int
|
||||
LuaCurveGetVoronoi( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, nDestGrpId [, nBound]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
// 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
|
||||
@@ -1067,7 +1103,7 @@ LuaCurveGetVoronoi( lua_State* L)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo
|
||||
int nCount = 0 ;
|
||||
int nNewId = ExeCurveGetVoronoi( nId, nDestGrpId, nBound, &nCount) ;
|
||||
int nNewId = ExeCurveGetVoronoi( vIds, nDestGrpId, nBound, &nCount) ;
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nNewId) ;
|
||||
else
|
||||
@@ -1081,9 +1117,9 @@ LuaCurveGetVoronoi( lua_State* L)
|
||||
static int
|
||||
LuaCurveMedialAxisAdv( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, nDestGrpId [, nSide]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
// 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
|
||||
@@ -1091,7 +1127,7 @@ LuaCurveMedialAxisAdv( lua_State* L)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo
|
||||
int nCount = 0 ;
|
||||
int nNewId = ExeCurveGetMedialAxis( nId, nDestGrpId, nSide, &nCount) ;
|
||||
int nNewId = ExeCurveGetMedialAxis( vIds, nDestGrpId, nSide, &nCount) ;
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nNewId) ;
|
||||
else
|
||||
@@ -1129,6 +1165,70 @@ LuaCurveGetFatCurve( lua_State* L)
|
||||
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)
|
||||
@@ -1164,6 +1264,7 @@ 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) ;
|
||||
@@ -1182,14 +1283,19 @@ 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( "EgtProjectCurveOnSurfTm", LuaProjectCurveOnSurfTm) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfTmExt", LuaProjectCurveOnSurfTmExt) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurf", LuaProjectCurveOnSurf) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfDir", LuaProjectCurveOnSurfDir) ;
|
||||
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( "EgtProjectCurveOnSurfBz", LuaProjectCurveOnSurfBz) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfBzExt", LuaProjectCurveOnSurfBzExt) ;
|
||||
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 ;
|
||||
}
|
||||
|
||||
+126
-25
@@ -18,6 +18,7 @@
|
||||
#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"
|
||||
|
||||
@@ -165,6 +166,23 @@ LuaSurfFrOffsetAdv( lua_State* 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)
|
||||
@@ -308,29 +326,6 @@ LuaCutSurfTmPlane( lua_State* L)
|
||||
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
|
||||
LuaCutSurfTmClosedCurve( lua_State* L)
|
||||
@@ -566,6 +561,107 @@ LuaSurfTmGetShowEdges( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmSetSmoothAng( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nId, dAngDeg
|
||||
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
|
||||
LuaSurfTmGetSmoothAng( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nId
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero lo smooth angle della superficie
|
||||
double dAngDeg ;
|
||||
bool bOk = ExeSurfTmGetSmoothAng( nId, dAngDeg) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, dAngDeg) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
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)
|
||||
@@ -586,7 +682,7 @@ LuaSurfBzTrim( lua_State* L)
|
||||
bool
|
||||
LuaInstallGdbModifySurf( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bool bOk = true ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtInvertSurf", LuaInvertSurf) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeSurf", LuaExplodeSurf) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtApproxSurf", LuaApproxSurf) ;
|
||||
@@ -595,6 +691,7 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
|
||||
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) ;
|
||||
@@ -602,7 +699,6 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwapFacets", LuaSurfTmSwapFacets) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemovePart", LuaSurfTmRemovePart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmPlane", LuaCutSurfTmPlane) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfBzPlane", LuaCutSurfBzPlane) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmClosedCurve", LuaCutSurfTmClosedCurve) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmAdd", LuaSurfTmAdd) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtract", LuaSurfTmSubtract) ;
|
||||
@@ -615,6 +711,11 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
|
||||
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( "EgtSurfTmGetSmoothAng", LuaSurfTmGetSmoothAng) ;
|
||||
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 ;
|
||||
}
|
||||
|
||||
+97
-1
@@ -73,6 +73,25 @@ LuaVolZmapSetShowEdges( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaVolZmapGetShowEdges( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// imposto flag visualizzazione spigoli vivi
|
||||
bool bShow ;
|
||||
bool bOk = ExeVolZmapGetShowEdges( nId, bShow) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetParam( L, bShow) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRemoveVolZmapPart( lua_State* L)
|
||||
@@ -378,13 +397,85 @@ LuaCutVolZmapPlane( lua_State* L)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// taglio la superficie con ilpiano
|
||||
// taglio la superficie con il piano
|
||||
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
|
||||
LuaVolZmapMakeUniform( 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 = ExeVolZmapMakeUniform( 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 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaVolZmapRemoveFins( lua_State* L)
|
||||
{
|
||||
// 3 parametri : Id, vtDir, dThick
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId) ;
|
||||
Vector3d vtDir ;
|
||||
LuaCheckParam( L, 2, vtDir) ;
|
||||
double dThick ;
|
||||
LuaCheckParam( L, 3, dThick) ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// Eseguo la rimozione delle alette
|
||||
bool bOk = ExeVolZMapRemoveFins( nId, vtDir, dThick, nRefType) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbModifyVol( LuaMgr& luaMgr)
|
||||
@@ -393,6 +484,7 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeVolume", LuaExplodeVolume) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapChangeResolution", LuaVolZmapChangeResolution) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetShowEdges", LuaVolZmapSetShowEdges) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetShowEdges", LuaVolZmapGetShowEdges) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdvTool", LuaVolZmapSetAdvTool) ;
|
||||
@@ -405,5 +497,9 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
|
||||
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( "EgtVolZmapMakeUniform", LuaVolZmapMakeUniform) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapOffset", LuaVolZmapOffset) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapRemoveFins", LuaVolZmapRemoveFins) ;
|
||||
return bOk ;
|
||||
}
|
||||
+33
-11
@@ -42,13 +42,13 @@ LuaCopyAttributes( lua_State* L)
|
||||
static int
|
||||
LuaSetLevel( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nId, nLevel
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
// 2 parametri : Ids, nLevel
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
int nLevel ;
|
||||
LuaCheckParam( L, 2, nLevel)
|
||||
// imposto lo stato
|
||||
bool bOk = ExeSetLevel( nId, nLevel) ;
|
||||
bool bOk = ExeSetLevel( vId, 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 : nId, nMode
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
// 2 parametri : Ids, nMode
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
int nMode ;
|
||||
LuaCheckParam( L, 2, nMode)
|
||||
LuaClearStack( L) ;
|
||||
// imposto il modo
|
||||
bool bOk = ExeSetMode( nId, nMode) ;
|
||||
bool bOk = ExeSetMode( vId, 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 : Id, nStatus
|
||||
// 2 parametri : Ids, nStatus
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
int nStatus ;
|
||||
@@ -247,12 +247,14 @@ LuaGetCalcStatus( lua_State* L)
|
||||
static int
|
||||
LuaSetMark( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
// 1 o 2 parametri : Id [, nMark]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nMark = 1 ;
|
||||
LuaGetParam( L, 2, nMark) ;
|
||||
LuaClearStack( L) ;
|
||||
// imposto l'evidenziazione
|
||||
bool bOk = ExeSetMark( nId) ;
|
||||
bool bOk = ExeSetMark( nId, nMark) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -782,6 +784,25 @@ 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)
|
||||
@@ -824,5 +845,6 @@ 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 ;
|
||||
}
|
||||
|
||||
+118
-26
@@ -208,31 +208,6 @@ 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)
|
||||
@@ -313,6 +288,48 @@ 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)
|
||||
@@ -472,6 +489,32 @@ 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)
|
||||
@@ -494,6 +537,51 @@ 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
|
||||
LuaDuplicateGeomDB( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : nSouCtx, nDestCtx [, bSkipTemp]
|
||||
int nSouCtx ;
|
||||
LuaCheckParam( L, 1, nSouCtx)
|
||||
int nDestCtx ;
|
||||
LuaCheckParam( L, 2, nDestCtx)
|
||||
bool bSkipTemp = false ;
|
||||
LuaGetParam( L, 3, bSkipTemp) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la copia
|
||||
bool bOk = ExeDuplicateGeomDB( nSouCtx, nDestCtx, bSkipTemp) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRelocate( lua_State* L)
|
||||
@@ -632,11 +720,12 @@ 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) ;
|
||||
@@ -645,7 +734,10 @@ 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( "EgtDuplicateGeomDB", LuaDuplicateGeomDB) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRelocate", LuaRelocate) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRelocateGlob", LuaRelocateGlob) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGroupSwap", LuaGroupSwap) ;
|
||||
|
||||
+344
-126
@@ -30,8 +30,9 @@
|
||||
#include "/EgtDev/Include/EgtIniFile.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "Windowsx.h"
|
||||
#include "shlobj.h"
|
||||
#include <sstream>
|
||||
#include <Windowsx.h>
|
||||
#include <shlobj.h>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -88,12 +89,14 @@ LuaEvalNumExpr( lua_State* L)
|
||||
static int
|
||||
LuaPause( lua_State* L)
|
||||
{
|
||||
// 1 parametro : numero di millisecondi
|
||||
// 1 o 2 parametri : numero di millisecondi [, bForced]
|
||||
int nTime ;
|
||||
LuaCheckParam( L, 1, nTime)
|
||||
bool bForced = false ;
|
||||
LuaGetParam( L, 2, bForced) ;
|
||||
LuaClearStack( L) ;
|
||||
// se abilitata UI, controllo la durata della pausa e la eseguo
|
||||
if ( ExeGetEnableUI()) {
|
||||
// se forzata o abilitata UI, controllo la durata della pausa e la eseguo
|
||||
if ( bForced || ExeGetEnableUI()) {
|
||||
const int MIN_TIME = 0 ;
|
||||
const int MAX_TIME = 10000 ;
|
||||
if ( nTime < MIN_TIME)
|
||||
@@ -896,6 +899,21 @@ LuaEraseDirectory( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaEraseNonEmptyDirectory( lua_State* L)
|
||||
{
|
||||
// 1 parametro : sDir
|
||||
string sDir ;
|
||||
LuaCheckParam( L, 1, sDir)
|
||||
LuaClearStack( L) ;
|
||||
// cancello direttorio (deve essere vuoto)
|
||||
bool bOk = EraseNonEmptyDirectory( sDir) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTextFileCompare( lua_State* L)
|
||||
@@ -1083,6 +1101,50 @@ 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)
|
||||
@@ -1152,146 +1214,298 @@ LuaReleaseMutex( lua_State* L)
|
||||
//-------------------------------------------------------------------------------
|
||||
const int MAX_CTRLS = IDC_TEXT8 -IDC_TEXT1 + 1 ;
|
||||
const int OFFS_CTRLS = 40 ;
|
||||
enum TYPE_CTRLS { CTRL_NONE = 0, CTRL_CHECK = 1, CTRL_COMBO = 2, CTRL_EDIT = 3} ;
|
||||
enum TYPE_CTRLS { CTRL_NONE = 0, CTRL_CHECK = 1, CTRL_COMBO = 2, CTRL_EDIT = 3, CTRL_COLOR = 4} ;
|
||||
static int s_nCtrls = 0 ;
|
||||
static string s_sCaption ;
|
||||
static string s_sText[MAX_CTRLS] ;
|
||||
static string s_sEdit[MAX_CTRLS] ;
|
||||
static int s_nType[MAX_CTRLS] ;
|
||||
static COLORREF s_CustomColors[16] = {12632256} ; // 16 colori GRAY
|
||||
static bool s_bCustomColorsInit = false ; // flag di inizializzazione colori
|
||||
const char* SEC_SCENE = "Scene" ;
|
||||
const char* KEY_CUSTOMCOLORS = "CustomColors" ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
BOOL
|
||||
CALLBACK DialogBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
{
|
||||
// variabili static locali per mantenere lo stato tra chiamate per selezione colori
|
||||
static COLORREF selectedColor[MAX_CTRLS] = {0} ; // BLACK
|
||||
static HBRUSH hColorBrush[MAX_CTRLS] = {NULL} ; // non definito
|
||||
|
||||
switch ( message) {
|
||||
case WM_INITDIALOG :
|
||||
{
|
||||
// dati del dialogo
|
||||
HWND hwndOwner = GetParent( hwndDlg) ;
|
||||
if ( hwndOwner == nullptr)
|
||||
hwndOwner = GetDesktopWindow() ;
|
||||
RECT rcOwner, rcDlg ;
|
||||
GetWindowRect( hwndOwner, &rcOwner) ;
|
||||
GetWindowRect( hwndDlg, &rcDlg) ;
|
||||
// determino la posizione dell'ultima riga di dati da visualizzare
|
||||
HWND hwndLR = GetDlgItem( hwndDlg, IDC_TEXT1 + Clamp( s_nCtrls, 1, MAX_CTRLS) - 1) ;
|
||||
RECT rcLR ;
|
||||
GetWindowRect( hwndLR, &rcLR) ;
|
||||
POINT ptLR{ rcLR.left, rcLR.top} ;
|
||||
ScreenToClient( hwndDlg, &ptLR) ;
|
||||
// centro e scalo il dialogo
|
||||
int nNewH = rcLR.top - rcOwner.top + 2 * OFFS_CTRLS ; // non chiaro perchè va sottratto rcOwner.top ma funziona sempre
|
||||
SetWindowPos( hwndDlg,
|
||||
HWND_TOP,
|
||||
( rcOwner.left + rcOwner.right - ( rcDlg.right - rcDlg.left)) / 2,
|
||||
( rcOwner.top + rcOwner.bottom - nNewH) / 2,
|
||||
( rcDlg.right - rcDlg.left),
|
||||
nNewH,
|
||||
0) ;
|
||||
// riposiziono il bottone Ok
|
||||
HWND hwndOk = GetDlgItem( hwndDlg, IDOK) ;
|
||||
RECT rcOk ;
|
||||
GetWindowRect( hwndOk, &rcOk) ;
|
||||
POINT ptOk{ rcOk.left, rcOk.top} ;
|
||||
ScreenToClient( hwndDlg, &ptOk) ;
|
||||
SetWindowPos( hwndOk,
|
||||
hwndDlg,
|
||||
ptOk.x,
|
||||
ptLR.y + OFFS_CTRLS,
|
||||
0, 0,
|
||||
SWP_NOSIZE | SWP_NOZORDER) ;
|
||||
// riposiziono il bottone Cancel
|
||||
HWND hwndCl = GetDlgItem( hwndDlg, IDCANCEL) ;
|
||||
RECT rcCl ;
|
||||
GetWindowRect( hwndCl, &rcCl) ;
|
||||
POINT ptCl{ rcCl.left, rcCl.top} ;
|
||||
ScreenToClient( hwndDlg, &ptCl) ;
|
||||
SetWindowPos( hwndCl,
|
||||
hwndDlg,
|
||||
ptCl.x,
|
||||
ptLR.y + OFFS_CTRLS,
|
||||
0, 0,
|
||||
SWP_NOSIZE | SWP_NOZORDER) ;
|
||||
}
|
||||
// assegno titolo del dialogo
|
||||
SetWindowText( hwndDlg, stringtoW( s_sCaption)) ;
|
||||
// assegno testi e valori di default e nascondo linee dei controlli non usati
|
||||
for ( int i = 0 ; i < MAX_CTRLS ; ++ i) {
|
||||
if ( i < s_nCtrls) {
|
||||
SetDlgItemText( hwndDlg, IDC_TEXT1 + i, stringtoW( s_sText[i])) ;
|
||||
if ( s_sEdit[i].find( "CK:") == 0) {
|
||||
bool bChecked = false ;
|
||||
FromString( s_sEdit[i].substr( 3), bChecked) ;
|
||||
CheckDlgButton( hwndDlg, IDC_CHECK1 + i, ( bChecked ? BST_CHECKED : BST_UNCHECKED)) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO1 + i), SW_HIDE) ;
|
||||
s_nType[i] = CTRL_CHECK ;
|
||||
case WM_INITDIALOG :
|
||||
{
|
||||
// colore di default
|
||||
COLORREF defaultColor = RGB( 255, 0, 0) ;
|
||||
// inizializzazione colori e brush
|
||||
for ( int i = 0 ; i < MAX_CTRLS ; ++ i) {
|
||||
selectedColor[i] = defaultColor ;
|
||||
if ( hColorBrush[i] != NULL)
|
||||
DeleteObject( hColorBrush[i]) ;
|
||||
hColorBrush[i] = CreateSolidBrush( selectedColor[i]) ;
|
||||
}
|
||||
else if ( s_sEdit[i].find( "CB:") == 0) {
|
||||
string sList = s_sEdit[i].substr( 3) ;
|
||||
STRVECTOR vsVal ;
|
||||
Tokenize( sList, ",", vsVal) ;
|
||||
int nSel = 0 ;
|
||||
HWND hwndCBox = GetDlgItem( hwndDlg, IDC_COMBO1 + i) ;
|
||||
for ( int j = 0 ; j < int( vsVal.size()) ; ++ j) {
|
||||
string sItem ;
|
||||
if ( vsVal[j][0] == '*') {
|
||||
nSel = j ;
|
||||
sItem = vsVal[j].substr( 1) ;
|
||||
}
|
||||
else
|
||||
sItem = vsVal[j] ;
|
||||
ComboBox_AddString( hwndCBox, stringtoW( sItem)) ;
|
||||
// dati del dialogo
|
||||
HWND hwndOwner = GetParent( hwndDlg) ;
|
||||
if ( hwndOwner == nullptr)
|
||||
hwndOwner = GetDesktopWindow() ;
|
||||
RECT rcOwner, rcDlg ;
|
||||
GetWindowRect( hwndOwner, &rcOwner) ;
|
||||
GetWindowRect( hwndDlg, &rcDlg) ;
|
||||
// determino la posizione dell'ultima riga di dati da visualizzare
|
||||
HWND hwndLR = GetDlgItem( hwndDlg, IDC_TEXT1 + Clamp( s_nCtrls, 1, MAX_CTRLS) - 1) ;
|
||||
RECT rcLR ;
|
||||
GetWindowRect( hwndLR, &rcLR) ;
|
||||
POINT ptLR{ rcLR.left, rcLR.top} ;
|
||||
ScreenToClient( hwndDlg, &ptLR) ;
|
||||
// centro e scalo il dialogo
|
||||
int nNewH = rcLR.top - rcOwner.top + 2 * OFFS_CTRLS ; // non chiaro perchè va sottratto rcOwner.top ma funziona sempre
|
||||
SetWindowPos( hwndDlg,
|
||||
HWND_TOP,
|
||||
( rcOwner.left + rcOwner.right - ( rcDlg.right - rcDlg.left)) / 2,
|
||||
( rcOwner.top + rcOwner.bottom - nNewH) / 2,
|
||||
( rcDlg.right - rcDlg.left),
|
||||
nNewH,
|
||||
0) ;
|
||||
// riposiziono il bottone Ok
|
||||
HWND hwndOk = GetDlgItem( hwndDlg, IDOK) ;
|
||||
RECT rcOk ;
|
||||
GetWindowRect( hwndOk, &rcOk) ;
|
||||
POINT ptOk{ rcOk.left, rcOk.top} ;
|
||||
ScreenToClient( hwndDlg, &ptOk) ;
|
||||
SetWindowPos( hwndOk,
|
||||
hwndDlg,
|
||||
ptOk.x,
|
||||
ptLR.y + OFFS_CTRLS,
|
||||
0, 0,
|
||||
SWP_NOSIZE | SWP_NOZORDER) ;
|
||||
// riposiziono il bottone Cancel
|
||||
HWND hwndCl = GetDlgItem( hwndDlg, IDCANCEL) ;
|
||||
RECT rcCl ;
|
||||
GetWindowRect( hwndCl, &rcCl) ;
|
||||
POINT ptCl{ rcCl.left, rcCl.top} ;
|
||||
ScreenToClient( hwndDlg, &ptCl) ;
|
||||
SetWindowPos( hwndCl,
|
||||
hwndDlg,
|
||||
ptCl.x,
|
||||
ptLR.y + OFFS_CTRLS,
|
||||
0, 0,
|
||||
SWP_NOSIZE | SWP_NOZORDER) ;
|
||||
}
|
||||
// assegno titolo del dialogo
|
||||
SetWindowText( hwndDlg, stringtoW( s_sCaption)) ;
|
||||
// assegno testi e valori di default e nascondo linee dei controlli non usati
|
||||
for ( int i = 0 ; i < MAX_CTRLS ; ++ i) {
|
||||
if ( i < s_nCtrls) {
|
||||
SetDlgItemText( hwndDlg, IDC_TEXT1 + i, stringtoW( s_sText[i])) ;
|
||||
if ( s_sEdit[i].find( "CK:") == 0) {
|
||||
bool bChecked = false ;
|
||||
FromString( s_sEdit[i].substr( 3), bChecked) ;
|
||||
CheckDlgButton( hwndDlg, IDC_CHECK1 + i, ( bChecked ? BST_CHECKED : BST_UNCHECKED)) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO1 + i), SW_HIDE) ;
|
||||
s_nType[i] = CTRL_CHECK ;
|
||||
}
|
||||
else if ( s_sEdit[i].find( "CB:") == 0) {
|
||||
string sList = s_sEdit[i].substr( 3) ;
|
||||
STRVECTOR vsVal ;
|
||||
Tokenize( sList, ",", vsVal) ;
|
||||
int nSel = 0 ;
|
||||
HWND hwndCBox = GetDlgItem( hwndDlg, IDC_COMBO1 + i) ;
|
||||
for ( int j = 0 ; j < int( vsVal.size()) ; ++ j) {
|
||||
string sItem ;
|
||||
if ( vsVal[j][0] == '*') {
|
||||
nSel = j ;
|
||||
sItem = vsVal[j].substr( 1) ;
|
||||
}
|
||||
else
|
||||
sItem = vsVal[j] ;
|
||||
ComboBox_AddString( hwndCBox, stringtoW( sItem)) ;
|
||||
}
|
||||
ComboBox_SetCurSel( hwndCBox, nSel) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK1 + i), SW_HIDE) ;
|
||||
s_nType[i] = CTRL_COMBO ;
|
||||
}
|
||||
else if ( s_sEdit[i].find( "CP:") == 0) {
|
||||
string sVal = s_sEdit[i].substr( 3) ;
|
||||
Color CColor ;
|
||||
if ( ! FromString( sVal, CColor))
|
||||
CColor = INVISIBLE ;
|
||||
selectedColor[i] = RGB( CColor.GetIntRed(), CColor.GetIntGreen(), CColor.GetIntBlue()) ;
|
||||
if ( hColorBrush[i] != NULL)
|
||||
DeleteObject( hColorBrush[i]) ;
|
||||
hColorBrush[i] = CreateSolidBrush( selectedColor[i]) ;
|
||||
// recupero i valori dei colori personalizzati dal file .ini
|
||||
if ( ! s_bCustomColorsInit) {
|
||||
// recupero il file Ini
|
||||
string sIniFile = ExeGetIniFile() ;
|
||||
if ( ! sIniFile.empty()) {
|
||||
string sCustomVals = GetPrivateProfileStringUtf8( SEC_SCENE, KEY_CUSTOMCOLORS, "", sIniFile.c_str()) ;
|
||||
STRVECTOR vsWinColors ; Tokenize( sCustomVals, ",", vsWinColors) ;
|
||||
for ( int j = 0 ; j < ssize( vsWinColors) && j < 16 ; ++ j) {
|
||||
unsigned int unVal ;
|
||||
if ( FromString( vsWinColors[j], unVal)) {
|
||||
unsigned int unR = unVal & 0xFF ;
|
||||
unsigned int unG = ( unVal >> 8) & 0xFF ;
|
||||
unsigned int unB = ( unVal >> 16) & 0xFF ;
|
||||
s_CustomColors[j] = RGB( unR, unG, unB) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
s_bCustomColorsInit = true ;
|
||||
}
|
||||
// nascondo qualsiasi tipo di componente ( per sicurezza)
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO1 + i), SW_HIDE) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK1 + i), SW_HIDE) ;
|
||||
|
||||
// margini per dimensione del rettangolo preview pickColor
|
||||
const int MARGIN_RIGHT = 8 ; // spazio tra preview e bordo destro dialog
|
||||
const int PREVIEW_HEIGHT = 20 ; // altezza del rettangolo
|
||||
const int PREVIEW_MIN_WIDTH = 40 ; // larghezza minima
|
||||
|
||||
// ottieni o crea la static preview (allargata fino al bordo destro del dialog)
|
||||
HWND hwndPreview = NULL ;
|
||||
RECT rcLabel ;
|
||||
HWND hwndLabel = GetDlgItem( hwndDlg, IDC_TEXT1 + i) ;
|
||||
RECT rcClient ; GetClientRect( hwndDlg, &rcClient) ; // coordinate client del dialog
|
||||
if ( hwndLabel && GetWindowRect( hwndLabel, &rcLabel)) {
|
||||
// converti rcLabel in coordinate client
|
||||
POINT ptLabel = { rcLabel.right, rcLabel.top } ;
|
||||
ScreenToClient( hwndDlg, &ptLabel) ;
|
||||
int x = ptLabel.x + 8 ; // distanza dal label
|
||||
int y = ptLabel.y ;
|
||||
int width = rcClient.right - x - MARGIN_RIGHT ;
|
||||
if ( width < PREVIEW_MIN_WIDTH)
|
||||
width = PREVIEW_MIN_WIDTH ;
|
||||
hwndPreview = CreateWindowEx( 0, L"STATIC", NULL,
|
||||
WS_CHILD | WS_VISIBLE | SS_NOTIFY | SS_CENTERIMAGE | WS_BORDER,
|
||||
x, y, width, PREVIEW_HEIGHT,
|
||||
hwndDlg, ( HMENU)( IDC_COLOR1 + i),
|
||||
GetModuleHandle( NULL), NULL) ;
|
||||
}
|
||||
// pulizia elementi testuali
|
||||
if ( hwndPreview) {
|
||||
SetWindowText( hwndPreview, L"") ;
|
||||
SetWindowPos( hwndPreview, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) ;
|
||||
InvalidateRect( hwndPreview, NULL, TRUE) ;
|
||||
UpdateWindow( hwndPreview) ;
|
||||
}
|
||||
s_nType[i] = CTRL_COLOR ;
|
||||
}
|
||||
else {
|
||||
SetDlgItemText( hwndDlg, IDC_EDIT1 + i, stringtoW( s_sEdit[i])) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO1 + i), SW_HIDE) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK1 + i), SW_HIDE) ;
|
||||
s_nType[i] = CTRL_EDIT ;
|
||||
}
|
||||
ComboBox_SetCurSel( hwndCBox, nSel) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK1 + i), SW_HIDE) ;
|
||||
s_nType[i] = CTRL_COMBO ;
|
||||
}
|
||||
else {
|
||||
SetDlgItemText( hwndDlg, IDC_EDIT1 + i, stringtoW( s_sEdit[i])) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_TEXT1 + i), SW_HIDE) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO1 + i), SW_HIDE) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK1 + i), SW_HIDE) ;
|
||||
s_nType[i] = CTRL_EDIT ;
|
||||
s_nType[i] = CTRL_NONE ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_TEXT1 + i), SW_HIDE) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO1 + i), SW_HIDE) ;
|
||||
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK1 + i), SW_HIDE) ;
|
||||
s_nType[i] = CTRL_NONE ;
|
||||
break ;
|
||||
case WM_CTLCOLORSTATIC :
|
||||
{
|
||||
HDC hdcStatic = ( HDC)wParam ;
|
||||
HWND hwndCtrl = ( HWND)lParam ;
|
||||
int ctrlId = GetDlgCtrlID( hwndCtrl) ;
|
||||
if ( ctrlId >= IDC_COLOR1 && ctrlId <= IDC_COLOR8) {
|
||||
int idx = ctrlId - IDC_COLOR1 ;
|
||||
if ( hColorBrush[idx] == NULL)
|
||||
hColorBrush[idx] = CreateSolidBrush( selectedColor[idx]) ;
|
||||
SetBkMode( hdcStatic, OPAQUE) ;
|
||||
SetBkColor( hdcStatic, selectedColor[idx]) ;
|
||||
return ( INT_PTR)hColorBrush[idx] ;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
case WM_COMMAND : {
|
||||
int id = LOWORD( wParam) ;
|
||||
int code = HIWORD( wParam) ;
|
||||
// comando di Preview per brush di colori mediante click del mouse
|
||||
if ( code == STN_CLICKED && id >= IDC_COLOR1 && id <= IDC_COLOR8) {
|
||||
int idx = id - IDC_COLOR1 ;
|
||||
HWND hwndPreview = GetDlgItem( hwndDlg, IDC_COLOR1 + idx) ;
|
||||
if ( ! hwndPreview)
|
||||
return TRUE ;
|
||||
// apertura ChooseColor (usa hwndDlg come owner)
|
||||
CHOOSECOLOR cc = {} ;
|
||||
cc.lStructSize = sizeof( cc) ;
|
||||
cc.hwndOwner = hwndDlg ;
|
||||
cc.lpCustColors = s_CustomColors ;
|
||||
cc.rgbResult = selectedColor[idx] ;
|
||||
cc.Flags = CC_FULLOPEN | CC_RGBINIT ;
|
||||
if ( ChooseColor( &cc)) {
|
||||
selectedColor[idx] = cc.rgbResult ;
|
||||
// salvo nel file Ini i nuovi colori personalizzati
|
||||
string sIniFile = ExeGetIniFile() ;
|
||||
if ( ! sIniFile.empty()) {
|
||||
string sOut = "" ;
|
||||
for ( int j = 0 ; j < ssize( s_CustomColors) && j < 16 ; ++ j)
|
||||
sOut += ToString( ( unsigned int)s_CustomColors[j]) + "," ;
|
||||
sOut.pop_back() ;
|
||||
WritePrivateProfileStringUtf8( SEC_SCENE, KEY_CUSTOMCOLORS, sOut.c_str(), sIniFile.c_str()) ;
|
||||
}
|
||||
if ( hColorBrush[idx] != NULL)
|
||||
DeleteObject( hColorBrush[idx]) ;
|
||||
hColorBrush[idx] = CreateSolidBrush( selectedColor[idx]) ;
|
||||
InvalidateRect(hwndPreview, NULL, TRUE) ;
|
||||
UpdateWindow( hwndPreview) ;
|
||||
}
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
switch ( LOWORD( wParam)) {
|
||||
case IDOK :
|
||||
for ( int i = 0 ; i < s_nCtrls ; ++ i) {
|
||||
AtoWEX<128> wsEdit( "") ;
|
||||
s_sEdit[i] = "" ;
|
||||
switch ( s_nType[i]) {
|
||||
case CTRL_CHECK :
|
||||
s_sEdit[i] = ( IsDlgButtonChecked( hwndDlg, IDC_CHECK1 + i) == BST_CHECKED ? "1" : "0") ;
|
||||
break ;
|
||||
case CTRL_COMBO :
|
||||
if ( GetDlgItemText( hwndDlg, IDC_COMBO1 + i, LPWSTR( wsEdit), 128) > 0)
|
||||
s_sEdit[i] = wstrztoA( wsEdit) ;
|
||||
break ;
|
||||
case CTRL_EDIT :
|
||||
if ( GetDlgItemText( hwndDlg, IDC_EDIT1 + i, LPWSTR( wsEdit), 128) > 0)
|
||||
s_sEdit[i] = wstrztoA( wsEdit) ;
|
||||
break ;
|
||||
case CTRL_COLOR :
|
||||
{
|
||||
COLORREF col = selectedColor[i] ;
|
||||
BYTE r = GetRValue( col), g = GetGValue( col), b = GetBValue( col) ;
|
||||
char buf[16] ;
|
||||
sprintf_s( buf, sizeof( buf), "%u,%u,%u", r, g, b) ;
|
||||
s_sEdit[i] = buf ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
[[fallthrough]] ;
|
||||
case IDCANCEL : {
|
||||
// pulizia brush colori
|
||||
for ( int i = 0 ; i < MAX_CTRLS ; ++ i) {
|
||||
if ( hColorBrush[i] != NULL) {
|
||||
DeleteObject( hColorBrush[i]) ;
|
||||
hColorBrush[i] = NULL ;
|
||||
}
|
||||
}
|
||||
EndDialog( hwndDlg, wParam) ;
|
||||
return TRUE ;
|
||||
}
|
||||
}
|
||||
}
|
||||
break ;
|
||||
case WM_COMMAND :
|
||||
switch ( LOWORD( wParam)) {
|
||||
case IDOK :
|
||||
for ( int i = 0 ; i < s_nCtrls ; ++ i) {
|
||||
AtoWEX<128> wsEdit( "") ;
|
||||
s_sEdit[i] = "" ;
|
||||
switch ( s_nType[i]) {
|
||||
case CTRL_CHECK :
|
||||
s_sEdit[i] = ( IsDlgButtonChecked( hwndDlg, IDC_CHECK1 + i) == BST_CHECKED ? "1" : "0") ;
|
||||
break ;
|
||||
case CTRL_COMBO :
|
||||
if ( GetDlgItemText( hwndDlg, IDC_COMBO1 + i, LPWSTR( wsEdit), 128) > 0)
|
||||
s_sEdit[i] = wstrztoA( wsEdit) ;
|
||||
break ;
|
||||
case CTRL_EDIT :
|
||||
if ( GetDlgItemText( hwndDlg, IDC_EDIT1 + i, LPWSTR( wsEdit), 128) > 0)
|
||||
s_sEdit[i] = wstrztoA( wsEdit) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// continua di seguito
|
||||
case IDCANCEL :
|
||||
EndDialog( hwndDlg, wParam) ;
|
||||
return TRUE ;
|
||||
}
|
||||
}
|
||||
return FALSE ;
|
||||
}
|
||||
}
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
@@ -1373,6 +1587,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateDirectory", LuaCreateDirectory) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEmptyDirectory", LuaEmptyDirectory) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseDirectory", LuaEraseDirectory) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseNonEmptyDirectory", LuaEraseNonEmptyDirectory) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTextFileCompare", LuaTextFileCompare) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtBinaryFileCompare", LuaBinaryFileCompare) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetStringFromIni", LuaGetStringFromIni) ;
|
||||
@@ -1384,11 +1599,14 @@ 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( "EgtDialogBox", LuaDialogBox) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVerifyKeyOption", LuaVerifyKeyOption) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetDefaultFont", LuaSetDefaultFont) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetDefaultFont", LuaGetDefaultFont) ;
|
||||
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 ;
|
||||
}
|
||||
|
||||
@@ -111,6 +111,36 @@ 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)
|
||||
@@ -119,5 +149,6 @@ 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 ;
|
||||
}
|
||||
|
||||
+25
-2
@@ -354,18 +354,20 @@ LuaPlaneVolZmapInters( lua_State* L)
|
||||
static int
|
||||
LuaCurveCurveInters( lua_State* L)
|
||||
{
|
||||
// 3 parametri : nId1, nId2, nDestGrpId
|
||||
// 3 o 4 parametri : nId1, nId2, nDestGrpId [, bOnly3D]
|
||||
int nId1 ;
|
||||
LuaCheckParam( L, 1, nId1)
|
||||
int nId2 ;
|
||||
LuaCheckParam( L, 2, nId2)
|
||||
int nDestGrpId ;
|
||||
LuaCheckParam( L, 3, nDestGrpId) ;
|
||||
bool bOnly3D = false ;
|
||||
LuaGetParam( L, 4, bOnly3D) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo l'intersezione
|
||||
int nPntCount = 0 ;
|
||||
int nCrvCount = 0 ;
|
||||
int nNewId = ExeCurveCurveInters( nId1, nId2, nDestGrpId, &nPntCount, &nCrvCount) ;
|
||||
int nNewId = ExeCurveCurveInters( nId1, nId2, nDestGrpId, &nPntCount, &nCrvCount, bOnly3D) ;
|
||||
// restituisco il risultato
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nNewId) ;
|
||||
@@ -432,6 +434,26 @@ LuaSurfTmSurfTmInters( lua_State* L)
|
||||
return 4 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaBBoxOverlap( lua_State* L)
|
||||
{
|
||||
// 4 parametri : BBoxA, frA, BBoxB, frB
|
||||
BBox3d bboxA ;
|
||||
LuaCheckParam( L, 1, bboxA)
|
||||
Frame3d frA ;
|
||||
LuaCheckParam( L, 2, frA)
|
||||
BBox3d bboxB ;
|
||||
LuaCheckParam( L, 3, bboxB) ;
|
||||
Frame3d frB ;
|
||||
LuaCheckParam( L, 4, frB) ;
|
||||
LuaClearStack( L) ;
|
||||
bool bRes = ExeBBoxOverlap( bboxA, frA, bboxB, frB) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bRes) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGeoInters( LuaMgr& luaMgr)
|
||||
@@ -450,5 +472,6 @@ LuaInstallGeoInters( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCurveInters", LuaCurveCurveInters) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSurfTmInters", LuaCurveSurfTmInters) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxOverlap", LuaBBoxOverlap) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
+10
-8
@@ -312,16 +312,16 @@ LuaSaveFile( lua_State* L)
|
||||
static int
|
||||
LuaSaveObjToFile( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : nId, path del file [, flag]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
// 2 o 3 parametri : vId, path del file [, flag]
|
||||
INTVECTOR vId ;
|
||||
LuaCheckParam( L, 1, vId)
|
||||
string sFilePath ;
|
||||
LuaCheckParam( L, 2, sFilePath)
|
||||
int nFlag = GDB_SV_CMPTXT ;
|
||||
LuaGetParam( L, 3, nFlag) ;
|
||||
LuaClearStack( L) ;
|
||||
// copio il gruppo nel file
|
||||
bool bOk = ExeSaveObjToFile( nId, sFilePath, nFlag) ;
|
||||
bool bOk = ExeSaveObjToFile( vId, sFilePath, nFlag) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -331,16 +331,18 @@ LuaSaveObjToFile( lua_State* L)
|
||||
static int
|
||||
LuaSaveMachGroupToFile( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : nMGroupId, path del file [, flag]
|
||||
// 2, 3 o 4 parametri : nMGroupId, [ vPlusId,] sFilePath [, nFlag]
|
||||
int nMGroupId ;
|
||||
LuaCheckParam( L, 1, nMGroupId)
|
||||
INTVECTOR vPlusId ;
|
||||
int nOffs = ( LuaGetParam( L, 2, vPlusId) ?1 : 0) ;
|
||||
string sFilePath ;
|
||||
LuaCheckParam( L, 2, sFilePath)
|
||||
LuaCheckParam( L, 2 + nOffs, sFilePath)
|
||||
int nFlag = GDB_SV_CMPTXT ;
|
||||
LuaGetParam( L, 3, nFlag) ;
|
||||
LuaGetParam( L, 3 + nOffs, nFlag) ;
|
||||
LuaClearStack( L) ;
|
||||
// copio il gruppo nel file
|
||||
bool bOk = ExeSaveMachGroupToFile( nMGroupId, sFilePath, nFlag) ;
|
||||
bool bOk = ExeSaveMachGroupToFile( nMGroupId, vPlusId, sFilePath, nFlag) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
|
||||
+491
-41
@@ -15,6 +15,7 @@
|
||||
#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"
|
||||
@@ -557,22 +558,20 @@ LuaAddRawPartWithPart( lua_State* L)
|
||||
static int
|
||||
LuaModifyRawPart( lua_State* L)
|
||||
{
|
||||
// 6 parametri : nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol
|
||||
// 5 parametri : nRawId, nCrvId, dOverMat, 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, 5, dHeight)
|
||||
LuaCheckParam( L, 4, dHeight)
|
||||
Color cCol ;
|
||||
LuaCheckParam( L, 6, cCol)
|
||||
LuaCheckParam( L, 5, cCol)
|
||||
LuaClearStack( L) ;
|
||||
// modifico le dimensioni del grezzo
|
||||
bool bOk = ExeModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ;
|
||||
bool bOk = ExeModifyRawPart( nRawId, nCrvId, dOverMat, dHeight, cCol) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -1080,6 +1079,53 @@ 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)
|
||||
@@ -1094,7 +1140,7 @@ LuaAddFixture( lua_State* L)
|
||||
if ( LuaGetParam( L, 3, dAngRotDeg))
|
||||
LuaGetParam( L, 4, dMov) ;
|
||||
LuaClearStack( L) ;
|
||||
// metto l'asse nella nuova posizione
|
||||
// aggiungo la ventosa nella posizione indicata
|
||||
int nId = ExeAddFixture( sName, ptPos, dAngRotDeg, dMov) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
@@ -1204,6 +1250,23 @@ 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)
|
||||
@@ -1221,6 +1284,23 @@ 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
|
||||
//-------------------------------------------------------------------------------
|
||||
@@ -1382,7 +1462,7 @@ LuaTdbIsCurrToolModified( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// verifico se l'utensile corrente è stato modificato
|
||||
// verifico se l'utensile corrente � stato modificato
|
||||
bool bOk = ExeTdbIsCurrToolModified() ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -1629,6 +1709,22 @@ 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)
|
||||
@@ -1727,6 +1823,18 @@ LuaImportSetup( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExistsCurrSetup( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// verifico l'esistenza dell'attrezzaggio della macchinata corrente
|
||||
bool bOk = ExeExistsCurrSetup() ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaVerifyCurrSetup( lua_State* L)
|
||||
@@ -1929,7 +2037,7 @@ LuaMdbIsCurrMachiningModified( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// verifico se la lavorazione corrente è stata modificata
|
||||
// verifico se la lavorazione corrente � stata modificata
|
||||
bool bOk = ExeMdbIsCurrMachiningModified() ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -2189,10 +2297,12 @@ LuaGetPrevOperation( lua_State* L)
|
||||
static int
|
||||
LuaGetFirstActiveOperation( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
// nessuno o 1 parametro : [bNeedMachNotEmpty]
|
||||
bool bNeedMachNotEmpty = false ;
|
||||
LuaGetParam( L, 1, bNeedMachNotEmpty) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero la prima operazione attiva della macchinata corrente
|
||||
int nId = ExeGetFirstActiveOperation() ;
|
||||
int nId = ExeGetFirstActiveOperation( bNeedMachNotEmpty) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
@@ -2205,12 +2315,14 @@ LuaGetFirstActiveOperation( lua_State* L)
|
||||
static int
|
||||
LuaGetNextActiveOperation( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nId
|
||||
// 1 o 2 parametri : nId [, bNeedMachNotEmpty]
|
||||
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) ;
|
||||
int nNextId = ExeGetNextActiveOperation( nId, bNeedMachNotEmpty) ;
|
||||
// restituisco il risultato
|
||||
if ( nNextId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nNextId) ;
|
||||
@@ -2223,10 +2335,12 @@ LuaGetNextActiveOperation( lua_State* L)
|
||||
static int
|
||||
LuaGetLastActiveOperation( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
// nessuno o 1 parametro : [bNeedMachNotEmpty]
|
||||
bool bNeedMachNotEmpty = false ;
|
||||
LuaGetParam( L, 1, bNeedMachNotEmpty) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero l'ultima operazione attiva della macchinata corrente
|
||||
int nId = ExeGetLastActiveOperation() ;
|
||||
int nId = ExeGetLastActiveOperation( bNeedMachNotEmpty) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
@@ -2239,12 +2353,14 @@ LuaGetLastActiveOperation( lua_State* L)
|
||||
static int
|
||||
LuaGetPrevActiveOperation( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nId
|
||||
// 1 o 2 parametri : nId [, bNeedMachNotEmpty]
|
||||
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) ;
|
||||
int nNextId = ExeGetPrevActiveOperation( nId, bNeedMachNotEmpty) ;
|
||||
// restituisco il risultato
|
||||
if ( nNextId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nNextId) ;
|
||||
@@ -2341,12 +2457,14 @@ LuaGetOperationId( lua_State* L)
|
||||
static int
|
||||
LuaIsOperationEmpty( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nId
|
||||
// 1 o 2 parametri : nId [, nEmptyType]
|
||||
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) ;
|
||||
bool bOk = ExeIsOperationEmpty( nId, nEmptyType) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -2596,6 +2714,34 @@ 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
|
||||
//-------------------------------------------------------------------------------
|
||||
@@ -2884,12 +3030,31 @@ LuaGetMachiningGeometry( lua_State* L)
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaIsMachiningEmpty( lua_State* L)
|
||||
LuaGetMachiningSkippedGeometry( 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() ;
|
||||
bool bEmpty = ExeIsMachiningEmpty( nEmptyType) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bEmpty) ;
|
||||
return 1 ;
|
||||
@@ -2929,6 +3094,44 @@ LuaGetMachiningEndPoint( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetMachiningStartAxes( lua_State* L)
|
||||
{
|
||||
// 0 o 1 parametro : [bSkipClimb]
|
||||
bool bSkipClimb = true ;
|
||||
LuaGetParam( L, 1, bSkipClimb) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il valore iniziale degli assi del primo percorso della lavorazione corrente
|
||||
DBLVECTOR vAxVal ;
|
||||
bool bOk = ExeGetMachiningStartAxes( bSkipClimb, vAxVal) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vAxVal) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetMachiningEndAxes( lua_State* L)
|
||||
{
|
||||
// 0 o 1 parametro : [bSkipRise]
|
||||
bool bSkipRise = true ;
|
||||
LuaGetParam( L, 1, bSkipRise) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il valore finale degli assi dell'ultimo percorso della lavorazione corrente
|
||||
DBLVECTOR vAxVal ;
|
||||
bool bOk = ExeGetMachiningEndAxes( bSkipRise, vAxVal) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vAxVal) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaApplyAllMachinings( lua_State* L)
|
||||
@@ -3030,6 +3233,44 @@ LuaGetClEntIndex( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetClEntFeed( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nEntId
|
||||
int nEntId ;
|
||||
LuaGetParam( L, 1, nEntId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero la feed
|
||||
double dFeed ;
|
||||
bool bOk = ExeGetClEntFeed( nEntId, dFeed) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetParam( L, dFeed) ;
|
||||
else
|
||||
LuaSetParam( 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)
|
||||
@@ -3038,7 +3279,7 @@ LuaGetClEntAxesMask( lua_State* L)
|
||||
int nEntId ;
|
||||
LuaGetParam( L, 1, nEntId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero la mascheratura del movimento assi
|
||||
// recupero la mascheratura del movimento assi (valida solo in rapido)
|
||||
int nMask ;
|
||||
bool bOk = ExeGetClEntAxesMask( nEntId, nMask) ;
|
||||
// restituisco il risultato
|
||||
@@ -3068,6 +3309,60 @@ LuaGetClEntAxesVal( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetClEntTDir( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nEntId
|
||||
int nEntId ;
|
||||
LuaGetParam( L, 1, nEntId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero TDir
|
||||
Vector3d vtTDir ;
|
||||
bool bOk = ExeGetClEntTDir( nEntId, vtTDir) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vtTDir) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetClEntCDir( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nEntId
|
||||
int nEntId ;
|
||||
LuaGetParam( L, 1, nEntId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero CDir
|
||||
Vector3d vtCDir ;
|
||||
bool bOk = ExeGetClEntCDir( nEntId, vtCDir) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vtCDir) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetClEntADir( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nEntId
|
||||
int nEntId ;
|
||||
LuaGetParam( L, 1, nEntId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero ADir
|
||||
Vector3d vtADir ;
|
||||
bool bOk = ExeGetClEntADir( nEntId, vtADir) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vtADir) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
// Simulation
|
||||
//-------------------------------------------------------------------------------
|
||||
@@ -3156,6 +3451,21 @@ 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)
|
||||
@@ -3236,7 +3546,7 @@ LuaSimGetMoveInfo( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero tipo e veolcità del movimento corrente
|
||||
// recupero tipo e veolcit� del movimento corrente
|
||||
int nGmove ;
|
||||
double dFeed ;
|
||||
bool bOk = ExeSimGetMoveInfo( nGmove, dFeed) ;
|
||||
@@ -3354,6 +3664,23 @@ LuaSetCalcTool( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetCalcSolCh( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nScc [, bExact]
|
||||
int nScc ;
|
||||
LuaCheckParam( L, 1, nScc)
|
||||
bool bExact = false ;
|
||||
LuaGetParam( L, 2, bExact) ;
|
||||
LuaClearStack( L) ;
|
||||
// imposto il criterio di scelta della soluzione e se deve essere rispettato esattamente
|
||||
bool bOk = ExeSetCalcSolCh( nScc, bExact) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetRotAxisBlock( lua_State* L)
|
||||
@@ -3413,6 +3740,28 @@ LuaGetCalcTool( lua_State* L)
|
||||
return 3 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetCalcSolCh( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero il criterio di scelta della soluzione e se deve essere rispettato esattamente
|
||||
int nScc ;
|
||||
bool bExact ;
|
||||
bool bOk = ExeGetCalcSolCh( nScc, bExact) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, nScc) ;
|
||||
LuaSetParam( L, bExact) ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L) ;
|
||||
LuaSetParam( L) ;
|
||||
}
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetAllCurrAxesNames( lua_State* L)
|
||||
@@ -3483,11 +3832,38 @@ LuaGetCalcAngles( lua_State* L)
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetCalcAnglesEx( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : vtDirT, vtDirA
|
||||
Vector3d vtDirT ;
|
||||
LuaCheckParam( L, 1, vtDirT)
|
||||
Vector3d vtDirA ;
|
||||
LuaGetParam( L, 2, vtDirA) ;
|
||||
LuaClearStack( L) ;
|
||||
// calcolo gli angoli macchina dalle direzioni fresa e ausiliaria
|
||||
int nStat ; DBLVECTOR vAng1, vAng2 ;
|
||||
bool bOk = ExeGetCalcAngles( vtDirT, vtDirA, nStat, vAng1, vAng2) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, bOk) ;
|
||||
LuaSetParam( L, nStat) ;
|
||||
LuaSetParam( L, vAng1) ;
|
||||
LuaSetParam( L, vAng2) ;
|
||||
return 4 ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetCalcPositions( lua_State* L)
|
||||
{
|
||||
// da 2 a 5 parametri : ptP, dAngA [, dAngB] [, dAngC] [, dAngD]
|
||||
// da 1 a 5 parametri : ptP [, dAngR1] [, dAngR2] [, dAngR3] [, dAngR4]
|
||||
Point3d ptP ;
|
||||
LuaCheckParam( L, 1, ptP)
|
||||
DBLVECTOR vAng ;
|
||||
@@ -3499,13 +3875,13 @@ LuaGetCalcPositions( lua_State* L)
|
||||
break ;
|
||||
}
|
||||
LuaClearStack( L) ;
|
||||
// imposto la tavola corrente per il calcolo
|
||||
int nStat ; double dX ; double dY ; double dZ ;
|
||||
bool bOk = ExeGetCalcPositions( ptP, vAng, nStat, dX, dY, dZ) ;
|
||||
// calcolo gli assi lineari dalla posizione e dagli angoli
|
||||
double dX ; double dY ; double dZ ;
|
||||
bool bOk = ExeGetCalcPositions( ptP, vAng, dX, dY, dZ) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, bOk) ;
|
||||
LuaSetParam( L, nStat) ;
|
||||
LuaSetParam( L, 0) ; // assegnato per compatibilità
|
||||
LuaSetParam( L, dX) ;
|
||||
LuaSetParam( L, dY) ;
|
||||
LuaSetParam( L, dZ) ;
|
||||
@@ -3517,11 +3893,39 @@ 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 5 a 10 parametri : dX, dY, dZ, dAngR1[, dAngR2][, dAngR3][, dAngR4][, dAngR5][, dAngR6], bBottom
|
||||
// da 3 a 10 parametri : dX, dY, dZ [, dAngR1] [, dAngR2] [, dAngR3] [, dAngR4] [, dAngR5] [, dAngR6] [, bBottom]
|
||||
double dX ;
|
||||
LuaCheckParam( L, 1, dX)
|
||||
double dY ;
|
||||
@@ -3537,8 +3941,8 @@ LuaGetCalcTipFromPositions( lua_State* L)
|
||||
else
|
||||
break ;
|
||||
}
|
||||
bool bBottom ;
|
||||
LuaCheckParam( L, i, bBottom)
|
||||
bool bBottom = false ;
|
||||
LuaGetParam( L, i, bBottom) ;
|
||||
LuaClearStack( L) ;
|
||||
// calcolo il tip utensile dagli assi macchina
|
||||
Point3d ptTip ;
|
||||
@@ -3555,7 +3959,7 @@ LuaGetCalcTipFromPositions( lua_State* L)
|
||||
static int
|
||||
LuaGetCalcToolDirFromAngles( lua_State* L)
|
||||
{
|
||||
// da 1 a 6 parametri : dAngR1, dAngR2, dAngR3, dAngR4, dAngR5, dAngR6
|
||||
// da 0 a 6 parametri : [dAngR1] [, dAngR2] [, dAngR3] [, dAngR4] [, dAngR5] [, dAngR6]
|
||||
DBLVECTOR vAng ;
|
||||
for ( int i = 1 ; i <= 6 ; ++ i) {
|
||||
double dAng ;
|
||||
@@ -3580,7 +3984,7 @@ LuaGetCalcToolDirFromAngles( lua_State* L)
|
||||
static int
|
||||
LuaGetCalcAuxDirFromAngles( lua_State* L)
|
||||
{
|
||||
// da 1 a 6 parametri : dAngR1, dAngR2, dAngR3, dAngR4, dAngR5, dAngR6
|
||||
// da 0 a 6 parametri : [dAngR1] [, dAngR2] [, dAngR3] [, dAngR4] [, dAngR5] [, dAngR6]
|
||||
DBLVECTOR vAng ;
|
||||
for ( int i = 1 ; i <= 6 ; ++ i) {
|
||||
double dAng ;
|
||||
@@ -3605,21 +4009,26 @@ LuaGetCalcAuxDirFromAngles( lua_State* L)
|
||||
static int
|
||||
LuaVerifyOutstroke( lua_State* L)
|
||||
{
|
||||
// 5 parametri : dX, dY, dZ, dAngA, dAngB
|
||||
// 3 o 4 o 5 o 6 o 7 parametri : dX, dY, dZ [, dAngR1] [, dAngR2] [, dAngR3] [, dAngR4]
|
||||
double dX ;
|
||||
LuaCheckParam( L, 1, dX)
|
||||
double dY ;
|
||||
LuaCheckParam( L, 2, dY)
|
||||
double dZ ;
|
||||
LuaCheckParam( L, 3, dZ)
|
||||
double dAngA ;
|
||||
LuaCheckParam( L, 4, dAngA)
|
||||
double dAngB ;
|
||||
LuaCheckParam( L, 5, dAngB)
|
||||
DBLVECTOR vAng ;
|
||||
int i ;
|
||||
for ( i = 4 ; i <= 7 ; ++ i) {
|
||||
double dAng ;
|
||||
if ( LuaGetParam( L, i, dAng))
|
||||
vAng.emplace_back( dAng) ;
|
||||
else
|
||||
break ;
|
||||
}
|
||||
LuaClearStack( L) ;
|
||||
// imposto la tavola corrente per il calcolo
|
||||
int nStat ;
|
||||
bool bOk = ExeVerifyOutstroke( dX, dY, dZ, dAngA, dAngB, nStat) ;
|
||||
bool bOk = ExeVerifyOutstroke( dX, dY, dZ, vAng, nStat) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, ( nStat == 0)) ;
|
||||
@@ -3813,6 +4222,25 @@ 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)
|
||||
@@ -4187,6 +4615,9 @@ 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) ;
|
||||
@@ -4194,7 +4625,9 @@ 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) ;
|
||||
@@ -4214,6 +4647,7 @@ 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) ;
|
||||
@@ -4221,6 +4655,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCurrSetup", LuaGetCurrSetup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetDefaultSetupName", LuaGetDefaultSetupName) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtImportSetup", LuaImportSetup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsCurrSetup", LuaExistsCurrSetup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVerifyCurrSetup", LuaVerifyCurrSetup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtFindToolInCurrSetup", LuaFindToolInCurrSetup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetToolsInCurrSetupPos", LuaGetToolsInCurrSetupPos) ;
|
||||
@@ -4272,6 +4707,7 @@ 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) ;
|
||||
@@ -4286,17 +4722,25 @@ 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) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningStartAxes", LuaGetMachiningStartAxes) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningEndAxes", LuaGetMachiningEndAxes) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtApplyAllMachinings", LuaApplyAllMachinings) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateAllMachinings", LuaUpdateAllMachinings) ;
|
||||
// CL Entities Interrogations
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntMove", LuaGetClEntMove) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntFlag", LuaGetClEntFlag) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntIndex", LuaGetClEntIndex) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntIndex", LuaGetClEntIndex) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntFeed", LuaGetClEntFeed) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesStatus", LuaGetClEntAxesStatus) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesMask", LuaGetClEntAxesMask) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesVal", LuaGetClEntAxesVal) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesVal", LuaGetClEntAxesVal) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntTDir", LuaGetClEntTDir) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntCDir", LuaGetClEntCDir) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntADir", LuaGetClEntADir) ;
|
||||
// Simulation
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSimInit", LuaSimInit) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSimStart", LuaSimStart) ;
|
||||
@@ -4304,6 +4748,7 @@ 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) ;
|
||||
@@ -4323,6 +4768,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
||||
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) ;
|
||||
@@ -4332,13 +4778,17 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
||||
// Machine Calc
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTable", LuaSetCalcTable) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTool", LuaSetCalcTool) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcSolCh", LuaSetCalcSolCh) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetRotAxisBlock", LuaSetRotAxisBlock) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTable", LuaGetCalcTable) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTool", LuaGetCalcTool) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcSolCh", LuaGetCalcSolCh) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllCurrAxesNames", LuaGetAllCurrAxesNames) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRotAxisBlocked", LuaGetRotAxisBlocked) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAngles", LuaGetCalcAngles) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAnglesEx", LuaGetCalcAnglesEx) ;
|
||||
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) ;
|
||||
|
||||
+306
@@ -0,0 +1,306 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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
|
||||
LuaOptMachSetOptimizationForGroups( lua_State* L)
|
||||
{
|
||||
// 1 Parametro : bOptForGroups
|
||||
bool bOptForGroups = false ;
|
||||
LuaCheckParam( L, 1, bOptForGroups) ;
|
||||
LuaClearStack( L) ;
|
||||
// Imposto il Flag
|
||||
bool bOk = ExeOptMachSetOptimizationForGroups( bOptForGroups) ;
|
||||
// Restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaOptMachSetOpenBound( lua_State* L)
|
||||
{
|
||||
// 5 parametri : bStartVsEnd, nFlag, dX, dY, dZ
|
||||
bool bStartVsEnd ;
|
||||
LuaCheckParam( L, 1, bStartVsEnd) ;
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 2, nFlag) ;
|
||||
double dX ;
|
||||
LuaCheckParam( L, 3, dX) ;
|
||||
double dY ;
|
||||
LuaCheckParam( L, 4, dY) ;
|
||||
double dZ ;
|
||||
LuaCheckParam( L, 5, dZ) ;
|
||||
LuaClearStack( L) ;
|
||||
// Imposto la condizione
|
||||
bool bOk = ExeOptMachSetOpenBound( bStartVsEnd, nFlag, dX, dY, dZ) ;
|
||||
// Restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaOptMachSetOpenBoundForGroups( lua_State* L)
|
||||
{
|
||||
// 6 parametri : nGroup, bStartVsEnd, nFlag, dX, dY, dZ
|
||||
int nGroup ;
|
||||
LuaCheckParam( L, 1, nGroup) ;
|
||||
bool bStartVsEnd ;
|
||||
LuaCheckParam( L, 2, bStartVsEnd) ;
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 3, nFlag) ;
|
||||
double dX ;
|
||||
LuaCheckParam( L, 4, dX) ;
|
||||
double dY ;
|
||||
LuaCheckParam( L, 5, dY) ;
|
||||
double dZ ;
|
||||
LuaCheckParam( L, 6, dZ) ;
|
||||
LuaClearStack( L) ;
|
||||
// Imposto la condizione
|
||||
bool bOk = ExeOptMachSetOpenBoundForGroups( nGroup, bStartVsEnd, nFlag, dX, dY, dZ) ;
|
||||
// Restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaOptMachCalculate( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// eseguo calcolo di minimo percorso
|
||||
INTVECTOR vOrder ;
|
||||
bool bOk = ExeOptMachCalculate( 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( "EgtOptMachSetOptimizationForGroups", LuaOptMachSetOptimizationForGroups) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetOpenBound", LuaOptMachSetOpenBound) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetOpenBoundForGroups", LuaOptMachSetOpenBoundForGroups) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachCalculate", LuaOptMachCalculate) ;
|
||||
return bOk ;
|
||||
}
|
||||
@@ -340,6 +340,21 @@ 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)
|
||||
@@ -466,6 +481,28 @@ 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)
|
||||
@@ -488,6 +525,7 @@ 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) ;
|
||||
@@ -495,6 +533,7 @@ 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 ;
|
||||
}
|
||||
|
||||
+234
@@ -0,0 +1,234 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRedisAsyncGetMessage( lua_State* L)
|
||||
{
|
||||
int nIdConnection = 0 ;
|
||||
LuaCheckParam( L, 1, nIdConnection) ;
|
||||
string sChannel ;
|
||||
LuaCheckParam( L, 2, sChannel) ;
|
||||
// Eseguo la funzione per leggere il messaggio
|
||||
int nCount = 0 ;
|
||||
string sMessage ;
|
||||
bool bOk = ExeRedisAsyncGetMessage( nIdConnection, sChannel, nCount, sMessage) ;
|
||||
// Restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
LuaSetParam( L, sMessage) ;
|
||||
return 3 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
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) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncGetMessage", LuaRedisAsyncGetMessage) ;
|
||||
return bOk ;
|
||||
}
|
||||
+69
-1
@@ -73,6 +73,19 @@ LuaDraw( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRedraw( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// forzo ridisegno
|
||||
bool bOk = ExeRedraw() ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetShowMode( lua_State* L)
|
||||
@@ -322,14 +335,67 @@ 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 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetShowSurfBezierTol( lua_State* L)
|
||||
{
|
||||
// 1 o 2 argomenti : dLinTol [, bRedraw]
|
||||
double dLinTol ;
|
||||
LuaCheckParam( L, 1, dLinTol)
|
||||
bool bRedraw = true ;
|
||||
LuaCheckParam( L, 2, bRedraw)
|
||||
bool bOk = ExeSetShowSurfBezierTol( dLinTol, bRedraw) ;
|
||||
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallScene( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bool bOk = true ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetBackground", LuaSetBackground) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetBackground", LuaGetBackground) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDraw", LuaDraw) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRedraw", LuaRedraw) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowMode", LuaSetShowMode) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowCurveDirection", LuaSetShowCurveDirection) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowTriaAdv", LuaSetShowTriaAdv) ;
|
||||
@@ -344,5 +410,7 @@ LuaInstallScene( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetView", LuaGetView) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetGenericView", LuaGetGenericView) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImage", LuaGetImage) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImageEx", LuaGetImageEx) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowSurfBezierTol", LuaSetShowSurfBezierTol) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
@@ -169,16 +169,18 @@ LuaTestSpheSurface( lua_State* L)
|
||||
static int
|
||||
LuaTestSurfaceSurface( lua_State* L)
|
||||
{
|
||||
// 3 parametri : nSurf1Id, nSurf2Id, dSafeDist
|
||||
// 3 o 4 parametri : nSurf1Id, nSurf2Id, dSafeDist [, bTestEnclusion]
|
||||
int nSurf1Id ;
|
||||
LuaCheckParam( L, 1, nSurf1Id)
|
||||
int nSurf2Id ;
|
||||
LuaCheckParam( L, 2, nSurf2Id)
|
||||
double dSafeDist ;
|
||||
LuaCheckParam( L, 3, dSafeDist)
|
||||
bool bTestEnclusion = false ;
|
||||
LuaGetParam( L, 4, bTestEnclusion) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo verifica di interferenza
|
||||
int nRes = ExeTestSurfaceSurface( nSurf1Id, nSurf2Id, dSafeDist) ;
|
||||
int nRes = ExeTestSurfaceSurface( nSurf1Id, nSurf2Id, dSafeDist, bTestEnclusion) ;
|
||||
// restituisco il risultato
|
||||
if ( nRes >= 0)
|
||||
LuaSetParam( L, ( nRes != 0)) ;
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2025-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_Trimming.cpp Data : 23.10.25 Versione : 2.7j3
|
||||
// Contenuto : Funzioni per le lavorazioni di Trimming.
|
||||
//
|
||||
// Modifiche : 23.10.25 RE 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
|
||||
LuaTrimmingGetHoleBorder( lua_State* L)
|
||||
{
|
||||
// 7 parametri : nPartId, vSurfIds, vOtherSurfIds, dSurfLinTol, dSurfAngTol, dEdgeLinTol, dEdgeAngTol, dEdgeThick
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId) ;
|
||||
INTVECTOR vSurfIds ;
|
||||
LuaCheckParam( L, 2, vSurfIds) ;
|
||||
INTVECTOR vOtherSurfIds ;
|
||||
LuaCheckParam( L, 3, vOtherSurfIds) ;
|
||||
double dSurfLinTol ;
|
||||
LuaCheckParam( L, 4, dSurfLinTol) ;
|
||||
double dSurfAngTol ;
|
||||
LuaCheckParam( L, 5, dSurfAngTol) ;
|
||||
double dEdgeLinTol ;
|
||||
LuaCheckParam( L, 6, dEdgeLinTol) ;
|
||||
double dEdgeAngTol ;
|
||||
LuaCheckParam( L, 7, dEdgeAngTol) ;
|
||||
double dEdgeThick ;
|
||||
LuaCheckParam( L, 8, dEdgeThick) ;
|
||||
LuaClearStack( L) ;
|
||||
// Recupero le Curve per Asole e Fori
|
||||
int nFirstId = GDB_ID_NULL, nCount = 0 ;
|
||||
bool bOk = ExeTrimmingGetHoleBorder( nParentId, vSurfIds, vOtherSurfIds, dSurfLinTol, dSurfAngTol, dEdgeLinTol,
|
||||
dEdgeAngTol, dEdgeThick, nFirstId, nCount) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
LuaSetParam( L, nFirstId) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
return 3 ;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimmingGetSurfTmFaceAdj( lua_State* L)
|
||||
{
|
||||
// 7 parametri : nParentId, nSurfId, nTria, ptTria, dAngTol, dSize, dSizeTol
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId) ;
|
||||
int nSurfId ;
|
||||
LuaCheckParam( L, 2, nSurfId)
|
||||
int nTria ;
|
||||
LuaCheckParam( L, 3, nTria)
|
||||
Point3d ptTria ;
|
||||
LuaCheckParam( L, 4, ptTria)
|
||||
double dAngTol ;
|
||||
LuaCheckParam( L, 5, dAngTol)
|
||||
double dSize ;
|
||||
LuaCheckParam( L, 6, dSize)
|
||||
double dSizeTol ;
|
||||
LuaCheckParam( L, 7, dSizeTol)
|
||||
LuaClearStack( L) ;
|
||||
// Recupero le facce adiacenti in tolleranza angolare
|
||||
INTVECTOR vOtherFaces ;
|
||||
int nNewSurfId = ExeTrimmingGetSurfTmFaceAdj( nParentId, nSurfId, nTria, ptTria, dAngTol, dSize, dSizeTol) ;
|
||||
LuaSetParam( L, nNewSurfId) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimmingGetAdjSurfs( lua_State* L)
|
||||
{
|
||||
// 5 parametri : nRefSfrId, vAllSurfId, dLinTol, dAngTol, dAngFaceTol
|
||||
INTVECTOR vRefSurfId ;
|
||||
LuaCheckParam( L, 1, vRefSurfId)
|
||||
INTVECTOR vOtherSurfId ;
|
||||
LuaCheckParam( L, 2, vOtherSurfId)
|
||||
double dLinTol ;
|
||||
LuaCheckParam( L, 3, dLinTol)
|
||||
double dAngTol ;
|
||||
LuaCheckParam( L, 4, dAngTol)
|
||||
double dAngFaceTol ;
|
||||
LuaCheckParam( L, 5, dAngFaceTol)
|
||||
LuaClearStack( L) ;
|
||||
// Calcolo le facce adiacenti per tolleranza
|
||||
INTVECTOR vOtherSurf ;
|
||||
bool bOk = ExeTrimmingGetAdjSurfs( vRefSurfId, vOtherSurfId, dLinTol, dAngTol, dAngFaceTol, vOtherSurf) ;
|
||||
// Restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
LuaSetParam( L, vOtherSurf) ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimmingGetBorders( lua_State* L)
|
||||
{
|
||||
// 6 parametri : nParentId, vIds, dSurfLinTol, dSurfAngTol, dLinTol, dAngTol
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
SELVECTOR vIds ;
|
||||
LuaCheckParam( L, 2, vIds)
|
||||
double dSurfLinTol ;
|
||||
LuaCheckParam( L, 3, dSurfLinTol) ;
|
||||
double dSurfAngTol ;
|
||||
LuaCheckParam( L, 4, dSurfAngTol) ;
|
||||
double dLinTol ;
|
||||
LuaCheckParam( L, 5, dLinTol)
|
||||
double dAngTol ;
|
||||
LuaCheckParam( L, 6, dAngTol)
|
||||
LuaClearStack( L) ;
|
||||
// Creo le curve di Edge grezze
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
bool bOk = ExeTrimmingGetBorders( nParentId, vIds, dSurfLinTol, dSurfAngTol, dLinTol, dAngTol, nFirstId, nCount) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
LuaSetParam( L, nFirstId) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
return 3 ;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimmingGetBordersByNormals( lua_State* L)
|
||||
{
|
||||
// 7 o 8 parametri : nParentId, vIds, dSurfLinTol, dSurfAngTol, dThickness
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
SELVECTOR vIds ;
|
||||
LuaCheckParam( L, 2, vIds)
|
||||
double dSurfLinTol ;
|
||||
LuaCheckParam( L, 3, dSurfLinTol) ;
|
||||
double dSurfAngTol ;
|
||||
LuaCheckParam( L, 4, dSurfAngTol) ;
|
||||
double dLinTol ;
|
||||
LuaCheckParam( L, 5, dLinTol)
|
||||
double dAngTol ;
|
||||
LuaCheckParam( L, 6, dAngTol)
|
||||
double dThickness ;
|
||||
LuaCheckParam( L, 7, dThickness)
|
||||
LuaClearStack( L) ;
|
||||
// Creo le curve di Edge grezze
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
bool bOk = ExeTrimmingGetBordersByNormals( nParentId, vIds, dSurfLinTol, dSurfAngTol, dLinTol, dAngTol, dThickness, nFirstId, nCount) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
LuaSetParam( L, nFirstId) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
return 3 ;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimmingGetFinalBorders( lua_State* L)
|
||||
{
|
||||
// 4 o 5 o 6 o 7 parametri : nParentId, vCrvBezierId, dLinTol, dAngTol [,vBreakingPts] [,dThick [,dThickTol]]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
INTVECTOR vCrvBezierId ;
|
||||
LuaCheckParam( L, 2, vCrvBezierId)
|
||||
double dLinTol ;
|
||||
LuaCheckParam( L, 3, dLinTol)
|
||||
double dAngTol ;
|
||||
LuaCheckParam( L, 4, dAngTol)
|
||||
PNTVECTOR vBreakingPts ;
|
||||
int nInd = 5 ;
|
||||
if ( LuaGetParam( L, nInd, vBreakingPts))
|
||||
++ nInd ;
|
||||
double dThick = 0., dThickTol = EPS_SMALL ;
|
||||
if ( LuaGetParam( L, nInd, dThick)) {
|
||||
if ( ! LuaGetParam( L, nInd + 1, dThickTol)) {
|
||||
LuaClearStack( L) ;
|
||||
LuaSetParam( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
LuaClearStack( L) ;
|
||||
// Creo le curve Edges
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
bool bOk = ExeTrimmingGetFinalBorders( nParentId, vCrvBezierId, dLinTol, dAngTol, vBreakingPts, dThick, dThickTol,
|
||||
nFirstId, nCount) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
LuaSetParam( L, nFirstId) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
return 3 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimmingGetRuledBezier( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : nParentId, vIds, nEdge1Id, nEdge2Id, dLinTol [,vnLineId]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
INTVECTOR vIds ;
|
||||
LuaCheckParam( L, 2, vIds) ; // serve per orientare la superficie rigata ( Ids delle superfici)
|
||||
int nEdge1Id ;
|
||||
LuaCheckParam( L, 3, nEdge1Id)
|
||||
int nEdge2Id ;
|
||||
LuaCheckParam( L, 4, nEdge2Id)
|
||||
double dLinTol ;
|
||||
LuaCheckParam( L, 5, dLinTol)
|
||||
INTVECTOR vnLineId ;
|
||||
LuaGetParam( L, 6, vnLineId) ;
|
||||
LuaClearStack( L) ;
|
||||
// Calcolo la superficie di Bezier rigata
|
||||
int nId = ExeTrimmingGetRuledBezier( nParentId, vIds, nEdge1Id, nEdge2Id, dLinTol, vnLineId) ;
|
||||
LuaSetParam( L, nId) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimmingInterpolateSyncLines( lua_State* L)
|
||||
{
|
||||
// 7 parametri : nParentId, nFirstSyncId, nSecondSyncId, nBorder1Id, nBorder2Id, dEdgeLinTol, dEdgeAngTol
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId) ;
|
||||
int nSync1Id ;
|
||||
LuaCheckParam( L, 2, nSync1Id) ;
|
||||
int nSync2Id ;
|
||||
LuaCheckParam( L, 3, nSync2Id) ;
|
||||
int nBorder1Id ;
|
||||
LuaCheckParam( L, 4, nBorder1Id) ;
|
||||
int nBorder2Id ;
|
||||
LuaCheckParam( L, 5, nBorder2Id) ;
|
||||
double dEdgeLinTol ;
|
||||
LuaCheckParam( L, 6, dEdgeLinTol) ;
|
||||
double dEdgeAngTol ;
|
||||
LuaCheckParam( L, 7, dEdgeAngTol) ;
|
||||
LuaClearStack( L) ;
|
||||
// Interpolo le curve di sincronizzazione
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
bool bOk = ExeTrimmingInterpolateSyncLines( nParentId, nSync1Id, nSync2Id, nBorder1Id,
|
||||
nBorder2Id, dEdgeLinTol, dEdgeAngTol, nFirstId, nCount) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
LuaSetParam( L, nFirstId) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
return 3 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimmingGetSurfBzSyncPoints( lua_State* L)
|
||||
{
|
||||
// 7 parametri : nParentId, nEdge1Id, nEdge2Id, dLinTol, dAngTol, nLinesNbr, bShowOnCorners
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nEdge1Id ;
|
||||
LuaCheckParam( L, 2, nEdge1Id)
|
||||
int nEdge2Id ;
|
||||
LuaCheckParam( L, 3, nEdge2Id)
|
||||
double dLinTol ;
|
||||
LuaCheckParam( L, 4, dLinTol)
|
||||
double dAngTol ;
|
||||
LuaCheckParam( L, 5, dAngTol)
|
||||
int nLineNbr ;
|
||||
LuaCheckParam( L, 6, nLineNbr)
|
||||
bool bShowOnCorners ;
|
||||
LuaCheckParam( L, 7, bShowOnCorners)
|
||||
LuaClearStack( L) ;
|
||||
// Inserisco i tratti lineari associati ai punti di sincronizzazione
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
bool bOk = ExeTrimmingGetSurfBzSyncPoints( nParentId, nEdge1Id, nEdge2Id, dLinTol, dAngTol, nLineNbr, bShowOnCorners, nFirstId, nCount) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
LuaSetParam( L, nFirstId) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
return 3 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRegolarizeSurfaceLocally( lua_State* L)
|
||||
{
|
||||
int nParentId = GDB_ID_NULL ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nSurfId = GDB_ID_NULL ;
|
||||
LuaCheckParam( L, 2, nSurfId)
|
||||
int nSyncStartId ;
|
||||
LuaCheckParam( L, 3, nSyncStartId)
|
||||
int nSyncEndId ;
|
||||
LuaCheckParam( L, 4, nSyncEndId)
|
||||
double dLinTol ;
|
||||
LuaCheckParam( L, 5, dLinTol)
|
||||
int nType = 0 ;
|
||||
LuaCheckParam( L, 6, nType)
|
||||
|
||||
int nId = ExeRegolarizeSurfaceLocally( nParentId, nSurfId, nSyncStartId, nSyncEndId, dLinTol, nType) ;
|
||||
LuaSetParam( L, nId) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallTrimming( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
// --- Ricerca Fori e Asole
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetHoleBorder", LuaTrimmingGetHoleBorder) ;
|
||||
// --- Ricerca Superifici
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetSurfTmFaceAdj", LuaTrimmingGetSurfTmFaceAdj) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetAdjSurfs", LuaTrimmingGetAdjSurfs) ;
|
||||
// --- Estrazione dei Bordi
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetBorders", LuaTrimmingGetBorders) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetBordersByNormals", LuaTrimmingGetBordersByNormals) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetFinalBorders", LuaTrimmingGetFinalBorders) ;
|
||||
// --- Recupero Surf Bezier Ruled
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetRuledBezier", LuaTrimmingGetRuledBezier) ;
|
||||
// --- Recupero linee di sincronizzazione
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingInterpolateSyncLines", LuaTrimmingInterpolateSyncLines) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetSurfBzSyncPoints", LuaTrimmingGetSurfBzSyncPoints) ;
|
||||
// --- Modifica della superficie
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRegolarizeSurfaceLocally", LuaRegolarizeSurfaceLocally) ;
|
||||
return bOk ;
|
||||
}
|
||||
+15
-1
@@ -163,8 +163,22 @@ PictureObj::Load( const STRVECTOR& vString, int nBaseGdbId)
|
||||
string sOut = "Error loading image " + sOtherPath ;
|
||||
LOG_ERROR( GetLogger(), sOut.c_str())
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
else {
|
||||
// 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
|
||||
{
|
||||
string sOut = "Error missing image " + sOtherPath ;
|
||||
LOG_ERROR( GetLogger(), sOut.c_str())
|
||||
}
|
||||
|
||||
+11
-1
@@ -4,6 +4,7 @@
|
||||
//
|
||||
#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
|
||||
@@ -36,6 +37,15 @@
|
||||
#define IDC_CHECK6 1036
|
||||
#define IDC_CHECK7 1037
|
||||
#define IDC_CHECK8 1038
|
||||
#define IDC_COLOR1 1041
|
||||
#define IDC_COLOR2 1042
|
||||
#define IDC_COLOR3 1043
|
||||
#define IDC_COLOR4 1044
|
||||
#define IDC_COLOR5 1045
|
||||
#define IDC_COLOR6 1046
|
||||
#define IDC_COLOR7 1047
|
||||
#define IDC_COLOR8 1048
|
||||
#define IDC_PICTURE1 1101
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
@@ -44,6 +54,6 @@
|
||||
#define _APS_NEXT_RESOURCE_VALUE 103
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1030
|
||||
#define _APS_NEXT_SYMED_VALUE 113
|
||||
#define _APS_NEXT_SYMED_VALUE 115
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -28,8 +28,10 @@
|
||||
|
||||
#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, EGTLIBDIR "SEgtLock" EGTLIBVER ".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, EGTEXTDIR "hiredis/Lib/hiredis" EGTLIBVER ".lib")
|
||||
#pragma comment( lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")
|
||||
#pragma comment( lib, "ws2_32.lib")
|
||||
|
||||
Reference in New Issue
Block a user