Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a5a0646ddc | |||
| b954be810c | |||
| 8500a0467e | |||
| 8145b4586c |
-181
@@ -1,181 +0,0 @@
|
|||||||
//----------------------------------------------------------------------------
|
|
||||||
// EgalTech 2023-2023
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// File : DllExch3dm.cpp Data : 14.11.23 Versione : 2.5k2
|
|
||||||
// Contenuto : Funzioni di gestione della libreria opzionale EgtExch3dme.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Modifiche : 14.11.23 DS Creazione modulo.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//--------------------------- Include ----------------------------------------
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "EXE.h"
|
|
||||||
#include "DllExch3dm.h"
|
|
||||||
#include "/EgtDev/Include/EE3DllMain.h"
|
|
||||||
#define NOMINMAX
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
using namespace std ;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Nome della libreria
|
|
||||||
#if defined( _WIN64) && defined( _DEBUG)
|
|
||||||
static const wchar_t* EE3_NAME = L"EgtExch3dmD64.dll" ;
|
|
||||||
#elif defined( _WIN64)
|
|
||||||
static const wchar_t* EE3_NAME = L"EgtExch3dmR64.dll" ;
|
|
||||||
#elif defined( _WIN32) && defined( _DEBUG)
|
|
||||||
static const wchar_t* EE3_NAME = L"EgtExch3dmD32.dll" ;
|
|
||||||
#else
|
|
||||||
static const wchar_t* EE3_NAME = L"EgtExch3dmR32.dll" ;
|
|
||||||
#endif
|
|
||||||
// Nome delle funzioni caricate
|
|
||||||
static const char* EE3_SETEE3LOGGER = "SetEE3Logger" ;
|
|
||||||
static const char* EE3_GETEE3VERSION = "GetEE3Version" ;
|
|
||||||
static const char* EE3_SETEE3KEY = "SetEE3Key" ;
|
|
||||||
static const char* EE3_SETEE3NETHWKEY = "SetEE3NetHwKey" ;
|
|
||||||
static const char* EE3_CREATEIMPORT3DM = "CreateImport3dm" ;
|
|
||||||
static const char* EE3_CREATEEXPORT3DM = "CreateExport3dm" ;
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
HMODULE s_hEE3 = nullptr ;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
LoadExch3dmDll( ILogger* pLogger, const string& sKey, bool bNetHwKey)
|
|
||||||
{
|
|
||||||
// verifico la chiave
|
|
||||||
if ( ! TestKeyForEE3( sKey, 0, pLogger)) {
|
|
||||||
FreeExch3dmDll() ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
// se già caricata
|
|
||||||
if ( s_hEE3 != nullptr)
|
|
||||||
return true ;
|
|
||||||
// carico la libreria EgtExch3dm
|
|
||||||
s_hEE3 = LoadLibrary( EE3_NAME) ;
|
|
||||||
if ( s_hEE3 == nullptr)
|
|
||||||
return false ;
|
|
||||||
// imposto logger
|
|
||||||
MySetEE3Logger( pLogger) ;
|
|
||||||
// imposto i codici della chiave
|
|
||||||
MySetEE3Key( sKey) ;
|
|
||||||
// imposto eventuale chiave di rete
|
|
||||||
MySetEE3NetHwKey( bNetHwKey) ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
FreeExch3dmDll( void)
|
|
||||||
{
|
|
||||||
// se non è già caricata
|
|
||||||
if ( s_hEE3 == nullptr)
|
|
||||||
return true ;
|
|
||||||
// libero la libreria EgtExch3dm
|
|
||||||
FreeLibrary( s_hEE3) ;
|
|
||||||
s_hEE3 = nullptr ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
IsLoadedExch3dmDll( void)
|
|
||||||
{
|
|
||||||
return ( s_hEE3 != nullptr) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void
|
|
||||||
MySetEE3Logger( ILogger* pLogger)
|
|
||||||
{
|
|
||||||
// verifico caricamento libreria EgtExch3dm
|
|
||||||
if ( s_hEE3 == nullptr)
|
|
||||||
return ;
|
|
||||||
// recupero funzione che imposta il logger
|
|
||||||
typedef void (* PF_SetEE3Logger) ( ILogger* pLogger) ;
|
|
||||||
PF_SetEE3Logger pFun = (PF_SetEE3Logger)GetProcAddress( s_hEE3, EE3_SETEE3LOGGER) ;
|
|
||||||
if ( pFun == nullptr)
|
|
||||||
return ;
|
|
||||||
pFun( pLogger) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
const char*
|
|
||||||
MyGetEE3Version( void)
|
|
||||||
{
|
|
||||||
// verifico caricamento libreria EgtExch3dm
|
|
||||||
if ( s_hEE3 == nullptr)
|
|
||||||
return "" ;
|
|
||||||
// recupero funzione che restituisce la versione della libreria
|
|
||||||
typedef const char* (* PF_GetEE3Version) ( void) ;
|
|
||||||
PF_GetEE3Version pFun = (PF_GetEE3Version)GetProcAddress( s_hEE3, EE3_GETEE3VERSION) ;
|
|
||||||
if ( pFun == nullptr)
|
|
||||||
return "" ;
|
|
||||||
return pFun() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void
|
|
||||||
MySetEE3Key( const string& sKey)
|
|
||||||
{
|
|
||||||
// verifico caricamento libreria EgtExch3dm
|
|
||||||
if ( s_hEE3 == nullptr)
|
|
||||||
return ;
|
|
||||||
// recupero funzione che imposta i codici di protezione
|
|
||||||
typedef void (* PF_SetEE3Key) ( const string& sKey) ;
|
|
||||||
PF_SetEE3Key pFun = (PF_SetEE3Key)GetProcAddress( s_hEE3, EE3_SETEE3KEY) ;
|
|
||||||
if ( pFun == nullptr)
|
|
||||||
return ;
|
|
||||||
pFun( sKey) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void
|
|
||||||
MySetEE3NetHwKey( bool bNetHwKey)
|
|
||||||
{
|
|
||||||
// verifico caricamento libreria EgtExch3dm
|
|
||||||
if ( s_hEE3 == nullptr)
|
|
||||||
return ;
|
|
||||||
// recupero funzione che imposta il flag per chiave di rete
|
|
||||||
typedef void (* PF_SetEE3NetHwKey) ( bool bNetHwKey) ;
|
|
||||||
PF_SetEE3NetHwKey pFun = (PF_SetEE3NetHwKey)GetProcAddress( s_hEE3, EE3_SETEE3NETHWKEY) ;
|
|
||||||
if ( pFun == nullptr)
|
|
||||||
return ;
|
|
||||||
pFun( bNetHwKey) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
IImport3dm*
|
|
||||||
MyCreateImport3dm( void)
|
|
||||||
{
|
|
||||||
// verifico caricamento libreria EgtExch3dm
|
|
||||||
if ( s_hEE3 == nullptr)
|
|
||||||
return nullptr ;
|
|
||||||
// recupero funzione creazione oggetto
|
|
||||||
typedef IImport3dm* (* PF_CreateImport3dm) ( void) ;
|
|
||||||
PF_CreateImport3dm pFun = (PF_CreateImport3dm)GetProcAddress( s_hEE3, EE3_CREATEIMPORT3DM) ;
|
|
||||||
if ( pFun == nullptr)
|
|
||||||
return nullptr ;
|
|
||||||
return pFun() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
IExport3dm*
|
|
||||||
MyCreateExport3dm( void)
|
|
||||||
{
|
|
||||||
// verifico caricamento libreria EgtExch3dm
|
|
||||||
if ( s_hEE3 == nullptr)
|
|
||||||
return nullptr ;
|
|
||||||
// recupero funzione creazione oggetto
|
|
||||||
typedef IExport3dm* (* PF_CreateExport3dm) ( void) ;
|
|
||||||
PF_CreateExport3dm pFun = (PF_CreateExport3dm)GetProcAddress( s_hEE3, EE3_CREATEEXPORT3DM) ;
|
|
||||||
if ( pFun == nullptr)
|
|
||||||
return nullptr ;
|
|
||||||
return pFun() ;
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
//----------------------------------------------------------------------------
|
|
||||||
// EgalTech 2023-2023
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// File : DllExch3dm.h Data : 14.11.23 Versione : 2.5k3
|
|
||||||
// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtExchange.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Modifiche : 14.11.23 DS Creazione modulo.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
class ILogger ;
|
|
||||||
class IImport3dm ;
|
|
||||||
class IExport3dm ;
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool LoadExch3dmDll( ILogger* pLogger, const std::string& sKey, bool bNetHwKey) ;
|
|
||||||
bool FreeExch3dmDll( void) ;
|
|
||||||
bool IsLoadedExch3dmDll( void) ;
|
|
||||||
void MySetEE3Logger( ILogger* pLogger) ;
|
|
||||||
void MySetEE3Key( const std::string& sKey) ;
|
|
||||||
void MySetEE3NetHwKey( bool bNetHwKey) ;
|
|
||||||
const char* MyGetEE3Version( void) ;
|
|
||||||
IImport3dm* MyCreateImport3dm( void) ;
|
|
||||||
IExport3dm* MyCreateExport3dm( void) ;
|
|
||||||
+36
-4
@@ -10,8 +10,8 @@
|
|||||||
// 03.07.18 DS Aggiunto ImportPnt.
|
// 03.07.18 DS Aggiunto ImportPnt.
|
||||||
// 15.09.19 DS Aggiunto ExportSvg.
|
// 15.09.19 DS Aggiunto ExportSvg.
|
||||||
// 14.12.20 DS Aggiunto ImportBtlx.
|
// 14.12.20 DS Aggiunto ImportBtlx.
|
||||||
// 23.10.23 DB Aggiunto Export3dm.
|
// 23.06.23 DB Aggiunto Import3dm.
|
||||||
// 07.11.23 DB Aggiunto Import3dm.
|
// 21.09.23 DB Aggiunto Export3dm.
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -51,9 +51,11 @@ static const char* EEX_CREATEIMPORTDXF = "CreateImportDxf" ;
|
|||||||
static const char* EEX_CREATEIMPORTPNT = "CreateImportPnt" ;
|
static const char* EEX_CREATEIMPORTPNT = "CreateImportPnt" ;
|
||||||
static const char* EEX_CREATEIMPORTSTL = "CreateImportStl" ;
|
static const char* EEX_CREATEIMPORTSTL = "CreateImportStl" ;
|
||||||
static const char* EEX_CREATEIMPORT3MF = "CreateImport3MF" ;
|
static const char* EEX_CREATEIMPORT3MF = "CreateImport3MF" ;
|
||||||
|
static const char* EEX_CREATEIMPORT3DM = "CreateImport3dm" ;
|
||||||
static const char* EEX_CREATEEXPORTDXF = "CreateExportDxf" ;
|
static const char* EEX_CREATEEXPORTDXF = "CreateExportDxf" ;
|
||||||
static const char* EEX_CREATEEXPORTSTL = "CreateExportStl" ;
|
static const char* EEX_CREATEEXPORTSTL = "CreateExportStl" ;
|
||||||
static const char* EEX_CREATEEXPORT3MF = "CreateExport3MF" ;
|
static const char* EEX_CREATEEXPORT3MF = "CreateExport3MF" ;
|
||||||
|
static const char* EEX_CREATEEXPORT3DM = "CreateExport3dm" ;
|
||||||
static const char* EEX_CREATEEXPORTSVG = "CreateExportSvg" ;
|
static const char* EEX_CREATEEXPORTSVG = "CreateExportSvg" ;
|
||||||
static const char* EEX_SETTHREEJSLIBDIR = "SetThreeJSLibDir" ;
|
static const char* EEX_SETTHREEJSLIBDIR = "SetThreeJSLibDir" ;
|
||||||
static const char* EEX_CREATEEXPORTTHREEJS = "CreateExportThreeJS" ;
|
static const char* EEX_CREATEEXPORTTHREEJS = "CreateExportThreeJS" ;
|
||||||
@@ -72,7 +74,7 @@ LoadExchangeDll( ILogger* pLogger, const string& sKey, bool bNetHwKey)
|
|||||||
FreeExchangeDll() ;
|
FreeExchangeDll() ;
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
// se già caricata
|
// se già caricata
|
||||||
if ( s_hEEx != nullptr)
|
if ( s_hEEx != nullptr)
|
||||||
return true ;
|
return true ;
|
||||||
// carico la libreria EgtExchange
|
// carico la libreria EgtExchange
|
||||||
@@ -92,7 +94,7 @@ LoadExchangeDll( ILogger* pLogger, const string& sKey, bool bNetHwKey)
|
|||||||
bool
|
bool
|
||||||
FreeExchangeDll( void)
|
FreeExchangeDll( void)
|
||||||
{
|
{
|
||||||
// se non è già caricata
|
// se non è già caricata
|
||||||
if ( s_hEEx == nullptr)
|
if ( s_hEEx == nullptr)
|
||||||
return true ;
|
return true ;
|
||||||
// libero la libreria EgtExchange
|
// libero la libreria EgtExchange
|
||||||
@@ -318,6 +320,21 @@ MyCreateImport3MF( void)
|
|||||||
return pFun() ;
|
return pFun() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
IImport3dm*
|
||||||
|
MyCreateImport3dm( void)
|
||||||
|
{
|
||||||
|
// verifico caricamento libreria EgtExchange
|
||||||
|
if ( s_hEEx == nullptr)
|
||||||
|
return nullptr ;
|
||||||
|
// recupero funzione creazione oggetto
|
||||||
|
typedef IImport3dm* (* PF_CreateImport3dm) ( void) ;
|
||||||
|
PF_CreateImport3dm pFun = (PF_CreateImport3dm)GetProcAddress( s_hEEx, EEX_CREATEIMPORT3DM) ;
|
||||||
|
if ( pFun == nullptr)
|
||||||
|
return nullptr ;
|
||||||
|
return pFun() ;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
IExportDxf*
|
IExportDxf*
|
||||||
MyCreateExportDxf( void)
|
MyCreateExportDxf( void)
|
||||||
@@ -363,6 +380,21 @@ MyCreateExport3MF( void)
|
|||||||
return pFun() ;
|
return pFun() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
IExport3dm*
|
||||||
|
MyCreateExport3dm( void)
|
||||||
|
{
|
||||||
|
// verifico caricamento libreria EgtExchange
|
||||||
|
if ( s_hEEx == nullptr)
|
||||||
|
return nullptr ;
|
||||||
|
// recupero funzione creazione oggetto
|
||||||
|
typedef IExport3dm* (* PF_CreateExport3dm) ( void) ;
|
||||||
|
PF_CreateExport3dm pFun = (PF_CreateExport3dm)GetProcAddress( s_hEEx, EEX_CREATEEXPORT3DM) ;
|
||||||
|
if ( pFun == nullptr)
|
||||||
|
return nullptr ;
|
||||||
|
return pFun() ;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
IExportSvg*
|
IExportSvg*
|
||||||
MyCreateExportSvg( void)
|
MyCreateExportSvg( void)
|
||||||
|
|||||||
@@ -25,9 +25,11 @@ class IImportDxf ;
|
|||||||
class IImportPnt ;
|
class IImportPnt ;
|
||||||
class IImportStl ;
|
class IImportStl ;
|
||||||
class IImport3MF ;
|
class IImport3MF ;
|
||||||
|
class IImport3dm ;
|
||||||
class IExportDxf ;
|
class IExportDxf ;
|
||||||
class IExportStl ;
|
class IExportStl ;
|
||||||
class IExport3MF ;
|
class IExport3MF ;
|
||||||
|
class IExport3dm ;
|
||||||
class IExportThreeJS ;
|
class IExportThreeJS ;
|
||||||
class IExportSvg ;
|
class IExportSvg ;
|
||||||
class IExcExecutor ;
|
class IExcExecutor ;
|
||||||
@@ -50,9 +52,11 @@ IImportDxf* MyCreateImportDxf( void) ;
|
|||||||
IImportPnt* MyCreateImportPnt( void) ;
|
IImportPnt* MyCreateImportPnt( void) ;
|
||||||
IImportStl* MyCreateImportStl( void) ;
|
IImportStl* MyCreateImportStl( void) ;
|
||||||
IImport3MF* MyCreateImport3MF( void) ;
|
IImport3MF* MyCreateImport3MF( void) ;
|
||||||
|
IImport3dm* MyCreateImport3dm( void) ;
|
||||||
IExportDxf* MyCreateExportDxf( void) ;
|
IExportDxf* MyCreateExportDxf( void) ;
|
||||||
IExportStl* MyCreateExportStl( void) ;
|
IExportStl* MyCreateExportStl( void) ;
|
||||||
IExport3MF* MyCreateExport3MF( void) ;
|
IExport3MF* MyCreateExport3MF( void) ;
|
||||||
|
IExport3dm* MyCreateExport3dm( void) ;
|
||||||
bool MySetThreeJSLibDir( const std::string& sThreeJSLibDir) ;
|
bool MySetThreeJSLibDir( const std::string& sThreeJSLibDir) ;
|
||||||
IExportThreeJS* MyCreateExportThreeJS( void) ;
|
IExportThreeJS* MyCreateExportThreeJS( void) ;
|
||||||
IExportSvg* MyCreateExportSvg( void) ;
|
IExportSvg* MyCreateExportSvg( void) ;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2014-2024
|
// EgalTech 2014-2023
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : EXE.h Data : 15.05.24 Versione : 2.6e4
|
// File : EXE.h Data : 05.02.23 Versione : 2.5a6
|
||||||
// Contenuto : Dichiarazioni locali per moduli EXE.
|
// Contenuto : Dichiarazioni locali per moduli EXE.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -26,7 +26,6 @@ const std::string& ExeGetIniFile( void) ;
|
|||||||
const std::string& ExeGetKey( void) ;
|
const std::string& ExeGetKey( void) ;
|
||||||
const std::string& ExeGetNestKey( void) ;
|
const std::string& ExeGetNestKey( void) ;
|
||||||
const std::string& ExeGetLockId( void) ;
|
const std::string& ExeGetLockId( void) ;
|
||||||
bool ExeVerifyKeyOption( int nOptInd) ;
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
ILogger* GetLogger( void) ;
|
ILogger* GetLogger( void) ;
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
#include "/EgtDev/Include/EXeConst.h"
|
#include "/EgtDev/Include/EXeConst.h"
|
||||||
#include "/EgtDev/Include/EGkCurve.h"
|
#include "/EgtDev/Include/EGkCurve.h"
|
||||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
|
||||||
#include "/EgtDev/Include/EGkCAvToolSurfTm.h"
|
#include "/EgtDev/Include/EGkCAvToolSurfTm.h"
|
||||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||||
@@ -99,28 +98,6 @@ ExeCAvGetToolOutline( int nDestGrpId, bool bApprox)
|
|||||||
return nId ;
|
return nId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
double
|
|
||||||
ExeCAvToolPosBox( const Point3d& ptP, const Vector3d& vtAx, const BBox3d& b3Box, const Vector3d& vtMove)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// creo la superficie TriMesh
|
|
||||||
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshBox( b3Box.GetDimX(), b3Box.GetDimY(), b3Box.GetDimZ())) ;
|
|
||||||
if ( IsNull( pStm))
|
|
||||||
return -1 ;
|
|
||||||
pStm->Translate( b3Box.GetMin() - ORIG) ;
|
|
||||||
// verifico oggetto per evitare collisioni
|
|
||||||
if ( IsNull( s_pCAvTlStm))
|
|
||||||
return -1 ;
|
|
||||||
// imposto dati
|
|
||||||
s_pCAvTlStm->SetSurfTm( *pStm) ;
|
|
||||||
double dMove ;
|
|
||||||
if ( ! s_pCAvTlStm->TestPosition( ptP, vtAx, vtMove, dMove))
|
|
||||||
return -1 ;
|
|
||||||
return dMove ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
double
|
double
|
||||||
ExeCAvToolPosStm( const Point3d& ptP, const Vector3d& vtAx, int nSurfTmId, const Vector3d& vtMove, int nRefType)
|
ExeCAvToolPosStm( const Point3d& ptP, const Vector3d& vtAx, int nSurfTmId, const Vector3d& vtMove, int nRefType)
|
||||||
|
|||||||
+17
-21
@@ -1,9 +1,9 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2020-2020
|
// EgalTech 2020-2020
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : EXE_CDeObjSolid.cpp Data : 09.01.20 Versione : 2.2a2
|
// File : EXE_CDeObjClosedSurfTm.cpp Data : 09.01.20 Versione : 2.2a2
|
||||||
// Contenuto : Funzioni per verificare collisioni tra
|
// Contenuto : Funzioni per verificare collisioni tra
|
||||||
// Objects e Solidi (Closed SurftriMesh e Zmap).
|
// Objects e Closed SurftriMesh.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Modifiche : 09.01.20 DS Creazione modulo.
|
// Modifiche : 09.01.20 DS Creazione modulo.
|
||||||
@@ -49,7 +49,7 @@ MyCDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, int nSurfTmI
|
|||||||
// porto in locale alla superficie il riferimento del box (il vettore è già in questo stesso riferimento)
|
// porto in locale alla superficie il riferimento del box (il vettore è già in questo stesso riferimento)
|
||||||
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frSurf) ;
|
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frSurf) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( CDeBoxClosedSurfTm( frBoxL, vtDiag, *pStm, dSafeDist) ? 1 : 0) ;
|
return ( CDeBoxClosedSurfTm( frBoxL, vtDiag, dSafeDist, *pStm) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -69,7 +69,7 @@ MyCDeBoxVolZmap( const Frame3d& frBox, const Vector3d& vtDiag, int nZmapId, doub
|
|||||||
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
|
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
|
||||||
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frLoc) ;
|
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frLoc) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( pVZM->CDeBox( frBoxL, vtDiag, dSafeDist, false) ? 1 : 0) ;
|
return ( pVZM->AvoidBox( frBoxL, vtDiag, dSafeDist, false) ? 0 : 1) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -118,7 +118,7 @@ MyCDeRectPrismoidClosedSurfTm( const Frame3d& frPrismoid, double dBaseLenX, doub
|
|||||||
// porto in locale alla superficie il riferimento del prismoide rettangolare
|
// porto in locale alla superficie il riferimento del prismoide rettangolare
|
||||||
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frSurf) ;
|
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frSurf) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( CDeRectPrismoidClosedSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, *pStm, dSafeDist) ? 1 : 0) ;
|
return ( CDeRectPrismoidClosedSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, *pStm) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -140,7 +140,7 @@ MyCDeRectPrismoidVolZmap( const Frame3d& frPrismoid, double dBaseLenX, double dB
|
|||||||
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
|
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
|
||||||
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frLoc) ;
|
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frLoc) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( pVZM->CDeRectPrismoid( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, false) ? 1 : 0) ;
|
return ( pVZM->AvoidRectPrismoid( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, false) ? 0 : 1) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -193,7 +193,7 @@ MyCDeCylClosedSurfTm( const Frame3d& frCyl, double dR, double dH, int nSurfTmId,
|
|||||||
// porto in locale alla superficie il riferimento del cilindro
|
// porto in locale alla superficie il riferimento del cilindro
|
||||||
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frSurf) ;
|
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frSurf) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( CDeCylClosedSurfTm( frCylL, dR, dH, *pStm, dSafeDist) ? 1 : 0) ;
|
return ( CDeCylClosedSurfTm( frCylL, dR, dH, dSafeDist, *pStm) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -213,7 +213,7 @@ MyCDeCylVolZmap( const Frame3d& frCyl, double dR, double dH, int nZmapId, double
|
|||||||
// porto in locale il riferimento
|
// porto in locale il riferimento
|
||||||
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frLoc) ;
|
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frLoc) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( pVZM->CDeCylinder( frCylL, dR, dH, dSafeDist, false) ? 1 : 0) ;
|
return ( pVZM->AvoidCylinder( frCylL, dR, dH, dSafeDist, false) ? 0 : 1) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -261,7 +261,7 @@ MyCDeConeClosedSurfTm( const Frame3d& frCone, double dR1, double dR2, double dH,
|
|||||||
// porto in locale alla superficie il riferimento del cilindro
|
// porto in locale alla superficie il riferimento del cilindro
|
||||||
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frSurf) ;
|
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frSurf) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( CDeConeFrustumClosedSurfTm( frConeL, dR1, dR2, dH, *pStm, dSafeDist) ? 1 : 0) ;
|
return ( CDeConeFrustumClosedSurfTm( frConeL, dR1, dR2, dH, dSafeDist, *pStm) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -281,7 +281,7 @@ MyCDeConeVolZmap( const Frame3d& frCone, double dR1, double dR2, double dH, int
|
|||||||
// porto in locale il riferimento
|
// porto in locale il riferimento
|
||||||
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frLoc) ;
|
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frLoc) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( pVZM->CDeConeFrustum( frConeL, dR1, dR2, dH, dSafeDist, false) ? 1 : 0) ;
|
return ( pVZM->AvoidConeFrustum( frConeL, dR1, dR2, dH, dSafeDist, false) ? 0 : 1) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -330,7 +330,7 @@ MyCDeSpheClosedSurfTm( const Point3d& ptCen, double dR, int nSurfTmId, double dS
|
|||||||
// porto in locale alla superficie il centro della sfera
|
// porto in locale alla superficie il centro della sfera
|
||||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ;
|
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( CDeSpheClosedSurfTm( ptCenL, dR, *pStm, dSafeDist) ? 1 : 0) ;
|
return ( CDeSpheClosedSurfTm( ptCenL, dR, dSafeDist, *pStm) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -350,7 +350,7 @@ MyCDeSpheVolZmap( const Point3d& ptCen, double dRad, int nZmapId, double dSafeDi
|
|||||||
// porto in locale il centro della sfera
|
// porto in locale il centro della sfera
|
||||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
|
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( pVZM->CDeSphere( ptCenL, dRad, dSafeDist, false) ? 1 : 0) ;
|
return ( pVZM->AvoidSphere( ptCenL, dRad, dSafeDist, false) ? 0 : 1) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -420,7 +420,7 @@ MyCDeClosedSurfTmVolZmap( int nSurfTmId, int nZmapId, double dSafeDist)
|
|||||||
if ( pVZM == nullptr)
|
if ( pVZM == nullptr)
|
||||||
return -1 ;
|
return -1 ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( pVZM->CDeSurfTm( *pStm, dSafeDist, false) ? 1 : 0) ;
|
return ( pVZM->AvoidSurfTm( *pStm, dSafeDist, false) ? 0 : 1) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -429,14 +429,10 @@ ExeCDeSolidSolid( int nSolid1Id, int nSolid2Id, double dSafeDist)
|
|||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
int nRes = -1 ;
|
int nRes = -1 ;
|
||||||
if ( pGeomDB != nullptr) {
|
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
|
||||||
if ( pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
|
nRes = MyCDeClosedSurfTmClosedSurfTm( nSolid1Id, nSolid2Id, dSafeDist) ;
|
||||||
nRes = MyCDeClosedSurfTmClosedSurfTm( nSolid1Id, nSolid2Id, dSafeDist) ;
|
else if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == VOL_ZMAP)
|
||||||
else if ( pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == VOL_ZMAP)
|
nRes = MyCDeClosedSurfTmVolZmap( nSolid1Id, nSolid2Id, dSafeDist) ;
|
||||||
nRes = MyCDeClosedSurfTmVolZmap( nSolid1Id, nSolid2Id, dSafeDist) ;
|
|
||||||
else if ( pGeomDB->GetGeoType( nSolid1Id) == VOL_ZMAP && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
|
|
||||||
nRes = MyCDeClosedSurfTmVolZmap( nSolid2Id, nSolid1Id, dSafeDist) ;
|
|
||||||
}
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
string sLua = "EgtCDeSolidSolid({" + IdToString( nSolid1Id) + "," +
|
string sLua = "EgtCDeSolidSolid({" + IdToString( nSolid1Id) + "," +
|
||||||
|
|||||||
+34
-85
@@ -17,7 +17,6 @@
|
|||||||
#include "EXE_Macro.h"
|
#include "EXE_Macro.h"
|
||||||
#include "AuxTools.h"
|
#include "AuxTools.h"
|
||||||
#include "DllExchange.h"
|
#include "DllExchange.h"
|
||||||
#include "DllExch3dm.h"
|
|
||||||
#include "/EgtDev/Include/EXeExecutor.h"
|
#include "/EgtDev/Include/EXeExecutor.h"
|
||||||
#include "/EgtDev/Include/EXeConst.h"
|
#include "/EgtDev/Include/EXeConst.h"
|
||||||
#include "/EgtDev/Include/EXeCmdLogOff.h"
|
#include "/EgtDev/Include/EXeCmdLogOff.h"
|
||||||
@@ -29,13 +28,13 @@
|
|||||||
#include "/EgtDev/Include/EExImportPnt.h"
|
#include "/EgtDev/Include/EExImportPnt.h"
|
||||||
#include "/EgtDev/Include/EExImportBtl.h"
|
#include "/EgtDev/Include/EExImportBtl.h"
|
||||||
#include "/EgtDev/Include/EExImportBtlx.h"
|
#include "/EgtDev/Include/EExImportBtlx.h"
|
||||||
|
#include "/EgtDev/Include/EExImport3dm.h"
|
||||||
#include "/EgtDev/Include/EExExportDxf.h"
|
#include "/EgtDev/Include/EExExportDxf.h"
|
||||||
#include "/EgtDev/Include/EExExportStl.h"
|
#include "/EgtDev/Include/EExExportStl.h"
|
||||||
#include "/EgtDev/Include/EExExport3MF.h"
|
#include "/EgtDev/Include/EExExport3MF.h"
|
||||||
|
#include "/EgtDev/Include/EExExport3dm.h"
|
||||||
#include "/EgtDev/Include/EExExportSvg.h"
|
#include "/EgtDev/Include/EExExportSvg.h"
|
||||||
#include "/EgtDev/Include/EExExportThreeJS.h"
|
#include "/EgtDev/Include/EExExportThreeJS.h"
|
||||||
#include "/EgtDev/Include/EE3Import3dm.h"
|
|
||||||
#include "/EgtDev/Include/EE3Export3dm.h"
|
|
||||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||||
@@ -73,8 +72,6 @@ ExeGetFileType( const string& sFilePath)
|
|||||||
return FT_STL ;
|
return FT_STL ;
|
||||||
else if ( sFileExt == "3MF")
|
else if ( sFileExt == "3MF")
|
||||||
return FT_3MF ;
|
return FT_3MF ;
|
||||||
else if ( sFileExt == "3DM")
|
|
||||||
return FT_3DM ;
|
|
||||||
else if ( sFileExt == "OBJ")
|
else if ( sFileExt == "OBJ")
|
||||||
return FT_OBJ ;
|
return FT_OBJ ;
|
||||||
else if ( sFileExt == "CNC" || sFileExt == "XPI" || sFileExt == "MPF" || sFileExt == "ISO" || sFileExt == "EIA")
|
else if ( sFileExt == "CNC" || sFileExt == "XPI" || sFileExt == "MPF" || sFileExt == "ISO" || sFileExt == "EIA")
|
||||||
@@ -152,11 +149,6 @@ ExeImportBtl( const string& sFilePath, int nFlag)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// scrivo il log
|
|
||||||
if ( ! IsNull( pImpBtl)) {
|
|
||||||
string sLog = "Import File " + sFilePath ;
|
|
||||||
LOG_INFO( GetLogger(), sLog.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -185,11 +177,6 @@ ExeImportBtlx( const string& sFilePath, int nFlag)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// scrivo il log
|
|
||||||
if ( ! IsNull( pImpBtlx)) {
|
|
||||||
string sLog = "Import File " + sFilePath ;
|
|
||||||
LOG_INFO( GetLogger(), sLog.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -220,11 +207,6 @@ ExeImportCnc( const string& sFilePath, int nFlag)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// scrivo il log
|
|
||||||
if ( ! IsNull( pImpCnc)) {
|
|
||||||
string sLog = "Import File " + sFilePath ;
|
|
||||||
LOG_INFO( GetLogger(), sLog.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -252,11 +234,6 @@ ExeImportCsf( const string& sFilePath)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// scrivo il log
|
|
||||||
if ( ! IsNull( pImpCsf)) {
|
|
||||||
string sLog = "Import File " + sFilePath ;
|
|
||||||
LOG_INFO( GetLogger(), sLog.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -287,11 +264,6 @@ ExeImportDxf( const string& sFilePath, double dScaleFactor)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// scrivo il log
|
|
||||||
if ( ! IsNull( pImpDxf)) {
|
|
||||||
string sLog = "Import File " + sFilePath ;
|
|
||||||
LOG_INFO( GetLogger(), sLog.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -322,11 +294,6 @@ ExeImportPnt( const string& sFilePath, int nFlag)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// scrivo il log
|
|
||||||
if ( ! IsNull( pImpPnt)) {
|
|
||||||
string sLog = "Import File " + sFilePath ;
|
|
||||||
LOG_INFO( GetLogger(), sLog.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -342,10 +309,10 @@ ExeImportStl( const string& sFilePath, double dScaleFactor)
|
|||||||
// aggiungo un gruppo pezzo e un gruppo layer
|
// aggiungo un gruppo pezzo e un gruppo layer
|
||||||
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
|
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 = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
|
||||||
// preparo l'importatore
|
// preparo l'importatore
|
||||||
PtrOwner<IImportStl> pImpStl( MyCreateImportStl()) ;
|
PtrOwner<IImportStl> pImpStl( MyCreateImportStl()) ;
|
||||||
bOk = bOk && ! IsNull( pImpStl) ;
|
bOk = bOk && ! IsNull( pImpStl) ;
|
||||||
// eseguo l'importazione
|
// eseguo l'importazione
|
||||||
bOk = bOk && pImpStl->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ;
|
bOk = bOk && pImpStl->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ;
|
||||||
// aggiorno stato file corrente
|
// aggiorno stato file corrente
|
||||||
if ( pGseCtx->m_sFilePath.empty())
|
if ( pGseCtx->m_sFilePath.empty())
|
||||||
@@ -358,11 +325,6 @@ ExeImportStl( const string& sFilePath, double dScaleFactor)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// scrivo il log
|
|
||||||
if ( ! IsNull( pImpStl)) {
|
|
||||||
string sLog = "Import File " + sFilePath ;
|
|
||||||
LOG_INFO( GetLogger(), sLog.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -375,13 +337,13 @@ ExeImport3MF( const string& sFilePath)
|
|||||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||||
bool bOk = true ;
|
bool bOk = true ;
|
||||||
// importo il file 3MF
|
// importo il file 3MF
|
||||||
// aggiungo un gruppo pezzo e un gruppo layer
|
// aggiungo un gruppo pezzo e un gruppo layer
|
||||||
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
|
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 = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
|
||||||
// preparo l'importatore
|
// preparo l'importatore
|
||||||
PtrOwner<IImport3MF> pImp3MF( MyCreateImport3MF()) ;
|
PtrOwner<IImport3MF> pImp3MF( MyCreateImport3MF()) ;
|
||||||
bOk = bOk && ! IsNull( pImp3MF) ;
|
bOk = bOk && ! IsNull( pImp3MF) ;
|
||||||
// eseguo l'importazione
|
// eseguo l'importazione
|
||||||
bOk = bOk && pImp3MF->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId) ;
|
bOk = bOk && pImp3MF->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId) ;
|
||||||
// aggiorno stato file corrente
|
// aggiorno stato file corrente
|
||||||
if ( pGseCtx->m_sFilePath.empty())
|
if ( pGseCtx->m_sFilePath.empty())
|
||||||
@@ -393,29 +355,25 @@ ExeImport3MF( const string& sFilePath)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// scrivo il log
|
|
||||||
if ( ! IsNull( pImp3MF)) {
|
|
||||||
string sLog = "Import File " + sFilePath ;
|
|
||||||
LOG_INFO( GetLogger(), sLog.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeImport3dm( const string& sFilePath)
|
ExeImport3dm( const string& sFilePath, double dScaleFactor)
|
||||||
{
|
{
|
||||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||||
bool bOk = true ;
|
bool bOk = true ;
|
||||||
// importo il file 3dm
|
// importo il file 3dm
|
||||||
//// aggiungo un gruppo pezzo e un gruppo layer
|
// aggiungo un gruppo pezzo e un gruppo layer
|
||||||
// int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
|
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
|
||||||
// preparo l'importatore
|
int nLayerId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
|
||||||
|
// preparo l'importatore
|
||||||
PtrOwner<IImport3dm> pImp3dm( MyCreateImport3dm()) ;
|
PtrOwner<IImport3dm> pImp3dm( MyCreateImport3dm()) ;
|
||||||
bOk = bOk && ! IsNull( pImp3dm) ;
|
bOk = bOk && ! IsNull( pImp3dm) ;
|
||||||
// eseguo l'importazione
|
// eseguo l'importazione
|
||||||
const DimensionStyle& DimSt = pGseCtx->m_dsCurr ;
|
const DimensionStyle& DimSt = pGseCtx->m_dsCurr ;
|
||||||
double dExtLine = DimSt.dExtLineLen ;
|
double dExtLine = DimSt.dExtLineLen ;
|
||||||
double dArrLen = DimSt.dArrowLen ;
|
double dArrLen = DimSt.dArrowLen ;
|
||||||
@@ -424,7 +382,7 @@ ExeImport3dm( const string& sFilePath)
|
|||||||
int nDecDig = DimSt.nDecDigit ;
|
int nDecDig = DimSt.nDecDigit ;
|
||||||
string sFont = DimSt.sFont ;
|
string sFont = DimSt.sFont ;
|
||||||
double dTextHeight = DimSt.dTextHeight ;
|
double dTextHeight = DimSt.dTextHeight ;
|
||||||
bOk = bOk && pImp3dm->Import( sFilePath, pGseCtx->m_pGeomDB, GDB_ID_ROOT,
|
bOk = bOk && pImp3dm->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor,
|
||||||
dTextHeight, dExtLine, dArrLen, dTextDist, bLenIsMM, nDecDig, sFont) ;
|
dTextHeight, dExtLine, dArrLen, dTextDist, bLenIsMM, nDecDig, sFont) ;
|
||||||
// aggiorno stato file corrente
|
// aggiorno stato file corrente
|
||||||
if ( pGseCtx->m_sFilePath.empty())
|
if ( pGseCtx->m_sFilePath.empty())
|
||||||
@@ -432,15 +390,11 @@ ExeImport3dm( const string& sFilePath)
|
|||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
string sLua = "EgtImport3dm('" + StringToLuaString( sFilePath) + "')" +
|
string sLua = "EgtImport3dm('" + StringToLuaString( sFilePath) + "'," +
|
||||||
|
ToString( dScaleFactor) + ")" +
|
||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// scrivo il log
|
|
||||||
if ( ! IsNull( pImp3dm)) {
|
|
||||||
string sLog = "Import File " + sFilePath ;
|
|
||||||
LOG_INFO( GetLogger(), sLog.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -470,7 +424,7 @@ ExeAdvancedImportIsEnabled( void)
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeAdvancedImport( const string& sFilePath, double dToler, int nFlag)
|
ExeAdvancedImport( const string& sFilePath, double dToler)
|
||||||
{
|
{
|
||||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||||
@@ -504,7 +458,7 @@ ExeAdvancedImport( const string& sFilePath, double dToler, int nFlag)
|
|||||||
#endif
|
#endif
|
||||||
string sCmdLine = "\"" + sExec + "\" \"" + sFilePath + "\" \"" + sFileOut + "\" \"" +
|
string sCmdLine = "\"" + sExec + "\" \"" + sFilePath + "\" \"" + sFileOut + "\" \"" +
|
||||||
ToString( dToler, 3) + "\" \"" + ToString( ExeGetDebugLevel()) + "\" \"" +
|
ToString( dToler, 3) + "\" \"" + ToString( ExeGetDebugLevel()) + "\" \"" +
|
||||||
ExeGetKey() + "\" \"" + ExeGetLockId() + "\" \"" + ToString( nFlag) + "\"" ;
|
ExeGetKey() + "\" \"" + ExeGetLockId() + "\"" ;
|
||||||
STARTUPINFO si ;
|
STARTUPINFO si ;
|
||||||
PROCESS_INFORMATION pi ;
|
PROCESS_INFORMATION pi ;
|
||||||
ZeroMemory( &si, sizeof( si)) ;
|
ZeroMemory( &si, sizeof( si)) ;
|
||||||
@@ -548,11 +502,6 @@ ExeAdvancedImport( const string& sFilePath, double dToler, int nFlag)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// scrivo il log
|
|
||||||
{
|
|
||||||
string sLog = "Advanced Import File " + sFilePath ;
|
|
||||||
LOG_INFO( GetLogger(), sLog.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -565,11 +514,11 @@ ExeExportDxf( int nId, const string& sFilePath, int nFlag, int nFilter)
|
|||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
bool bOk = true ;
|
bool bOk = true ;
|
||||||
// esporto il file DXF
|
// esporto il file DXF
|
||||||
// preparo l'esportatore
|
// preparo l'esportatore
|
||||||
PtrOwner<IExportDxf> pExpDxf( MyCreateExportDxf()) ;
|
PtrOwner<IExportDxf> pExpDxf( MyCreateExportDxf()) ;
|
||||||
bOk = bOk && ! IsNull( pExpDxf) ;
|
bOk = bOk && ! IsNull( pExpDxf) ;
|
||||||
// eseguo l'esportazione
|
// eseguo l'esportazione
|
||||||
bOk = bOk && pExpDxf->SetOptions( nFilter, nFlag) ;
|
pExpDxf->SetOptions( nFilter, nFlag) ;
|
||||||
bOk = bOk && pExpDxf->Export( pGeomDB, nId, sFilePath) ;
|
bOk = bOk && pExpDxf->Export( pGeomDB, nId, sFilePath) ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
@@ -591,11 +540,11 @@ ExeExportStl( int nId, const string& sFilePath, int nFilter)
|
|||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
bool bOk = true ;
|
bool bOk = true ;
|
||||||
// esporto il file STL
|
// esporto il file STL
|
||||||
// preparo l'esportatore
|
// preparo l'esportatore
|
||||||
PtrOwner<IExportStl> pExpStl( MyCreateExportStl()) ;
|
PtrOwner<IExportStl> pExpStl( MyCreateExportStl()) ;
|
||||||
bOk = bOk && ! IsNull( pExpStl) ;
|
bOk = bOk && ! IsNull( pExpStl) ;
|
||||||
// eseguo l'esportazione
|
// eseguo l'esportazione
|
||||||
bOk = bOk && pExpStl->SetOptions( nFilter) ;
|
pExpStl->SetOptions( nFilter) ;
|
||||||
bOk = bOk && pExpStl->Export( pGeomDB, nId, sFilePath) ;
|
bOk = bOk && pExpStl->Export( pGeomDB, nId, sFilePath) ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
@@ -616,11 +565,11 @@ ExeExport3MF( int nId, const string& sFilePath, int nFilter)
|
|||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
bool bOk = true ;
|
bool bOk = true ;
|
||||||
// esporto il file 3MF
|
// esporto il file 3MF
|
||||||
// preparo l'esportatore
|
// preparo l'esportatore
|
||||||
PtrOwner<IExport3MF> pExp3MF( MyCreateExport3MF()) ;
|
PtrOwner<IExport3MF> pExp3MF( MyCreateExport3MF()) ;
|
||||||
bOk = bOk && ! IsNull( pExp3MF) ;
|
bOk = bOk && ! IsNull( pExp3MF) ;
|
||||||
// eseguo l'esportazione
|
// eseguo l'esportazione
|
||||||
bOk = bOk && pExp3MF->SetOptions( nFilter) ;
|
pExp3MF->SetOptions( nFilter) ;
|
||||||
bOk = bOk && pExp3MF->Export( pGeomDB, nId, sFilePath) ;
|
bOk = bOk && pExp3MF->Export( pGeomDB, nId, sFilePath) ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
@@ -641,17 +590,17 @@ ExeExport3dm( int nId, const string& sFilePath, int nFilter)
|
|||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
bool bOk = true ;
|
bool bOk = true ;
|
||||||
// esporto il file 3dm
|
// esporto il file 3dm
|
||||||
// preparo l'esportatore
|
// preparo l'esportatore
|
||||||
PtrOwner<IExport3dm> pExp3dm( MyCreateExport3dm()) ;
|
PtrOwner<IExport3dm> pExp3dm( MyCreateExport3dm()) ;
|
||||||
bOk = bOk && ! IsNull( pExp3dm) ;
|
bOk = bOk && ! IsNull( pExp3dm) ;
|
||||||
// eseguo l'esportazione
|
// eseguo l'esportazione
|
||||||
bOk = bOk && pExp3dm->SetOptions( nFilter) ;
|
bOk = bOk && pExp3dm->SetOptions( nFilter) ;
|
||||||
bOk = bOk && pExp3dm->Export( pGeomDB, nId, sFilePath) ;
|
bOk = bOk && pExp3dm->Export( pGeomDB, nId, sFilePath) ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
string sLua = "EgtExport3dm(" + ToString( nId) + ",'" +
|
string sLua = "EgtExport3dm(" + ToString( nId) + ",'" +
|
||||||
StringToLuaString( sFilePath) + "')" +
|
StringToLuaString( sFilePath) + "')" +
|
||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
@@ -665,12 +614,12 @@ ExeExportSvg( int nId, const string& sFilePath, int nFilter)
|
|||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
bool bOk = true ;
|
bool bOk = true ;
|
||||||
// esporto il file SVG
|
// esporto il file SVG
|
||||||
// preparo l'esportatore
|
// preparo l'esportatore
|
||||||
PtrOwner<IExportSvg> pExpSvg( MyCreateExportSvg()) ;
|
PtrOwner<IExportSvg> pExpSvg( MyCreateExportSvg()) ;
|
||||||
bOk = bOk && ! IsNull( pExpSvg) ;
|
bOk = bOk && ! IsNull( pExpSvg) ;
|
||||||
// eseguo l'esportazione
|
// eseguo l'esportazione
|
||||||
bOk = bOk && pExpSvg->SetOptions( nFilter) ;
|
pExpSvg->SetOptions( nFilter) ;
|
||||||
bOk = bOk && pExpSvg->Export( pGeomDB, nId, sFilePath) ;
|
bOk = bOk && pExpSvg->Export( pGeomDB, nId, sFilePath) ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
|
|||||||
+181
-134
@@ -131,7 +131,7 @@ ExeCreateGeoVector( int nParentId, const Vector3d& vtV, const Point3d& ptB, int
|
|||||||
Point3d ptBL = GetPointLocal( pGeomDB, ptB, nRefType, frLoc) ;
|
Point3d ptBL = GetPointLocal( pGeomDB, ptB, nRefType, frLoc) ;
|
||||||
// creo il vettore
|
// creo il vettore
|
||||||
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
|
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
|
||||||
bOk = bOk && ! IsNull( pGeoVct) ;
|
bOk = bOk && !IsNull( pGeoVct) ;
|
||||||
// setto il vettore (con il punto base)
|
// setto il vettore (con il punto base)
|
||||||
bOk = bOk && pGeoVct->Set( vtVL, ptBL) ;
|
bOk = bOk && pGeoVct->Set( vtVL, ptBL) ;
|
||||||
// inserisco il vettore nel DB
|
// inserisco il vettore nel DB
|
||||||
@@ -480,7 +480,7 @@ MyCreateRadialDimension( int nParentId, int nCrvId, const Point3d& ptDim,
|
|||||||
Point3d ptCenL = pArc->GetCenter() ;
|
Point3d ptCenL = pArc->GetCenter() ;
|
||||||
ptCenL.LocToLoc( frArc, frLoc) ;
|
ptCenL.LocToLoc( frArc, frLoc) ;
|
||||||
Vector3d vtNL = pArc->GetNormVersor() ;
|
Vector3d vtNL = pArc->GetNormVersor() ;
|
||||||
vtNL.LocToLoc( frArc, frLoc) ;
|
vtNL.LocToLoc( frArc, frLoc) ;
|
||||||
// porto ptDimL sulla circonferenza cui appartiene l'arco
|
// porto ptDimL sulla circonferenza cui appartiene l'arco
|
||||||
Vector3d vtDir = ptDimL - ptCenL ;
|
Vector3d vtDir = ptDimL - ptCenL ;
|
||||||
if ( ! vtDir.Normalize())
|
if ( ! vtDir.Normalize())
|
||||||
@@ -543,7 +543,7 @@ MyCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
|
|||||||
Point3d ptCenL = pArc->GetCenter() ;
|
Point3d ptCenL = pArc->GetCenter() ;
|
||||||
ptCenL.LocToLoc( frArc, frLoc) ;
|
ptCenL.LocToLoc( frArc, frLoc) ;
|
||||||
Vector3d vtNL = pArc->GetNormVersor() ;
|
Vector3d vtNL = pArc->GetNormVersor() ;
|
||||||
vtNL.LocToLoc( frArc, frLoc) ;
|
vtNL.LocToLoc( frArc, frLoc) ;
|
||||||
// porto ptDimL sulla circonferenza
|
// porto ptDimL sulla circonferenza
|
||||||
Vector3d vtDir = ptDimL - ptCenL ;
|
Vector3d vtDir = ptDimL - ptCenL ;
|
||||||
if ( ! vtDir.Normalize())
|
if ( ! vtDir.Normalize())
|
||||||
@@ -583,7 +583,7 @@ ExeCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
MyCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2,
|
MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP0, const Point3d& ptP2,
|
||||||
const Point3d& ptDim, const string& sText, int nRefType)
|
const Point3d& ptDim, const string& sText, int nRefType)
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
@@ -594,7 +594,7 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1
|
|||||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// porto in locale i punti e assegno i versori
|
// porto in locale i punti e assegno i versori
|
||||||
Point3d ptVL = GetPointLocal( pGeomDB, ptV, nRefType, frLoc) ;
|
Point3d ptP0L = GetPointLocal( pGeomDB, ptP0, nRefType, frLoc) ;
|
||||||
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
|
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
|
||||||
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
|
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
|
||||||
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
|
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
|
||||||
@@ -603,7 +603,7 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1
|
|||||||
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
|
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
|
||||||
if ( IsNull( pDim) ||
|
if ( IsNull( pDim) ||
|
||||||
! MySetDimensionStyle( pDim ) ||
|
! MySetDimensionStyle( pDim ) ||
|
||||||
! pDim->SetAngular( ptVL, ptP1L, ptP2L, ptDimL, vtNL, sText))
|
! pDim->SetAngular( ptP1L, ptP0L, ptP2L, ptDimL, vtNL, sText))
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// inserisco la quota nel DB
|
// inserisco la quota nel DB
|
||||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
|
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
|
||||||
@@ -611,16 +611,16 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2,
|
ExeCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP0, const Point3d& ptP2,
|
||||||
const Point3d& ptDim, const string& sText, int nRefType)
|
const Point3d& ptDim, const string& sText, int nRefType)
|
||||||
{
|
{
|
||||||
// eseguo
|
// eseguo
|
||||||
int nId = MyCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
|
int nId = MyCreateAngularDimension( nParentId, ptP1, ptP0, ptP2, ptDim, sText, nRefType) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
string sLua = "EgtAngularDimension(" + IdToString( nParentId) + ",{" +
|
string sLua = "EgtAngularDimension(" + IdToString( nParentId) + ",{" +
|
||||||
ToString( ptV) + "},{" +
|
ToString( ptP0) + "},{" +
|
||||||
ToString( ptP1) + "},{" +
|
ToString( ptP1) + "},{" +
|
||||||
ToString( ptP2) + "},{" +
|
ToString( ptP2) + "},{" +
|
||||||
ToString( ptDim) + "},'" +
|
ToString( ptDim) + "},'" +
|
||||||
@@ -633,62 +633,6 @@ ExeCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP
|
|||||||
return nId ;
|
return nId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
MyCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
|
|
||||||
const Point3d& ptV2,const Point3d& ptP2, const Point3d& ptDim,
|
|
||||||
const string& sText, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
||||||
nParentId = AdjustId( nParentId) ;
|
|
||||||
// recupero il riferimento locale
|
|
||||||
Frame3d frLoc ;
|
|
||||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
// porto in locale i punti e assegno i versori
|
|
||||||
Point3d ptV1L = GetPointLocal( pGeomDB, ptV1, nRefType, frLoc) ;
|
|
||||||
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
|
|
||||||
Point3d ptV2L = GetPointLocal( pGeomDB, ptV2, nRefType, frLoc) ;
|
|
||||||
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
|
|
||||||
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
|
|
||||||
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
|
|
||||||
// creo la quota
|
|
||||||
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
|
|
||||||
if ( IsNull( pDim) ||
|
|
||||||
! MySetDimensionStyle( pDim ) ||
|
|
||||||
! pDim->SetAngularEx( ptV1L, ptP1L, ptV2L, ptP2L, ptDimL, vtNL, sText))
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
// inserisco la quota nel DB
|
|
||||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
|
|
||||||
const Point3d& ptV2, const Point3d& ptP2, const Point3d& ptDim,
|
|
||||||
const string& sText, int nRefType)
|
|
||||||
{
|
|
||||||
// eseguo
|
|
||||||
int nId = MyCreateAngularDimensionEx( nParentId, ptV1, ptP1, ptV2, ptP2, ptDim, sText, nRefType) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtAngularDimensionEx(" + IdToString( nParentId) + ",{" +
|
|
||||||
ToString( ptV1) + "},{" +
|
|
||||||
ToString( ptP1) + "},{" +
|
|
||||||
ToString( ptV2) + "},{" +
|
|
||||||
ToString( ptP2) + "},{" +
|
|
||||||
ToString( ptDim) + "},'" +
|
|
||||||
StringToLuaString( sText) + "'," +
|
|
||||||
RefTypeToString( nRefType) + ")" +
|
|
||||||
" -- Id=" + ToString( nId) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco l'identificativo del oggetto
|
|
||||||
return nId ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Point3d& ptDim,
|
MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Point3d& ptDim,
|
||||||
@@ -701,24 +645,27 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
|
|||||||
Frame3d frLoc ;
|
Frame3d frLoc ;
|
||||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// recupero le linee
|
|
||||||
|
//recupero le linee
|
||||||
ICurveLine* pCrv1 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[0])) ;
|
ICurveLine* pCrv1 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[0])) ;
|
||||||
ICurveLine* pCrv2 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[1])) ;
|
ICurveLine* pCrv2 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[1])) ;
|
||||||
if ( pCrv1 == nullptr || pCrv2 == nullptr)
|
if ( pCrv1 == nullptr || pCrv2 == nullptr)
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
PtrOwner<ICurveLine> pL1( pCrv1->Clone()) ;
|
PtrOwner<ICurveLine> pL1( pCrv1->Clone()) ;
|
||||||
PtrOwner<ICurveLine> pL2( pCrv2->Clone()) ;
|
PtrOwner<ICurveLine> pL2( pCrv2->Clone()) ;
|
||||||
if ( IsNull( pL1 ) || ! pL1->IsValid() || IsNull( pL2) || ! pL2->IsValid())
|
if ( IsNull( pL1 ) || ! pL1->IsValid() || IsNull( pL2) || ! pL2->IsValid())
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// porto tutto nel frLoc
|
|
||||||
|
//porto tutto nel frLoc
|
||||||
Frame3d frL1, frL2 ;
|
Frame3d frL1, frL2 ;
|
||||||
if ( ! pGeomDB->GetGlobFrame( vLineIds[0], frL1) || ! pGeomDB->GetGlobFrame( vLineIds[1], frL2))
|
if ( ! pGeomDB->GetGlobFrame( vLineIds[0], frL1) || ! pGeomDB->GetGlobFrame( vLineIds[1], frL2))
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
pL1->LocToLoc( frL1, frLoc) ;
|
pL1->LocToLoc( frL1, frLoc) ;
|
||||||
pL2->LocToLoc( frL2, frLoc) ;
|
pL2->LocToLoc( frL2, frLoc) ;
|
||||||
// recupero il punto lo porto nel riferimento locale
|
|
||||||
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
|
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
|
||||||
// recupero i punti e le direzioni
|
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
|
||||||
|
|
||||||
|
//recupero i punti e le direzioni
|
||||||
Point3d ptP1L, ptP2L, ptP3L, ptP4L ;
|
Point3d ptP1L, ptP2L, ptP3L, ptP4L ;
|
||||||
Vector3d vtL1, vtL2 ;
|
Vector3d vtL1, vtL2 ;
|
||||||
pL1->GetStartPoint( ptP1L) ;
|
pL1->GetStartPoint( ptP1L) ;
|
||||||
@@ -727,12 +674,15 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
|
|||||||
pL2->GetEndPoint( ptP4L) ;
|
pL2->GetEndPoint( ptP4L) ;
|
||||||
pL1->GetStartDir( vtL1) ;
|
pL1->GetStartDir( vtL1) ;
|
||||||
pL2->GetStartDir( vtL2) ;
|
pL2->GetStartDir( vtL2) ;
|
||||||
|
|
||||||
// controllo se le rette sono coincidenti o parallele
|
// controllo se le rette sono coincidenti o parallele
|
||||||
if ( AreSameOrOppositeVectorApprox( vtL1, vtL2))
|
if ( AreSameOrOppositeVectorApprox( vtL1, vtL2))
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
|
|
||||||
// verifico se le rette si intersecano già
|
// verifico se le rette si intersecano già
|
||||||
Point3d ptCenL ;
|
Point3d ptP0L ;
|
||||||
IntersCurveCurve pInters( *pL1, *pL2) ;
|
IntersCurveCurve pInters( *pL1, *pL2) ;
|
||||||
|
IntCrvCrvInfo Info ;
|
||||||
int nNumeroInters = pInters.GetIntersCount() ;
|
int nNumeroInters = pInters.GetIntersCount() ;
|
||||||
// se non ho intersezioni estendo
|
// se non ho intersezioni estendo
|
||||||
if ( nNumeroInters == 0) {
|
if ( nNumeroInters == 0) {
|
||||||
@@ -741,54 +691,54 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
|
|||||||
pL2->ExtendStartByLen( dLen) ;
|
pL2->ExtendStartByLen( dLen) ;
|
||||||
pL1->ExtendEndByLen( dLen) ;
|
pL1->ExtendEndByLen( dLen) ;
|
||||||
pL2->ExtendEndByLen( dLen) ;
|
pL2->ExtendEndByLen( dLen) ;
|
||||||
// faccio intersezione
|
|
||||||
|
//faccio intersezione
|
||||||
IntersCurveCurve pIntersExt( *pL1, *pL2) ;
|
IntersCurveCurve pIntersExt( *pL1, *pL2) ;
|
||||||
nNumeroInters = pIntersExt.GetIntersCount() ;
|
nNumeroInters = pIntersExt.GetIntersCount() ;
|
||||||
|
|
||||||
// le linee estese non si intersecano, quindi vuol dire che sono quasi parallele e lontanissime
|
// le linee estese non si intersecano, quindi vuol dire che sono quasi parallele e lontanissime
|
||||||
if ( nNumeroInters == 0 )
|
if ( nNumeroInters == 0 )
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
else {
|
else {
|
||||||
IntCrvCrvInfo Info ;
|
|
||||||
pIntersExt.GetIntCrvCrvInfo( 0, Info) ;
|
pIntersExt.GetIntCrvCrvInfo( 0, Info) ;
|
||||||
// controllo che non siano coincidenti
|
// controllo che non siano coincidenti
|
||||||
if ( Info.bOverlap)
|
if ( Info.bOverlap)
|
||||||
return false ;
|
return false ;
|
||||||
else
|
else
|
||||||
ptCenL = Info.IciA->ptI ;
|
ptP0L = Info.IciA->ptI ;
|
||||||
}
|
}
|
||||||
// seleziono i punti necessari
|
// seleziono i punti necessari
|
||||||
// se ptDimL è più vicino a ptCenL rispetto agli estremi esterni delle linee, allora tengo gli estremi interni
|
// se ptDimL è più vicino a ptP0L rispetto agli estremi esterni delle linee, allora tengo gli estremi interni
|
||||||
double dP1Cen = ( ptP1L - ptCenL).Len() ;
|
double dP1P0 = ( ptP1L - ptP0L ).Len() ;
|
||||||
double dP2Cen = ( ptP2L - ptCenL).Len() ;
|
double dP2P0 = ( ptP2L - ptP0L ).Len() ;
|
||||||
double dDimCen = ( ptDimL - ptCenL).Len() ;
|
double dDimP0 = ( ptDimL - ptP0L ).Len() ;
|
||||||
if ( ( dDimCen < dP1Cen || dDimCen < dP2Cen))
|
if ( ( dDimP0 < dP1P0 || dDimP0 < dP2P0))
|
||||||
// se uno dei due punti è più vicino a ptCenL rispetto a ptDimL, allora tengo il punto più vicino a ptDimL
|
// se uno dei due punti è più vicino a ptP0L rispetto a ptDimL, allora tengo il punto più vicino a ptDimL
|
||||||
ptP1L = ( ( ptDimL - ptP1L ).Len() < ( ptDimL - ptP2L ).Len() ? ptP1L : ptP2L) ;
|
ptP1L = ( ( ptDimL - ptP1L ).Len() < ( ptDimL - ptP2L ).Len() ? ptP1L : ptP2L) ;
|
||||||
else
|
else
|
||||||
ptP1L = ( dP1Cen < dP2Cen ? ptP2L : ptP1L ) ;
|
ptP1L = ( dP1P0 < dP2P0 ? ptP2L : ptP1L ) ;
|
||||||
// rifaccio anche per l'altro lato
|
// rifaccio anche per l'altro lato
|
||||||
double dP3Cen = ( ptP3L - ptCenL).Len() ;
|
double dP3P0 = ( ptP3L - ptP0L).Len() ;
|
||||||
double dP4Cen = ( ptP4L - ptCenL).Len() ;
|
double dP4P0 = ( ptP4L - ptP0L).Len() ;
|
||||||
if ( dDimCen < dP3Cen || dDimCen < dP4Cen)
|
if ( dDimP0 < dP3P0 || dDimP0 < dP4P0 )
|
||||||
ptP3L = ( ( ptDimL - ptP3L).Len() < ( ptDimL - ptP4L).Len() ? ptP3L : ptP4L) ;
|
ptP3L = ( ( ptDimL - ptP3L).Len() < ( ptDimL - ptP4L).Len() ? ptP3L : ptP4L ) ;
|
||||||
else
|
else
|
||||||
ptP3L = ( dP3Cen < dP4Cen ? ptP4L : ptP3L) ;
|
ptP3L = ( dP3P0 < dP4P0 ? ptP4L : ptP3L) ;
|
||||||
}
|
}
|
||||||
// se ho già intesezioni devo capire in quale quadrante si trova ptDim
|
// se ho già intesezioni devo capire in quale quadrante si trova ptDim
|
||||||
else {
|
else {
|
||||||
// recupero l'intersezione
|
// recupero l'intersezione
|
||||||
IntCrvCrvInfo Info ;
|
|
||||||
pInters.GetIntCrvCrvInfo( 0, Info) ;
|
pInters.GetIntCrvCrvInfo( 0, Info) ;
|
||||||
// controllo che non siano coincidenti
|
// controllo che non siano coincidenti
|
||||||
if ( Info.bOverlap)
|
if ( Info.bOverlap)
|
||||||
return false ;
|
return false ;
|
||||||
// se non coincidono restituisco l'intersezione
|
|
||||||
else
|
else
|
||||||
ptCenL = Info.IciA->ptI ;
|
ptP0L = Info.IciA->ptI ; // se non coincidono restituisco l'intersezione
|
||||||
// se le due linee hanno un estremo in comune, estendo le linee da quel lato
|
|
||||||
if ( ( AreSamePointApprox( ptCenL, ptP1L) || AreSamePointApprox( ptCenL, ptP2L)) &&
|
// se le due linee hanno un estremo in comune, estendo le linee quel lato
|
||||||
( AreSamePointApprox( ptCenL, ptP3L) || AreSamePointApprox( ptCenL, ptP4L))) {
|
if ( ( AreSamePointApprox( ptP0L, ptP1L) || AreSamePointApprox( ptP0L, ptP2L)) &&
|
||||||
if ( AreSamePointApprox( ptCenL, ptP1L)) {
|
( AreSamePointApprox( ptP0L, ptP3L) || AreSamePointApprox( ptP0L, ptP4L))) {
|
||||||
|
if ( AreSamePointApprox( ptP0L, ptP1L)) {
|
||||||
pL1->ExtendStartByLen(Dist( ptP1L, ptP2L) / 2) ;
|
pL1->ExtendStartByLen(Dist( ptP1L, ptP2L) / 2) ;
|
||||||
pL1->GetStartPoint( ptP1L) ;
|
pL1->GetStartPoint( ptP1L) ;
|
||||||
}
|
}
|
||||||
@@ -796,8 +746,8 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
|
|||||||
pL1->ExtendEndByLen(Dist( ptP1L, ptP2L) / 2) ;
|
pL1->ExtendEndByLen(Dist( ptP1L, ptP2L) / 2) ;
|
||||||
pL1->GetEndPoint( ptP2L) ;
|
pL1->GetEndPoint( ptP2L) ;
|
||||||
}
|
}
|
||||||
if ( AreSamePointApprox( ptCenL, ptP3L)) {
|
if ( AreSamePointApprox( ptP0L, ptP3L) ) {
|
||||||
pL2->ExtendStartByLen( Dist( ptP3L, ptP4L) / 2);
|
pL2->ExtendStartByLen(Dist( ptP3L, ptP4L) / 2);
|
||||||
pL2->GetStartPoint( ptP3L) ;
|
pL2->GetStartPoint( ptP3L) ;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -805,42 +755,36 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
|
|||||||
pL2->GetEndPoint( ptP4L) ;
|
pL2->GetEndPoint( ptP4L) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// seleziono i punti necessari
|
// seleziono i punti necessari
|
||||||
// proietto pdDim su vtLine1 e su vtLine2
|
// proietto pdDim su vtLine1 e su vtLine2
|
||||||
Point3d ptDim1, ptDim2 ;
|
Point3d ptDim1, ptDim2 ;
|
||||||
DistPointCurve distPL1( ptDimL, *pL1, true) ;
|
DistPointCurve distPL1( ptDimL, *pL1, true) ;
|
||||||
DistPointCurve distPL2( ptDimL, *pL2, true) ;
|
DistPointCurve distPL2( ptDimL, *pL2, true) ;
|
||||||
int nFlag1, nFlag2 ;
|
int nFlag1, nFlag2 ;
|
||||||
if ( ! distPL1.GetMinDistPoint( 0, ptDim1, nFlag1) || ! distPL2.GetMinDistPoint( 0, ptDim2, nFlag2) )
|
if ( ! distPL1.GetMinDistPoint( 0, ptDim1, nFlag1) || ! distPL2.GetMinDistPoint( 0, ptDim2, nFlag2) )
|
||||||
return false ;
|
return false ;
|
||||||
if ( abs(( ptDim1 - ptP1L).Len() + ( ptCenL - ptDim1).Len() - ( ptCenL - ptP1L).Len()) < EPS_SMALL ||
|
if ( abs(( ptDim1 - ptP1L).Len() + ( ptP0L - ptDim1).Len() - ( ptP0L - ptP1L).Len()) < EPS_SMALL ||
|
||||||
abs(( ptDim1 - ptP1L).Len() + ( ptCenL - ptP1L ).Len() - ( ptDim1 - ptCenL).Len()) < EPS_SMALL)
|
abs(( ptDim1 - ptP1L).Len() + ( ptP0L - ptP1L ).Len() - ( ptDim1 - ptP0L).Len()) < EPS_SMALL)
|
||||||
// ptDim è dal lato di ptP1L, quindi tengo ptP1L
|
// ptDim è dal lato di ptP1L, quindi tengo ptP1L
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
// ptDim è dal lato di ptP2L
|
// ptDim è dal lato di ptP2L
|
||||||
ptP1L = ptP2L ;
|
ptP1L = ptP2L ;
|
||||||
if ( abs(( ptDim2 - ptP3L).Len() + ( ptCenL - ptDim2).Len() - ( ptCenL - ptP3L).Len()) < EPS_SMALL ||
|
if ( abs(( ptDim2 - ptP3L).Len() + ( ptP0L - ptDim2).Len() - ( ptP0L - ptP3L).Len()) < EPS_SMALL ||
|
||||||
abs(( ptDim2 - ptP3L).Len() + ( ptCenL - ptP3L).Len() - ( ptDim2 - ptCenL).Len()) < EPS_SMALL)
|
abs(( ptDim2 - ptP3L).Len() + ( ptP0L - ptP3L).Len() - ( ptDim2 - ptP0L).Len()) < EPS_SMALL)
|
||||||
// ptDim è dal lato di ptP1L
|
// ptDim è dal lato di ptP1L, quindi tengo ptP3L
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
// ptDim è dal lato di ptP2L
|
// ptDim è dal lato di ptP2L
|
||||||
ptP3L = ptP4L ;
|
ptP3L = ptP4L ;
|
||||||
}
|
}
|
||||||
// recupero la normale al piano dell'angolo da quotare
|
|
||||||
Frame3d frArc;
|
|
||||||
frArc.Set(ptCenL, ptP1L, ptP3L);
|
|
||||||
Vector3d vtNL = frArc.VersZ() ;
|
|
||||||
if ( vtNL * Z_AX < - EPS_SMALL) {
|
|
||||||
frArc.Set(ptCenL, ptP3L, ptP1L);
|
|
||||||
vtNL = frArc.VersZ() ;
|
|
||||||
}
|
|
||||||
// creo la quota
|
// creo la quota
|
||||||
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
|
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
|
||||||
if ( IsNull( pDim ) ||
|
if ( IsNull( pDim ) ||
|
||||||
! MySetDimensionStyle( pDim ) ||
|
! MySetDimensionStyle( pDim ) ||
|
||||||
! pDim->SetAngular( ptP1L, ptCenL, ptP3L, ptDimL, vtNL, sText))
|
! pDim->SetAngular( ptP1L, ptP0L, ptP3L, ptDimL, vtNL, sText))
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// inserisco la quota nel DB
|
// inserisco la quota nel DB
|
||||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
|
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
|
||||||
@@ -881,36 +825,50 @@ MyCreateAngularDimensionFromArc( int nParentId, int nCrvId, const Point3d& ptDim
|
|||||||
Frame3d frLoc ;
|
Frame3d frLoc ;
|
||||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
|
|
||||||
// recupero l'arco e il suo frame
|
// recupero l'arco e il suo frame
|
||||||
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
|
ICurveArc* pCurve = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
|
||||||
if ( pArc == nullptr)
|
if ( pCurve == nullptr)
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
Frame3d frArc ;
|
Frame3d frArc;
|
||||||
if ( ! pGeomDB->GetGlobFrame( nCrvId, frArc))
|
if ( ! pGeomDB->GetGlobFrame( nCrvId, frArc))
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// recupero i punti e la normale e li porto nel frame locale
|
|
||||||
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
|
PtrOwner<ICurveArc> pCrv( pCurve->Clone()) ;
|
||||||
Vector3d vtNL = pArc->GetNormVersor() ;
|
if ( IsNull( pCrv ) || ! pCrv->IsValid())
|
||||||
vtNL.LocToLoc( frArc, frLoc) ;
|
|
||||||
Point3d ptCenL, ptP1L, ptP2L ;
|
|
||||||
pArc->GetStartPoint( ptP1L) ;
|
|
||||||
ptP1L.LocToLoc( frArc, frLoc) ;
|
|
||||||
pArc->GetEndPoint( ptP2L) ;
|
|
||||||
ptP2L.LocToLoc( frArc, frLoc) ;
|
|
||||||
pArc->GetCenterPoint( ptCenL) ;
|
|
||||||
ptCenL.LocToLoc( frArc, frLoc) ;
|
|
||||||
// porto ptDimL nell'area di influenza dell'arco
|
|
||||||
Point3d ptMid ;
|
|
||||||
pArc->GetMidPoint( ptMid) ;
|
|
||||||
Vector3d vtDir = ( ptMid - ptCenL) ;
|
|
||||||
if ( ! vtDir.Normalize())
|
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
ptDimL = ptCenL + Dist( ptDimL, ptCenL) * vtDir ;
|
|
||||||
|
// porto tutto nel frLoc
|
||||||
|
pCrv->LocToLoc( frArc, frLoc ) ;
|
||||||
|
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
|
||||||
|
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
|
||||||
|
|
||||||
|
//recupero i punti e i versori
|
||||||
|
Point3d ptP0L, ptP1L, ptP2L ;
|
||||||
|
pCrv->GetStartPoint( ptP1L) ;
|
||||||
|
pCrv->GetEndPoint( ptP2L) ;
|
||||||
|
pCrv->GetCenterPoint( ptP0L) ;
|
||||||
|
|
||||||
|
// porto ptDimL nell'area di influenza dell'arco
|
||||||
|
Point3d ptDimNew ;
|
||||||
|
double dDist = ( ptDimL - ptP0L).Len() ;
|
||||||
|
Point3d ptMid ;
|
||||||
|
pCrv->GetMidPoint( ptMid) ;
|
||||||
|
Vector3d vtDir = ( ptMid - ptP0L) ;
|
||||||
|
vtDir.Normalize() ;
|
||||||
|
ptDimNew = ptP0L + dDist * vtDir ;
|
||||||
|
// proietto il punto sul piano XY della griglia
|
||||||
|
Frame3d frGrid = pGeomDB->GetGridFrame() ;
|
||||||
|
if ( ! frGrid.IsValid())
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
Point3d ptOrig = frGrid.Orig() ;
|
||||||
|
ptDimNew -= ( ptDimNew - ptOrig) * vtNL * vtNL;
|
||||||
|
|
||||||
// creo la quota
|
// creo la quota
|
||||||
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
|
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
|
||||||
if ( IsNull( pDim ) ||
|
if ( IsNull( pDim ) ||
|
||||||
! MySetDimensionStyle( pDim) ||
|
! MySetDimensionStyle( pDim) ||
|
||||||
! pDim->SetAngular( ptP1L, ptCenL, ptP2L, ptDimL, vtNL, sText))
|
! pDim->SetAngular( ptP1L, ptP0L, ptP2L, ptDimNew, vtNL, sText))
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// inserisco la quota nel DB
|
// inserisco la quota nel DB
|
||||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
|
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
|
||||||
@@ -936,4 +894,93 @@ ExeCreateAngularDimensionFromArc( int nParentId, int nCrvId, const Point3d& ptDi
|
|||||||
}
|
}
|
||||||
// restituisco l'identificativo del oggetto
|
// restituisco l'identificativo del oggetto
|
||||||
return nId ;
|
return nId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
MyCreateAngularDimensionFromCircle( int nParentId, int nCrvId, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptDim,
|
||||||
|
const string& sText, int nRefType)
|
||||||
|
{
|
||||||
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
|
nParentId = AdjustId( nParentId ) ;
|
||||||
|
// recupero il riferimento locale
|
||||||
|
Frame3d frLoc ;
|
||||||
|
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
|
||||||
|
// recupero il cerchio e il suo frame
|
||||||
|
ICurveArc* pCurve = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
|
||||||
|
if ( pCurve == nullptr)
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
Frame3d frCrv;
|
||||||
|
if ( ! pGeomDB->GetGlobFrame( nCrvId, frCrv))
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
|
||||||
|
PtrOwner<ICurveArc> pCrv( pCurve->Clone()) ;
|
||||||
|
if ( IsNull( pCrv ) || ! pCrv->IsValid())
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
|
||||||
|
// porto tutto nel frLoc
|
||||||
|
pCrv->LocToLoc( frCrv, frLoc ) ;
|
||||||
|
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
|
||||||
|
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
|
||||||
|
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
|
||||||
|
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
|
||||||
|
|
||||||
|
// recupero il centro
|
||||||
|
Point3d ptP0L ;
|
||||||
|
pCrv->GetCenterPoint( ptP0L) ;
|
||||||
|
|
||||||
|
// verifico che i punti P1 e P2 siano sul cerchio, sennò prendo i più vicini
|
||||||
|
if ( ! pCrv->IsPointOn(ptP1L)) {
|
||||||
|
DistPointCurve distPC( ptP1L, *pCrv) ;
|
||||||
|
int nFlag ;
|
||||||
|
distPC.GetMinDistPoint(0,ptP1L,nFlag);
|
||||||
|
}
|
||||||
|
if ( ! pCrv->IsPointOn(ptP2L)) {
|
||||||
|
DistPointCurve distPC(ptP2L, *pCrv) ;
|
||||||
|
int nFlag ;
|
||||||
|
distPC.GetMinDistPoint(0, ptP2L, nFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
// proietto il punto sul piano XY della griglia
|
||||||
|
Frame3d frGrid = pGeomDB->GetGridFrame() ;
|
||||||
|
if ( ! frGrid.IsValid())
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
Point3d ptOrig = frGrid.Orig() ;
|
||||||
|
ptDimL -= ( ptDimL - ptOrig) * vtNL * vtNL;
|
||||||
|
|
||||||
|
// creo la quota
|
||||||
|
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
|
||||||
|
if ( IsNull( pDim) ||
|
||||||
|
! MySetDimensionStyle( pDim) ||
|
||||||
|
! pDim->SetAngular( ptP1L, ptP0L, ptP2L, ptDimL, vtNL, sText))
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
// inserisco la quota nel DB
|
||||||
|
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
int
|
||||||
|
ExeCreateAngularDimensionFromCircle( int nParentId, int nCrvId, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptDim,
|
||||||
|
const string& sText, int nRefType)
|
||||||
|
{
|
||||||
|
// eseguo
|
||||||
|
int nId = MyCreateAngularDimensionFromCircle( nParentId, nCrvId, ptP1, ptP2, ptDim, sText, nRefType) ;
|
||||||
|
ExeSetModified() ;
|
||||||
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
|
if ( IsCmdLog()) {
|
||||||
|
string sLua = "EgtAngularDimensionFromCircle(" + IdToString( nParentId) + "," +
|
||||||
|
IdToString( nCrvId) + ",{" +
|
||||||
|
ToString( ptP1) + "},'" +
|
||||||
|
ToString( ptP2) + "},'" +
|
||||||
|
ToString( ptDim) + "},'" +
|
||||||
|
StringToLuaString( sText) + "'," +
|
||||||
|
RefTypeToString( nRefType) + ")" +
|
||||||
|
" -- Id=" + ToString( nId) ;
|
||||||
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
}
|
||||||
|
// restituisco l'identificativo del oggetto
|
||||||
|
return nId ;
|
||||||
|
}
|
||||||
|
|||||||
+6
-109
@@ -40,12 +40,11 @@
|
|||||||
#include "/EgtDev/Include/EGkChainCurves.h"
|
#include "/EgtDev/Include/EGkChainCurves.h"
|
||||||
#include "/EgtDev/Include/EGkCurveByInterp.h"
|
#include "/EgtDev/Include/EGkCurveByInterp.h"
|
||||||
#include "/EgtDev/Include/EGkCurveByApprox.h"
|
#include "/EgtDev/Include/EGkCurveByApprox.h"
|
||||||
#include "/EgtDev/Include/EGkCurveAux.h"
|
|
||||||
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
||||||
#include "/EgtDev/Include/EGkCurveLocal.h"
|
|
||||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
|
#include "/EgtDev/Include/EGkCurveLocal.h"
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
@@ -363,13 +362,16 @@ CreateLineTgTwoCurves( IGeomDB* pGeomDB, int nParentId,
|
|||||||
if ( pCrv2 == nullptr)
|
if ( pCrv2 == nullptr)
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
// porto la seconda curva nel riferimento della prima
|
// porto la seconda curva nel riferimento della prima
|
||||||
CurveLocal Crv2Loc( pGeomDB, nIdF, frCrv1) ;
|
PtrOwner<ICurve> pCrv2Loc( pCrv2->Clone()) ;
|
||||||
|
if ( IsNull( pCrv2Loc))
|
||||||
|
return nullptr ;
|
||||||
|
pCrv2Loc->LocToLoc( frCrv2, frCrv1) ;
|
||||||
// porto il punto vicino al finale nel riferimento della prima curva
|
// porto il punto vicino al finale nel riferimento della prima curva
|
||||||
Point3d ptN2loc( ptFin) ;
|
Point3d ptN2loc( ptFin) ;
|
||||||
ptN2loc.LocToLoc( frDest, frCrv1) ;
|
ptN2loc.LocToLoc( frDest, frCrv1) ;
|
||||||
// calcolo la retta tangente alle due curve
|
// calcolo la retta tangente alle due curve
|
||||||
PtrOwner<ICurveLine> pCrvLine ;
|
PtrOwner<ICurveLine> pCrvLine ;
|
||||||
pCrvLine.Set( GetLineTgTwoCurves( *pCrv1, ptN1loc, *Crv2Loc, ptN2loc)) ;
|
pCrvLine.Set( GetLineTgTwoCurves( *pCrv1, ptN1loc, *pCrv2Loc, ptN2loc)) ;
|
||||||
if ( IsNull( pCrvLine))
|
if ( IsNull( pCrvLine))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
// porto la linea nel riferimento del gruppo destinazione
|
// porto la linea nel riferimento del gruppo destinazione
|
||||||
@@ -1089,45 +1091,6 @@ ExeCreateArc3P( int nParentId, const Point3d& ptP1,
|
|||||||
return nId ;
|
return nId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeCreateArc2PR( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
|
|
||||||
double dRad, bool bCCW, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
||||||
nParentId = AdjustId( nParentId) ;
|
|
||||||
// recupero il riferimento locale
|
|
||||||
Frame3d frLoc ;
|
|
||||||
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
|
||||||
// porto in locale i punti, il versore normale e quelloe estrusione
|
|
||||||
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
|
|
||||||
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
|
|
||||||
Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
|
|
||||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
|
|
||||||
// creo l'arco
|
|
||||||
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
|
|
||||||
bOk = bOk && ( ! IsNull( pCrvArc) &&
|
|
||||||
pCrvArc->Set2PNRS( ptStartL, ptEndL, vtNormL, dRad, bCCW)) ;
|
|
||||||
// assegno il versore estrusione
|
|
||||||
bOk = bOk && pCrvArc->SetExtrusion( vtExtrL) ;
|
|
||||||
// inserisco l'arco nel DB
|
|
||||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) : GDB_ID_NULL) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtArc2PR(" + IdToString( nParentId) + ",{" +
|
|
||||||
ToString( ptStart) + "},{" +
|
|
||||||
ToString( ptEnd) + "}," +
|
|
||||||
ToString( dRad) + "," +
|
|
||||||
RefTypeToString( nRefType) + ")" +
|
|
||||||
" -- Id=" + ToString( nId) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco l'identificativo della nuova entità
|
|
||||||
return nId ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeCreateArc2PB( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
|
ExeCreateArc2PB( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
|
||||||
@@ -2585,69 +2548,3 @@ CalcExtrusion( IGeomDB* pGeomDB, int nParentId, int nRefType)
|
|||||||
vtExtr.LocToLoc( pGeomDB->GetGridFrame(), frEnt) ;
|
vtExtr.LocToLoc( pGeomDB->GetGridFrame(), frEnt) ;
|
||||||
return vtExtr ;
|
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 ;
|
|
||||||
}
|
|
||||||
|
|||||||
+81
-367
@@ -1,4 +1,4 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2014-2015
|
// EgalTech 2014-2015
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : EXE_GdbCreateSurf.cpp Data : 04.05.15 Versione : 1.6e1
|
// File : EXE_GdbCreateSurf.cpp Data : 04.05.15 Versione : 1.6e1
|
||||||
@@ -31,10 +31,7 @@
|
|||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||||
#include "/EgtDev/Include/EGkCurveLocal.h"
|
#include "/EgtDev/Include/EGkCurveLocal.h"
|
||||||
#include "/EgtDev/Include/EGkSurfLocal.h"
|
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||||
#include "/EgtDev/Include/EGkExtText.h"
|
|
||||||
#include "/EgtDev/Include/EGkSbzStandard.h"
|
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
@@ -59,7 +56,8 @@ ExeCreateSurfFrRectangle( int nParentId, const Point3d& ptIni, const Point3d& pt
|
|||||||
if ( ( frEnt.VersZ() * vtZL) < 0)
|
if ( ( frEnt.VersZ() * vtZL) < 0)
|
||||||
frEnt.PseudoMirror( frEnt.Orig(), frEnt.VersZ()) ;
|
frEnt.PseudoMirror( frEnt.Orig(), frEnt.VersZ()) ;
|
||||||
// ricavo le dimensioni della base
|
// ricavo le dimensioni della base
|
||||||
Point3d ptCrossI = GetToLoc( ptCrossL, frEnt) ;
|
Point3d ptCrossI = ptCrossL ;
|
||||||
|
ptCrossI.ToLoc( frEnt) ;
|
||||||
double dWidth = ptCrossI.x ;
|
double dWidth = ptCrossI.x ;
|
||||||
double dLen = ptCrossI.y ;
|
double dLen = ptCrossI.y ;
|
||||||
// creo il rettangolo nel suo riferimento intrinseco
|
// creo il rettangolo nel suo riferimento intrinseco
|
||||||
@@ -82,7 +80,7 @@ ExeCreateSurfFrRectangle( int nParentId, const Point3d& ptIni, const Point3d& pt
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +131,7 @@ ExeCreateSurfFrRectangle3P( int nParentId, const Point3d& ptIni,
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +180,7 @@ ExeCreateSurfFrStadium( int nParentId, const Point3d& ptIni, const Point3d& ptCr
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +197,7 @@ ExeCreateSurfFrDisk( int nParentId, const Point3d& ptOrig, double dRad, int nRef
|
|||||||
// porto in locale il punto e calcolo la normale in locale
|
// porto in locale il punto e calcolo la normale in locale
|
||||||
Point3d ptOrigL = GetPointLocal( pGeomDB, ptOrig, nRefType, frLoc) ;
|
Point3d ptOrigL = GetPointLocal( pGeomDB, ptOrig, nRefType, frLoc) ;
|
||||||
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
|
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
|
||||||
// calcolo riferimento per l'entità
|
// calcolo riferimento per l'entità
|
||||||
Frame3d frEnt ;
|
Frame3d frEnt ;
|
||||||
bOk = bOk && frEnt.Set( ptOrigL, vtNL) ;
|
bOk = bOk && frEnt.Set( ptOrigL, vtNL) ;
|
||||||
// creo il disco nel suo riferimento intrinseco
|
// creo il disco nel suo riferimento intrinseco
|
||||||
@@ -219,13 +217,13 @@ ExeCreateSurfFrDisk( int nParentId, const Point3d& ptOrig, double dRad, int nRef
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeCreateSurfFrFatCurve( int nParentId, int nCrvId, double dRad, bool bSquaredEnds, bool bSquaredMids, double dLinTol)
|
ExeCreateSurfFrFatCurve( int nParentId, int nCrvId, double dRad, bool bSquared)
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
@@ -248,7 +246,7 @@ ExeCreateSurfFrFatCurve( int nParentId, int nCrvId, double dRad, bool bSquaredEn
|
|||||||
// eseguo la trasformazione (viene eseguita solo se i riferimenti sono diversi
|
// eseguo la trasformazione (viene eseguita solo se i riferimenti sono diversi
|
||||||
pCopCrv->LocToLoc( frCrv, frLoc) ;
|
pCopCrv->LocToLoc( frCrv, frLoc) ;
|
||||||
// creo la regione
|
// creo la regione
|
||||||
PtrOwner<ISurfFlatRegion> pSfr( GetSurfFlatRegionFromFatCurve( Release( pCopCrv), dRad, bSquaredEnds, bSquaredMids, dLinTol)) ;
|
PtrOwner<ISurfFlatRegion> pSfr( GetSurfFlatRegionFromFatCurve( Release( pCopCrv), dRad, bSquared, bSquared)) ;
|
||||||
bOk = bOk && ! IsNull( pSfr) ;
|
bOk = bOk && ! IsNull( pSfr) ;
|
||||||
// inserisco la superficie nel DB
|
// inserisco la superficie nel DB
|
||||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSfr)) : GDB_ID_NULL) ;
|
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSfr)) : GDB_ID_NULL) ;
|
||||||
@@ -258,12 +256,11 @@ ExeCreateSurfFrFatCurve( int nParentId, int nCrvId, double dRad, bool bSquaredEn
|
|||||||
string sLua = "EgtSurfFrFatCurve(" + IdToString( nParentId) + "," +
|
string sLua = "EgtSurfFrFatCurve(" + IdToString( nParentId) + "," +
|
||||||
ToString( nCrvId) + "," +
|
ToString( nCrvId) + "," +
|
||||||
ToString( dRad) + "," +
|
ToString( dRad) + "," +
|
||||||
ToString( bSquaredEnds) + "," +
|
ToString( bSquared) + ")" +
|
||||||
ToString( bSquaredMids) + ")" +
|
|
||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +316,7 @@ MyCreateSurfFlatRegion( int nParentId, const INTVECTOR& vCrvIds, int* pnCount)
|
|||||||
// recupero la prossima superficie
|
// recupero la prossima superficie
|
||||||
pSfr = SfrCntr.GetSurf() ;
|
pSfr = SfrCntr.GetSurf() ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della prima nuova entità
|
// restituisco l'identificativo della prima nuova entità
|
||||||
if ( pnCount != nullptr)
|
if ( pnCount != nullptr)
|
||||||
*pnCount = nCount ;
|
*pnCount = nCount ;
|
||||||
return nFirstId ;
|
return nFirstId ;
|
||||||
@@ -342,7 +339,7 @@ ExeCreateSurfFlatRegion( int nParentId, const INTVECTOR& vCrvIds, int* pnCount)
|
|||||||
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nFirstId ;
|
return nFirstId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,7 +388,7 @@ ExeCreateSurfTmPlaneInBBox( int nParentId, const Point3d& ptP, const Vector3d& v
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,7 +449,7 @@ MyCreateSewPolygon( ISurfTriMesh* pStm, const Polygon3d& Polyg)
|
|||||||
// verifico esistenza superficie
|
// verifico esistenza superficie
|
||||||
if ( pStm == nullptr)
|
if ( pStm == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
// se poligono vuoto, non devo fare alcunché
|
// se poligono vuoto, non devo fare alcunché
|
||||||
if ( Polyg.GetSideCount() == 0)
|
if ( Polyg.GetSideCount() == 0)
|
||||||
return true ;
|
return true ;
|
||||||
// creo la superficie trimesh del poligono
|
// creo la superficie trimesh del poligono
|
||||||
@@ -582,7 +579,7 @@ ExeCreateSurfTmConvexHullInBBox( int nParentId, int nId, const BBox3d& b3Box, in
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -630,7 +627,7 @@ ExeCreateSurfTmBBox( int nParentId, const BBox3d& b3Box, bool bRegular, int nRef
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -685,7 +682,7 @@ ExeCreateSurfTmBox( int nParentId, const Point3d& ptIni, const Point3d& ptCross,
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -742,7 +739,7 @@ ExeCreateSurfTmPyramid( int nParentId, const Point3d& ptIni, const Point3d& ptCr
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -784,7 +781,7 @@ ExeCreateSurfTmCylinder( int nParentId, const Point3d& ptOrig, const Vector3d& v
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -826,7 +823,7 @@ ExeCreateSurfTmCone( int nParentId, const Point3d& ptOrig, const Vector3d& vtN,
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -862,98 +859,7 @@ ExeCreateSurfTmSphere( int nParentId, const Point3d& ptOrig,
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeCreateSurfTmTriangle( int nParentId, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
||||||
nParentId = AdjustId( nParentId) ;
|
|
||||||
// recupero il riferimento locale
|
|
||||||
Frame3d frLoc ;
|
|
||||||
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
|
||||||
// porto in locale i punti
|
|
||||||
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
|
|
||||||
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
|
|
||||||
Point3d ptP3L = GetPointLocal( pGeomDB, ptP3, nRefType, frLoc) ;
|
|
||||||
// creo la superficie trimesh
|
|
||||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
|
||||||
bOk = bOk && ! IsNull( pStm) ;
|
|
||||||
// assegno il triangolo
|
|
||||||
if ( bOk) {
|
|
||||||
pStm->Init( 3, 1, 1) ;
|
|
||||||
int vV[3]{ pStm->AddVertex( ptP1L),
|
|
||||||
pStm->AddVertex( ptP2L),
|
|
||||||
pStm->AddVertex( ptP3L)} ;
|
|
||||||
bOk = ( pStm->AddTriangle( vV) != SVT_NULL) && pStm->AdjustTopology() ;
|
|
||||||
}
|
|
||||||
// inserisco la superficie nel DB
|
|
||||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtSurfTmTriangle(" + IdToString( nParentId) + ",{" +
|
|
||||||
ToString( ptP1) + "},{" +
|
|
||||||
ToString( ptP2) + "},{" +
|
|
||||||
ToString( ptP3) + "}," +
|
|
||||||
RefTypeToString( nRefType) + ")" +
|
|
||||||
" -- Id=" + ToString( nNewId) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco l'identificativo della nuova entità
|
|
||||||
return nNewId ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeCreateSurfTmRectangle( int nParentId, const Point3d& ptO, const Point3d& ptL, const Point3d& ptT, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
||||||
nParentId = AdjustId( nParentId) ;
|
|
||||||
// recupero il riferimento locale
|
|
||||||
Frame3d frLoc ;
|
|
||||||
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
|
||||||
// porto in locale i punti
|
|
||||||
Point3d ptOL = GetPointLocal( pGeomDB, ptO, nRefType, frLoc) ;
|
|
||||||
Point3d ptLL = GetPointLocal( pGeomDB, ptL, nRefType, frLoc) ;
|
|
||||||
Point3d ptTL = GetPointLocal( pGeomDB, ptT, nRefType, frLoc) ;
|
|
||||||
// modifico il punto trasversale per metterlo perpendicolare al lato Lungo
|
|
||||||
ptTL -= ParallCompo( ptTL - ptOL, ptLL - ptOL) ;
|
|
||||||
// calcolo il quarto punto
|
|
||||||
Point3d ptVL = ptTL + ( ptLL - ptOL) ;
|
|
||||||
// creo la superficie trimesh
|
|
||||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
|
||||||
bOk = bOk && ! IsNull( pStm) ;
|
|
||||||
// assegno il triangolo
|
|
||||||
if ( bOk) {
|
|
||||||
pStm->Init( 4, 2, 1) ;
|
|
||||||
int vV[4]{ pStm->AddVertex( ptOL),
|
|
||||||
pStm->AddVertex( ptLL),
|
|
||||||
pStm->AddVertex( ptTL),
|
|
||||||
pStm->AddVertex( ptVL)} ;
|
|
||||||
int vV1[3]{ vV[0], vV[1], vV[2] } ;
|
|
||||||
int vV2[3]{ vV[2], vV[1], vV[3] } ;
|
|
||||||
bOk = ( pStm->AddTriangle( vV1) != SVT_NULL) && ( pStm->AddTriangle( vV2) != SVT_NULL) && pStm->AdjustTopology() ;
|
|
||||||
}
|
|
||||||
// inserisco la superficie nel DB
|
|
||||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtSurfTmRectangle(" + IdToString( nParentId) + ",{" +
|
|
||||||
ToString( ptO) + "},{" +
|
|
||||||
ToString( ptL) + "},{" +
|
|
||||||
ToString( ptT) + "}," +
|
|
||||||
RefTypeToString( nRefType) + ")" +
|
|
||||||
" -- Id=" + ToString( nNewId) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco l'identificativo della nuova entità
|
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -984,7 +890,7 @@ ExeCreateSurfTmByFlatContour( int nParentId, int nCrvId, double dLinTol)
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1030,7 +936,7 @@ ExeCreateSurfTmByRegion( int nParentId, const INTVECTOR& vCrvIds, double dLinTol
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1085,7 +991,7 @@ ExeCreateSurfTmByExtrusion( int nParentId, const INTVECTOR& vCrvIds, const Vecto
|
|||||||
" -- Id=" + ToString( nFirstId) ;
|
" -- Id=" + ToString( nFirstId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nFirstId ;
|
return nFirstId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1129,7 +1035,7 @@ ExeCreateSurfTmByRegionExtrusion( int nParentId, const INTVECTOR& vCrvIds, const
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1169,7 +1075,7 @@ ExeCreateSurfTmByRevolve( int nParentId, int nCrvId,
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1211,14 +1117,13 @@ ExeCreateSurfTmByScrewing( int nParentId, int nCrvId,
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeCreateSurfTmRectSwept( int nParentId, double dDimH, double dDimV, double dBevelH, double dBevelV,
|
ExeCreateSurfTmRectSwept( int nParentId, double dDimH, double dDimV, double dBevelH, double dBevelV, int nGuideId, int nCapType, double dLinTol)
|
||||||
int nGuideId, int nCapType, double dLinTol)
|
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
@@ -1249,75 +1154,13 @@ ExeCreateSurfTmRectSwept( int nParentId, double dDimH, double dDimV, double dBev
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, const Vector3d& vtAx,
|
ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, double dLinTol)
|
||||||
bool bCapEnds, double dLinTol, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
||||||
nParentId = AdjustId( nParentId) ;
|
|
||||||
bool bOk = true ;
|
|
||||||
// recupero il riferimento locale
|
|
||||||
Frame3d frLoc ;
|
|
||||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
|
||||||
// recupero la guida in locale
|
|
||||||
CurveLocal CrvGuide( pGeomDB, nGuideId, frLoc) ;
|
|
||||||
bOk = bOk && ( CrvGuide.Get() != nullptr) ;
|
|
||||||
// porto in locale vettore asse
|
|
||||||
Vector3d vtAxL = GetVectorLocal( pGeomDB, vtAx, nRefType, frLoc) ;
|
|
||||||
// inizializzazione superficie e suo Id
|
|
||||||
ISurfTriMesh* pSTM = nullptr ;
|
|
||||||
int nNewId = GDB_ID_NULL ;
|
|
||||||
// recupero il tipo di entità della sezione
|
|
||||||
int nSecType = pGeomDB->GetGeoType( nSectId) ;
|
|
||||||
|
|
||||||
// controllo se la sezione è definita da una curva
|
|
||||||
if ( ( nSecType & GEO_CURVE) != 0) {
|
|
||||||
// recupero la sezione in locale
|
|
||||||
CurveLocal CrvSect( pGeomDB, nSectId, frLoc) ;
|
|
||||||
bOk = bOk && ( CrvSect.Get() != nullptr) ;
|
|
||||||
// calcolo la Swept
|
|
||||||
pSTM = ( bOk ? GetSurfTriMeshSwept( CrvSect, CrvGuide, vtAxL, bCapEnds, dLinTol) : nullptr) ;
|
|
||||||
// inserisco la superficie trimesh nel DB
|
|
||||||
nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
|
||||||
}
|
|
||||||
// controllo se la sezione è definita da una regione piana
|
|
||||||
else if ( nSecType == SRF_FLATRGN) {
|
|
||||||
// recupero la regione sezion in locale
|
|
||||||
SurfLocal SrfSect( pGeomDB, nSectId, frLoc) ;
|
|
||||||
const ISurfFlatRegion* pSFrSect = GetSurfFlatRegion( SrfSect.Get()) ;
|
|
||||||
bOk = bOk && ( pSFrSect != nullptr) ;
|
|
||||||
// calcolo la Swept
|
|
||||||
pSTM = ( bOk ? GetSurfTriMeshSwept( pSFrSect, CrvGuide, vtAxL, bCapEnds, dLinTol) : nullptr) ;
|
|
||||||
// inserisco la superficie trimesh nel DB
|
|
||||||
nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
|
||||||
}
|
|
||||||
ExeSetModified() ;
|
|
||||||
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtSurfTmSwept(" + IdToString( nParentId) + "," +
|
|
||||||
ToString( nSectId) + "," +
|
|
||||||
ToString( nGuideId) + ",{" +
|
|
||||||
ToString( vtAx) + "}," +
|
|
||||||
( bCapEnds ? "true" : "false") + "," +
|
|
||||||
ToString( dLinTol) + "," +
|
|
||||||
RefTypeToString( nRefType) + ")" +
|
|
||||||
" -- Id=" + ToString( nNewId) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco l'identificativo della nuova entità
|
|
||||||
return nNewId ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeCreateSurfTmTransSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, double dLinTol)
|
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
@@ -1334,21 +1177,21 @@ ExeCreateSurfTmTransSwept( int nParentId, int nSectId, int nGuideId, bool bCapEn
|
|||||||
bOk = bOk && ( CrvGuide.Get() != nullptr) ;
|
bOk = bOk && ( CrvGuide.Get() != nullptr) ;
|
||||||
// creo la superficie trimesh
|
// creo la superficie trimesh
|
||||||
ISurfTriMesh* pSTM = nullptr ;
|
ISurfTriMesh* pSTM = nullptr ;
|
||||||
pSTM = ( bOk ? GetSurfTriMeshTransSwept( CrvSect, CrvGuide, bCapEnds, dLinTol) : nullptr) ;
|
pSTM = ( bOk ? GetSurfTriMeshSwept( CrvSect, CrvGuide, bCapEnds, dLinTol) : nullptr) ;
|
||||||
// inserisco la superficie trimesh nel DB
|
// inserisco la superficie trimesh nel DB
|
||||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
string sLua = "EgtSurfTmTransSwept(" + IdToString( nParentId) + "," +
|
string sLua = "EgtSurfTmSwept(" + IdToString( nParentId) + "," +
|
||||||
ToString( nSectId) + "," +
|
ToString( nSectId) + "," +
|
||||||
ToString( nGuideId) + "," +
|
ToString( nGuideId) + "," +
|
||||||
( bCapEnds ? "true" : "false") + "," +
|
( bCapEnds ? "true" : "false") + "," +
|
||||||
ToString( dLinTol) + ")" +
|
ToString( dLinTol) + ")" +
|
||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1365,7 +1208,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
|
|||||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||||
// creo la superficie trimesh
|
// creo la superficie trimesh
|
||||||
ISurfTriMesh* pSTM = nullptr ;
|
ISurfTriMesh* pSTM = nullptr ;
|
||||||
// se la prima entità è un punto e la seconda una curva
|
// se la prima entità è un punto e la seconda una curva
|
||||||
if ( pGeomDB->GetGeoType( nPtOrCrvId1) == GEO_PNT3D &&
|
if ( pGeomDB->GetGeoType( nPtOrCrvId1) == GEO_PNT3D &&
|
||||||
( pGeomDB->GetGeoType( nPtOrCrvId2) & GEO_CURVE) != 0) {
|
( pGeomDB->GetGeoType( nPtOrCrvId2) & GEO_CURVE) != 0) {
|
||||||
// recupero il punto in locale
|
// recupero il punto in locale
|
||||||
@@ -1381,7 +1224,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
|
|||||||
// calcolo la superficie
|
// calcolo la superficie
|
||||||
pSTM = ( bOk ? GetSurfTriMeshRuled( ptP, CrvLoc, dLinTol) : nullptr) ;
|
pSTM = ( bOk ? GetSurfTriMeshRuled( ptP, CrvLoc, dLinTol) : nullptr) ;
|
||||||
}
|
}
|
||||||
// se la prima entità è una curva e la seconda un punto
|
// se la prima entità è una curva e la seconda un punto
|
||||||
else if ( ( pGeomDB->GetGeoType( nPtOrCrvId1) & GEO_CURVE) != 0 &&
|
else if ( ( pGeomDB->GetGeoType( nPtOrCrvId1) & GEO_CURVE) != 0 &&
|
||||||
pGeomDB->GetGeoType( nPtOrCrvId2) == GEO_PNT3D) {
|
pGeomDB->GetGeoType( nPtOrCrvId2) == GEO_PNT3D) {
|
||||||
// recupero la curva in locale
|
// recupero la curva in locale
|
||||||
@@ -1425,7 +1268,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1536,7 +1379,7 @@ ExeCreateSurfTmBySewing( int nParentId, const INTVECTOR& vIds, bool bErase)
|
|||||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStmS) ;
|
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStmS) ;
|
||||||
// lo esprimo rispetto a quello della prima superficie
|
// lo esprimo rispetto a quello della prima superficie
|
||||||
frStmS.ToLoc( frLoc) ;
|
frStmS.ToLoc( frLoc) ;
|
||||||
// se è la prima, copio
|
// se è la prima, copio
|
||||||
if ( bFirst) {
|
if ( bFirst) {
|
||||||
bOk = bOk && pStm->CopyFrom( pStmS) ;
|
bOk = bOk && pStm->CopyFrom( pStmS) ;
|
||||||
bOk = bOk && pStm->ToGlob( frStmS) ;
|
bOk = bOk && pStm->ToGlob( frStmS) ;
|
||||||
@@ -1581,6 +1424,42 @@ ExeCreateSurfTmBySewing( int nParentId, const INTVECTOR& vIds, bool bErase)
|
|||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
int
|
||||||
|
ExeCreateSurfTmBySurfBezier( int nParentId, int nSbezId)
|
||||||
|
{
|
||||||
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
|
nParentId = AdjustId( nParentId) ;
|
||||||
|
// recupero la superficie di Bezier
|
||||||
|
const ISurfBezier* pSbez = GetSurfBezier( pGeomDB->GetGeoObj( nSbezId)) ;
|
||||||
|
bool bOk = ( pSbez != nullptr) ;
|
||||||
|
// recupero il riferimento della superficie sorgente
|
||||||
|
Frame3d frSou ;
|
||||||
|
bOk = bOk && pGeomDB->GetGlobFrame( nSbezId, frSou) ;
|
||||||
|
// recupero il riferimento locale
|
||||||
|
Frame3d frLoc ;
|
||||||
|
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||||
|
// copio la superficie ausiliaria della Bezier
|
||||||
|
const ISurfTriMesh* pAuxSurf = ( bOk ? pSbez->GetAuxSurf() : nullptr) ;
|
||||||
|
PtrOwner<ISurfTriMesh> pStm( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ;
|
||||||
|
bOk = bOk && ! IsNull( pStm) ;
|
||||||
|
// la porto nel riferimento destinazione
|
||||||
|
pStm->LocToLoc( frSou, frLoc) ;
|
||||||
|
// inserisco la superficie trimesh nel DB
|
||||||
|
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
|
||||||
|
ExeSetModified() ;
|
||||||
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
|
if ( IsCmdLog()) {
|
||||||
|
string sLua = "EgtSurfTmBySurfBezier(" + IdToString( nParentId) + "," +
|
||||||
|
IdToString( nSbezId) + ")" +
|
||||||
|
" -- Id=" + ToString( nNewId) ;
|
||||||
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
}
|
||||||
|
// restituisco il risultato
|
||||||
|
return nNewId ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeCreateSurfTmByVolZmap( int nParentId, int nZmapId, int nPart)
|
ExeCreateSurfTmByVolZmap( int nParentId, int nZmapId, int nPart)
|
||||||
@@ -1689,7 +1568,7 @@ ExeCreateSurfBezier( int nParentId, int nDegU, int nDegV, int nSpanU, int nSpanV
|
|||||||
" -- Id=" + ToString( nId) ;
|
" -- Id=" + ToString( nId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nId ;
|
return nId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1741,171 +1620,6 @@ ExeCreateSurfBezierRational( int nParentId, int nDegU, int nDegV, int nSpanU, in
|
|||||||
" -- Id=" + ToString( nId) ;
|
" -- Id=" + ToString( nId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nId ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeCreateSurfBezierLeaves( int nParentId, int nSurfBzId, int nTextHeight, bool bShowTrim, int* pnCount)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
||||||
nParentId = AdjustId( nParentId) ;
|
|
||||||
// recupero la superficie
|
|
||||||
const ISurfBezier* pSurfBez = GetSurfBezier( pGeomDB->GetGeoObj( nSurfBzId)) ;
|
|
||||||
if ( pSurfBez == nullptr)
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
// disegno le foglie
|
|
||||||
vector<tuple<int,Point3d,Point3d>> vLeaves ;
|
|
||||||
pSurfBez->GetLeaves( vLeaves) ;
|
|
||||||
double dFactor = 1 ;
|
|
||||||
int nFirstId = GDB_ID_NULL ;
|
|
||||||
int nCount = 0 ;
|
|
||||||
for ( int k = 0 ; k < (int)vLeaves.size() ; ++ k) {
|
|
||||||
Point3d ptBL = get<1>( vLeaves[k]) * dFactor ;
|
|
||||||
Point3d ptTR = get<2>( vLeaves[k]) * dFactor ;
|
|
||||||
Point3d ptBR( ptTR.x, ptBL.y) ;
|
|
||||||
Point3d ptTL( ptBL.x, ptTR.y) ;
|
|
||||||
PolyLine PL ;
|
|
||||||
PL.AddUPoint( 0, ptBL) ;
|
|
||||||
PL.AddUPoint( 1, ptBR) ;
|
|
||||||
PL.AddUPoint( 2, ptTR) ;
|
|
||||||
PL.AddUPoint( 3, ptTL) ;
|
|
||||||
PL.Close() ;
|
|
||||||
// creo la curva e la inserisco nel GDB
|
|
||||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
|
||||||
if ( IsNull( pCrvCompo) || ! pCrvCompo->FromPolyLine( PL) || ! pCrvCompo->SetExtrusion( Z_AX))
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
// inserisco la curva composita nel DB
|
|
||||||
int nCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvCompo)) ;
|
|
||||||
if ( nCrvId == GDB_ID_NULL)
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
++ nCount ;
|
|
||||||
if ( nFirstId == GDB_ID_NULL)
|
|
||||||
nFirstId = nCrvId ;
|
|
||||||
// creo il testo e lo riempio
|
|
||||||
string sText = ToString( get<0>( vLeaves[k])) ;
|
|
||||||
Point3d ptCenter( ( ptBL + ptTR) / 2) ;
|
|
||||||
PtrOwner<IExtText> pTXT( CreateExtText()) ;
|
|
||||||
if ( IsNull( pTXT) || ! pTXT->Set( ptCenter, Z_AX, X_AX, sText, "", false, nTextHeight))
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
// inserisco il testo nel DB
|
|
||||||
int nTxtId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) ;
|
|
||||||
if ( nTxtId == GDB_ID_NULL)
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
++ nCount ;
|
|
||||||
}
|
|
||||||
// se richiesto disegno la regione di trim
|
|
||||||
const ISurfFlatRegion* pSfr = pSurfBez->GetTrimRegion() ;
|
|
||||||
if ( bShowTrim && pSfr != nullptr) {
|
|
||||||
PtrOwner<ISurfFlatRegion> pTrimReg( pSfr->Clone()) ;
|
|
||||||
if ( ! IsNull( pTrimReg)) {
|
|
||||||
int nTrimId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTrimReg)) ;
|
|
||||||
if ( nTrimId == GDB_ID_NULL)
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
++ nCount ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// restituisco i risultati
|
|
||||||
if ( pnCount != nullptr)
|
|
||||||
*pnCount = nCount ;
|
|
||||||
return nFirstId ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeCreateSurfBezierTria2D( int nParentId, int nSurfBzId, int nTextHeight, bool bShowTrim, int* pnCount)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
||||||
nParentId = AdjustId( nParentId) ;
|
|
||||||
// recupero la superficie
|
|
||||||
const ISurfBezier* pSurfBez = GetSurfBezier( pGeomDB->GetGeoObj( nSurfBzId)) ;
|
|
||||||
if ( pSurfBez == nullptr)
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
// disegno i triangoli
|
|
||||||
vector<tuple<int,Point3d,Point3d,Point3d>> vTria2D ;
|
|
||||||
pSurfBez->GetTriangles2D( vTria2D) ;
|
|
||||||
int nFirstId = GDB_ID_NULL ;
|
|
||||||
int nCount = 0 ;
|
|
||||||
bool bOk = true ;
|
|
||||||
for ( int k = 0 ; k < (int)vTria2D.size() ; ++ k) {
|
|
||||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
|
||||||
bOk = bOk && ! IsNull( pStm) ;
|
|
||||||
Point3d ptP1L = get<1>(vTria2D[k]) ;
|
|
||||||
Point3d ptP2L = get<2>(vTria2D[k]) ;
|
|
||||||
Point3d ptP3L = get<3>(vTria2D[k]) ;
|
|
||||||
// assegno il triangolo
|
|
||||||
if ( bOk) {
|
|
||||||
pStm->Init( 3, 1, 1) ;
|
|
||||||
int vV[3]{ pStm->AddVertex( ptP1L),
|
|
||||||
pStm->AddVertex( ptP2L),
|
|
||||||
pStm->AddVertex( ptP3L)} ;
|
|
||||||
bOk = ( pStm->AddTriangle( vV) != SVT_NULL) && pStm->AdjustTopology() ;
|
|
||||||
}
|
|
||||||
// inserisco la superficie nel DB
|
|
||||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
|
|
||||||
if ( nNewId == GDB_ID_NULL)
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
if ( nFirstId == GDB_ID_NULL)
|
|
||||||
nFirstId = nNewId ;
|
|
||||||
++ nCount ;
|
|
||||||
|
|
||||||
// creo il testo e lo riempio
|
|
||||||
string sText = ToString( get<0>( vTria2D[k])) ;
|
|
||||||
Point3d ptCenter( ( ptP1L + ptP2L + ptP3L) / 3) ;
|
|
||||||
PtrOwner<IExtText> pTXT( CreateExtText()) ;
|
|
||||||
if ( IsNull( pTXT) || ! pTXT->Set( ptCenter, Z_AX, X_AX, sText, "", false, nTextHeight))
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
// inserisco il testo nel DB
|
|
||||||
int nTxtId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) ;
|
|
||||||
if ( nTxtId == GDB_ID_NULL)
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
++ nCount ;
|
|
||||||
}
|
|
||||||
// se richiesto disegno la regione di trim
|
|
||||||
const ISurfFlatRegion* pSfr = pSurfBez->GetTrimRegion() ;
|
|
||||||
if ( bShowTrim && pSfr != nullptr) {
|
|
||||||
PtrOwner<ISurfFlatRegion> pTrimReg( pSfr->Clone()) ;
|
|
||||||
if ( ! IsNull( pTrimReg)) {
|
|
||||||
int nTrimId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTrimReg)) ;
|
|
||||||
if ( nTrimId == GDB_ID_NULL)
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
++ nCount ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// restituisco i risultati
|
|
||||||
if ( pnCount != nullptr)
|
|
||||||
*pnCount = nCount ;
|
|
||||||
return nFirstId ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeCreateBezierSphere( int nParentId, const Point3d& ptCenter, double dR, int nRefType) {
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
||||||
nParentId = AdjustId( nParentId) ;
|
|
||||||
bool bOk = true ;
|
|
||||||
// recupero il riferimento di immersione della superficie
|
|
||||||
Frame3d frLoc ;
|
|
||||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
|
||||||
// reucpero il punto in locale
|
|
||||||
Point3d ptCenterLoc = GetPointLocal( pGeomDB, ptCenter, nRefType, frLoc) ;
|
|
||||||
// Creo la superficie
|
|
||||||
PtrOwner<ISurfBezier> pSurfBez( CreateBezierSphere( ptCenterLoc, dR)) ;
|
|
||||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSurfBez)) : GDB_ID_NULL) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtCreateBezierSphere(" + IdToString( nParentId) + "," +
|
|
||||||
ToString( ptCenter) + "," +
|
|
||||||
ToString( dR) + "," +
|
|
||||||
RefTypeToString( nRefType) + ")" +
|
|
||||||
" -- Id=" + ToString( nId) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// resituisco l'identificativo dell'entit� creata
|
|
||||||
return nId ;
|
return nId ;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-101
@@ -1,4 +1,4 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2016-2016
|
// EgalTech 2016-2016
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : EXE_GdbCreateVol.cpp Data : 27.10.16 Versione : 1.6v7
|
// File : EXE_GdbCreateVol.cpp Data : 27.10.16 Versione : 1.6v7
|
||||||
@@ -64,50 +64,7 @@ ExeCreateVolZmap( int nParentId, const Point3d& ptIni, double dDimX, double dDim
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
int ExeCreateVolZmapEmpty( int nParentId, const Point3d& ptIni, double dDimX, double dDimY, double dDimZ,
|
|
||||||
double dPrec, bool bTriDex, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
||||||
nParentId = AdjustId( nParentId) ;
|
|
||||||
// recupero il riferimento locale
|
|
||||||
Frame3d frLoc ;
|
|
||||||
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
|
||||||
// porto in locale i punti
|
|
||||||
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
|
|
||||||
Point3d ptOnXL = GetPointLocal( pGeomDB, ptIni + X_AX, nRefType, frLoc) ;
|
|
||||||
Point3d ptOnYL = GetPointLocal( pGeomDB, ptIni + Y_AX, nRefType, frLoc) ;
|
|
||||||
// ne ricavo un riferimento intrinseco
|
|
||||||
Frame3d frBox ;
|
|
||||||
bOk = bOk && frBox.Set( ptIniL, ptOnXL, ptOnYL) ;
|
|
||||||
// creo lo Zmap nel suo riferimento intrinseco
|
|
||||||
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
|
|
||||||
bOk = bOk && ! IsNull( pVZM) ;
|
|
||||||
bOk = bOk && pVZM->CreateEmpty( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex) ;
|
|
||||||
// lo porto nel riferimento locale
|
|
||||||
bOk = bOk && pVZM->ToGlob( frBox) ;
|
|
||||||
// inserisco lo Zmap nel DB
|
|
||||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pVZM)) : GDB_ID_NULL) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtVolZmapEmpty(" + IdToString( nParentId) + ",{" +
|
|
||||||
ToString( ptIni) + "}," +
|
|
||||||
ToString( dDimX) + "," +
|
|
||||||
ToString( dDimY) + "," +
|
|
||||||
ToString( dDimZ) + "," +
|
|
||||||
ToString( dPrec) + "," +
|
|
||||||
( bTriDex ? "true" : "false") + "," +
|
|
||||||
RefTypeToString( nRefType) + ")" +
|
|
||||||
" -- Id=" + ToString( nNewId) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco l'identificativo della nuova entità
|
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +103,7 @@ ExeCreateVolZmapByRegionExtrusion( int nParentId, int nSfrId, double dDimZ, doub
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,60 +141,6 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
|
|||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco l'identificativo della nuova entità
|
// restituisco l'identificativo della nuova entità
|
||||||
return nNewId ;
|
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 ;
|
|
||||||
}
|
|
||||||
|
|||||||
+1
-3
@@ -23,11 +23,9 @@
|
|||||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
#include "/EgtDev/Include/EGkCurveBezier.h"
|
||||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||||
#include "/EgtDev/Include/EGkCurveAux.h"
|
|
||||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||||
#include "/EgtDev/Include/EGkIntersCurves.h"
|
#include "/EgtDev/Include/EGkIntersCurves.h"
|
||||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
@@ -677,4 +675,4 @@ ExeCurveCompoNormVersor( int nId, int nSimpCrv, int nRefId, Vector3d& vtNorm)
|
|||||||
}
|
}
|
||||||
// gestione trasformazione ( eventuale)
|
// gestione trasformazione ( eventuale)
|
||||||
return TransformVector( pGeomDB, nId, nRefId, vtNorm) ;
|
return TransformVector( pGeomDB, nId, nRefId, vtNorm) ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,161 +0,0 @@
|
|||||||
//----------------------------------------------------------------------------
|
|
||||||
// EgalTech 2023-2024
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// File : Exe_GdbGetPocketing.cpp Data : 02.02.24 Versione : 2.6b1
|
|
||||||
// Contenuto : Funzioni di interrogazione di regioni piane del DBG per EXE.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Modifiche : 29.11.23 RE Creazione modulo.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//--------------------------- Include ----------------------------------------
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "EXE.h"
|
|
||||||
#include "EXE_Macro.h"
|
|
||||||
#include "/EgtDev/Include/EXeExecutor.h"
|
|
||||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
|
||||||
#include "/EgtDev/Include/EGkCalcPocketing.h"
|
|
||||||
|
|
||||||
using namespace std ;
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId,
|
|
||||||
int& nFirstId, int& nCrvCount)
|
|
||||||
{
|
|
||||||
// database geometrico
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false) ;
|
|
||||||
|
|
||||||
// recupero la FlatRegion da svuotare
|
|
||||||
PtrOwner<ISurfFlatRegion> pMySfr ;
|
|
||||||
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
if ( pSfr == nullptr) {
|
|
||||||
// verifico se è una curva chiusa e piana che permette di definire una regione
|
|
||||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
Plane3d plPlane ;
|
|
||||||
if ( pCrv == nullptr || ! pCrv->IsFlat( plPlane, true, 10 * EPS_SMALL))
|
|
||||||
return false ;
|
|
||||||
SurfFlatRegionByContours SfrCntr ;
|
|
||||||
SfrCntr.AddCurve( pCrv->Clone()) ;
|
|
||||||
pMySfr.Set( SfrCntr.GetSurf()) ;
|
|
||||||
if ( IsNull( pMySfr))
|
|
||||||
return false ;
|
|
||||||
pSfr = pMySfr ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// recupero il suo frame
|
|
||||||
Frame3d frSfr ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nId, frSfr))
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
// recupero il riferimento del gruppo di destinazione
|
|
||||||
Frame3d frDest ;
|
|
||||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
// eseguo Pocketing
|
|
||||||
ICRVCOMPOPOVECTOR vCrvCompoRes ;
|
|
||||||
bool bOk = CalcPocketing( pSfr, dRad, dStep, dAngle, nType, bSmooth, vCrvCompoRes) ;
|
|
||||||
nFirstId = GDB_ID_NULL ;
|
|
||||||
nCrvCount = int( vCrvCompoRes.size()) ;
|
|
||||||
if ( bOk && nCrvCount > 0) {
|
|
||||||
// scorro le curve di Pocketing ottenute
|
|
||||||
for ( int nI = 0 ; nI < nCrvCount ; ++ nI) {
|
|
||||||
vCrvCompoRes[nI]->LocToLoc( frSfr, frDest) ;
|
|
||||||
// inserisco la curva nel DB Geometrico
|
|
||||||
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrvCompoRes[nI])) ;
|
|
||||||
if ( nCurrId == GDB_ID_NULL)
|
|
||||||
return false ;
|
|
||||||
if ( nI == 0)
|
|
||||||
nFirstId = nCurrId ;
|
|
||||||
}
|
|
||||||
ExeSetModified() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtPocketing(" + ToString( nId) + "," +
|
|
||||||
ToString( dRad) + "," +
|
|
||||||
ToString( dStep) + "," +
|
|
||||||
ToString( dAngle) + "," +
|
|
||||||
ToString( nType) + "," +
|
|
||||||
ToString( bSmooth) + "," +
|
|
||||||
ToString( nDestGrpId) + ")" +
|
|
||||||
" FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCrvCount) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeSurfFrGetZigZagInfill( int nId, int nDestGrpId, double dStep, double dAng, bool bSmooth, bool bRemoveOverlapLink,
|
|
||||||
int* pnCount)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
||||||
|
|
||||||
// recupero la superficie FlatRegion
|
|
||||||
ISurfFlatRegion* pOrigSrf = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
if ( pOrigSrf == nullptr)
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
PtrOwner<ISurfFlatRegion> pSfr( pOrigSrf->Clone()) ;
|
|
||||||
bool bOk = ( ! IsNull( pSfr)) ;
|
|
||||||
|
|
||||||
// recupero il riferimento della superficie
|
|
||||||
Frame3d frSurf ;
|
|
||||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
|
|
||||||
// recupero il riferimento di destinazione
|
|
||||||
Frame3d frDest ;
|
|
||||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
|
|
||||||
|
|
||||||
// creo il riferimento per il calcolo del percorso a zigzag
|
|
||||||
Vector3d vtN ;
|
|
||||||
if ( bOk)
|
|
||||||
vtN = pSfr->GetNormVersor() ;
|
|
||||||
bOk = bOk && vtN.ToGlob( frSurf) ;
|
|
||||||
Frame3d frRef ;
|
|
||||||
bOk = bOk && frRef.Set( ORIG, vtN) ;
|
|
||||||
bOk = bOk && frRef.Rotate( ORIG, vtN, dAng) ;
|
|
||||||
|
|
||||||
// calcolo il percorso a zigzag
|
|
||||||
bOk = bOk && pSfr->LocToLoc( frSurf, frRef) ;
|
|
||||||
ICRVCOMPOPOVECTOR vpCrvs ;
|
|
||||||
bOk = bOk && CalcZigZagInfill( pSfr, dStep, bSmooth, bRemoveOverlapLink, vpCrvs) ;
|
|
||||||
|
|
||||||
// inserisco le curve risultanti nel DB
|
|
||||||
int nFirstId = GDB_ID_NULL ;
|
|
||||||
int nCount = 0 ;
|
|
||||||
for ( int i = 0 ; bOk && i < ( int) vpCrvs.size() ; i ++) {
|
|
||||||
// porto la curva nel riferimento di destinazione
|
|
||||||
bOk = bOk && vpCrvs[i]->LocToLoc( frRef, frDest) ;
|
|
||||||
// la inserisco nel DB geometrico
|
|
||||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vpCrvs[i])) : GDB_ID_NULL) ;
|
|
||||||
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
|
|
||||||
// aggiorno contatori
|
|
||||||
if ( bOk && nFirstId == GDB_ID_NULL)
|
|
||||||
nFirstId = nNewId ;
|
|
||||||
if ( bOk)
|
|
||||||
++ nCount ;
|
|
||||||
}
|
|
||||||
ExeSetModified() ;
|
|
||||||
|
|
||||||
// restituisco risultati
|
|
||||||
if ( pnCount != nullptr)
|
|
||||||
*pnCount = nCount ;
|
|
||||||
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtGetSurfFrZigZagInfill(" + ToString( nId) + "," +
|
|
||||||
ToString( dStep) + "," +
|
|
||||||
ToString( dAng) + "," +
|
|
||||||
ToString( bSmooth) + "," +
|
|
||||||
ToString( bRemoveOverlapLink) + "," +
|
|
||||||
" -- Ok=" + ToString( bOk) + " FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCount) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nFirstId ;
|
|
||||||
}
|
|
||||||
+79
-253
@@ -21,7 +21,6 @@
|
|||||||
#include "/EgtDev/Include/EXeExecutor.h"
|
#include "/EgtDev/Include/EXeExecutor.h"
|
||||||
#include "/EgtDev/Include/EXeConst.h"
|
#include "/EgtDev/Include/EXeConst.h"
|
||||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
#include "/EgtDev/Include/EGkCurveBezier.h"
|
||||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||||
#include "/EgtDev/Include/EGkCurveLocal.h"
|
#include "/EgtDev/Include/EGkCurveLocal.h"
|
||||||
@@ -30,11 +29,6 @@
|
|||||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||||
#include "/EgtDev/Include/EGkSurfBezier.h"
|
#include "/EgtDev/Include/EGkSurfBezier.h"
|
||||||
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
|
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
|
||||||
#include "/EgtDev/Include/EGkIntersCurves.h"
|
|
||||||
#include "/EgtDev/Include/EGkIntersLineBox.h"
|
|
||||||
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
|
|
||||||
#include "/EgtDev/Include/EGkCalcPocketing.h"
|
|
||||||
#include "/EgtDev/Include/EGkPolygonElevation.h"
|
|
||||||
#include "/EgtDev/Include/EGkSurfLocal.h"
|
#include "/EgtDev/Include/EGkSurfLocal.h"
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
|
|
||||||
@@ -311,6 +305,67 @@ ExeExtractSurfFrChunkLoops( int nId, int nChunk, int nDestGrpId, int* pnCount)
|
|||||||
return nFirstId ;
|
return nFirstId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
int
|
||||||
|
ExeSurfFrGetZigZagInfill( int nId, int nDestGrpId, double dStep, double dAng, bool bStepCorrection, bool bInvert, int* pnCount)
|
||||||
|
{
|
||||||
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
|
|
||||||
|
// recupero la superficie FlatRegion
|
||||||
|
ISurfFlatRegion * pOrigSrf = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
|
||||||
|
if ( pOrigSrf == nullptr)
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
PtrOwner<ISurfFlatRegion> pSfr( pOrigSrf->Clone()) ;
|
||||||
|
bool bOk = ( ! IsNull( pSfr)) ;
|
||||||
|
|
||||||
|
// recupero il riferimento della superficie
|
||||||
|
Frame3d frSurf ;
|
||||||
|
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
|
||||||
|
// recupero il riferimento di destinazione
|
||||||
|
Frame3d frDest ;
|
||||||
|
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
|
||||||
|
|
||||||
|
// creo il riferimento per il calcolo del percorso a zigzag
|
||||||
|
Vector3d vtN ;
|
||||||
|
if ( bOk)
|
||||||
|
vtN = pSfr->GetNormVersor() ;
|
||||||
|
bOk = bOk && vtN.ToGlob( frSurf) ;
|
||||||
|
Frame3d frRef ;
|
||||||
|
bOk = bOk && frRef.Set( ORIG, vtN) ;
|
||||||
|
bOk = bOk && frRef.Rotate( ORIG, vtN, dAng) ;
|
||||||
|
|
||||||
|
// calcolo il percorso a zigzag
|
||||||
|
bOk = bOk && pSfr->LocToLoc( frSurf, frRef) ;
|
||||||
|
ICRVCOMPOPOVECTOR vpCrvs ;
|
||||||
|
bOk = bOk && pSfr->GetZigZagInfill( dStep, bStepCorrection, bInvert, vpCrvs) ;
|
||||||
|
|
||||||
|
// inserisco le curve risultanti nel DB
|
||||||
|
int nFirstId = GDB_ID_NULL ;
|
||||||
|
int nCount = 0 ;
|
||||||
|
for ( int i = 0 ; bOk && i < ( int) vpCrvs.size() ; i ++) {
|
||||||
|
// porto la curva nel riferimento di destinazione
|
||||||
|
bOk = bOk && vpCrvs[i]->LocToLoc( frRef, frDest) ;
|
||||||
|
// la inserisco nel DB geometrico
|
||||||
|
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vpCrvs[i])) : GDB_ID_NULL) ;
|
||||||
|
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
|
||||||
|
// copio il materiale
|
||||||
|
if ( ! pGeomDB->CopyMaterial( nId, nNewId))
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
// aggiorno contatori
|
||||||
|
if ( bOk && nFirstId == GDB_ID_NULL)
|
||||||
|
nFirstId = nNewId ;
|
||||||
|
if ( bOk)
|
||||||
|
++ nCount ;
|
||||||
|
}
|
||||||
|
ExeSetModified() ;
|
||||||
|
|
||||||
|
// restituisco risultati
|
||||||
|
if ( pnCount != nullptr)
|
||||||
|
*pnCount = nCount ;
|
||||||
|
return nFirstId ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeSurfTmVertexCount( int nId)
|
ExeSurfTmVertexCount( int nId)
|
||||||
@@ -532,83 +587,6 @@ ExeSurfTmFacetMinAreaRectangle( int nId, int nFacet, int nRefId, Frame3d& frRect
|
|||||||
return TransformFrame( pGeomDB, nId, nRefId, frRect) ;
|
return TransformFrame( pGeomDB, nId, nRefId, frRect) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSurfTmFacetElevationInBBox( int nId, int nFacet, const BBox3d& b3Box, bool bAcceptOutFacet, int nRefId, double& dElev)
|
|
||||||
{
|
|
||||||
// La faccia deve essere tutta contenuta nel Box
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la superficie trimesh e il suo riferimento
|
|
||||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
if ( pStm == nullptr)
|
|
||||||
return false ;
|
|
||||||
Frame3d frStm ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nId, frStm))
|
|
||||||
return false ;
|
|
||||||
// verifico il box e ne recupero il riferimento
|
|
||||||
if ( b3Box.IsEmpty())
|
|
||||||
return false ;
|
|
||||||
Frame3d frBox ;
|
|
||||||
if ( nRefId == GDB_ID_ROOT)
|
|
||||||
frBox = GLOB_FRM ;
|
|
||||||
else if ( nRefId == GDB_ID_GRID)
|
|
||||||
frBox = pGeomDB->GetGridFrame() ;
|
|
||||||
else {
|
|
||||||
// nRefId può essere un gruppo o una entità
|
|
||||||
if ( ! pGeomDB->GetGroupGlobFrame( nRefId, frBox) &&
|
|
||||||
! pGeomDB->GetGlobFrame( nRefId, frBox))
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
// recupero il contorno esterno della faccia e lo porto nel riferimento del box
|
|
||||||
POLYLINEVECTOR vPL ;
|
|
||||||
pStm->GetFacetLoops( nFacet, vPL) ;
|
|
||||||
if ( vPL.empty())
|
|
||||||
return false ;
|
|
||||||
vPL[0].LocToLoc( frStm, frBox) ;
|
|
||||||
// ne derivo il poligono
|
|
||||||
Polygon3d pgFacet ;
|
|
||||||
if ( ! pgFacet.FromPolyLine( vPL[0]))
|
|
||||||
return false ;
|
|
||||||
// calcolo l'elevazione
|
|
||||||
return PolygonElevationInBBox( pgFacet, b3Box, bAcceptOutFacet, dElev) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSurfTmFacetElevationInClosedSurfTm( int nFacetStmId, int nFacet, int nClosedStmId, bool bAcceptOutFacet, double& dElev)
|
|
||||||
{
|
|
||||||
// La faccia deve essere tutta contenuta nel Box
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la superficie trimesh della faccia e il suo riferimento
|
|
||||||
const ISurfTriMesh* pFacStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nFacetStmId)) ;
|
|
||||||
if ( pFacStm == nullptr)
|
|
||||||
return false ;
|
|
||||||
Frame3d frFacStm ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nFacetStmId, frFacStm))
|
|
||||||
return false ;
|
|
||||||
// recupero la superficie trimesh chiusa (volume)
|
|
||||||
const ISurfTriMesh* pCldStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nClosedStmId)) ;
|
|
||||||
if ( pCldStm == nullptr)
|
|
||||||
return false ;
|
|
||||||
Frame3d frCldStm ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nClosedStmId, frCldStm))
|
|
||||||
return false ;
|
|
||||||
// recupero il contorno esterno della faccia e lo porto nel riferimento della superficie chiusa
|
|
||||||
POLYLINEVECTOR vPL ;
|
|
||||||
pFacStm->GetFacetLoops( nFacet, vPL) ;
|
|
||||||
if ( vPL.empty())
|
|
||||||
return false ;
|
|
||||||
vPL[0].LocToLoc( frFacStm, frCldStm) ;
|
|
||||||
// ne derivo il poligono
|
|
||||||
Polygon3d pgFacet ;
|
|
||||||
if ( ! pgFacet.FromPolyLine( vPL[0]))
|
|
||||||
return false ;
|
|
||||||
// calcolo l'elevazione
|
|
||||||
return PolygonElevationInClosedSurfTm( pgFacet, *pCldStm, bAcceptOutFacet, dElev) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeSurfTmFacetOppositeSide( int nId, int nFacet, const Vector3d& vtDir, int nRefId,
|
ExeSurfTmFacetOppositeSide( int nId, int nFacet, const Vector3d& vtDir, int nRefId,
|
||||||
@@ -856,8 +834,7 @@ ExeExtractSurfTmLoops( int nId, int nDestGrpId, int* pnCount)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeGetSurfTmSilhouette( int nId, const Vector3d& vtDir, double dToler, int nDestGrpId, int nRefType,
|
ExeGetSurfTmSilhouette( int nId, const Vector3d& vtDir, double dToler, int nDestGrpId, int nRefType, int* pnCount)
|
||||||
int* pnCount, bool bAllTria)
|
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
@@ -874,7 +851,7 @@ ExeGetSurfTmSilhouette( int nId, const Vector3d& vtDir, double dToler, int nDest
|
|||||||
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frSurf) ;
|
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frSurf) ;
|
||||||
// recupero i loop come polilinee
|
// recupero i loop come polilinee
|
||||||
POLYLINEVECTOR vPL ;
|
POLYLINEVECTOR vPL ;
|
||||||
bOk = bOk && pStm->GetSilhouette( vtDirL, dToler, vPL, bAllTria) ;
|
bOk = bOk && pStm->GetSilhouette( vtDirL, dToler, vPL) ;
|
||||||
// dalle polilinee creo le curve e le inserisco nel DB
|
// dalle polilinee creo le curve e le inserisco nel DB
|
||||||
int nFirstId = GDB_ID_NULL ;
|
int nFirstId = GDB_ID_NULL ;
|
||||||
int nCount = 0 ;
|
int nCount = 0 ;
|
||||||
@@ -902,8 +879,7 @@ ExeGetSurfTmSilhouette( int nId, const Vector3d& vtDir, double dToler, int nDest
|
|||||||
string sLua = "EgtGetSurfTmSilhouette(" + ToString( nId) + ",{" +
|
string sLua = "EgtGetSurfTmSilhouette(" + ToString( nId) + ",{" +
|
||||||
ToString( vtDir) + "}," +
|
ToString( vtDir) + "}," +
|
||||||
ToString( nDestGrpId) + "," +
|
ToString( nDestGrpId) + "," +
|
||||||
RefTypeToString( nRefType) + "," +
|
RefTypeToString( nRefType) + ")" +
|
||||||
ToString( bAllTria) + ")" +
|
|
||||||
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
@@ -1054,7 +1030,7 @@ ExeSurfTmGetFacetBBoxGlob( int nId, int nFacet, int nFlag, BBox3d& b3Box)
|
|||||||
return false ;
|
return false ;
|
||||||
// recupero il riferimento globale del gruppo cui appartiene
|
// recupero il riferimento globale del gruppo cui appartiene
|
||||||
Frame3d frGlob ;
|
Frame3d frGlob ;
|
||||||
if ( ! pGeomDB->GetGlobFrame( nId, frGlob))
|
if ( nId != GDB_ID_ROOT && ! pGeomDB->GetGroupGlobFrame( pGeomDB->GetParentId( nId), frGlob))
|
||||||
return false ;
|
return false ;
|
||||||
// recupero il bounding box della faccia dell'oggetto in globale
|
// recupero il bounding box della faccia dell'oggetto in globale
|
||||||
return pStm->GetFacetBBox( nFacet, frGlob, b3Box, nFlag) ;
|
return pStm->GetFacetBBox( nFacet, frGlob, b3Box, nFlag) ;
|
||||||
@@ -1072,7 +1048,7 @@ ExeSurfTmGetFacetBBoxRef( int nId, int nFacet, int nFlag, const Frame3d& frRef,
|
|||||||
return false ;
|
return false ;
|
||||||
// recupero il riferimento globale del gruppo cui appartiene
|
// recupero il riferimento globale del gruppo cui appartiene
|
||||||
Frame3d frGlob ;
|
Frame3d frGlob ;
|
||||||
if ( ! pGeomDB->GetGlobFrame( nId, frGlob))
|
if ( nId != GDB_ID_ROOT && ! pGeomDB->GetGroupGlobFrame( pGeomDB->GetParentId( nId), frGlob))
|
||||||
return false ;
|
return false ;
|
||||||
// porto il riferimento di espressione in quello della superficie
|
// porto il riferimento di espressione in quello della superficie
|
||||||
Frame3d frGlobL = frGlob ;
|
Frame3d frGlobL = frGlob ;
|
||||||
@@ -1081,155 +1057,6 @@ ExeSurfTmGetFacetBBoxRef( int nId, int nFacet, int nFlag, const Frame3d& frRef,
|
|||||||
return pStm->GetFacetBBox( nFacet, frGlobL, b3Box, nFlag) ;
|
return pStm->GetFacetBBox( nFacet, frGlobL, b3Box, nFlag) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSurfTmGetFacetOutlineInfo( int nId, int nFacet, int nRefId,
|
|
||||||
int& nStatus, BOOLVECTOR& vbOpen, INTVECTOR& vnAdj, DBLVECTOR& vdLen, VCT3DVECTOR& vvtNorm, DBLVECTOR& vdElev)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la superficie TriMesh
|
|
||||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
if ( pStm == nullptr)
|
|
||||||
return false ;
|
|
||||||
// recupero normale della faccia
|
|
||||||
Vector3d vtNorm ;
|
|
||||||
if ( ! pStm->GetFacetNormal( nFacet, vtNorm))
|
|
||||||
return false ;
|
|
||||||
// recupero i loop come polilinee
|
|
||||||
POLYLINEVECTOR vPL ;
|
|
||||||
if ( ! pStm->GetFacetLoops( nFacet, vPL) || vPL.empty())
|
|
||||||
return false ;
|
|
||||||
// calcolo lo stato
|
|
||||||
if ( vPL.size() == 1)
|
|
||||||
nStatus = 0 ;
|
|
||||||
else {
|
|
||||||
nStatus = -1 ;
|
|
||||||
for ( int i = 1 ; nStatus == -1 && i < int( vPL.size()) ; ++ i) {
|
|
||||||
double dIni, dFin ;
|
|
||||||
Point3d ptIni, ptFin ;
|
|
||||||
bool bFound = vPL[i].GetFirstULine( &dIni, &ptIni, &dFin, &ptFin) ;
|
|
||||||
while ( bFound) {
|
|
||||||
int nAdj = lround( dIni) ;
|
|
||||||
Vector3d vtNf ;
|
|
||||||
if ( nAdj >= 0 && pStm->GetFacetNormal( nAdj, vtNf)) {
|
|
||||||
Vector3d vtTg = ptFin - ptIni ;
|
|
||||||
vtTg.Normalize() ;
|
|
||||||
if ( ( vtTg ^ vtNf) * vtNorm > EPS_SMALL) {
|
|
||||||
nStatus = 1 ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bFound = vPL[i].GetNextULine( &dIni, &ptIni, &dFin, &ptFin) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// pulisco e prealloco i vettori del risultato
|
|
||||||
int nDim = vPL[0].GetLineNbr() ;
|
|
||||||
vbOpen.clear() ; vbOpen.reserve( nDim) ;
|
|
||||||
vnAdj.clear() ; vnAdj.reserve( nDim) ;
|
|
||||||
vdLen.clear() ; vdLen.reserve( nDim) ;
|
|
||||||
vvtNorm.clear() ; vvtNorm.reserve( nDim) ;
|
|
||||||
vdElev.clear() ; vdElev.reserve( nDim) ;
|
|
||||||
// recupero riferimento alla lista dei punti
|
|
||||||
PNTULIST& lstPU = vPL[0].GetUPointList() ;
|
|
||||||
// ciclo sui lati del loop esterno (il primo)
|
|
||||||
double dIni, dFin ;
|
|
||||||
Point3d ptIni, ptFin ;
|
|
||||||
bool bFound = vPL[0].GetFirstULine( &dIni, &ptIni, &dFin, &ptFin) ;
|
|
||||||
while ( bFound) {
|
|
||||||
// faccia adiacente
|
|
||||||
int nAdj = lround( dIni) ;
|
|
||||||
// lunghezza lato
|
|
||||||
double dLen = Dist( ptIni, ptFin) ;
|
|
||||||
// aperto se senza adiacenza o con faccia adiacente che va da parte negativa (tipo foro)
|
|
||||||
bool bOpen = true ;
|
|
||||||
Vector3d vtTg = ptFin - ptIni ;
|
|
||||||
vtTg.Normalize() ;
|
|
||||||
Vector3d vtNf ;
|
|
||||||
if ( nAdj >= 0 && pStm->GetFacetNormal( nAdj, vtNf))
|
|
||||||
bOpen = ((vtTg ^ vtNf) * vtNorm < EPS_SMALL) ;
|
|
||||||
// normale al lato (verso interno se chiuso, verso esterno se aperto)
|
|
||||||
Vector3d vtN = vtTg ;
|
|
||||||
vtN.Rotate( vtNorm, 0, ( bOpen ? -1 : 1)) ;
|
|
||||||
// elevazione secondo direzione della normale al lato
|
|
||||||
double dElev = 0 ;
|
|
||||||
for ( const auto& PU : lstPU) {
|
|
||||||
double dDist = ( PU.first - ptIni) * vtN ;
|
|
||||||
dElev = ( bOpen ? min( dElev, dDist) : max( dElev, dDist)) ;
|
|
||||||
}
|
|
||||||
// porto 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) ;
|
|
||||||
vvtNorm.emplace_back( vtN) ;
|
|
||||||
vdElev.emplace_back( dElev) ;
|
|
||||||
// passo al prossimo lato
|
|
||||||
bFound = vPL[0].GetNextULine( &dIni, &ptIni, &dFin, &ptFin) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeSurfTmGetEdges( int nId, int nDestGrpId, bool bSmoothAng, int* pnCount)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
||||||
// recupero la superficie TriMesh
|
|
||||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
bool bOk = ( pStm != nullptr) ;
|
|
||||||
// recupero il riferimento globale del gruppo cui appartiene
|
|
||||||
Frame3d frSurf ;
|
|
||||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
|
|
||||||
// recupero il riferimento di destinazione
|
|
||||||
Frame3d frDest ;
|
|
||||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
|
|
||||||
// ne determino gli spigoli
|
|
||||||
ICURVEPOVECTOR vpCurve ;
|
|
||||||
bOk = bOk && pStm->GetEdges( vpCurve) ;
|
|
||||||
// inserisco gli spigoli come curve nel DB
|
|
||||||
int nFirstId = GDB_ID_NULL ;
|
|
||||||
int nCount = 0 ;
|
|
||||||
for ( int i = 0 ; i < int( vpCurve.size()) ; ++ i) {
|
|
||||||
// se richiesto, verifico l'angolo tra le facce adiacenti (0=allineate)
|
|
||||||
if ( bSmoothAng) {
|
|
||||||
double dAngInt = vpCurve[i]->GetTempParam() ;
|
|
||||||
if ( abs( dAngInt) < pStm->GetSmoothAngle())
|
|
||||||
continue ;
|
|
||||||
}
|
|
||||||
// lo porto nel riferimento destinazione
|
|
||||||
bOk = bOk && vpCurve[i]->LocToLoc( frSurf, frDest) ;
|
|
||||||
// lo inserisco nel DB geometrico
|
|
||||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vpCurve[i])) : GDB_ID_NULL) ;
|
|
||||||
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
|
|
||||||
// copio il materiale
|
|
||||||
bOk = bOk && pGeomDB->CopyMaterial( nId, nNewId) ;
|
|
||||||
// aggiorno contatori
|
|
||||||
if ( bOk && nFirstId == GDB_ID_NULL)
|
|
||||||
nFirstId = nNewId ;
|
|
||||||
if ( bOk)
|
|
||||||
++ nCount ;
|
|
||||||
}
|
|
||||||
if ( ! bOk)
|
|
||||||
nCount = -1 ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtSurfTmGetEdges(" + ToString( nId) + ",{" +
|
|
||||||
ToString( nDestGrpId) + ")" +
|
|
||||||
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco risultati
|
|
||||||
if ( pnCount != nullptr)
|
|
||||||
*pnCount = nCount ;
|
|
||||||
return nFirstId ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeSurfBezierGetPoint( int nSurfId, double dU, double dV, int nRefId, Point3d& ptP)
|
ExeSurfBezierGetPoint( int nSurfId, double dU, double dV, int nRefId, Point3d& ptP)
|
||||||
@@ -1554,26 +1381,25 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
|
|||||||
// richiedo i contorni della superficie e li inserisco nel DB
|
// richiedo i contorni della superficie e li inserisco nel DB
|
||||||
int nFirstId = GDB_ID_NULL ;
|
int nFirstId = GDB_ID_NULL ;
|
||||||
int nCount = 0 ;
|
int nCount = 0 ;
|
||||||
ICRVCOMPOPOVECTOR vCC ;
|
int nL = 0 ;
|
||||||
pSbz->GetLoops( vCC , true) ;
|
PtrOwner<ICurve> pCrv( bOk ? pSbz->GetLoop( nL) : nullptr) ;
|
||||||
for ( int i = 0 ; i < int( vCC.size()) ; ++i) {
|
while ( ! IsNull( pCrv)) {
|
||||||
if ( IsNull( vCC[i]) || ! vCC[i]->IsValid())
|
// porto la curva nel riferimento destinazione
|
||||||
continue ;
|
bOk = bOk && pCrv->LocToLoc( frSurf, frDest) ;
|
||||||
// porto la curva nel riferimento destinazione
|
// la inserisco nel DB geometrico
|
||||||
bOk = bOk && vCC[i]->LocToLoc(frSurf, frDest) ;
|
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCrv)) : GDB_ID_NULL) ;
|
||||||
// la inserisco nel DB geometrico
|
|
||||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCC[i])) : GDB_ID_NULL) ;
|
|
||||||
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
|
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
|
||||||
// copio il materiale
|
// copio il materiale
|
||||||
if ( ! pGeomDB->CopyMaterial( nId, nNewId))
|
if ( ! pGeomDB->CopyMaterial( nId, nNewId))
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// aggiorno contatori
|
// aggiorno contatori
|
||||||
if ( bOk && nFirstId == GDB_ID_NULL)
|
if ( bOk && nFirstId == GDB_ID_NULL)
|
||||||
nFirstId = nNewId ;
|
nFirstId = nNewId ;
|
||||||
if ( bOk)
|
if ( bOk)
|
||||||
++ nCount ;
|
++ nCount ;
|
||||||
|
// passo alla prossima curva
|
||||||
|
pCrv.Set( bOk ? pSbz->GetLoop( ++nL) : nullptr) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
@@ -1586,4 +1412,4 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
|
|||||||
if ( pnCount != nullptr)
|
if ( pnCount != nullptr)
|
||||||
*pnCount = nCount ;
|
*pnCount = nCount ;
|
||||||
return nFirstId ;
|
return nFirstId ;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -250,8 +250,8 @@ ExeVolZmapGetEdges( int nId, int nDestGrpId, int* pnCount)
|
|||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
string sLua = "EgtVolZmapGetEdges(" + ToString( nId) + ",{" +
|
string sLua = "EgtGetSurfTmSilhouette(" + ToString( nId) + ",{" +
|
||||||
ToString( nDestGrpId) + ")" +
|
ToString( nDestGrpId) + ")" +
|
||||||
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-616
@@ -20,8 +20,6 @@
|
|||||||
#include "GeoTools.h"
|
#include "GeoTools.h"
|
||||||
#include "/EgtDev/Include/EXeExecutor.h"
|
#include "/EgtDev/Include/EXeExecutor.h"
|
||||||
#include "/EgtDev/Include/EXeConst.h"
|
#include "/EgtDev/Include/EXeConst.h"
|
||||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
|
||||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurve.h"
|
#include "/EgtDev/Include/EGkCurve.h"
|
||||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
#include "/EgtDev/Include/EGkCurveBezier.h"
|
||||||
@@ -29,25 +27,19 @@
|
|||||||
#include "/EgtDev/Include/EGkIntersCurves.h"
|
#include "/EgtDev/Include/EGkIntersCurves.h"
|
||||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||||
#include "/EgtDev/Include/EGkCurveLocal.h"
|
#include "/EgtDev/Include/EGkCurveLocal.h"
|
||||||
#include "/EgtDev/Include/EGkSurfLocal.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurveAux.h"
|
#include "/EgtDev/Include/EGkCurveAux.h"
|
||||||
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
||||||
#include "/EgtDev/Include/EGkMedialAxis.h"
|
#include "/EgtDev/Include/EGkMedialAxis.h"
|
||||||
#include "/EgtDev/Include/EGkChainCurves.h"
|
#include "/EgtDev/Include/EGkChainCurves.h"
|
||||||
#include "/EgtDev/Include/EGkProjectCurveSurfTm.h"
|
|
||||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
|
||||||
#include "/EgtDev/Include/EGkSurfBezier.h"
|
|
||||||
#include "/EgtDev/Include/EGkExtTExt.h"
|
#include "/EgtDev/Include/EGkExtTExt.h"
|
||||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
#include "/EgtDev/Include/EGkIntervals.h"
|
#include "/EgtDev/Include/EGkIntervals.h"
|
||||||
#include "/EgtDev/Include/EGkPolygon3d.h"
|
#include "/EgtDev/Include/EGkPolygon3d.h"
|
||||||
#include "/EgtDev/Include/EGkCalcPocketing.h"
|
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -105,14 +97,14 @@ ExeOffsetCurve( int nId, double dDist, int nType)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeOffsetCurveAdv( int nId, double dDist, int nType, int* pnCount, double dLinTol)
|
ExeOffsetCurveAdv( int nId, double dDist, int nType, int* pnCount)
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
// recupero la curva
|
// recupero la curva
|
||||||
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||||
// eseguo l'offset
|
// eseguo l'offset
|
||||||
OffsetCurve OffsCrv( dLinTol) ;
|
OffsetCurve OffsCrv ;
|
||||||
bool bOk = OffsCrv.Make( pCurve, dDist, nType) ;
|
bool bOk = OffsCrv.Make( pCurve, dDist, nType) ;
|
||||||
// salvo le curve di offset
|
// salvo le curve di offset
|
||||||
int nRefId = nId ;
|
int nRefId = nId ;
|
||||||
@@ -189,7 +181,7 @@ ExeCurveMedialAxis( int nId)
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeApproxCurve( int nId, int nApprType, double dLinTol, double dMaxSegmLen)
|
ExeApproxCurve( int nId, int nApprType, double dLinTol)
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
@@ -203,8 +195,7 @@ ExeApproxCurve( int nId, int nApprType, double dLinTol, double dMaxSegmLen)
|
|||||||
nApprType == APP_LEFT_LINES || nApprType == APP_LEFT_CONVEX_LINES ||
|
nApprType == APP_LEFT_LINES || nApprType == APP_LEFT_CONVEX_LINES ||
|
||||||
nApprType == APP_RIGHT_LINES || nApprType == APP_RIGHT_CONVEX_LINES) {
|
nApprType == APP_RIGHT_LINES || nApprType == APP_RIGHT_CONVEX_LINES) {
|
||||||
PolyLine PL ;
|
PolyLine PL ;
|
||||||
bOk = bOk && pCurve->ApproxWithLines( dLinTol, ANG_TOL_MAX_DEG, nApprType, PL) &&
|
bOk = bOk && pCurve->ApproxWithLines( dLinTol, ANG_TOL_MAX_DEG, nApprType, PL) && pCC->FromPolyLine( PL) ;
|
||||||
PL.AdjustForMaxSegmentLen( dMaxSegmLen) && pCC->FromPolyLine( PL) ;
|
|
||||||
// eliminazione di small Z
|
// eliminazione di small Z
|
||||||
bOk = bOk && pCC->RemoveSmallDefects( 0.5 * dLinTol, ANG_TOL_STD_DEG) ;
|
bOk = bOk && pCC->RemoveSmallDefects( 0.5 * dLinTol, ANG_TOL_STD_DEG) ;
|
||||||
}
|
}
|
||||||
@@ -334,9 +325,10 @@ ExeChangeClosedCurveStartPoint( int nId, const Point3d& ptP, int nRefType)
|
|||||||
// porto in locale il punto vicino ad iniziale
|
// porto in locale il punto vicino ad iniziale
|
||||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
|
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
|
||||||
// recupero la posizione parametrica della proiezione di questo punto sulla curva
|
// recupero la posizione parametrica della proiezione di questo punto sulla curva
|
||||||
|
DistPointCurve distPC( ptPL, *pCurve) ;
|
||||||
double dPar ;
|
double dPar ;
|
||||||
int nFlag ;
|
int nFlag ;
|
||||||
bOk = bOk && DistPointCurve( ptPL, *pCurve).GetParamAtMinDistPoint( 0, dPar, nFlag) ;
|
bOk = bOk && distPC.GetParamAtMinDistPoint( 0, dPar, nFlag) ;
|
||||||
// cambio il punto iniziale
|
// cambio il punto iniziale
|
||||||
if ( bOk && pCurve->GetType() == CRV_ARC)
|
if ( bOk && pCurve->GetType() == CRV_ARC)
|
||||||
bOk = bOk && GetCurveArc(pCurve)->ChangeStartPoint(dPar) ;
|
bOk = bOk && GetCurveArc(pCurve)->ChangeStartPoint(dPar) ;
|
||||||
@@ -2143,7 +2135,7 @@ bool
|
|||||||
ExeMergeCurvesInCurveCompo( int nId, double dLinTol, bool bStartEnd)
|
ExeMergeCurvesInCurveCompo( int nId, double dLinTol, bool bStartEnd)
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
// recupero la curva composita
|
// recupero la curva composita
|
||||||
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
|
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
|
||||||
bool bOk = ( pCompo != nullptr) ;
|
bool bOk = ( pCompo != nullptr) ;
|
||||||
@@ -2166,7 +2158,7 @@ bool
|
|||||||
ExeRemoveCurveCompoUndercutOnY( int nId, double dLinTol)
|
ExeRemoveCurveCompoUndercutOnY( int nId, double dLinTol)
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
// recupero la curva composita
|
// recupero la curva composita
|
||||||
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
|
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
|
||||||
bool bOk = ( pCompo != nullptr) ;
|
bool bOk = ( pCompo != nullptr) ;
|
||||||
@@ -2188,7 +2180,7 @@ static bool
|
|||||||
MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, int nRefType)
|
MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, int nRefType)
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
nGroupId = AdjustId( nGroupId) ;
|
nGroupId = AdjustId( nGroupId) ;
|
||||||
// recupero il riferimento del gruppo
|
// recupero il riferimento del gruppo
|
||||||
Frame3d frGrp ;
|
Frame3d frGrp ;
|
||||||
@@ -2241,11 +2233,11 @@ MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, in
|
|||||||
bool
|
bool
|
||||||
ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
||||||
{
|
{
|
||||||
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, true, nRefType) ;
|
bool bOk = MyChainCurvesInGroup(nGroupId, ptNear, true, nRefType) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
string sLua = "EgtChainCurvesInGroup(" + ToString( nGroupId) + ",{" +
|
string sLua = "EgtChainCurvesInGroup(" + ToString( nGroupId) + "," +
|
||||||
ToString( ptNear) + "}," +
|
ToString( ptNear) + "}," +
|
||||||
RefTypeToString( nRefType) + ")" +
|
RefTypeToString( nRefType) + ")" +
|
||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
@@ -2258,11 +2250,11 @@ ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
|||||||
bool
|
bool
|
||||||
ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
||||||
{
|
{
|
||||||
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, false, nRefType) ;
|
bool bOk = MyChainCurvesInGroup(nGroupId, ptNear, false, nRefType) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
string sLua = "EgtReorderCurvesInGroup(" + ToString( nGroupId) + ",{" +
|
string sLua = "EgtReorderCurvesInGroup(" + ToString( nGroupId) + "," +
|
||||||
ToString( ptNear) + "}," +
|
ToString( ptNear) + "}," +
|
||||||
RefTypeToString( nRefType) + ")" +
|
RefTypeToString( nRefType) + ")" +
|
||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
@@ -2270,598 +2262,3 @@ ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
|||||||
}
|
}
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static bool
|
|
||||||
MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId,
|
|
||||||
double dLinTol, double dMaxSegmLen, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la curva e il suo riferimento
|
|
||||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCurveId)) ;
|
|
||||||
if ( pCrv == nullptr)
|
|
||||||
return false ;
|
|
||||||
Frame3d frCrv ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv))
|
|
||||||
return false ;
|
|
||||||
// recupero la superficie trimesh e il suo riferimento
|
|
||||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
|
|
||||||
if ( pStm == nullptr)
|
|
||||||
return false ;
|
|
||||||
Frame3d frStm ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frStm))
|
|
||||||
return false ;
|
|
||||||
// recupero il riferimento del gruppo di destinazione
|
|
||||||
nDestGrpId = AdjustId( nDestGrpId) ;
|
|
||||||
Frame3d frDest ;
|
|
||||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
|
||||||
return false ;
|
|
||||||
// porto la curva e il vettore nel riferimento della superficie
|
|
||||||
CurveLocal CrvLoc( pCrv, frCrv, frStm) ;
|
|
||||||
if ( CrvLoc.Get() == nullptr)
|
|
||||||
return false ;
|
|
||||||
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frCrv) ;
|
|
||||||
vtDirL.LocToLoc( frCrv, frStm) ;
|
|
||||||
// eseguo la proiezione
|
|
||||||
PNT5AXVECTOR vPt5ax ;
|
|
||||||
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, vtDirL, dLinTol, dMaxSegmLen, vPt5ax))
|
|
||||||
return false ;
|
|
||||||
// inserisco la composita nel gruppo destinazione
|
|
||||||
PtrOwner<ICurveComposite> pCompo ;
|
|
||||||
for ( const auto& Pt5ax : vPt5ax) {
|
|
||||||
if ( IsNull( pCompo)) {
|
|
||||||
pCompo.Set( CreateCurveComposite()) ;
|
|
||||||
if ( IsNull( pCompo))
|
|
||||||
return false ;
|
|
||||||
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
|
|
||||||
}
|
|
||||||
int nCompoId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCompo)) ;
|
|
||||||
if ( nCompoId == GDB_ID_NULL)
|
|
||||||
return false ;
|
|
||||||
// aggiungo i versori nel gruppo destinazione
|
|
||||||
int nInd = 0 ;
|
|
||||||
for ( const auto& Pt5ax : vPt5ax) {
|
|
||||||
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
|
|
||||||
if ( IsNull( pGeoVct))
|
|
||||||
return false ;
|
|
||||||
pGeoVct->Set( 10 * GetLocToLoc( Pt5ax.vtDir, frStm, frDest), GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
|
|
||||||
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoVct)) ;
|
|
||||||
if ( nNewId == GDB_ID_NULL)
|
|
||||||
return false ;
|
|
||||||
pGeomDB->SetInfo( nNewId, "Ind", nInd ++) ;
|
|
||||||
pGeomDB->SetInfo( nNewId, "Par", Pt5ax.dPar) ;
|
|
||||||
pGeomDB->SetInfo( nNewId, "Flag", Pt5ax.nFlag) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId,
|
|
||||||
double dLinTol, double dMaxSegmLen, int nRefType)
|
|
||||||
{
|
|
||||||
bool bOk = MyProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, nRefType) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtProjectCurveOnSurfTm(" + ToString( nCurveId) + "," +
|
|
||||||
ToString( nSurfTmId) + ",{" +
|
|
||||||
ToString( vtDir) + "}," +
|
|
||||||
ToString( nDestGrpId) + "," +
|
|
||||||
ToString( dLinTol) + "," +
|
|
||||||
ToString( dMaxSegmLen) + "," +
|
|
||||||
RefTypeToString( nRefType) + ")" +
|
|
||||||
" -- Ok=" + ToString( bOk) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
return bOk ;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static bool
|
|
||||||
MyProjectCurveOnSurfTmExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrpId,
|
|
||||||
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la curva e il suo riferimento
|
|
||||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCurveId)) ;
|
|
||||||
if ( pCrv == nullptr)
|
|
||||||
return false ;
|
|
||||||
Frame3d frCrv ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv))
|
|
||||||
return false ;
|
|
||||||
// recupero la superficie trimesh e il suo riferimento
|
|
||||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
|
|
||||||
if ( pStm == nullptr)
|
|
||||||
return false ;
|
|
||||||
Frame3d frStm ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frStm))
|
|
||||||
return false ;
|
|
||||||
// recupero l'entità guida (punto, curva o superficie) e il suo riferimento
|
|
||||||
const IGeoPoint3d* pGdePnt = nullptr ;
|
|
||||||
const ICurve* pGdeCrv = nullptr ;
|
|
||||||
const ISurfTriMesh* pGdeStm = nullptr ;
|
|
||||||
pGdePnt = GetGeoPoint3d( pGeomDB->GetGeoObj( nGuideId)) ;
|
|
||||||
if ( pGdePnt == nullptr) {
|
|
||||||
pGdeCrv = GetCurve( pGeomDB->GetGeoObj( nGuideId)) ;
|
|
||||||
if ( pGdeCrv == nullptr) {
|
|
||||||
pGdeStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nGuideId)) ;
|
|
||||||
if ( pGdeStm == nullptr)
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Frame3d frGde ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nGuideId, frGde))
|
|
||||||
return false ;
|
|
||||||
// recupero il riferimento del gruppo di destinazione
|
|
||||||
nDestGrpId = AdjustId( nDestGrpId) ;
|
|
||||||
Frame3d frDest ;
|
|
||||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
|
||||||
return false ;
|
|
||||||
// porto la curva nel riferimento della superficie
|
|
||||||
CurveLocal CrvLoc( pCrv, frCrv, frStm) ;
|
|
||||||
if ( CrvLoc.Get() == nullptr)
|
|
||||||
return false ;
|
|
||||||
// eseguo l'opportuna proiezione dopo aver portato l'entità guida nel riferimento della superficie
|
|
||||||
PNT5AXVECTOR vPt5ax ;
|
|
||||||
if ( pGdePnt != nullptr) {
|
|
||||||
PtrOwner<IGeoPoint3d> pGdeLoc( pGdePnt->Clone()) ;
|
|
||||||
if ( pGdeLoc == nullptr)
|
|
||||||
return false ;
|
|
||||||
pGdeLoc->LocToLoc( frGde, frStm) ;
|
|
||||||
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, *pGdeLoc, dLinTol, dMaxSegmLen, vPt5ax))
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
else if ( pGdeCrv != nullptr) {
|
|
||||||
CurveLocal GdeLoc( pGdeCrv, frGde, frStm) ;
|
|
||||||
if ( GdeLoc.Get() == nullptr)
|
|
||||||
return false ;
|
|
||||||
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, *GdeLoc.Get(), dLinTol, dMaxSegmLen, vPt5ax))
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
else { // pGdeStm != nullptr
|
|
||||||
SurfLocal GdeLoc( pGdeStm, frGde, frStm) ;
|
|
||||||
const ISurfTriMesh* pGdeLoc = GetSurfTriMesh( GdeLoc.Get()) ;
|
|
||||||
if ( pGdeLoc == nullptr)
|
|
||||||
return false ;
|
|
||||||
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, *pGdeLoc, dLinTol, dMaxSegmLen, vPt5ax))
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
// inserisco la composita nel gruppo destinazione
|
|
||||||
PtrOwner<ICurveComposite> pCompo ;
|
|
||||||
for ( const auto& Pt5ax : vPt5ax) {
|
|
||||||
if ( IsNull( pCompo)) {
|
|
||||||
pCompo.Set( CreateCurveComposite()) ;
|
|
||||||
if ( IsNull( pCompo))
|
|
||||||
return false ;
|
|
||||||
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
|
|
||||||
}
|
|
||||||
int nCompoId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCompo)) ;
|
|
||||||
if ( nCompoId == GDB_ID_NULL)
|
|
||||||
return false ;
|
|
||||||
// aggiungo i versori nel gruppo destinazione
|
|
||||||
int nInd = 0 ;
|
|
||||||
for ( const auto& Pt5ax : vPt5ax) {
|
|
||||||
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
|
|
||||||
if ( IsNull( pGeoVct))
|
|
||||||
return false ;
|
|
||||||
Vector3d vtDir = ( bDirFromGuide ? Pt5ax.vtDir2 : Pt5ax.vtDir) ;
|
|
||||||
pGeoVct->Set( 10 * GetLocToLoc( vtDir, frStm, frDest), GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
|
|
||||||
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoVct)) ;
|
|
||||||
if ( nNewId == GDB_ID_NULL)
|
|
||||||
return false ;
|
|
||||||
pGeomDB->SetInfo( nNewId, "Ind", nInd ++) ;
|
|
||||||
pGeomDB->SetInfo( nNewId, "Par", Pt5ax.dPar) ;
|
|
||||||
pGeomDB->SetInfo( nNewId, "Flag", Pt5ax.nFlag) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeProjectCurveOnSurfTmExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrpId,
|
|
||||||
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
|
|
||||||
{
|
|
||||||
bool bOk = MyProjectCurveOnSurfTmExt( nCurveId, nSurfTmId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtProjectCurveOnSurfTmExt(" + ToString( nCurveId) + "," +
|
|
||||||
ToString( nSurfTmId) + ",{" +
|
|
||||||
ToString( nGuideId) + "}," +
|
|
||||||
ToString( nDestGrpId) + "," +
|
|
||||||
ToString( dLinTol) + "," +
|
|
||||||
ToString( dMaxSegmLen) + "," +
|
|
||||||
( bDirFromGuide ? "true" : "false") + ")" +
|
|
||||||
" -- Ok=" + ToString( bOk) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
return bOk ;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static bool
|
|
||||||
MyProjectCurveOnSurfBz( int nCurveId, int nSurfBzId, const Vector3d& vtDir, int nDestGrpId,
|
|
||||||
double dLinTol, double dMaxSegmLen, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la curva e il suo riferimento
|
|
||||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCurveId)) ;
|
|
||||||
if ( pCrv == nullptr)
|
|
||||||
return false ;
|
|
||||||
Frame3d frCrv ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv))
|
|
||||||
return false ;
|
|
||||||
// recupero la superficie bezier e il suo riferimento
|
|
||||||
const ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nSurfBzId)) ;
|
|
||||||
// recupero la superficie trimesh
|
|
||||||
const ISurfTriMesh* pStm = pSbz->GetAuxSurf() ;
|
|
||||||
if ( pStm == nullptr)
|
|
||||||
return false ;
|
|
||||||
Frame3d frSbz ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nSurfBzId, frSbz))
|
|
||||||
return false ;
|
|
||||||
// recupero il riferimento del gruppo di destinazione
|
|
||||||
nDestGrpId = AdjustId( nDestGrpId) ;
|
|
||||||
Frame3d frDest ;
|
|
||||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
|
||||||
return false ;
|
|
||||||
// porto la curva e il vettore nel riferimento della superficie
|
|
||||||
CurveLocal CrvLoc( pCrv, frCrv, frSbz) ;
|
|
||||||
if ( CrvLoc.Get() == nullptr)
|
|
||||||
return false ;
|
|
||||||
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frCrv) ;
|
|
||||||
vtDirL.LocToLoc( frCrv, frSbz) ;
|
|
||||||
// eseguo la proiezione
|
|
||||||
PNT5AXVECTOR vPt5ax ;
|
|
||||||
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, vtDirL, dLinTol, dMaxSegmLen, vPt5ax))
|
|
||||||
return false ;
|
|
||||||
// inserisco la composita nel gruppo destinazione
|
|
||||||
PtrOwner<ICurveComposite> pCompo ;
|
|
||||||
for ( const auto& Pt5ax : vPt5ax) {
|
|
||||||
if ( IsNull( pCompo)) {
|
|
||||||
pCompo.Set( CreateCurveComposite()) ;
|
|
||||||
if ( IsNull( pCompo))
|
|
||||||
return false ;
|
|
||||||
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frSbz, frDest)) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frSbz, frDest)) ;
|
|
||||||
}
|
|
||||||
int nCompoId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCompo)) ;
|
|
||||||
if ( nCompoId == GDB_ID_NULL)
|
|
||||||
return false ;
|
|
||||||
// aggiungo i versori nel gruppo destinazione
|
|
||||||
int nInd = 0 ;
|
|
||||||
for ( const auto& Pt5ax : vPt5ax) {
|
|
||||||
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
|
|
||||||
if ( IsNull( pGeoVct))
|
|
||||||
return false ;
|
|
||||||
pGeoVct->Set( 10 * GetLocToLoc( Pt5ax.vtDir, frSbz, frDest), GetLocToLoc( Pt5ax.ptP, frSbz, frDest)) ;
|
|
||||||
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoVct)) ;
|
|
||||||
if ( nNewId == GDB_ID_NULL)
|
|
||||||
return false ;
|
|
||||||
pGeomDB->SetInfo( nNewId, "Ind", nInd ++) ;
|
|
||||||
pGeomDB->SetInfo( nNewId, "Par", Pt5ax.dPar) ;
|
|
||||||
pGeomDB->SetInfo( nNewId, "Flag", Pt5ax.nFlag) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeProjectCurveOnSurfBz( int nCurveId, int nSurfBzId, const Vector3d& vtDir, int nDestGrpId,
|
|
||||||
double dLinTol, double dMaxSegmLen, int nRefType)
|
|
||||||
{
|
|
||||||
bool bOk = MyProjectCurveOnSurfBz( nCurveId, nSurfBzId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, nRefType) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtProjectCurveOnSurfBz(" + ToString( nCurveId) + "," +
|
|
||||||
ToString( nSurfBzId) + ",{" +
|
|
||||||
ToString( vtDir) + "}," +
|
|
||||||
ToString( nDestGrpId) + "," +
|
|
||||||
ToString( dLinTol) + "," +
|
|
||||||
ToString( dMaxSegmLen) + "," +
|
|
||||||
RefTypeToString( nRefType) + ")" +
|
|
||||||
" -- Ok=" + ToString( bOk) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
return bOk ;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static bool
|
|
||||||
MyProjectCurveOnSurfBzExt( int nCurveId, int nSurfBzId, int nGuideId, int nDestGrpId,
|
|
||||||
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la curva e il suo riferimento
|
|
||||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCurveId)) ;
|
|
||||||
if ( pCrv == nullptr)
|
|
||||||
return false ;
|
|
||||||
Frame3d frCrv ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv))
|
|
||||||
return false ;
|
|
||||||
// recupero la superficie Bezier e il suo riferimento
|
|
||||||
const ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nSurfBzId)) ;
|
|
||||||
// recupero la superficie trimesh
|
|
||||||
const ISurfTriMesh* pStm = pSbz->GetAuxSurf() ;
|
|
||||||
if ( pStm == nullptr)
|
|
||||||
return false ;
|
|
||||||
Frame3d frSbz ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nSurfBzId, frSbz))
|
|
||||||
return false ;
|
|
||||||
// recupero l'entità guida (punto, curva o superficie) e il suo riferimento
|
|
||||||
const IGeoPoint3d* pGdePnt = nullptr ;
|
|
||||||
const ICurve* pGdeCrv = nullptr ;
|
|
||||||
const ISurfTriMesh* pGdeStm = nullptr ;
|
|
||||||
pGdePnt = GetGeoPoint3d( pGeomDB->GetGeoObj( nGuideId)) ;
|
|
||||||
if ( pGdePnt == nullptr) {
|
|
||||||
pGdeCrv = GetCurve( pGeomDB->GetGeoObj( nGuideId)) ;
|
|
||||||
if ( pGdeCrv == nullptr) {
|
|
||||||
pGdeStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nGuideId)) ;
|
|
||||||
if ( pGdeStm == nullptr)
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Frame3d frGde ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nGuideId, frGde))
|
|
||||||
return false ;
|
|
||||||
// recupero il riferimento del gruppo di destinazione
|
|
||||||
nDestGrpId = AdjustId( nDestGrpId) ;
|
|
||||||
Frame3d frDest ;
|
|
||||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
|
||||||
return false ;
|
|
||||||
// porto la curva nel riferimento della superficie
|
|
||||||
CurveLocal CrvLoc( pCrv, frCrv, frSbz) ;
|
|
||||||
if ( CrvLoc.Get() == nullptr)
|
|
||||||
return false ;
|
|
||||||
// eseguo l'opportuna proiezione dopo aver portato l'entità guida nel riferimento della superficie
|
|
||||||
PNT5AXVECTOR vPt5ax ;
|
|
||||||
if ( pGdePnt != nullptr) {
|
|
||||||
PtrOwner<IGeoPoint3d> pGdeLoc( pGdePnt->Clone()) ;
|
|
||||||
if ( pGdeLoc == nullptr)
|
|
||||||
return false ;
|
|
||||||
pGdeLoc->LocToLoc( frGde, frSbz) ;
|
|
||||||
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, *pGdeLoc, dLinTol, dMaxSegmLen, vPt5ax))
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
else if ( pGdeCrv != nullptr) {
|
|
||||||
CurveLocal GdeLoc( pGdeCrv, frGde, frSbz) ;
|
|
||||||
if ( GdeLoc.Get() == nullptr)
|
|
||||||
return false ;
|
|
||||||
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, *GdeLoc.Get(), dLinTol, dMaxSegmLen, vPt5ax))
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
else { // pGdeStm != nullptr
|
|
||||||
SurfLocal GdeLoc( pGdeStm, frGde, frSbz) ;
|
|
||||||
const ISurfTriMesh* pGdeLoc = GetSurfTriMesh( GdeLoc.Get()) ;
|
|
||||||
if ( pGdeLoc == nullptr)
|
|
||||||
return false ;
|
|
||||||
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, *pGdeLoc, dLinTol, dMaxSegmLen, vPt5ax))
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
// inserisco la composita nel gruppo destinazione
|
|
||||||
PtrOwner<ICurveComposite> pCompo ;
|
|
||||||
for ( const auto& Pt5ax : vPt5ax) {
|
|
||||||
if ( IsNull( pCompo)) {
|
|
||||||
pCompo.Set( CreateCurveComposite()) ;
|
|
||||||
if ( IsNull( pCompo))
|
|
||||||
return false ;
|
|
||||||
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frSbz, frDest)) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frSbz, frDest)) ;
|
|
||||||
}
|
|
||||||
int nCompoId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCompo)) ;
|
|
||||||
if ( nCompoId == GDB_ID_NULL)
|
|
||||||
return false ;
|
|
||||||
// aggiungo i versori nel gruppo destinazione
|
|
||||||
int nInd = 0 ;
|
|
||||||
for ( const auto& Pt5ax : vPt5ax) {
|
|
||||||
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
|
|
||||||
if ( IsNull( pGeoVct))
|
|
||||||
return false ;
|
|
||||||
Vector3d vtDir = ( bDirFromGuide ? Pt5ax.vtDir2 : Pt5ax.vtDir) ;
|
|
||||||
pGeoVct->Set( 10 * GetLocToLoc( vtDir, frSbz, frDest), GetLocToLoc( Pt5ax.ptP, frSbz, frDest)) ;
|
|
||||||
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoVct)) ;
|
|
||||||
if ( nNewId == GDB_ID_NULL)
|
|
||||||
return false ;
|
|
||||||
pGeomDB->SetInfo( nNewId, "Ind", nInd ++) ;
|
|
||||||
pGeomDB->SetInfo( nNewId, "Par", Pt5ax.dPar) ;
|
|
||||||
pGeomDB->SetInfo( nNewId, "Flag", Pt5ax.nFlag) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeProjectCurveOnSurfBzExt( int nCurveId, int nSurfBzId, int nGuideId, int nDestGrpId,
|
|
||||||
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
|
|
||||||
{
|
|
||||||
bool bOk = MyProjectCurveOnSurfBzExt( nCurveId, nSurfBzId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtProjectCurveOnSurfBzExt(" + ToString( nCurveId) + "," +
|
|
||||||
ToString( nSurfBzId) + ",{" +
|
|
||||||
ToString( nGuideId) + "}," +
|
|
||||||
ToString( nDestGrpId) + "," +
|
|
||||||
ToString( dLinTol) + "," +
|
|
||||||
ToString( dMaxSegmLen) + "," +
|
|
||||||
( bDirFromGuide ? "true" : "false") + ")" +
|
|
||||||
" -- Ok=" + ToString( bOk) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
return bOk ;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeCurveGetVoronoi( int nId, int nDestGrpId, int nBound, int* pnCount)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
||||||
// recupero la curva
|
|
||||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
if ( pCrv == nullptr)
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
// recupero il riferimento della curva
|
|
||||||
Frame3d frCrv ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nId, frCrv))
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
// recupero il riferimento di destinazione
|
|
||||||
Frame3d frDest ;
|
|
||||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
|
|
||||||
// Calcolo diagramma di Voronoi
|
|
||||||
ICURVEPOVECTOR vCrv ;
|
|
||||||
CalcCurveVoronoiDiagram( *pCrv, vCrv, nBound) ;
|
|
||||||
|
|
||||||
// inserisco i risultati nel DB geometrico
|
|
||||||
int nFirstId = GDB_ID_NULL ;
|
|
||||||
int nCount = 0 ;
|
|
||||||
for ( int i = 0 ; i < int( vCrv.size()) ; i++) {
|
|
||||||
vCrv[i]->LocToLoc( frCrv, frDest) ;
|
|
||||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrv[i])) ;
|
|
||||||
if ( nId != GDB_ID_NULL) {
|
|
||||||
nCount ++ ;
|
|
||||||
if ( nFirstId == GDB_ID_NULL)
|
|
||||||
nFirstId = nId ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ExeSetModified() ;
|
|
||||||
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtCurveGetVoronoi(" + ToString( nId) + "," +
|
|
||||||
ToString( nDestGrpId) + ")" +
|
|
||||||
" FirstId=" + ToString( nFirstId) + " nCurveCount=" + ToString( nCount) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// restituisco risultati
|
|
||||||
if ( pnCount != nullptr)
|
|
||||||
*pnCount = nCount ;
|
|
||||||
return nFirstId ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeCurveGetMedialAxis( int nId, int nDestGrpId, int nSide, int* pnCount)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
||||||
// recupero la curva
|
|
||||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
if ( pCrv == nullptr)
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
// recupero il riferimento della curva
|
|
||||||
Frame3d frCrv ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nId, frCrv))
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
// recupero il riferimento di destinazione
|
|
||||||
Frame3d frDest ;
|
|
||||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
|
|
||||||
// Calcolo il Medial Axis
|
|
||||||
ICURVEPOVECTOR vCrv ;
|
|
||||||
CalcCurveMedialAxis( *pCrv, vCrv, nSide) ;
|
|
||||||
|
|
||||||
// inserisco i risultati nel DB geometrico
|
|
||||||
int nFirstId = GDB_ID_NULL ;
|
|
||||||
int nCount = 0 ;
|
|
||||||
for ( int i = 0 ; i < int( vCrv.size()) ; i++) {
|
|
||||||
vCrv[i]->LocToLoc( frCrv, frDest) ;
|
|
||||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrv[i])) ;
|
|
||||||
if ( nId != GDB_ID_NULL) {
|
|
||||||
nCount ++ ;
|
|
||||||
if ( nFirstId == GDB_ID_NULL)
|
|
||||||
nFirstId = nId ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ExeSetModified() ;
|
|
||||||
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtCurveMedialAxisAdv(" + ToString( nId) + "," +
|
|
||||||
ToString( nSide) + "," +
|
|
||||||
ToString( nDestGrpId) + ")" +
|
|
||||||
" FirstId=" + ToString( nFirstId) + " nCurveCount=" + ToString( nCount) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// restituisco risultati
|
|
||||||
if ( pnCount != nullptr)
|
|
||||||
*pnCount = nCount ;
|
|
||||||
return nFirstId ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeCurveGetFatCurve( int nId, int nDestGrpId, double dRad, bool bSquareEnds, bool bSquareMids, int* pnCount)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
||||||
// recupero la curva
|
|
||||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
if ( pCrv == nullptr)
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
// recupero il riferimento della curva
|
|
||||||
Frame3d frCrv ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nId, frCrv))
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
// recupero il riferimento di destinazione
|
|
||||||
Frame3d frDest ;
|
|
||||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
|
||||||
return GDB_ID_NULL ;
|
|
||||||
|
|
||||||
// Calcolo la curva ingrossata
|
|
||||||
ICURVEPOVECTOR vCrv ;
|
|
||||||
CalcCurveFatCurve( *pCrv, vCrv, dRad, bSquareEnds, bSquareMids) ;
|
|
||||||
|
|
||||||
// inserisco i risultati nel DB geometrico
|
|
||||||
int nFirstId = GDB_ID_NULL ;
|
|
||||||
int nCount = 0 ;
|
|
||||||
for ( int i = 0 ; i < int( vCrv.size()) ; i++) {
|
|
||||||
vCrv[i]->LocToLoc( frCrv, frDest) ;
|
|
||||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrv[i])) ;
|
|
||||||
if ( nId != GDB_ID_NULL) {
|
|
||||||
nCount ++ ;
|
|
||||||
if ( nFirstId == GDB_ID_NULL)
|
|
||||||
nFirstId = nId ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ExeSetModified() ;
|
|
||||||
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtCurveGetFatCurve(" + ToString( nId) + "," +
|
|
||||||
ToString( nDestGrpId) + ")" +
|
|
||||||
" FirstId=" + ToString( nFirstId) + " nCurveCount=" + ToString( nCount) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// restituisco risultati
|
|
||||||
if ( pnCount != nullptr)
|
|
||||||
*pnCount = nCount ;
|
|
||||||
return nFirstId ;
|
|
||||||
}
|
|
||||||
|
|||||||
+38
-349
@@ -29,10 +29,8 @@
|
|||||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||||
#include "/EgtDev/Include/EGkCAvSimpleSurfFrMove.h"
|
#include "/EgtDev/Include/EGkCAvSimpleSurfFrMove.h"
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
#include "/EgtDev/Include/EGkSubtractProjectedFacesOnStmFace.h"
|
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -77,7 +75,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
|
|||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// recupero il numero di componenti connesse
|
// recupero il numero di componenti connesse
|
||||||
int nParts = pStm->GetPartCount() ;
|
int nParts = pStm->GetPartCount() ;
|
||||||
// se ci sono più parti, separo queste
|
// se ci sono più parti, separo queste
|
||||||
if ( nParts > 1) {
|
if ( nParts > 1) {
|
||||||
int nFirstId = GDB_ID_NULL ;
|
int nFirstId = GDB_ID_NULL ;
|
||||||
nCount = 0 ;
|
nCount = 0 ;
|
||||||
@@ -104,7 +102,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
|
|||||||
}
|
}
|
||||||
// recupero il numero di facce
|
// recupero il numero di facce
|
||||||
int nFacets = pStm->GetFacetCount() ;
|
int nFacets = pStm->GetFacetCount() ;
|
||||||
// se ci sono più facce, separo queste
|
// se ci sono più facce, separo queste
|
||||||
if ( nFacets > 1) {
|
if ( nFacets > 1) {
|
||||||
// copio tutte le facce
|
// copio tutte le facce
|
||||||
int nFirstId = GDB_ID_NULL ;
|
int nFirstId = GDB_ID_NULL ;
|
||||||
@@ -130,7 +128,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
|
|||||||
// restituisco risultati
|
// restituisco risultati
|
||||||
return nFirstId ;
|
return nFirstId ;
|
||||||
}
|
}
|
||||||
// non devo fare alcunché
|
// non devo fare alcunché
|
||||||
nCount = 1 ;
|
nCount = 1 ;
|
||||||
return nId ;
|
return nId ;
|
||||||
}
|
}
|
||||||
@@ -147,7 +145,7 @@ MyExplodeSurfFlatRegion( int nId, int& nCount)
|
|||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// recupero il numero di componenti connessi (chunk)
|
// recupero il numero di componenti connessi (chunk)
|
||||||
int nChunk = pSfr->GetChunkCount() ;
|
int nChunk = pSfr->GetChunkCount() ;
|
||||||
// se c'è un solo componente, non devo fare alcunché
|
// se c'è un solo componente, non devo fare alcunché
|
||||||
if ( nChunk == 1) {
|
if ( nChunk == 1) {
|
||||||
nCount = 1 ;
|
nCount = 1 ;
|
||||||
return nId ;
|
return nId ;
|
||||||
@@ -209,7 +207,7 @@ ExeExplodeSurface( int nId, int* pnCount)
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeApproxSurface( int nId, double dLinTol, double dTriaMinSide)
|
ExeApproxSurface( int nId, double dLinTol)
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
@@ -230,7 +228,8 @@ ExeApproxSurface( int nId, double dLinTol, double dTriaMinSide)
|
|||||||
else if ( nType == SRF_BEZIER) {
|
else if ( nType == SRF_BEZIER) {
|
||||||
// recupero la superficie ausiliaria della Bezier
|
// recupero la superficie ausiliaria della Bezier
|
||||||
const ISurfBezier* pSbez = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
|
const ISurfBezier* pSbez = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
|
||||||
pStm.Set( ( pSbez != nullptr ? pSbez->GetApproxSurf( dLinTol, dTriaMinSide) : nullptr)) ;
|
const ISurfTriMesh* pAuxSurf = ( pSbez != nullptr ? pSbez->GetAuxSurf() : nullptr) ;
|
||||||
|
pStm.Set( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ;
|
||||||
}
|
}
|
||||||
bool bOk = ( ! IsNull( pStm)) ;
|
bool bOk = ( ! IsNull( pStm)) ;
|
||||||
// semplificazione della trimesh
|
// semplificazione della trimesh
|
||||||
@@ -241,8 +240,7 @@ ExeApproxSurface( int nId, double dLinTol, double dTriaMinSide)
|
|||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
string sLua = "EgtApproxSurf(" + ToString( nId) + "," +
|
string sLua = "EgtApproxSurf(" + ToString( nId) + "," +
|
||||||
ToString( dLinTol) + "," +
|
ToString( dLinTol) + ")" +
|
||||||
ToString( dTriaMinSide) + ")" +
|
|
||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
@@ -296,7 +294,7 @@ ExeSurfFrSubtract( int nId1, int nId2)
|
|||||||
bOk = bOk && ( pSfr2L != nullptr) ;
|
bOk = bOk && ( pSfr2L != nullptr) ;
|
||||||
// eseguo la sottrazione della seconda superficie dalla prima
|
// eseguo la sottrazione della seconda superficie dalla prima
|
||||||
bOk = bOk && pSfr1->Subtract( *pSfr2L) ;
|
bOk = bOk && pSfr1->Subtract( *pSfr2L) ;
|
||||||
// se il risultato è vuoto, cancello la FlatRegion
|
// se il risultato è vuoto, cancello la FlatRegion
|
||||||
if ( bOk && ! pSfr1->IsValid())
|
if ( bOk && ! pSfr1->IsValid())
|
||||||
pGeomDB->Erase( nId1) ;
|
pGeomDB->Erase( nId1) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
@@ -328,7 +326,7 @@ ExeSurfFrIntersect( int nId1, int nId2)
|
|||||||
bOk = bOk && ( pSfr2L != nullptr) ;
|
bOk = bOk && ( pSfr2L != nullptr) ;
|
||||||
// eseguo l'intersezione tra le due superfici
|
// eseguo l'intersezione tra le due superfici
|
||||||
bOk = bOk && pSfr1->Intersect( *pSfr2L) ;
|
bOk = bOk && pSfr1->Intersect( *pSfr2L) ;
|
||||||
// se il risultato è vuoto, cancello la FlatRegion
|
// se il risultato è vuoto, cancello la FlatRegion
|
||||||
if ( bOk && ! pSfr1->IsValid())
|
if ( bOk && ! pSfr1->IsValid())
|
||||||
pGeomDB->Erase( nId1) ;
|
pGeomDB->Erase( nId1) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
@@ -353,7 +351,7 @@ ExeSurfFrOffset( int nId, double dDist, int nType)
|
|||||||
bool bOk = ( pSfr != nullptr) ;
|
bool bOk = ( pSfr != nullptr) ;
|
||||||
// eseguo l'offset
|
// eseguo l'offset
|
||||||
bOk = bOk && pSfr->Offset( dDist, nType) ;
|
bOk = bOk && pSfr->Offset( dDist, nType) ;
|
||||||
// se il risultato è vuoto, cancello la FlatRegion
|
// se il risultato è vuoto, cancello la FlatRegion
|
||||||
if ( bOk && ! pSfr->IsValid())
|
if ( bOk && ! pSfr->IsValid())
|
||||||
pGeomDB->Erase( nId) ;
|
pGeomDB->Erase( nId) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
@@ -368,32 +366,6 @@ ExeSurfFrOffset( int nId, double dDist, int nType)
|
|||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSurfFrOffsetAdv( int nId, double dDist, int nType, int& nNewId)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
||||||
// recupero la superficie FlatRegion
|
|
||||||
ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
if ( pSfr == nullptr)
|
|
||||||
return false ;
|
|
||||||
// eseguo l'offset
|
|
||||||
PtrOwner<ISurfFlatRegion> pSfrOffs( pSfr->CreateOffsetSurf( dDist, nType)) ;
|
|
||||||
if ( IsNull( pSfrOffs))
|
|
||||||
return false ;
|
|
||||||
// salvo la superficie di offset
|
|
||||||
nNewId = GDB_ID_NULL ;
|
|
||||||
if ( pSfr->GetChunkCount() > 0) {
|
|
||||||
// inserisco nel DB geometrico
|
|
||||||
nNewId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_AFTER, Release( pSfrOffs)) ;
|
|
||||||
// copio gli attributi
|
|
||||||
pGeomDB->CopyAttributes( nId, nNewId) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
}
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeSurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, int nRefType)
|
ExeSurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, int nRefType)
|
||||||
@@ -443,11 +415,11 @@ bool
|
|||||||
ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType, bool bUpdate)
|
ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType, bool bUpdate)
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
// recupero la superficie
|
// recupero la superficie
|
||||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||||
bool bOk = ( pStm != nullptr) ;
|
bool bOk = ( pStm != nullptr) ;
|
||||||
// recupero il riferimento in cui è immersa la superficie
|
// recupero il riferimento in cui è immersa la superficie
|
||||||
Frame3d frStm ;
|
Frame3d frStm ;
|
||||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
|
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
|
||||||
// eseguo la modifica
|
// eseguo la modifica
|
||||||
@@ -475,50 +447,6 @@ ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType,
|
|||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSurfTmMoveFacet( int nId, int nFacet, const Vector3d& vtMove, int nRefType, bool bUpdate)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la superficie
|
|
||||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
bool bOk = ( pStm != nullptr) ;
|
|
||||||
// recupero il riferimento in cui è immersa la superficie
|
|
||||||
Frame3d frStm ;
|
|
||||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
|
|
||||||
// porto in locale il movimento
|
|
||||||
Vector3d vtMoveL = GetVectorLocal( pGeomDB, vtMove, nRefType, frStm) ;
|
|
||||||
// recupero tutti i vertici della faccia
|
|
||||||
INTVECTOR vVert ;
|
|
||||||
bOk = bOk && pStm->GetAllVertInFacet( nFacet, vVert) ;
|
|
||||||
// sposto tutti i vertici della faccia della quantità desiderata
|
|
||||||
if ( bOk) {
|
|
||||||
for ( const auto nVert : vVert) {
|
|
||||||
// recupero la posizione originale del vertice
|
|
||||||
Point3d ptV ;
|
|
||||||
if ( pStm->GetVertex( nVert, ptV))
|
|
||||||
pStm->MoveVertex( nVert, ptV + vtMoveL) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// se richiesto, semplificazione della trimesh
|
|
||||||
if ( bUpdate)
|
|
||||||
bOk = bOk && pStm->DoCompacting() ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtSurfTmMoveFacet(" + IdToString( nId) + "," +
|
|
||||||
ToString( nFacet) + ",{" +
|
|
||||||
ToString( vtMove) + "}," +
|
|
||||||
RefTypeToString( nRefType) + "," +
|
|
||||||
( bUpdate ? "true" : "false") + ")" +
|
|
||||||
" -- Ok=" + ToString( bOk) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco risultato
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
MySurfTmToTriangles( int nId, int& nCount)
|
MySurfTmToTriangles( int nId, int& nCount)
|
||||||
@@ -531,7 +459,7 @@ MySurfTmToTriangles( int nId, int& nCount)
|
|||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// recupero il numero di triangoli
|
// recupero il numero di triangoli
|
||||||
int nTria = pStm->GetTriangleCount() ;
|
int nTria = pStm->GetTriangleCount() ;
|
||||||
// se ci sono più triangoli, li separo
|
// se ci sono più triangoli, li separo
|
||||||
if ( nTria > 1) {
|
if ( nTria > 1) {
|
||||||
// copio tutti triangoli
|
// copio tutti triangoli
|
||||||
int nFirstId = GDB_ID_NULL ;
|
int nFirstId = GDB_ID_NULL ;
|
||||||
@@ -557,7 +485,7 @@ MySurfTmToTriangles( int nId, int& nCount)
|
|||||||
// restituisco risultati
|
// restituisco risultati
|
||||||
return nFirstId ;
|
return nFirstId ;
|
||||||
}
|
}
|
||||||
// non devo fare alcunché
|
// non devo fare alcunché
|
||||||
nCount = 1 ;
|
nCount = 1 ;
|
||||||
return nId ;
|
return nId ;
|
||||||
}
|
}
|
||||||
@@ -692,41 +620,6 @@ ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSave
|
|||||||
return bOk ;
|
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
|
bool
|
||||||
ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq)
|
ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq)
|
||||||
@@ -807,7 +700,7 @@ ExeSurfTmSubtract( int nId1, int nId2, bool bTwoColors)
|
|||||||
bOk = bOk && ( pStm2L != nullptr) ;
|
bOk = bOk && ( pStm2L != nullptr) ;
|
||||||
// eseguo la sottrazione tra le due superfici
|
// eseguo la sottrazione tra le due superfici
|
||||||
bOk = bOk && pStm1->Subtract( *pStm2L) ;
|
bOk = bOk && pStm1->Subtract( *pStm2L) ;
|
||||||
// se il risultato � vuoto, cancello la superficie
|
// se il risultato è vuoto, cancello la superficie
|
||||||
if ( bOk && ! pStm1->IsValid()) {
|
if ( bOk && ! pStm1->IsValid()) {
|
||||||
pGeomDB->Erase( nId1) ;
|
pGeomDB->Erase( nId1) ;
|
||||||
pStm1 = nullptr ;
|
pStm1 = nullptr ;
|
||||||
@@ -844,7 +737,7 @@ ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors)
|
|||||||
bOk = bOk && ( pStm2L != nullptr) ;
|
bOk = bOk && ( pStm2L != nullptr) ;
|
||||||
// eseguo l'intersezione tra le due superfici
|
// eseguo l'intersezione tra le due superfici
|
||||||
bOk = bOk && pStm1->Intersect( *pStm2L) ;
|
bOk = bOk && pStm1->Intersect( *pStm2L) ;
|
||||||
// se il risultato � vuoto, cancello la superficie
|
// se il risultato è vuoto, cancello la superficie
|
||||||
if ( bOk && ! pStm1->IsValid()) {
|
if ( bOk && ! pStm1->IsValid()) {
|
||||||
pGeomDB->Erase( nId1) ;
|
pGeomDB->Erase( nId1) ;
|
||||||
pStm1 = nullptr ;
|
pStm1 = nullptr ;
|
||||||
@@ -863,6 +756,27 @@ ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors)
|
|||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
ExeSurfTmResetTwoColors( int nId)
|
||||||
|
{
|
||||||
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
|
// recupero la superficie TriMesh
|
||||||
|
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||||
|
bool bOk = ( pStm != nullptr) ;
|
||||||
|
// reset dei flag sui triangoli per i due colori
|
||||||
|
bOk = bOk && pStm->ResetTFlags() ;
|
||||||
|
ExeSetModified() ;
|
||||||
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
|
if ( IsCmdLog()) {
|
||||||
|
string sLua = "EgtSurfTmResetTwoColors(" + ToString( nId) + ")" +
|
||||||
|
" -- Ok=" + ToString( bOk) ;
|
||||||
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
}
|
||||||
|
return bOk ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static ISurfTriMesh*
|
static ISurfTriMesh*
|
||||||
MyCreateSubSurfTm( const ISurfTriMesh* pStm, const INTVECTOR& vTria, const INTVECTOR& vTria2)
|
MyCreateSubSurfTm( const ISurfTriMesh* pStm, const INTVECTOR& vTria, const INTVECTOR& vTria2)
|
||||||
@@ -1010,228 +924,3 @@ ExeSurfTmCut( int nId, int nCutterId, bool bInVsOut, bool bSaveOnEq)
|
|||||||
}
|
}
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSurfTmSubtractProjectedFacesOnFace( int nSurfId, int nFaceInd, int nDestGrpId,
|
|
||||||
INTVECTOR vSurfsId, bool bOCFlag,
|
|
||||||
bool& bExistProjection, int& nNewId, int& nNewFaceNbr)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la superficie TriMesh su cui proiettare
|
|
||||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
|
|
||||||
if ( pStm == nullptr)
|
|
||||||
return false ;
|
|
||||||
// recupero il riferimento della superficie
|
|
||||||
Frame3d frSurf ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nSurfId, frSurf))
|
|
||||||
return false ;
|
|
||||||
// recupero il riferimento del gruppo di destinazione
|
|
||||||
Frame3d frDest ;
|
|
||||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
|
||||||
return false ;
|
|
||||||
// costruzione vettori di superfici e indici delle facce per proiezione
|
|
||||||
ISURFTMPOVECTOR vpStmOthers ;
|
|
||||||
vector<SurfLocal> vSurfCLoc ;
|
|
||||||
// recupero le altre superfici e le porto nel sistema di riferimento della prima
|
|
||||||
for ( int i = 0 ; i < int( vSurfsId.size()) ; ++ i) {
|
|
||||||
if ( pGeomDB->GetGeoType( vSurfsId[i]) != SRF_TRIMESH)
|
|
||||||
return false ;
|
|
||||||
vSurfCLoc.emplace_back( pGeomDB, vSurfsId[i], frSurf) ;
|
|
||||||
const ISurfTriMesh* pStmCurr = GetSurfTriMesh( vSurfCLoc.back().Get()) ;
|
|
||||||
vpStmOthers.emplace_back( pStmCurr->Clone()) ;
|
|
||||||
}
|
|
||||||
// eseguo la proiezione
|
|
||||||
ISurfTriMesh* pStmRes = nullptr ;
|
|
||||||
bool bOk = SubtractProjectedFacesOnStmFace( *pStm, nFaceInd, vpStmOthers, bOCFlag,
|
|
||||||
bExistProjection, pStmRes, nNewFaceNbr) ;
|
|
||||||
if ( ! bOk) {
|
|
||||||
delete( pStmRes) ;
|
|
||||||
pStmRes = nullptr ;
|
|
||||||
}
|
|
||||||
|
|
||||||
nNewId = GDB_ID_NULL ;
|
|
||||||
if ( bOk && pStmRes != nullptr) {
|
|
||||||
// porto nel sistema di riferimento destinazione
|
|
||||||
pStmRes->LocToLoc( frSurf, frDest) ;
|
|
||||||
// la inserisco nel DB geometrico
|
|
||||||
nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pStmRes) ;
|
|
||||||
if ( nNewId == GDB_ID_NULL)
|
|
||||||
return false ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtSubtractProjectedFacesOnStmFace(" + ToString( nSurfId) + "," +
|
|
||||||
ToString( nFaceInd) + "," +
|
|
||||||
ToString( nDestGrpId) + "," +
|
|
||||||
ToString( vSurfsId) + "," +
|
|
||||||
ToString( bOCFlag) + ")" +
|
|
||||||
" -- Ok=" + ToString( bOk) + " Id=" + ToString( nNewId) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSurfTmSetFaceColor( int nId, int nFacet, int nColor)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la superficie TriMesh
|
|
||||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
bool bOk = ( pStm != nullptr) ;
|
|
||||||
// recupero tutti i triangoli della faccia e imposto il flag opportuno per il colore
|
|
||||||
INTVECTOR vTria ;
|
|
||||||
bOk = bOk && pStm->GetAllTriaInFacet( nFacet, vTria) ;
|
|
||||||
for ( const auto nT : vTria)
|
|
||||||
pStm->SetTFlag( nT, nColor) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtSurfTmSetFaceColor(" + ToString( nId) + "," +
|
|
||||||
ToString( nFacet) + "," +
|
|
||||||
ToString( nColor) + ")" +
|
|
||||||
" -- Ok=" + ToString( bOk) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSurfTmGetTriaColor( int nId, int nTria, int& nColor)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la superficie TriMesh
|
|
||||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
bool bOk = ( pStm != nullptr) ;
|
|
||||||
// recupero il colore del triangolo
|
|
||||||
return ( bOk && pStm->GetTFlag( nTria, nColor)) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSurfTmResetTwoColors( int nId)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la superficie TriMesh
|
|
||||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
bool bOk = ( pStm != nullptr) ;
|
|
||||||
// reset dei flag sui triangoli per i due colori
|
|
||||||
bOk = bOk && pStm->ResetTFlags() ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtSurfTmResetTwoColors(" + ToString( nId) + ")" +
|
|
||||||
" -- Ok=" + ToString( bOk) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSurfTmSetShowEdges( int nId, bool bShow)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la superficie trimesh
|
|
||||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
bool bOk = ( pStm != nullptr) ;
|
|
||||||
// imposto lo stato di visualizzazione degli spigoli vivi
|
|
||||||
if ( bOk)
|
|
||||||
pStm->SetShowEdges( bShow) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtSurfTmSetShowEdges(" + ToString( nId) + "," +
|
|
||||||
ToString( bShow) + ")" +
|
|
||||||
" -- Ok=" + ToString( bOk) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSurfTmGetShowEdges( int nId, bool& bShow)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la superficie trimesh
|
|
||||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
bool bOk = ( pStm != nullptr) ;
|
|
||||||
// recupero lo stato di visualizzazione degli spigoli vivi
|
|
||||||
bShow = ( bOk && pStm->GetShowEdges()) ;
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static bool
|
|
||||||
MySurfBzTrim( int nId, int nTrimmerId)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la superficie Bezier da trimmare
|
|
||||||
ISurfBezier* pSrfBz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
if ( pSrfBz == nullptr)
|
|
||||||
return false ;
|
|
||||||
// recupero il riferimento della superficie
|
|
||||||
Frame3d frSurf ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nId, frSurf))
|
|
||||||
return false ;
|
|
||||||
// recupero la superficie TriMesh divisore in locale alla prima
|
|
||||||
|
|
||||||
SurfLocal SurfCLoc( pGeomDB, nTrimmerId, frSurf) ;
|
|
||||||
//const ISurfTriMesh* pStmCLoc = GetSurfTriMesh( SurfCLoc) ;
|
|
||||||
const ISurfFlatRegion* pSrfFr = GetSurfFlatRegion( SurfCLoc) ;
|
|
||||||
if ( pSrfFr == nullptr)
|
|
||||||
return false ;
|
|
||||||
PtrOwner<ISurfFlatRegion> pSrfFrCopy( pSrfFr->Clone()) ;
|
|
||||||
if ( ! pSrfFr->GetNormVersor().IsZplus())
|
|
||||||
pSrfFrCopy->Invert() ;
|
|
||||||
// eseguo il taglio
|
|
||||||
return pSrfBz->SetTrimRegion( *pSrfFrCopy) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSurfBzTrim( int nId, int nCutterId)
|
|
||||||
{
|
|
||||||
bool bOk = MySurfBzTrim( nId, nCutterId) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtSurfTmCut(" + ToString( nId) + "," +
|
|
||||||
ToString( nCutterId) + "," +
|
|
||||||
" -- Ok=" + ToString( bOk) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSurfTmSetSmoothAng( int nId, double dAngDeg)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la superficie trimseh da trimmare
|
|
||||||
ISurfTriMesh* pSrfTm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
if ( pSrfTm == nullptr)
|
|
||||||
return false ;
|
|
||||||
pSrfTm->SetSmoothAngle( dAngDeg) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtSurfTmSetSmoothAng(" + ToString( nId) + "," +
|
|
||||||
ToString( dAngDeg) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|||||||
+3
-53
@@ -104,9 +104,10 @@ ExeVolZmapChangeResolution( int nId, int nNewRes)
|
|||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
// recupero lo Zmap
|
// recupero lo Zmap
|
||||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||||
bool bOk = ( pVZM != nullptr) ;
|
if ( pVZM == nullptr)
|
||||||
|
return false ;
|
||||||
// cambio la risoluzione (rapporto Voxel/Dexel, valori ammessi 1 e 2)
|
// cambio la risoluzione (rapporto Voxel/Dexel, valori ammessi 1 e 2)
|
||||||
bOk = bOk && pVZM->ChangeResolution( nNewRes) ;
|
bool bOk = pVZM->ChangeResolution( nNewRes) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
@@ -119,29 +120,6 @@ ExeVolZmapChangeResolution( int nId, int nNewRes)
|
|||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeVolZmapSetShowEdges( int nId, bool bShow)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero lo Zmap
|
|
||||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
bool bOk = ( pVZM != nullptr) ;
|
|
||||||
// imposto lo stato di visualizzazione degli spigoli vivi
|
|
||||||
if ( bOk)
|
|
||||||
pVZM->SetShowEdges( bShow) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtVolZmapSetShowEdges(" + ToString( nId) + "," +
|
|
||||||
ToString( bShow) + ")" +
|
|
||||||
" -- Ok=" + ToString( bOk) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeRemoveVolZmapPart( int nId, int nPart)
|
ExeRemoveVolZmapPart( int nId, int nPart)
|
||||||
@@ -337,34 +315,6 @@ ExeVolZmapSetChiselTool( const INTVECTOR& vIds, const string& sToolName,
|
|||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeVolZmapSetAdditiveTool( const INTVECTOR& vIds, const string& sToolName,
|
|
||||||
double dLen, double dDiam, double dCornR, int nFlag, bool bFirst)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero gli Zmap e assegno i dati dell'utensile
|
|
||||||
bool bOk = true ;
|
|
||||||
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
|
|
||||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
|
|
||||||
bOk = ( bOk && pVZM != nullptr && pVZM->SetAdditiveTool( sToolName, dLen, dDiam / 2, dCornR, nFlag, bFirst)) ;
|
|
||||||
}
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtVolZmapSetAdditiveTool({" + IdListToString( vIds) + "}," +
|
|
||||||
sToolName + "," +
|
|
||||||
ToString( dLen) + "," +
|
|
||||||
ToString( dDiam) + "," +
|
|
||||||
ToString( dCornR) + "," +
|
|
||||||
ToString( nFlag) + ")" +
|
|
||||||
" -- Ok=" + ToString( bOk) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco risultato
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeVolZmapResetTools( const INTVECTOR& vIds)
|
ExeVolZmapResetTools( const INTVECTOR& vIds)
|
||||||
|
|||||||
+8
-13
@@ -15,7 +15,6 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "EXE.h"
|
#include "EXE.h"
|
||||||
#include "EXE_Macro.h"
|
#include "EXE_Macro.h"
|
||||||
#include "GeoTools.h"
|
|
||||||
#include "AuxTools.h"
|
#include "AuxTools.h"
|
||||||
#include "/EgtDev/Include/EXeExecutor.h"
|
#include "/EgtDev/Include/EXeExecutor.h"
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
@@ -255,7 +254,6 @@ ExeCopy( int nSouId, int nRefId, int nSonBeforeAfter)
|
|||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
nRefId = AdjustId( nRefId) ;
|
|
||||||
// eseguo la copia
|
// eseguo la copia
|
||||||
int nNewId = pGeomDB->Copy( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
|
int nNewId = pGeomDB->Copy( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
|
||||||
pGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
|
pGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
|
||||||
@@ -266,11 +264,11 @@ ExeCopy( int nSouId, int nRefId, int nSonBeforeAfter)
|
|||||||
string sLua ;
|
string sLua ;
|
||||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||||
sLua = "EgtCopy(" + ToString( nSouId) + "," +
|
sLua = "EgtCopy(" + ToString( nSouId) + "," +
|
||||||
IdToString( nRefId) + ")" +
|
ToString( nRefId) + ")" +
|
||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
else
|
else
|
||||||
sLua = "EgtCopy(" + ToString( nSouId) + "," +
|
sLua = "EgtCopy(" + ToString( nSouId) + "," +
|
||||||
IdToString( nRefId) + "," +
|
ToString( nRefId) + "," +
|
||||||
InsToString( nSonBeforeAfter) + ")" +
|
InsToString( nSonBeforeAfter) + ")" +
|
||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
@@ -285,7 +283,6 @@ ExeCopyGlob( int nSouId, int nRefId, int nSonBeforeAfter)
|
|||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
nRefId = AdjustId( nRefId) ;
|
|
||||||
// eseguo la copia mantenendo la posizione in globale
|
// eseguo la copia mantenendo la posizione in globale
|
||||||
int nNewId = pGeomDB->CopyGlob( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
|
int nNewId = pGeomDB->CopyGlob( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
|
||||||
pGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
|
pGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
|
||||||
@@ -296,11 +293,11 @@ ExeCopyGlob( int nSouId, int nRefId, int nSonBeforeAfter)
|
|||||||
string sLua ;
|
string sLua ;
|
||||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||||
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
|
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
|
||||||
IdToString( nRefId) + ")" +
|
ToString( nRefId) + ")" +
|
||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
else
|
else
|
||||||
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
|
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
|
||||||
IdToString( nRefId) + "," +
|
ToString( nRefId) + "," +
|
||||||
InsToString( nSonBeforeAfter) + ")" +
|
InsToString( nSonBeforeAfter) + ")" +
|
||||||
" -- Id=" + ToString( nNewId) ;
|
" -- Id=" + ToString( nNewId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
@@ -315,7 +312,6 @@ ExeRelocate( int nSouId, int nRefId, int nSonBeforeAfter)
|
|||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
nRefId = AdjustId( nRefId) ;
|
|
||||||
// eseguo la rilocazione
|
// eseguo la rilocazione
|
||||||
bool bOk = pGeomDB->Relocate( nSouId, nRefId, nSonBeforeAfter) ;
|
bool bOk = pGeomDB->Relocate( nSouId, nRefId, nSonBeforeAfter) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
@@ -324,11 +320,11 @@ ExeRelocate( int nSouId, int nRefId, int nSonBeforeAfter)
|
|||||||
string sLua ;
|
string sLua ;
|
||||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||||
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
|
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
|
||||||
IdToString( nRefId) + ")" +
|
ToString( nRefId) + ")" +
|
||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
else
|
else
|
||||||
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
|
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
|
||||||
IdToString( nRefId) + "," +
|
ToString( nRefId) + "," +
|
||||||
InsToString( nSonBeforeAfter) + ")" +
|
InsToString( nSonBeforeAfter) + ")" +
|
||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
@@ -343,7 +339,6 @@ ExeRelocateGlob( int nSouId, int nRefId, int nSonBeforeAfter)
|
|||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
nRefId = AdjustId( nRefId) ;
|
|
||||||
// eseguo la rilocazione mantenendo la posizione in globale
|
// eseguo la rilocazione mantenendo la posizione in globale
|
||||||
bool bOk = pGeomDB->RelocateGlob( nSouId, nRefId, nSonBeforeAfter) ;
|
bool bOk = pGeomDB->RelocateGlob( nSouId, nRefId, nSonBeforeAfter) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
@@ -352,11 +347,11 @@ ExeRelocateGlob( int nSouId, int nRefId, int nSonBeforeAfter)
|
|||||||
string sLua ;
|
string sLua ;
|
||||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||||
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
|
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
|
||||||
IdToString( nRefId) + ")" +
|
ToString( nRefId) + ")" +
|
||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
else
|
else
|
||||||
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
|
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
|
||||||
IdToString( nRefId) + "," +
|
ToString( nRefId) + "," +
|
||||||
InsToString( nSonBeforeAfter) + ")" +
|
InsToString( nSonBeforeAfter) + ")" +
|
||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
|||||||
+14
-150
@@ -344,26 +344,6 @@ ExeGetPrevLayer( int nId, bool bOnlyVisible)
|
|||||||
return ExeVerifyOrPrev( pGeomDB, nLayerId, bOnlyVisible) ;
|
return ExeVerifyOrPrev( pGeomDB, nLayerId, bOnlyVisible) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeIsGhostPart( int nGhostId)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// verifico sia il segnaposto di un pezzo (Ghost)
|
|
||||||
if ( pGeomDB->GetGdbType( nGhostId) == GDB_TY_GROUP &&
|
|
||||||
pGeomDB->GetParentId( nGhostId) == GDB_ID_ROOT &&
|
|
||||||
ExeIsSystemObj( pGeomDB, nGhostId) &&
|
|
||||||
pGeomDB->ExistsInfo( nGhostId, GDB_SI_SOURCE)) {
|
|
||||||
int nPartId = GDB_ID_NULL ;
|
|
||||||
pGeomDB->GetInfo( nGhostId, GDB_SI_SOURCE, nPartId) ;
|
|
||||||
int nRawId = pGeomDB->GetParentId( nPartId) ;
|
|
||||||
if ( ExeIsRawPart( nRawId))
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeGetFirstGhostPart( void)
|
ExeGetFirstGhostPart( void)
|
||||||
@@ -697,32 +677,6 @@ IsPartForDuplo( IGeomDB* pGeomDB, int nPartId)
|
|||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
static bool
|
|
||||||
IsDuplo( IGeomDB* pGeomDB, int nDupId, bool& bInDuploGroup)
|
|
||||||
{
|
|
||||||
// verifica collegamento a DB geometrico
|
|
||||||
if ( pGeomDB == nullptr)
|
|
||||||
return false ;
|
|
||||||
// Recupero il gruppo base dei duplicati
|
|
||||||
int nDuploBaseId = GetDuploBase( pGeomDB) ;
|
|
||||||
if ( nDuploBaseId == GDB_ID_NULL)
|
|
||||||
return false ;
|
|
||||||
// Verifico sia un duplicato (gruppo sotto quello dei duplicati con riferimento a originale)
|
|
||||||
int nBaseId ;
|
|
||||||
if ( pGeomDB->GetGdbType( nDupId) == GDB_TY_GROUP && pGeomDB->ExistsInfo( nDupId, GDB_SI_DUPSOU)) {
|
|
||||||
if ( pGeomDB->GetParentId( nDupId) == nDuploBaseId) {
|
|
||||||
bInDuploGroup = true ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
else if ( pGeomDB->GetInfo( nDupId, GDB_SI_BASE, nBaseId) && pGeomDB->GetParentId( nBaseId) == nDuploBaseId) {
|
|
||||||
bInDuploGroup = false ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeDuploNew( int nSouId)
|
ExeDuploNew( int nSouId)
|
||||||
@@ -775,8 +729,7 @@ ExeDuploCount( int nSouId, int& nCount)
|
|||||||
// Conto i reali duplo
|
// Conto i reali duplo
|
||||||
nCount = 0 ;
|
nCount = 0 ;
|
||||||
for ( int i = 0 ; i < int( vnRef.size()) ; ++ i) {
|
for ( int i = 0 ; i < int( vnRef.size()) ; ++ i) {
|
||||||
bool bInDuploGroup ;
|
if ( ExeIsDuplo( vnRef[i]))
|
||||||
if ( IsDuplo( pGeomDB, vnRef[i], bInDuploGroup))
|
|
||||||
++ nCount ;
|
++ nCount ;
|
||||||
}
|
}
|
||||||
return true ;
|
return true ;
|
||||||
@@ -801,105 +754,6 @@ ExeDuploList( int nSouId, INTVECTOR& vnRef)
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeDuploInRawCount( int nSouId, int& nCount)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// Verifico sia un pezzo
|
|
||||||
if ( ! IsPartForDuplo( pGeomDB, nSouId))
|
|
||||||
return false ;
|
|
||||||
// Recupero info del sorgente
|
|
||||||
INTVECTOR vnRef ;
|
|
||||||
pGeomDB->GetInfo( nSouId, GDB_SI_DUPLIST, vnRef) ;
|
|
||||||
// Conto i reali duplo che sono riferiti o che stanno in un grezzo
|
|
||||||
nCount = 0 ;
|
|
||||||
for ( int i = 0 ; i < int( vnRef.size()) ; ++ i) {
|
|
||||||
// verifico sia un duplo
|
|
||||||
int nDupId = vnRef[i] ;
|
|
||||||
bool bInDuploGroup ;
|
|
||||||
if ( ! IsDuplo( pGeomDB, nDupId, bInDuploGroup))
|
|
||||||
continue ;
|
|
||||||
// se nel gruppo dei duplo
|
|
||||||
if ( bInDuploGroup) {
|
|
||||||
// verifico sia incluso in un grezzo di un gruppo di lavoro
|
|
||||||
INTVECTOR vnRef ;
|
|
||||||
if ( ! pGeomDB->GetInfo( nDupId, GDB_SI_LIST, vnRef))
|
|
||||||
continue ;
|
|
||||||
for ( auto& nId : vnRef) {
|
|
||||||
// verifico esista
|
|
||||||
if ( ! pGeomDB->ExistsObj( nId))
|
|
||||||
continue ;
|
|
||||||
// verifico sia in un grezzo (previsto solo in uno come massimo)
|
|
||||||
int nMachGrpId = pGeomDB->GetParentId( pGeomDB->GetParentId( pGeomDB->GetParentId( nId))) ;
|
|
||||||
string sMachGrpName ;
|
|
||||||
if ( ExeGetMachGroupName( nMachGrpId, sMachGrpName)) {
|
|
||||||
++ nCount ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// se in altro gruppo
|
|
||||||
else {
|
|
||||||
// verifico se incluso nel grezzo del gruppo di lavoro corrente (previsto solo in un gruppo)
|
|
||||||
if ( ExeIsRawPart( pGeomDB->GetParentId( nDupId)))
|
|
||||||
++ nCount ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeDuploWithoutRawList( INTVECTOR& vnDup)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// Reset del risultato
|
|
||||||
vnDup.clear() ;
|
|
||||||
// Recupero gruppo dei duplo
|
|
||||||
int nDuploBaseId = GetDuploBase( pGeomDB) ;
|
|
||||||
if ( nDuploBaseId == GDB_ID_NULL)
|
|
||||||
return true ;
|
|
||||||
// Ciclo sui duplo
|
|
||||||
for ( int nDuploId = pGeomDB->GetFirstGroupInGroup( nDuploBaseId) ;
|
|
||||||
nDuploId != GDB_ID_NULL ;
|
|
||||||
nDuploId = pGeomDB->GetNextGroup( nDuploId)) {
|
|
||||||
// se marcatore
|
|
||||||
if ( pGeomDB->ExistsInfo( nDuploId, GDB_SI_SOURCE)) {
|
|
||||||
int nPartId = GDB_ID_NULL ;
|
|
||||||
pGeomDB->GetInfo( nDuploId, GDB_SI_SOURCE, nPartId) ;
|
|
||||||
int nMachGrpId = pGeomDB->GetParentId( pGeomDB->GetParentId( pGeomDB->GetParentId( nPartId))) ;
|
|
||||||
string sMachGrpName ;
|
|
||||||
if ( pGeomDB->ExistsInfo( nPartId, GDB_SI_DUPSOU) && ExeGetMachGroupName( nMachGrpId, sMachGrpName))
|
|
||||||
continue ;
|
|
||||||
}
|
|
||||||
// se vero duplo
|
|
||||||
else if ( pGeomDB->ExistsInfo( nDuploId, GDB_SI_DUPSOU) && pGeomDB->ExistsInfo( nDuploId, GDB_SI_LIST)) {
|
|
||||||
// verifico sia incluso in un grezzo di un gruppo di lavoro
|
|
||||||
bool bFound = false ;
|
|
||||||
INTVECTOR vnRef ;
|
|
||||||
pGeomDB->GetInfo( nDuploId, GDB_SI_LIST, vnRef) ;
|
|
||||||
for ( auto& nId : vnRef) {
|
|
||||||
// verifico sia in un grezzo (previsto solo in uno come massimo)
|
|
||||||
int nMachGrpId = pGeomDB->GetParentId( pGeomDB->GetParentId( pGeomDB->GetParentId( nId))) ;
|
|
||||||
string sMachGrpName ;
|
|
||||||
if ( ExeGetMachGroupName( nMachGrpId, sMachGrpName)) {
|
|
||||||
bFound = true ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( bFound)
|
|
||||||
continue ;
|
|
||||||
}
|
|
||||||
// inserisco nella lista dei duplo senza grezzo
|
|
||||||
vnDup.emplace_back( nDuploId) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeDuploSetModified( int nSouId)
|
ExeDuploSetModified( int nSouId)
|
||||||
@@ -1101,9 +955,19 @@ ExeIsDuplo( int nDupId)
|
|||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
// Verifico sia un duplicato
|
// Recupero il gruppo base dei duplicati
|
||||||
bool bPartVsGhost ;
|
int nDuploBaseId = GetDuploBase( pGeomDB) ;
|
||||||
return IsDuplo( pGeomDB, nDupId, bPartVsGhost) ;
|
if ( nDuploBaseId == GDB_ID_NULL)
|
||||||
|
return false ;
|
||||||
|
// Verifico sia un duplicato (gruppo sotto quello dei duplicati con riferimento a originale)
|
||||||
|
int nBaseId ;
|
||||||
|
if ( pGeomDB->GetGdbType( nDupId) == GDB_TY_GROUP &&
|
||||||
|
( pGeomDB->GetParentId( nDupId) == nDuploBaseId ||
|
||||||
|
( pGeomDB->GetInfo( nDupId, GDB_SI_BASE, nBaseId) && pGeomDB->GetParentId( nBaseId) == nDuploBaseId)) &&
|
||||||
|
pGeomDB->ExistsInfo( nDupId, GDB_SI_DUPSOU))
|
||||||
|
return true ;
|
||||||
|
else
|
||||||
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
+11
-97
@@ -1,14 +1,13 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2014-2023
|
// EgalTech 2014-2015
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : EXE_General.cpp Data : 14.11.23 Versione : 2.5k2
|
// File : EXE_General.cpp Data : 01.09.14 Versione : 1.5i1
|
||||||
// Contenuto : Funzioni generali per EXE.
|
// Contenuto : Funzioni generali per EXE.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Modifiche : 01.09.14 DS Creazione modulo.
|
// Modifiche : 01.09.14 DS Creazione modulo.
|
||||||
// 28.11.19 DS Aggiunto caricamento opzionale di Nesting.
|
// 28.11.19 DS Aggiunto caricamento opzionale del Nesting.
|
||||||
// 14.11.23 DS Aggiunto caricamento opzionale di Exchange 3dm.
|
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -18,7 +17,6 @@
|
|||||||
#include "LUA_Base.h"
|
#include "LUA_Base.h"
|
||||||
#include "DllGraphics.h"
|
#include "DllGraphics.h"
|
||||||
#include "DllExchange.h"
|
#include "DllExchange.h"
|
||||||
#include "DllExch3dm.h"
|
|
||||||
#include "DllMachKernel.h"
|
#include "DllMachKernel.h"
|
||||||
#include "DllNesting.h"
|
#include "DllNesting.h"
|
||||||
#include "/EgtDev/Include/EXeExecutor.h"
|
#include "/EgtDev/Include/EXeExecutor.h"
|
||||||
@@ -35,7 +33,6 @@
|
|||||||
#include "/EgtDev/Include/EgtIniFile.h"
|
#include "/EgtDev/Include/EgtIniFile.h"
|
||||||
#include "/EgtDev/Include/EgtLogger.h"
|
#include "/EgtDev/Include/EgtLogger.h"
|
||||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
|
||||||
#include "/EgtDev/Include/SELkLockId.h"
|
#include "/EgtDev/Include/SELkLockId.h"
|
||||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@@ -53,13 +50,11 @@ static string s_sKey ;
|
|||||||
static int s_nKeyType = KEY_LOCK_TYPE_ANY ;
|
static int s_nKeyType = KEY_LOCK_TYPE_ANY ;
|
||||||
static bool s_bNetHwKey = false ;
|
static bool s_bNetHwKey = false ;
|
||||||
static int s_nKeyExpDays = 0 ;
|
static int s_nKeyExpDays = 0 ;
|
||||||
static int s_nKeyAssExpDays = 0 ;
|
|
||||||
static int s_nKeyOptExpDays = 0 ;
|
static int s_nKeyOptExpDays = 0 ;
|
||||||
static string s_sNestKey ;
|
static string s_sNestKey ;
|
||||||
static string s_sLockId ;
|
static string s_sLockId ;
|
||||||
static string s_sIniFile ;
|
static string s_sIniFile ;
|
||||||
static bool s_bEnableUI = true ;
|
static bool s_bEnableUI = true ;
|
||||||
static pfOnTerminateProcess s_pFunOnTerminateProcess = nullptr ;
|
|
||||||
static pfProcEvents s_pFunProcEvents = nullptr ;
|
static pfProcEvents s_pFunProcEvents = nullptr ;
|
||||||
static pfOutText s_pFunOutText = nullptr ;
|
static pfOutText s_pFunOutText = nullptr ;
|
||||||
static HWND s_hMainWnd = nullptr ;
|
static HWND s_hMainWnd = nullptr ;
|
||||||
@@ -75,7 +70,6 @@ ExeInit( int nDebug, const string& sLogFile, const string& sLogMsg)
|
|||||||
if ( s_pGenLog != nullptr)
|
if ( s_pGenLog != nullptr)
|
||||||
delete s_pGenLog ;
|
delete s_pGenLog ;
|
||||||
// cancello riferimenti a funzioni installate
|
// cancello riferimenti a funzioni installate
|
||||||
s_pFunOnTerminateProcess = nullptr ;
|
|
||||||
s_pFunProcEvents = nullptr ;
|
s_pFunProcEvents = nullptr ;
|
||||||
s_pFunOutText = nullptr ;
|
s_pFunOutText = nullptr ;
|
||||||
s_bEnableUI = true ;
|
s_bEnableUI = true ;
|
||||||
@@ -118,10 +112,6 @@ ExeInit( int nDebug, const string& sLogFile, const string& sLogMsg)
|
|||||||
if ( LoadExchangeDll( s_pGenLog, s_sKey, s_bNetHwKey))
|
if ( LoadExchangeDll( s_pGenLog, s_sKey, s_bNetHwKey))
|
||||||
LOG_INFO( s_pGenLog, MyGetEExVersion())
|
LOG_INFO( s_pGenLog, MyGetEExVersion())
|
||||||
|
|
||||||
// carico libreria exchange 3dm opzionale
|
|
||||||
if ( LoadExch3dmDll( s_pGenLog, s_sKey, s_bNetHwKey))
|
|
||||||
LOG_INFO( s_pGenLog, MyGetEE3Version())
|
|
||||||
|
|
||||||
// carico libreria di lavorazione opzionale
|
// carico libreria di lavorazione opzionale
|
||||||
if ( LoadMachKernelDll( s_pGenLog, s_sKey, s_bNetHwKey))
|
if ( LoadMachKernelDll( s_pGenLog, s_sKey, s_bNetHwKey))
|
||||||
LOG_INFO( s_pGenLog, MyGetEMkVersion())
|
LOG_INFO( s_pGenLog, MyGetEMkVersion())
|
||||||
@@ -178,11 +168,9 @@ ExeExit( void)
|
|||||||
// libero le librerie opzionali
|
// libero le librerie opzionali
|
||||||
FreeMachKernelDll() ;
|
FreeMachKernelDll() ;
|
||||||
FreeExchangeDll() ;
|
FreeExchangeDll() ;
|
||||||
FreeExch3dmDll() ;
|
|
||||||
FreeGraphicsDll() ;
|
FreeGraphicsDll() ;
|
||||||
|
|
||||||
// cancello riferimenti a funzioni installate
|
// cancello riferimenti a funzioni installate
|
||||||
s_pFunOnTerminateProcess = nullptr ;
|
|
||||||
s_pFunProcEvents = nullptr ;
|
s_pFunProcEvents = nullptr ;
|
||||||
s_pFunOutText = nullptr ;
|
s_pFunOutText = nullptr ;
|
||||||
s_bEnableUI = true ;
|
s_bEnableUI = true ;
|
||||||
@@ -209,30 +197,6 @@ ExeExit( void)
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSetOnTerminateProcess( pfOnTerminateProcess pFun)
|
|
||||||
{
|
|
||||||
s_pFunOnTerminateProcess = pFun ;
|
|
||||||
return ( pFun != nullptr) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeOnTerminateProcess( int nExitCode)
|
|
||||||
{
|
|
||||||
// lancio eventuale callback
|
|
||||||
bool bTerminate = true ;
|
|
||||||
if ( s_pFunOnTerminateProcess != nullptr)
|
|
||||||
bTerminate = s_pFunOnTerminateProcess( nExitCode) ;
|
|
||||||
|
|
||||||
// se confermata chiusura, libero eventuale chiave di rete
|
|
||||||
if ( bTerminate && s_bNetHwKey)
|
|
||||||
CloseNetHwKey() ;
|
|
||||||
|
|
||||||
return bTerminate ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeGetDebugLevel( void)
|
ExeGetDebugLevel( void)
|
||||||
@@ -314,12 +278,9 @@ ExeSetLockId( const string& sLockId)
|
|||||||
bOk = ( s_nKeyType != KEY_LOCK_TYPE_HW) ;
|
bOk = ( s_nKeyType != KEY_LOCK_TYPE_HW) ;
|
||||||
break ;
|
break ;
|
||||||
case KEY_LOCK_TYPE_HW :
|
case KEY_LOCK_TYPE_HW :
|
||||||
{ string sAddrPort ;
|
ExeSetNetHwKey( bNetKey, nUserId) ;
|
||||||
GetLockIdStringNetData( sLockId, sAddrPort) ;
|
bOk = true ;
|
||||||
ExeSetNetHwKey( bNetKey, nUserId, sAddrPort) ;
|
break ;
|
||||||
bOk = true ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ( bOk)
|
if ( bOk)
|
||||||
s_sLockId = sLockId ;
|
s_sLockId = sLockId ;
|
||||||
@@ -339,46 +300,11 @@ ExeGetLockId( void)
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeSetNetHwKey( bool bNetHwKey, int nUserId, const string& sAddrPort)
|
ExeSetNetHwKey( bool bNetHwKey, int nUserId)
|
||||||
{
|
{
|
||||||
s_bNetHwKey = bNetHwKey ;
|
s_bNetHwKey = bNetHwKey ;
|
||||||
SetEGnNetHwKey( s_bNetHwKey) ;
|
SetEGnNetHwKey( s_bNetHwKey) ;
|
||||||
return SetNetHwKey( s_bNetHwKey, nUserId, sAddrPort) ;
|
return SetNetHwKey( s_bNetHwKey, nUserId) ;
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeGetNetHwKey( void)
|
|
||||||
{
|
|
||||||
return s_bNetHwKey ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeVerifyKeyOption( int nOptInd)
|
|
||||||
{
|
|
||||||
// recupero le opzioni abilitate
|
|
||||||
unsigned int nOpt1, nOpt2 ;
|
|
||||||
int nOptExpDays ;
|
|
||||||
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
|
||||||
nOpt1, nOpt2, nOptExpDays) ;
|
|
||||||
if ( ! ExeGetNetHwKey())
|
|
||||||
nRet = GetKeyOptions( ExeGetKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
|
||||||
nOpt1, nOpt2, nOptExpDays) ;
|
|
||||||
// verifico validità chiave con licenza
|
|
||||||
if ( nRet != KEY_OK || nOptExpDays < GetCurrDay())
|
|
||||||
return false ;
|
|
||||||
// verifico le opzioni (nOptInd = 100 -> bit 0 di Opt1 ... = 200 -> bit 0 di Opt2 ... = 231 -> bit 31 di Opt2)
|
|
||||||
if ( nOptInd >= 100 && nOptInd <= 131) {
|
|
||||||
unsigned int nOptVal = ( 1 << ( nOptInd - 100)) ;
|
|
||||||
return ( ( nOpt1 & nOptVal) != 0) ;
|
|
||||||
}
|
|
||||||
else if ( nOptInd >= 200 && nOptInd <= 231) {
|
|
||||||
unsigned int nOptVal = ( 1 << ( nOptInd - 200)) ;
|
|
||||||
return ( ( nOpt2 & nOptVal) != 0) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -509,10 +435,6 @@ ExeGetVersionInfo( string& sVer, const char* szNewLine)
|
|||||||
sVer += szNewLine ;
|
sVer += szNewLine ;
|
||||||
sVer += MyGetEExVersion() ;
|
sVer += MyGetEExVersion() ;
|
||||||
}
|
}
|
||||||
if ( IsLoadedExch3dmDll()) {
|
|
||||||
sVer += szNewLine ;
|
|
||||||
sVer += MyGetEE3Version() ;
|
|
||||||
}
|
|
||||||
if ( IsLoadedMachKernelDll()) {
|
if ( IsLoadedMachKernelDll()) {
|
||||||
sVer += szNewLine ;
|
sVer += szNewLine ;
|
||||||
sVer += MyGetEMkVersion() ;
|
sVer += MyGetEMkVersion() ;
|
||||||
@@ -556,7 +478,7 @@ bool
|
|||||||
ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev)
|
ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev)
|
||||||
{
|
{
|
||||||
// verifico la chiave e il livello
|
// verifico la chiave e il livello
|
||||||
int nRet = GetKeyLevelEx( s_sKey, nProd, nVer, nLev, nKLev, s_nKeyExpDays, s_nKeyAssExpDays) ;
|
int nRet = GetKeyLevel( s_sKey, nProd, nVer, nLev, nKLev, s_nKeyExpDays) ;
|
||||||
SetEGnKeyLevel( nRet, nKLev, s_nKeyExpDays) ;
|
SetEGnKeyLevel( nRet, nKLev, s_nKeyExpDays) ;
|
||||||
if ( nRet != KEY_OK) {
|
if ( nRet != KEY_OK) {
|
||||||
string sErr = "Error on Key (EGKL/" + ToString( nRet) + ")" ;
|
string sErr = "Error on Key (EGKL/" + ToString( nRet) + ")" ;
|
||||||
@@ -564,6 +486,7 @@ ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev)
|
|||||||
nKLev = - nRet ;
|
nKLev = - nRet ;
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,6 +510,7 @@ ExeGetKeyOptions( int nProd, int nVer, int nLev, unsigned int& nOpt2)
|
|||||||
LOG_ERROR( s_pGenLog, sErr.c_str()) ;
|
LOG_ERROR( s_pGenLog, sErr.c_str()) ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,16 +524,6 @@ ExeGetKeyLeftDays( int& nLeftDays)
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeGetKeyAssLeftDays( int& nAssLeftDays)
|
|
||||||
{
|
|
||||||
if ( s_nKeyAssExpDays == 0)
|
|
||||||
return false ;
|
|
||||||
nAssLeftDays = s_nKeyAssExpDays - GetCurrDay() ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeGetKeyOptLeftDays( int& nOptLeftDays)
|
ExeGetKeyOptLeftDays( int& nOptLeftDays)
|
||||||
|
|||||||
+648
-825
File diff suppressed because it is too large
Load Diff
@@ -277,8 +277,6 @@ ExeNewFile( void)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// scrivo il log
|
|
||||||
LOG_INFO( GetLogger(), "New File") ;
|
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -318,11 +316,6 @@ ExeOpenFile( const string& sFilePath)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// scrivo il log
|
|
||||||
{
|
|
||||||
string sLog = "Open File " + sFilePath ;
|
|
||||||
LOG_INFO( GetLogger(), sLog.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -454,11 +447,6 @@ ExeSaveFile( const string& sFilePath, int nFlag)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// scrivo il log
|
|
||||||
{
|
|
||||||
string sLog = "Saved File " + sFilePath ;
|
|
||||||
LOG_INFO( GetLogger(), sLog.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-99
@@ -284,26 +284,6 @@ ExeRemoveMachGroup( int nMGroupId)
|
|||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeChangeMachGroupName( int nId, const string& sNewName)
|
|
||||||
{
|
|
||||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
|
||||||
VERIFY_MACHMGR( pMachMgr, false)
|
|
||||||
// cambia il nome della macchinata
|
|
||||||
bool bOk = pMachMgr->ChangeMachGroupName( nId, sNewName) ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtChangeMachGroupName(" + ToString( nId) + ",'" +
|
|
||||||
sNewName + "')" +
|
|
||||||
" -- Ok=" + ToString( bOk) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco il risultato
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeGetMachGroupName( int nId, string& sName)
|
ExeGetMachGroupName( int nId, string& sName)
|
||||||
@@ -331,8 +311,8 @@ int
|
|||||||
ExeGetMachGroupId( const string& sName)
|
ExeGetMachGroupId( const string& sName)
|
||||||
{
|
{
|
||||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||||
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
VERIFY_MACHMGR( pMachMgr, false)
|
||||||
// recupero l'identificativo della macchinata
|
// recupero l'indice della macchinata
|
||||||
return pMachMgr->GetMachGroupId( sName) ;
|
return pMachMgr->GetMachGroupId( sName) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,16 +373,16 @@ ExeAddPhase( void)
|
|||||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||||
VERIFY_MACHMGR( pMachMgr, 0)
|
VERIFY_MACHMGR( pMachMgr, 0)
|
||||||
// aggiungo una nuova fase di lavorazione alla macchinata corrente
|
// aggiungo una nuova fase di lavorazione alla macchinata corrente
|
||||||
int nInd = pMachMgr->AddPhase() ;
|
int nId = pMachMgr->AddPhase() ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
string sLua = "EgtAddPhase()"
|
string sLua = "EgtAddPhase()"
|
||||||
" -- Ind=" + ToString( nInd) ;
|
" -- Id=" + ToString( nId) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
return nInd ;
|
return nId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -491,7 +471,7 @@ bool
|
|||||||
ExeIsRawPart( int nRawId)
|
ExeIsRawPart( int nRawId)
|
||||||
{
|
{
|
||||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||||
VERIFY_MACHMGR( pMachMgr, false)
|
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
||||||
// verifico se è un grezzo della macchinata corrente
|
// verifico se è un grezzo della macchinata corrente
|
||||||
return pMachMgr->IsRawPart( nRawId) ;
|
return pMachMgr->IsRawPart( nRawId) ;
|
||||||
}
|
}
|
||||||
@@ -1605,16 +1585,6 @@ ExeFindToolInCurrSetup( const string& sTool)
|
|||||||
return pMachMgr->FindToolInCurrSetup( sTool) ;
|
return pMachMgr->FindToolInCurrSetup( sTool) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeGetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos)
|
|
||||||
{
|
|
||||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
|
||||||
VERIFY_MACHMGR( pMachMgr, false)
|
|
||||||
// eseguo la verifica
|
|
||||||
return pMachMgr->GetToolSetupPosInCurrSetup( sTool, sTcPos) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeGetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools)
|
ExeGetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools)
|
||||||
@@ -2896,12 +2866,12 @@ ExeGetClEntMove( int nEntId, int& nMove)
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeGetClEntFlag( int nEntId, int& nFlag, int& nFlag2)
|
ExeGetClEntFlag( int nEntId, int& nFlag)
|
||||||
{
|
{
|
||||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||||
VERIFY_MACHMGR( pMachMgr, false)
|
VERIFY_MACHMGR( pMachMgr, false)
|
||||||
// recupero i flag
|
// recupero il flag
|
||||||
return pMachMgr->GetClEntFlag( nEntId, nFlag, nFlag2) ;
|
return pMachMgr->GetClEntFlag( nEntId, nFlag) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -2914,26 +2884,6 @@ ExeGetClEntIndex( int nEntId, int& nIndex)
|
|||||||
return pMachMgr->GetClEntIndex( nEntId, nIndex) ;
|
return pMachMgr->GetClEntIndex( nEntId, nIndex) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeGetClEntAxesMask( int nEntId, int& nMask)
|
|
||||||
{
|
|
||||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
|
||||||
VERIFY_MACHMGR( pMachMgr, false)
|
|
||||||
// recupero la mascheratura del movimento assi
|
|
||||||
return pMachMgr->GetClEntAxesMask( nEntId, nMask) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeGetClEntAxesVal( int nEntId, DBLVECTOR& vAxes)
|
|
||||||
{
|
|
||||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
|
||||||
VERIFY_MACHMGR( pMachMgr, false)
|
|
||||||
// recupero il valore degli assi
|
|
||||||
return pMachMgr->GetClEntAxesVal( nEntId, vAxes) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Simulazione
|
// Simulazione
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -3222,16 +3172,6 @@ ExeSetRotAxisBlock( const string& sAxis, double dVal)
|
|||||||
return pMachMgr->SetRotAxisBlock( sAxis, dVal) ;
|
return pMachMgr->SetRotAxisBlock( sAxis, dVal) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeGetCalcTable( string& sTable)
|
|
||||||
{
|
|
||||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
|
||||||
VERIFY_MACHMGR( pMachMgr, false)
|
|
||||||
// restituisco la tavola corrente per il calcolo sulla macchina della macchinata corrente
|
|
||||||
return pMachMgr->GetCalcTable( sTable) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeGetCalcTool( string& sTool, string& sHead, int& nExit)
|
ExeGetCalcTool( string& sTool, string& sHead, int& nExit)
|
||||||
@@ -3242,16 +3182,6 @@ ExeGetCalcTool( string& sTool, string& sHead, int& nExit)
|
|||||||
return ( pMachMgr->GetCalcTool( sTool) && pMachMgr->GetCalcHead( sHead) && pMachMgr->GetCalcExit( nExit)) ;
|
return ( pMachMgr->GetCalcTool( sTool) && pMachMgr->GetCalcHead( sHead) && pMachMgr->GetCalcExit( nExit)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeGetAllCurrAxesNames( STRVECTOR& vAxName)
|
|
||||||
{
|
|
||||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
|
||||||
VERIFY_MACHMGR( pMachMgr, false)
|
|
||||||
// recupero gli assi correnti derivanti dalla scelta di tavola e utensile
|
|
||||||
return pMachMgr->GetAllCurrAxesNames( vAxName) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeGetRotAxisBlocked( int nInd, string& sAxis, double& dVal)
|
ExeGetRotAxisBlocked( int nInd, string& sAxis, double& dVal)
|
||||||
@@ -3421,16 +3351,6 @@ ExeGetHeadExitCount( const string& sHead)
|
|||||||
return pMachMgr->GetHeadExitCount( sHead) ;
|
return pMachMgr->GetHeadExitCount( sHead) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeGetExitId( const string& sHead, int nExit)
|
|
||||||
{
|
|
||||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
|
||||||
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
|
||||||
// restituisco identificativo dell'uscita della testa indicata nella macchina della macchinata corrente
|
|
||||||
return pMachMgr->GetExitId( sHead, nExit) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeGetTcPosId( const string& sTcPos)
|
ExeGetTcPosId( const string& sTcPos)
|
||||||
@@ -3491,16 +3411,6 @@ ExeGetAllTablesNames( STRVECTOR& vNames)
|
|||||||
return pMachMgr->GetAllTablesNames( vNames) ;
|
return pMachMgr->GetAllTablesNames( vNames) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeGetAllAxesNames( STRVECTOR& vNames)
|
|
||||||
{
|
|
||||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
|
||||||
VERIFY_MACHMGR( pMachMgr, false)
|
|
||||||
// recupero l'elenco degli assi
|
|
||||||
return pMachMgr->GetAllAxesNames( vNames) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeGetAllHeadsNames( STRVECTOR& vNames)
|
ExeGetAllHeadsNames( STRVECTOR& vNames)
|
||||||
|
|||||||
@@ -1613,50 +1613,6 @@ ExeCalcFlatPartUpRegion( int nPartId, bool bCalc)
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static bool
|
|
||||||
IgnoreOutlineFillet( IGeomDB* pGeomDB, int nCrvId, int nLayId)
|
|
||||||
{
|
|
||||||
// verifico se la curva nCrvId è un raccordo che deve essere ignorato, ovvero se si tratta di un arco non inclinato, in tangenza
|
|
||||||
// e consecutivo ad almeno un lato inclinato
|
|
||||||
|
|
||||||
// verifico se arco
|
|
||||||
if ( pGeomDB->GetGeoType( nCrvId) == CRV_ARC) {
|
|
||||||
// verifico se non inclinato
|
|
||||||
double dSideAng = 0, dSideAng2 = 0 ;
|
|
||||||
pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) ;
|
|
||||||
pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) ;
|
|
||||||
if ( abs( dSideAng) < EPS_ANG_SMALL && abs( dSideAng2) < EPS_ANG_SMALL) {
|
|
||||||
// verifico se in tangenza con curve consecutive
|
|
||||||
double dPrevAng = ANG_RIGHT, dNextAng = ANG_RIGHT ;
|
|
||||||
pGeomDB->GetInfo( nCrvId, MCH_KEY_PREVANG, dPrevAng) ;
|
|
||||||
pGeomDB->GetInfo( nCrvId, MCH_KEY_NEXTANG, dNextAng) ;
|
|
||||||
if ( abs( dPrevAng) < EPS_ANG_SMALL && abs( dNextAng) < EPS_ANG_SMALL) {
|
|
||||||
// verifico se è inclinata almeno una tra la curva precedente e quella successiva
|
|
||||||
int nPrevId = pGeomDB->GetPrev( nCrvId) ;
|
|
||||||
if ( nPrevId == GDB_ID_NULL)
|
|
||||||
nPrevId = pGeomDB->GetLastInGroup( nLayId) ;
|
|
||||||
if ( nPrevId == GDB_ID_NULL)
|
|
||||||
return false ;
|
|
||||||
double dSideAng, dSideAng2 ;
|
|
||||||
if ( ( pGeomDB->GetInfo( nPrevId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) ||
|
|
||||||
( pGeomDB->GetInfo( nPrevId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL))
|
|
||||||
return true ;
|
|
||||||
|
|
||||||
int nNextId = pGeomDB->GetNext( nCrvId) ;
|
|
||||||
if ( nNextId == GDB_ID_NULL)
|
|
||||||
nNextId = pGeomDB->GetFirstInGroup( nLayId) ;
|
|
||||||
if ( nNextId == GDB_ID_NULL)
|
|
||||||
return false ;
|
|
||||||
if ( ( pGeomDB->GetInfo( nNextId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) ||
|
|
||||||
( pGeomDB->GetInfo( nNextId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL))
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static bool
|
static bool
|
||||||
AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOrig, int nLayReg, double dH)
|
AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOrig, int nLayReg, double dH)
|
||||||
@@ -1727,8 +1683,7 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
|||||||
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
||||||
if ( pCrv == nullptr)
|
if ( pCrv == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
if ( ! pCrv->SimpleOffset( dCalcOffset))
|
pCrv->SimpleOffset( dCalcOffset) ;
|
||||||
pGeomDB->Erase( nNewId) ;
|
|
||||||
}
|
}
|
||||||
else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) {
|
else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) {
|
||||||
double dOffset2 = 0 ;
|
double dOffset2 = 0 ;
|
||||||
@@ -1741,12 +1696,8 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
|||||||
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
||||||
if ( pCrv == nullptr)
|
if ( pCrv == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
if ( ! pCrv->SimpleOffset( dCalcOffset))
|
pCrv->SimpleOffset( dCalcOffset) ;
|
||||||
pGeomDB->Erase( nNewId) ;
|
|
||||||
}
|
}
|
||||||
// verifico se raccordo da ignorare per poter calcolare la regione
|
|
||||||
else if ( IgnoreOutlineFillet( pGeomDB, nCrvId, nLayId))
|
|
||||||
pGeomDB->Erase( nNewId) ;
|
|
||||||
}
|
}
|
||||||
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
|
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
|
||||||
if ( ! AdjustLayerCurves( pGeomDB, nTmpLayId))
|
if ( ! AdjustLayerCurves( pGeomDB, nTmpLayId))
|
||||||
@@ -1769,7 +1720,7 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
|||||||
if ( nNewId == GDB_ID_NULL)
|
if ( nNewId == GDB_ID_NULL)
|
||||||
return false ;
|
return false ;
|
||||||
// determino ed eseguo offset
|
// determino ed eseguo offset
|
||||||
double dSideAng, dSideAng2 ;
|
double dSideAng ;
|
||||||
if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) {
|
if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) {
|
||||||
double dOffset = 0 ;
|
double dOffset = 0 ;
|
||||||
pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET, dOffset) ;
|
pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET, dOffset) ;
|
||||||
@@ -1777,22 +1728,8 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
|||||||
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
||||||
if ( pCrv == nullptr)
|
if ( pCrv == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
if ( ! pCrv->SimpleOffset( dCalcOffset))
|
pCrv->SimpleOffset( dCalcOffset) ;
|
||||||
pGeomDB->Erase( nNewId) ;
|
|
||||||
}
|
}
|
||||||
else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) {
|
|
||||||
double dOffset2 = 0 ;
|
|
||||||
pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET2, dOffset2) ;
|
|
||||||
double dCalcOffset = dOffset2 ;
|
|
||||||
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
|
||||||
if ( pCrv == nullptr)
|
|
||||||
return false ;
|
|
||||||
if ( ! pCrv->SimpleOffset( dCalcOffset))
|
|
||||||
pGeomDB->Erase( nNewId) ;
|
|
||||||
}
|
|
||||||
// verifico se raccordo da ignorare per poter calcolare la regione
|
|
||||||
else if ( IgnoreOutlineFillet( pGeomDB, nCrvId, nLayId))
|
|
||||||
pGeomDB->Erase( nNewId) ;
|
|
||||||
}
|
}
|
||||||
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
|
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
|
||||||
if ( ! AdjustLayerCurves( pGeomDB, nTmpLay2Id))
|
if ( ! AdjustLayerCurves( pGeomDB, nTmpLay2Id))
|
||||||
@@ -1832,13 +1769,10 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
|||||||
//if ( dStartProD > EPS_SMALL)
|
//if ( dStartProD > EPS_SMALL)
|
||||||
// pCrv->ExtendStartByLen( dStartProD) ;
|
// pCrv->ExtendStartByLen( dStartProD) ;
|
||||||
double dStartProMin = min( dStartProD, dStartProU) ;
|
double dStartProMin = min( dStartProD, dStartProU) ;
|
||||||
if ( dStartProMin < - EPS_SMALL) {
|
if ( dStartProMin < - EPS_SMALL)
|
||||||
pCrv->TrimStartAtLen( - dStartProMin) ;
|
pCrv->TrimStartAtLen( - dStartProMin) ;
|
||||||
if ( abs( dStartProD - dStartProU) > EPS_SMALL)
|
if ( abs( dStartProD - dStartProU) > EPS_SMALL)
|
||||||
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, abs( dStartProD - dStartProU)) ;
|
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, abs( dStartProD - dStartProU)) ;
|
||||||
}
|
|
||||||
else
|
|
||||||
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, max( dStartProD, dStartProU)) ;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( dStartProD < - EPS_SMALL)
|
if ( dStartProD < - EPS_SMALL)
|
||||||
@@ -1865,11 +1799,9 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
|||||||
double dLen ;
|
double dLen ;
|
||||||
pCrv->GetLength( dLen) ;
|
pCrv->GetLength( dLen) ;
|
||||||
pCrv->TrimEndAtLen( dLen + dEndProMin) ;
|
pCrv->TrimEndAtLen( dLen + dEndProMin) ;
|
||||||
if ( abs( dEndProD - dEndProU) > EPS_SMALL)
|
|
||||||
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, abs( dEndProD - dEndProU)) ;
|
|
||||||
}
|
}
|
||||||
else
|
if ( abs( dEndProD - dEndProU) > EPS_SMALL)
|
||||||
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, max( dEndProD, dEndProU)) ;
|
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, abs( dEndProD - dEndProU)) ;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( dEndProD < - EPS_SMALL) {
|
if ( dEndProD < - EPS_SMALL) {
|
||||||
|
|||||||
@@ -183,23 +183,10 @@ ExeSetGridGeo( double dSnapStep, int nMinLineSstep, int nMajLineSstep, int nExtS
|
|||||||
{
|
{
|
||||||
IEGrScene* pScene = GetCurrScene() ;
|
IEGrScene* pScene = GetCurrScene() ;
|
||||||
VERIFY_SCENE( pScene, false)
|
VERIFY_SCENE( pScene, false)
|
||||||
|
|
||||||
// imposto i parametri geometrici di griglia
|
// imposto i parametri geometrici di griglia
|
||||||
return pScene->SetGridGeo( dSnapStep, nMinLineSstep, nMajLineSstep, nExtSstep) ;
|
return pScene->SetGridGeo( dSnapStep, nMinLineSstep, nMajLineSstep, nExtSstep) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSetGridGeoAdv( double dSnapStep, int nMinLineSstep, int nMajLineSstep,
|
|
||||||
double dXmin, double dXmax, double dYmin, double dYmax)
|
|
||||||
{
|
|
||||||
IEGrScene* pScene = GetCurrScene() ;
|
|
||||||
VERIFY_SCENE( pScene, false)
|
|
||||||
|
|
||||||
// imposto i parametri geometrici di griglia
|
|
||||||
return pScene->SetGridGeoAdv( dSnapStep, nMinLineSstep, nMajLineSstep, dXmin, dXmax, dYmin, dYmax) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeSetGridColor( Color colMin, Color colMaj)
|
ExeSetGridColor( Color colMin, Color colMaj)
|
||||||
@@ -640,15 +627,6 @@ ExeZoomWin( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSetViewOrizzOffsStep( int nDirOffsStep)
|
|
||||||
{
|
|
||||||
IEGrScene* pScene = GetCurrScene() ;
|
|
||||||
VERIFY_SCENE( pScene, false)
|
|
||||||
return pScene->SetCameraDirOrizzOffset( nDirOffsStep) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeSetView( int nDir, bool bRedraw)
|
ExeSetView( int nDir, bool bRedraw)
|
||||||
@@ -718,19 +696,6 @@ ExeRotateView( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeGetViewOrizzOffsStep( int* pnDirOffsStep)
|
|
||||||
{
|
|
||||||
IEGrScene* pScene = GetCurrScene() ;
|
|
||||||
VERIFY_SCENE( pScene, false)
|
|
||||||
// recupero offset direzione di vista
|
|
||||||
if ( pnDirOffsStep == nullptr)
|
|
||||||
return false ;
|
|
||||||
*pnDirOffsStep = pScene->GetCameraDirOrizzOffset() ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeGetView( int* pnDir)
|
ExeGetView( int* pnDir)
|
||||||
|
|||||||
@@ -1,316 +0,0 @@
|
|||||||
//----------------------------------------------------------------------------
|
|
||||||
// EgalTech 2024-2024
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// File : EXE_TestObjSurface.cpp Data : 24.03.24 Versione : 2.6c2
|
|
||||||
// Contenuto : Funzioni per verificare collisioni tra
|
|
||||||
// Objects e Superfici (TriMesh).
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Modifiche : 09.01.20 DS Creazione modulo.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//--------------------------- Include ----------------------------------------
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "EXE.h"
|
|
||||||
#include "EXE_Macro.h"
|
|
||||||
#include "EXE_Const.h"
|
|
||||||
#include "AuxTools.h"
|
|
||||||
#include "GeoTools.h"
|
|
||||||
#include "/EgtDev/Include/EXeExecutor.h"
|
|
||||||
#include "/EgtDev/Include/EXeConst.h"
|
|
||||||
#include "/EgtDev/Include/EGkCDeBoxClosedSurfTm.h"
|
|
||||||
#include "/EgtDev/Include/EGkCDeRectPrismoidClosedSurfTm.h"
|
|
||||||
#include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h"
|
|
||||||
#include "/EgtDev/Include/EGkCDeConeFrustumClosedSurfTm.h"
|
|
||||||
#include "/EgtDev/Include/EGkCDeSpheClosedSurfTm.h"
|
|
||||||
#include "/EgtDev/Include/EGkCDeClosedSurfTmClosedSurfTm.h"
|
|
||||||
#include "/EgtDev/Include/EGkSurfLocal.h"
|
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
|
||||||
|
|
||||||
using namespace std ;
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
MyTestBoxSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, int nSurfTmId, double dSafeDist, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, -1)
|
|
||||||
// recupero la superficie TriMesh
|
|
||||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
|
|
||||||
if ( pStm == nullptr)
|
|
||||||
return -1 ;
|
|
||||||
// recupero il riferimento della superficie
|
|
||||||
Frame3d frSurf ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
|
|
||||||
return -1 ;
|
|
||||||
// porto in locale alla superficie il riferimento del box (il vettore è già in questo stesso riferimento)
|
|
||||||
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frSurf) ;
|
|
||||||
// verifico l'a collisione'interferenza
|
|
||||||
return ( TestBoxSurfTm( frBoxL, vtDiag, *pStm, dSafeDist) ? 1 : 0) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeTestBoxSurface( const Frame3d& frBox, const Vector3d& vtDiag, int nSurfId, double dSafeDist, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
int nRes = -1 ;
|
|
||||||
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSurfId) == SRF_TRIMESH)
|
|
||||||
nRes = MyTestBoxSurfTm( frBox, vtDiag, nSurfId, dSafeDist, nRefType) ;
|
|
||||||
// è da aggiungere il test con le superfici di Bezier
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtTestBoxSurface({{" + ToString( frBox.Orig()) + "},{" +
|
|
||||||
ToString( frBox.VersX()) + "},{" +
|
|
||||||
ToString( frBox.VersY()) + "},{" +
|
|
||||||
ToString( frBox.VersZ()) + "}},{" +
|
|
||||||
ToString( vtDiag) + "}," +
|
|
||||||
IdToString( nSurfId) + "," +
|
|
||||||
ToString( dSafeDist) + "," +
|
|
||||||
RefTypeToString( nRefType) + ")" +
|
|
||||||
" -- Res=" + ToString( nRes) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco risultato
|
|
||||||
return nRes ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
MyTestRectPrismoidSurfTm( const Frame3d& frPrismoid, double dBaseLenX, double dBaseLenY,
|
|
||||||
double dTopLenX, double dTopLenY, double dHeight,
|
|
||||||
int nSurfTmId, double dSafeDist, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, -1)
|
|
||||||
// recupero la superficie TriMesh
|
|
||||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
|
|
||||||
if ( pStm == nullptr)
|
|
||||||
return -1 ;
|
|
||||||
// recupero il riferimento della superficie
|
|
||||||
Frame3d frSurf ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
|
|
||||||
return -1 ;
|
|
||||||
// porto in locale alla superficie il riferimento del prismoide rettangolare
|
|
||||||
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frSurf) ;
|
|
||||||
// verifico l'a collisione'interferenza
|
|
||||||
return ( TestRectPrismoidSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, *pStm, dSafeDist) ? 1 : 0) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeTestRectPrismoidSurface( const Frame3d& frPrismoid, double dBaseLenX, double dBaseLenY,
|
|
||||||
double dTopLenX, double dTopLenY, double dHeight,
|
|
||||||
int nSurfId, double dSafeDist, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
int nRes = -1 ;
|
|
||||||
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSurfId) == SRF_TRIMESH)
|
|
||||||
nRes = MyTestRectPrismoidSurfTm( frPrismoid, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, nSurfId, dSafeDist, nRefType) ;
|
|
||||||
// è da aggiungere il test con le superfici di Bezier
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtTestRectPrismoidSurface({{" + ToString( frPrismoid.Orig()) + "},{" +
|
|
||||||
ToString( frPrismoid.VersX()) + "},{" +
|
|
||||||
ToString( frPrismoid.VersY()) + "},{" +
|
|
||||||
ToString( frPrismoid.VersZ()) + "}}," +
|
|
||||||
ToString( dBaseLenX) + "," +
|
|
||||||
ToString( dBaseLenY) + "," +
|
|
||||||
ToString( dTopLenX) + "," +
|
|
||||||
ToString( dTopLenY) + "," +
|
|
||||||
ToString( dHeight) + "," +
|
|
||||||
IdToString( nSurfId) + "," +
|
|
||||||
ToString( dSafeDist) + "," +
|
|
||||||
RefTypeToString( nRefType) + ")" +
|
|
||||||
" -- Res=" + ToString( nRes) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco risultato
|
|
||||||
return nRes ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
MyTestCylSurfTm( const Frame3d& frCyl, double dR, double dH, int nSurfTmId, double dSafeDist, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, -1)
|
|
||||||
// recupero la superficie TriMesh
|
|
||||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
|
|
||||||
if ( pStm == nullptr)
|
|
||||||
return -1 ;
|
|
||||||
// recupero il riferimento della superficie
|
|
||||||
Frame3d frSurf ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
|
|
||||||
return -1 ;
|
|
||||||
// porto in locale alla superficie il riferimento del cilindro
|
|
||||||
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frSurf) ;
|
|
||||||
// verifico l'interferenza
|
|
||||||
return ( TestCylSurfTm( frCylL, dR, dH, *pStm, dSafeDist) ? 1 : 0) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeTestCylSurface( const Frame3d& frCyl, double dR, double dH, int nSurfId, double dSafeDist, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
int nRes = -1 ;
|
|
||||||
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSurfId) == SRF_TRIMESH)
|
|
||||||
nRes = MyTestCylSurfTm( frCyl, dR, dH, nSurfId, dSafeDist, nRefType) ;
|
|
||||||
// è da aggiungere il test con le superfici di Bezier
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtTestCylSurface({{" + ToString( frCyl.Orig()) + "},{" +
|
|
||||||
ToString( frCyl.VersX()) + "},{" +
|
|
||||||
ToString( frCyl.VersY()) + "},{" +
|
|
||||||
ToString( frCyl.VersZ()) + "}}," +
|
|
||||||
ToString( dR) + "," +
|
|
||||||
ToString( dH) + "," +
|
|
||||||
IdToString( nSurfId) + "," +
|
|
||||||
ToString( dSafeDist) + "," +
|
|
||||||
RefTypeToString( nRefType) + ")" +
|
|
||||||
" -- Res=" + ToString( nRes) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco risultato
|
|
||||||
return nRes ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
MyTestConeSurfTm( const Frame3d& frCone, double dR1, double dR2, double dH, int nSurfTmId, double dSafeDist, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, -1)
|
|
||||||
// recupero la superficie TriMesh
|
|
||||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
|
|
||||||
if ( pStm == nullptr)
|
|
||||||
return -1 ;
|
|
||||||
// recupero il riferimento della superficie
|
|
||||||
Frame3d frSurf ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
|
|
||||||
return -1 ;
|
|
||||||
// porto in locale alla superficie il riferimento del cilindro
|
|
||||||
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frSurf) ;
|
|
||||||
// verifico l'interferenza
|
|
||||||
return ( TestConeFrustumSurfTm( frConeL, dR1, dR2, dH, *pStm, dSafeDist) ? 1 : 0) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeTestConeSurface( const Frame3d& frCone, double dR1, double dR2, double dH, int nSurfId, double dSafeDist, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
int nRes = -1 ;
|
|
||||||
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSurfId) == SRF_TRIMESH)
|
|
||||||
nRes = MyTestConeSurfTm( frCone, dR1, dR2, dH, nSurfId, dSafeDist, nRefType) ;
|
|
||||||
// è da aggiungere il test con le superfici di Bezier
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtTestConeSurface({{" + ToString( frCone.Orig()) + "},{" +
|
|
||||||
ToString( frCone.VersX()) + "},{" +
|
|
||||||
ToString( frCone.VersY()) + "},{" +
|
|
||||||
ToString( frCone.VersZ()) + "}}," +
|
|
||||||
ToString( dR1) + "," +
|
|
||||||
ToString( dR2) + "," +
|
|
||||||
ToString( dH) + "," +
|
|
||||||
IdToString( nSurfId) + "," +
|
|
||||||
ToString( dSafeDist) + "," +
|
|
||||||
RefTypeToString( nRefType) + ")" +
|
|
||||||
" -- Res=" + ToString( nRes) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco risultato
|
|
||||||
return nRes ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
MyTestSpheSurfTm( const Point3d& ptCen, double dR, int nSurfTmId, double dSafeDist, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, -1)
|
|
||||||
// recupero la superficie TriMesh
|
|
||||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
|
|
||||||
if ( pStm == nullptr)
|
|
||||||
return -1 ;
|
|
||||||
// recupero il riferimento della superficie
|
|
||||||
Frame3d frSurf ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
|
|
||||||
return -1 ;
|
|
||||||
// porto in locale alla superficie il centro della sfera
|
|
||||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ;
|
|
||||||
// verifico l'a collisione'interferenza
|
|
||||||
return ( TestSpheSurfTm( ptCenL, dR, *pStm, dSafeDist) ? 1 : 0) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeTestSpheSurface( const Point3d& ptCen, double dR, int nSurfId, double dSafeDist, int nRefType)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
int nRes = -1 ;
|
|
||||||
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSurfId) == SRF_TRIMESH)
|
|
||||||
nRes = MyTestSpheSurfTm( ptCen, dR, nSurfId, dSafeDist, nRefType) ;
|
|
||||||
// è da aggiungere il test con le superfici di Bezier
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtTestSpheSurface({" + ToString( ptCen) + "}," +
|
|
||||||
ToString( dR) + "," +
|
|
||||||
IdToString( nSurfId) + "," +
|
|
||||||
ToString( dSafeDist) + "," +
|
|
||||||
RefTypeToString( nRefType) + ")" +
|
|
||||||
" -- Res=" + ToString( nRes) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco risultato
|
|
||||||
return nRes ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
MyTestSurfTmSurfTm( int nSurfTm1Id, int nSurfTm2Id, double dSafeDist)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, -1)
|
|
||||||
// recupero il riferimento della seconda superficie
|
|
||||||
Frame3d frSurf2 ;
|
|
||||||
if ( ! pGeomDB->GetGlobFrame( nSurfTm2Id, frSurf2))
|
|
||||||
return -1 ;
|
|
||||||
// recupero la prima superficie in locale alla seconda
|
|
||||||
SurfLocal Surf1Loc( pGeomDB, nSurfTm1Id, frSurf2) ;
|
|
||||||
const ISurfTriMesh* pStm1 = GetSurfTriMesh( Surf1Loc) ;
|
|
||||||
if ( pStm1 == nullptr)
|
|
||||||
return -1 ;
|
|
||||||
// recupero la seconda superficie TriMesh
|
|
||||||
const ISurfTriMesh* pStm2 = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTm2Id)) ;
|
|
||||||
if ( pStm2 == nullptr)
|
|
||||||
return -1 ;
|
|
||||||
// verifico l'a collisione'interferenza
|
|
||||||
return ( TestSurfTmSurfTm( *pStm1, *pStm2, dSafeDist) ? 1 : 0) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeTestSurfaceSurface( int nSurf1Id, int nSurf2Id, double dSafeDist)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
int nRes = -1 ;
|
|
||||||
if ( pGeomDB != nullptr) {
|
|
||||||
if ( pGeomDB->GetGeoType( nSurf1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSurf2Id) == SRF_TRIMESH)
|
|
||||||
nRes = MyTestSurfTmSurfTm( nSurf1Id, nSurf2Id, dSafeDist) ;
|
|
||||||
// è da aggiungere il test con le superfici di Bezier
|
|
||||||
}
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtTestSurfaceSurface({" + IdToString( nSurf1Id) + "," +
|
|
||||||
IdToString( nSurf2Id) + "," +
|
|
||||||
ToString( dSafeDist) + ")" +
|
|
||||||
" -- Res=" + ToString( nRes) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco risultato
|
|
||||||
return nRes ;
|
|
||||||
}
|
|
||||||
Binary file not shown.
+1
-7
@@ -200,7 +200,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
|||||||
<OpenMPSupport>false</OpenMPSupport>
|
<OpenMPSupport>false</OpenMPSupport>
|
||||||
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
||||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -228,7 +228,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClInclude Include="..\Include\EXeConst.h" />
|
<ClInclude Include="..\Include\EXeConst.h" />
|
||||||
<ClInclude Include="..\Include\EXeDllMain.h" />
|
<ClInclude Include="..\Include\EXeDllMain.h" />
|
||||||
<ClInclude Include="..\Include\EXeExecutor.h" />
|
<ClInclude Include="..\Include\EXeExecutor.h" />
|
||||||
<ClInclude Include="DllExch3dm.h" />
|
|
||||||
<ClInclude Include="DllMain.h" />
|
<ClInclude Include="DllMain.h" />
|
||||||
<ClInclude Include="DllNesting.h" />
|
<ClInclude Include="DllNesting.h" />
|
||||||
<ClInclude Include="EXE.h" />
|
<ClInclude Include="EXE.h" />
|
||||||
@@ -249,7 +248,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="DllExch3dm.cpp" />
|
|
||||||
<ClCompile Include="DllNesting.cpp" />
|
<ClCompile Include="DllNesting.cpp" />
|
||||||
<ClCompile Include="EXE_BeamMgr.cpp" />
|
<ClCompile Include="EXE_BeamMgr.cpp" />
|
||||||
<ClCompile Include="EXE_CAvTool.cpp" />
|
<ClCompile Include="EXE_CAvTool.cpp" />
|
||||||
@@ -257,7 +255,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClCompile Include="EXE_GdbCreateVol.cpp" />
|
<ClCompile Include="EXE_GdbCreateVol.cpp" />
|
||||||
<ClCompile Include="EXE_GdbGet.cpp" />
|
<ClCompile Include="EXE_GdbGet.cpp" />
|
||||||
<ClCompile Include="EXE_GdbGetCurve.cpp" />
|
<ClCompile Include="EXE_GdbGetCurve.cpp" />
|
||||||
<ClCompile Include="EXE_GdbGetPocketing.cpp" />
|
|
||||||
<ClCompile Include="EXE_GdbGetSurf.cpp" />
|
<ClCompile Include="EXE_GdbGetSurf.cpp" />
|
||||||
<ClCompile Include="EXE_GdbGetVol.cpp" />
|
<ClCompile Include="EXE_GdbGetVol.cpp" />
|
||||||
<ClCompile Include="EXE_GdbModifyVol.cpp" />
|
<ClCompile Include="EXE_GdbModifyVol.cpp" />
|
||||||
@@ -293,7 +290,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClCompile Include="EXE_Picture.cpp" />
|
<ClCompile Include="EXE_Picture.cpp" />
|
||||||
<ClCompile Include="EXE_Scene.cpp" />
|
<ClCompile Include="EXE_Scene.cpp" />
|
||||||
<ClCompile Include="EXE_ShortestPath.cpp" />
|
<ClCompile Include="EXE_ShortestPath.cpp" />
|
||||||
<ClCompile Include="EXE_TestObjSurface.cpp" />
|
|
||||||
<ClCompile Include="EXE_TscExec.cpp" />
|
<ClCompile Include="EXE_TscExec.cpp" />
|
||||||
<ClCompile Include="AuxTools.cpp" />
|
<ClCompile Include="AuxTools.cpp" />
|
||||||
<ClCompile Include="DllExchange.cpp" />
|
<ClCompile Include="DllExchange.cpp" />
|
||||||
@@ -309,7 +305,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClCompile Include="LUA_CDeObjSolid.cpp" />
|
<ClCompile Include="LUA_CDeObjSolid.cpp" />
|
||||||
<ClCompile Include="LUA_GdbGet.cpp" />
|
<ClCompile Include="LUA_GdbGet.cpp" />
|
||||||
<ClCompile Include="LUA_GdbGetCurve.cpp" />
|
<ClCompile Include="LUA_GdbGetCurve.cpp" />
|
||||||
<ClCompile Include="LUA_GdbGetPocketing.cpp" />
|
|
||||||
<ClCompile Include="LUA_GdbGetSurf.cpp" />
|
<ClCompile Include="LUA_GdbGetSurf.cpp" />
|
||||||
<ClCompile Include="LUA_GdbGetVol.cpp" />
|
<ClCompile Include="LUA_GdbGetVol.cpp" />
|
||||||
<ClCompile Include="LUA_GeoDist.cpp" />
|
<ClCompile Include="LUA_GeoDist.cpp" />
|
||||||
@@ -317,7 +312,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClCompile Include="LUA_MaxFiller.cpp" />
|
<ClCompile Include="LUA_MaxFiller.cpp" />
|
||||||
<ClCompile Include="LUA_Picture.cpp" />
|
<ClCompile Include="LUA_Picture.cpp" />
|
||||||
<ClCompile Include="LUA_PolynomialRoots.cpp" />
|
<ClCompile Include="LUA_PolynomialRoots.cpp" />
|
||||||
<ClCompile Include="LUA_TestObjSurface.cpp" />
|
|
||||||
<ClCompile Include="PictureObj.cpp" />
|
<ClCompile Include="PictureObj.cpp" />
|
||||||
<ClCompile Include="LUA_Base.cpp" />
|
<ClCompile Include="LUA_Base.cpp" />
|
||||||
<ClCompile Include="LUA_GdbCreateCurve.cpp" />
|
<ClCompile Include="LUA_GdbCreateCurve.cpp" />
|
||||||
|
|||||||
@@ -108,9 +108,6 @@
|
|||||||
<ClInclude Include="DllNesting.h">
|
<ClInclude Include="DllNesting.h">
|
||||||
<Filter>File di intestazione</Filter>
|
<Filter>File di intestazione</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="DllExch3dm.h">
|
|
||||||
<Filter>File di intestazione</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="LUA_Exchange.cpp">
|
<ClCompile Include="LUA_Exchange.cpp">
|
||||||
@@ -392,21 +389,6 @@
|
|||||||
<ClCompile Include="EXE_Mutex.cpp">
|
<ClCompile Include="EXE_Mutex.cpp">
|
||||||
<Filter>File di origine\EXE</Filter>
|
<Filter>File di origine\EXE</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="DllExch3dm.cpp">
|
|
||||||
<Filter>File di origine\Optional Dll</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="EXE_GdbGetPocketing.cpp">
|
|
||||||
<Filter>File di origine\EXE</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="LUA_GdbGetPocketing.cpp">
|
|
||||||
<Filter>File di origine\LUA</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="EXE_TestObjSurface.cpp">
|
|
||||||
<Filter>File di origine\EXE</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="LUA_TestObjSurface.cpp">
|
|
||||||
<Filter>File di origine\LUA</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="EgtExecutor.rc">
|
<ResourceCompile Include="EgtExecutor.rc">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2014-2024
|
// EgalTech 2014-2015
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : LUA.h Data : 24.03.24 Versione : 2.6c2
|
// File : LUA.h Data : 16.01.15 Versione : 1.6a3
|
||||||
// Contenuto : Dichiarazioni locali per moduli LUA.
|
// Contenuto : Dichiarazioni locali per moduli LUA.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -54,9 +54,6 @@ bool LuaInstallGdbModifyVol( LuaMgr& luaMgr) ;
|
|||||||
//-------------------------- GdbGet ------------------------------------------
|
//-------------------------- GdbGet ------------------------------------------
|
||||||
bool LuaInstallGdbGet( LuaMgr& luaMgr) ;
|
bool LuaInstallGdbGet( LuaMgr& luaMgr) ;
|
||||||
|
|
||||||
//-------------------------- GdbGetPocketing ---------------------------------
|
|
||||||
bool LuaInstallGdbGetPocketing( LuaMgr& luaMgr) ;
|
|
||||||
|
|
||||||
//-------------------------- GdbGetCurve -------------------------------------
|
//-------------------------- GdbGetCurve -------------------------------------
|
||||||
bool LuaInstallGdbGetCurve( LuaMgr& luaMgr) ;
|
bool LuaInstallGdbGetCurve( LuaMgr& luaMgr) ;
|
||||||
|
|
||||||
@@ -65,7 +62,7 @@ bool LuaInstallGdbGetSurf( LuaMgr& luaMgr) ;
|
|||||||
|
|
||||||
//-------------------------- GdbGetVol ---------------------------------------
|
//-------------------------- GdbGetVol ---------------------------------------
|
||||||
bool LuaInstallGdbGetVol( LuaMgr& luaMgr) ;
|
bool LuaInstallGdbGetVol( LuaMgr& luaMgr) ;
|
||||||
|
|
||||||
//-------------------------- GdbPartLayer ------------------------------------
|
//-------------------------- GdbPartLayer ------------------------------------
|
||||||
bool LuaInstallGdbPartLayer( LuaMgr& luaMgr) ;
|
bool LuaInstallGdbPartLayer( LuaMgr& luaMgr) ;
|
||||||
|
|
||||||
@@ -93,9 +90,6 @@ bool LuaInstallGeoInters( LuaMgr& luaMgr) ;
|
|||||||
//-------------------------- Collision Detection -----------------------------
|
//-------------------------- Collision Detection -----------------------------
|
||||||
bool LuaInstallCDeObjSolid( LuaMgr& luaMgr) ;
|
bool LuaInstallCDeObjSolid( LuaMgr& luaMgr) ;
|
||||||
|
|
||||||
//-------------------------- Test Interference -------------------------------
|
|
||||||
bool LuaInstallTestObjSurface( LuaMgr& luaMgr) ;
|
|
||||||
|
|
||||||
//-------------------------- MachMgr -----------------------------------------
|
//-------------------------- MachMgr -----------------------------------------
|
||||||
bool LuaInstallMachMgr( LuaMgr& luaMgr) ;
|
bool LuaInstallMachMgr( LuaMgr& luaMgr) ;
|
||||||
|
|
||||||
|
|||||||
@@ -78,10 +78,6 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
|
|||||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGet (LuaInstallEgtFunctions)")
|
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGet (LuaInstallEgtFunctions)")
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
if ( ! LuaInstallGdbGetPocketing( LuaMgr)) {
|
|
||||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGetPocketing (LuaInstallEgtFunctions)")
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
if ( ! LuaInstallGdbGetCurve( LuaMgr)) {
|
if ( ! LuaInstallGdbGetCurve( LuaMgr)) {
|
||||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGetCurve (LuaInstallEgtFunctions)")
|
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGetCurve (LuaInstallEgtFunctions)")
|
||||||
return false ;
|
return false ;
|
||||||
@@ -130,10 +126,6 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
|
|||||||
LOG_ERROR( GetLogger(), "Error in LuaInstallCDeObjSolid (LuaInstallEgtFunctions)")
|
LOG_ERROR( GetLogger(), "Error in LuaInstallCDeObjSolid (LuaInstallEgtFunctions)")
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
if ( ! LuaInstallTestObjSurface( LuaMgr)) {
|
|
||||||
LOG_ERROR( GetLogger(), "Error in LuaInstallTestObjSurface (LuaInstallEgtFunctions)")
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
if ( ! LuaInstallMachMgr( LuaMgr)) {
|
if ( ! LuaInstallMachMgr( LuaMgr)) {
|
||||||
LOG_ERROR( GetLogger(), "Error in LuaInstallMachMgr (LuaInstallEgtFunctions)")
|
LOG_ERROR( GetLogger(), "Error in LuaInstallMachMgr (LuaInstallEgtFunctions)")
|
||||||
return false ;
|
return false ;
|
||||||
|
|||||||
@@ -118,27 +118,6 @@ LuaCAvGetToolOutline( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaCAvToolPosBox( lua_State* L)
|
|
||||||
{
|
|
||||||
// 4 parametri : ptP, vtAx, b3Box, vtMove
|
|
||||||
Point3d ptP ;
|
|
||||||
LuaCheckParam( L, 1, ptP)
|
|
||||||
Vector3d vtAx ;
|
|
||||||
LuaCheckParam( L, 2, vtAx)
|
|
||||||
BBox3d b3Box ;
|
|
||||||
LuaCheckParam( L, 3, b3Box)
|
|
||||||
Vector3d vtMove ;
|
|
||||||
LuaCheckParam( L, 4, vtMove)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// determino il movimento da dare all'utensile per evitare la collisione con il parallelepipedo
|
|
||||||
double dMove = ExeCAvToolPosBox( ptP, vtAx, b3Box, vtMove) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
LuaSetParam( L, dMove) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaCAvToolPosStm( lua_State* L)
|
LuaCAvToolPosStm( lua_State* L)
|
||||||
@@ -197,7 +176,6 @@ LuaInstallCAvTool( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetSawTool", LuaCAvSetSawTool) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetSawTool", LuaCAvSetSawTool) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetGenTool", LuaCAvSetGenTool) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetGenTool", LuaCAvSetGenTool) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvGetToolOutline", LuaCAvGetToolOutline) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvGetToolOutline", LuaCAvGetToolOutline) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPosBox", LuaCAvToolPosBox) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPosStm", LuaCAvToolPosStm) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPosStm", LuaCAvToolPosStm) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPathStm", LuaCAvToolPathStm) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPathStm", LuaCAvToolPathStm) ;
|
||||||
return bOk ;
|
return bOk ;
|
||||||
|
|||||||
+8
-8
@@ -173,12 +173,14 @@ LuaImport3MF( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaImport3dm( lua_State* L)
|
LuaImport3dm( lua_State* L)
|
||||||
{
|
{
|
||||||
// 1 parametro : path del file da importare
|
// 1 o 2 parametri : path del file da importare [, Fattore di scala]
|
||||||
string sFilePath ;
|
string sFilePath ;
|
||||||
LuaCheckParam( L, 1, sFilePath)
|
LuaCheckParam( L, 1, sFilePath)
|
||||||
|
double dScaleFactor = 1.0 ;
|
||||||
|
LuaGetParam( L, 2, dScaleFactor) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// apro il file
|
// apro il file
|
||||||
bool bOk = ExeImport3dm( sFilePath) ;
|
bool bOk = ExeImport3dm( sFilePath, dScaleFactor) ;
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
@@ -188,16 +190,14 @@ LuaImport3dm( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaAdvancedImport( lua_State* L)
|
LuaAdvancedImport( lua_State* L)
|
||||||
{
|
{
|
||||||
// 1 o 2 o 3 parametri : path del file da importare [, dLinToler] [, nFlag]
|
// 1 o 2 parametri : path del file da importare [, dLinToler]
|
||||||
string sFilePath ;
|
string sFilePath ;
|
||||||
LuaCheckParam( L, 1, sFilePath)
|
LuaCheckParam( L, 1, sFilePath)
|
||||||
double dLinToler = 0.1 ;
|
double dLinToler = 0.1 ;
|
||||||
LuaGetParam( L, 2, dLinToler) ;
|
LuaGetParam( L, 2, dLinToler) ;
|
||||||
int nFlag = 0 ;
|
|
||||||
LuaGetParam( L, 3, nFlag) ;
|
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// apro il file
|
// apro il file
|
||||||
bool bOk = ExeAdvancedImport( sFilePath, dLinToler, nFlag) ;
|
bool bOk = ExeAdvancedImport( sFilePath, dLinToler) ;
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
@@ -256,7 +256,7 @@ LuaExport3MF( lua_State* L)
|
|||||||
LuaGetParam( L, 3, nFilter) ;
|
LuaGetParam( L, 3, nFilter) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// creo il file
|
// creo il file
|
||||||
bool bOk = ExeExport3MF( nGroupId, sFilePath, nFilter) ;
|
bool bOk = ExeExport3MF( nGroupId, sFilePath) ;
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
@@ -275,7 +275,7 @@ LuaExport3dm( lua_State* L)
|
|||||||
LuaGetParam( L, 3, nFilter) ;
|
LuaGetParam( L, 3, nFilter) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// creo il file
|
// creo il file
|
||||||
bool bOk = ExeExport3dm( nGroupId, sFilePath, nFilter) ;
|
bool bOk = ExeExport3dm( nGroupId, sFilePath) ;
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
|
|||||||
+37
-39
@@ -400,13 +400,13 @@ LuaCreateDiametralDimension( lua_State* L )
|
|||||||
static int
|
static int
|
||||||
LuaCreateAngularDimension(lua_State* L)
|
LuaCreateAngularDimension(lua_State* L)
|
||||||
{
|
{
|
||||||
// 6 o 7 parametri : ParentId, ptV, ptP1, ptP2, ptDim, Text [, nRefType]
|
// 6 o 7 parametri : ParentId, ptP1, ptP0, ptP2, ptDim, Text [, nRefType]
|
||||||
int nParentId ;
|
int nParentId ;
|
||||||
LuaCheckParam( L, 1, nParentId)
|
LuaCheckParam( L, 1, nParentId)
|
||||||
Point3d ptV ;
|
|
||||||
LuaCheckParam( L, 2, ptV) ;
|
|
||||||
Point3d ptP1 ;
|
Point3d ptP1 ;
|
||||||
LuaCheckParam( L, 3, ptP1) ;
|
LuaCheckParam( L, 2, ptP1) ;
|
||||||
|
Point3d ptP0 ;
|
||||||
|
LuaCheckParam( L, 3, ptP0) ;
|
||||||
Point3d ptP2 ;
|
Point3d ptP2 ;
|
||||||
LuaCheckParam( L, 4, ptP2) ;
|
LuaCheckParam( L, 4, ptP2) ;
|
||||||
Point3d ptDim ;
|
Point3d ptDim ;
|
||||||
@@ -417,39 +417,7 @@ LuaCreateAngularDimension(lua_State* L)
|
|||||||
LuaGetParam( L, 7, nRefType) ;
|
LuaGetParam( L, 7, nRefType) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// creo la quota angolare
|
// creo la quota angolare
|
||||||
int nId = ExeCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
|
int nId = ExeCreateAngularDimension( nParentId, ptP1, ptP0, ptP2, ptDim, sText, nRefType) ;
|
||||||
// restituisco il risultato
|
|
||||||
if ( nId != GDB_ID_NULL)
|
|
||||||
LuaSetParam( L, nId) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaCreateAngularDimensionEx(lua_State* L)
|
|
||||||
{
|
|
||||||
// 7 o 8 parametri : ParentId, ptV1, ptP1, ptV2, ptP2, ptDim, Text [, nRefType]
|
|
||||||
int nParentId ;
|
|
||||||
LuaCheckParam( L, 1, nParentId)
|
|
||||||
Point3d ptV1 ;
|
|
||||||
LuaCheckParam( L, 2, ptV1) ;
|
|
||||||
Point3d ptP1 ;
|
|
||||||
LuaCheckParam( L, 3, ptP1) ;
|
|
||||||
Point3d ptV2 ;
|
|
||||||
LuaCheckParam( L, 4, ptV2) ;
|
|
||||||
Point3d ptP2 ;
|
|
||||||
LuaCheckParam( L, 5, ptP2) ;
|
|
||||||
Point3d ptDim ;
|
|
||||||
LuaCheckParam( L, 6, ptDim) ;
|
|
||||||
string sText ;
|
|
||||||
LuaCheckParam( L, 7, sText) ;
|
|
||||||
int nRefType = RTY_DEFAULT ;
|
|
||||||
LuaGetParam( L, 8, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// creo la quota angolare
|
|
||||||
int nId = ExeCreateAngularDimensionEx( nParentId, ptV1, ptP1, ptV2, ptP2, ptDim, sText, nRefType) ;
|
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
if ( nId != GDB_ID_NULL)
|
if ( nId != GDB_ID_NULL)
|
||||||
LuaSetParam( L, nId) ;
|
LuaSetParam( L, nId) ;
|
||||||
@@ -510,6 +478,36 @@ LuaCreateAngularDimensionFromArc( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaCreateAngularDimensionFromCircle( lua_State* L)
|
||||||
|
{
|
||||||
|
// 6 o 7 parametri : nParentId, nCrvId, ptP1, ptP2, ptDim, Text [, nRefType]
|
||||||
|
int nParentId ;
|
||||||
|
LuaCheckParam( L, 1, nParentId)
|
||||||
|
int nCrvId ;
|
||||||
|
LuaCheckParam( L, 2, nCrvId) ;
|
||||||
|
Point3d ptP1 ;
|
||||||
|
LuaCheckParam( L, 3, ptP1) ;
|
||||||
|
Point3d ptP2 ;
|
||||||
|
LuaCheckParam( L, 4, ptP2) ;
|
||||||
|
Point3d ptDim ;
|
||||||
|
LuaCheckParam( L, 5, ptDim) ;
|
||||||
|
string sText ;
|
||||||
|
LuaCheckParam( L, 6, sText) ;
|
||||||
|
int nRefType = RTY_DEFAULT ;
|
||||||
|
LuaGetParam( L, 7, nRefType) ;
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// creo la quota allineata
|
||||||
|
int nId = ExeCreateAngularDimensionFromCircle( nParentId, nCrvId, ptP1, ptP2, ptDim, sText, nRefType) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
if ( nId != GDB_ID_NULL)
|
||||||
|
LuaSetParam( L, nId) ;
|
||||||
|
else
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
LuaInstallGdbCreate( LuaMgr& luaMgr)
|
LuaInstallGdbCreate( LuaMgr& luaMgr)
|
||||||
@@ -529,9 +527,9 @@ LuaInstallGdbCreate( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAlignedDimension", LuaCreateAlignedDimension) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAlignedDimension", LuaCreateAlignedDimension) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRadialDimension", LuaCreateRadialDimension) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtRadialDimension", LuaCreateRadialDimension) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDiametralDimension", LuaCreateDiametralDimension) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtDiametralDimension", LuaCreateDiametralDimension) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension);
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionEx", LuaCreateAngularDimensionEx) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromCircle", LuaCreateAngularDimensionFromCircle) ;
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -425,34 +425,6 @@ LuaCreateArc3P( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaCreateArc2PR( lua_State* L)
|
|
||||||
{
|
|
||||||
// 5 o 6 parametri : ParentId, PtStart, PtEnd, dRad, bCCW [, nRefType]
|
|
||||||
int nParentId ;
|
|
||||||
LuaCheckParam( L, 1, nParentId)
|
|
||||||
Point3d ptStart ;
|
|
||||||
LuaCheckParam( L, 2, ptStart)
|
|
||||||
Point3d ptEnd ;
|
|
||||||
LuaCheckParam( L, 3, ptEnd)
|
|
||||||
double dRad ;
|
|
||||||
LuaCheckParam( L, 4, dRad)
|
|
||||||
bool bCCW ;
|
|
||||||
LuaCheckParam( L, 5, bCCW) ;
|
|
||||||
int nRefType = RTY_DEFAULT ;
|
|
||||||
LuaGetParam( L, 6, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// creo l'arco
|
|
||||||
int nId = ExeCreateArc2PR( nParentId, ptStart, ptEnd, dRad, bCCW, nRefType) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nId != GDB_ID_NULL)
|
|
||||||
LuaSetParam( L, nId) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaCreateArc2PB( lua_State* L)
|
LuaCreateArc2PB( lua_State* L)
|
||||||
@@ -1091,26 +1063,6 @@ LuaCreateCirclesAlongCurve( lua_State* L)
|
|||||||
return 2 ;
|
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
|
bool
|
||||||
LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
|
LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
|
||||||
@@ -1131,7 +1083,6 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2P", LuaCreateArcC2P) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2P", LuaCreateArcC2P) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2PEx", LuaCreateArcC2PEx) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2PEx", LuaCreateArcC2PEx) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArc3P", LuaCreateArc3P) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtArc3P", LuaCreateArc3P) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PR", LuaCreateArc2PR) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PB", LuaCreateArc2PB) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PB", LuaCreateArc2PB) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PD", LuaCreateArc2PD) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PD", LuaCreateArc2PD) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PDEx", LuaCreateArc2PDEx) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PDEx", LuaCreateArc2PDEx) ;
|
||||||
@@ -1155,6 +1106,5 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromApothem", LuaCreatePolygonFromApothem) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromApothem", LuaCreatePolygonFromApothem) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromSide", LuaCreatePolygonFromSide) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromSide", LuaCreatePolygonFromSide) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCirclesAlongCurve", LuaCreateCirclesAlongCurve) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCirclesAlongCurve", LuaCreateCirclesAlongCurve) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierForm", LuaCreateCurveBezierForm) ;
|
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-192
@@ -147,7 +147,7 @@ LuaCreateSurfFlatRegion( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaCreateSurfFrFatCurve( lua_State* L)
|
LuaCreateSurfFrFatCurve( lua_State* L)
|
||||||
{
|
{
|
||||||
// 4 o 5 o 6 parametri : ParentId, nCrvId, dRad, bSquared [, bSquaredMids] [, dLinTol]
|
// 4 parametri : ParentId, nCrvId, dRad, bSquared
|
||||||
int nParentId ;
|
int nParentId ;
|
||||||
LuaCheckParam( L, 1, nParentId)
|
LuaCheckParam( L, 1, nParentId)
|
||||||
int nCrvId ;
|
int nCrvId ;
|
||||||
@@ -156,13 +156,9 @@ LuaCreateSurfFrFatCurve( lua_State* L)
|
|||||||
LuaCheckParam( L, 3, dRad)
|
LuaCheckParam( L, 3, dRad)
|
||||||
bool bSquared ;
|
bool bSquared ;
|
||||||
LuaCheckParam( L, 4, bSquared)
|
LuaCheckParam( L, 4, bSquared)
|
||||||
bool bSquaredMids = bSquared ;
|
|
||||||
LuaGetParam( L, 5, bSquaredMids) ;
|
|
||||||
double dLinTol = 10 * EPS_SMALL ;
|
|
||||||
LuaGetParam( L, 6, dLinTol) ;
|
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// creo una regione piana
|
// creo una regione piana
|
||||||
int nId = ExeCreateSurfFrFatCurve( nParentId, nCrvId, dRad, bSquared, bSquaredMids, dLinTol) ;
|
int nId = ExeCreateSurfFrFatCurve( nParentId, nCrvId, dRad, bSquared) ;
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
if ( nId != GDB_ID_NULL)
|
if ( nId != GDB_ID_NULL)
|
||||||
LuaSetParam( L, nId) ;
|
LuaSetParam( L, nId) ;
|
||||||
@@ -389,7 +385,7 @@ LuaCreateSurfTmSphere( lua_State* L)
|
|||||||
else
|
else
|
||||||
LuaGetParam( L, 4, nRefType) ;
|
LuaGetParam( L, 4, nRefType) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// creo STM sfera
|
// creo STM cilindro
|
||||||
int nId = ExeCreateSurfTmSphere( nParentId, ptOrig, dRad, dLinTol, nRefType) ;
|
int nId = ExeCreateSurfTmSphere( nParentId, ptOrig, dRad, dLinTol, nRefType) ;
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
if ( nId != GDB_ID_NULL)
|
if ( nId != GDB_ID_NULL)
|
||||||
@@ -399,58 +395,6 @@ LuaCreateSurfTmSphere( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaCreateSurfTmTriangle( lua_State* L)
|
|
||||||
{
|
|
||||||
// 4 o 5 parametri : ParentId, PtP1, PtP2, PtP3 [, nRefType]
|
|
||||||
int nParentId ;
|
|
||||||
LuaCheckParam( L, 1, nParentId)
|
|
||||||
Point3d PtP1 ;
|
|
||||||
LuaCheckParam( L, 2, PtP1)
|
|
||||||
Point3d PtP2 ;
|
|
||||||
LuaCheckParam( L, 3, PtP2)
|
|
||||||
Point3d PtP3 ;
|
|
||||||
LuaCheckParam( L, 4, PtP3)
|
|
||||||
int nRefType = RTY_DEFAULT ;
|
|
||||||
LuaGetParam( L, 5, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// creo STM triangolo
|
|
||||||
int nId = ExeCreateSurfTmTriangle( nParentId, PtP1, PtP2, PtP3, nRefType) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nId != GDB_ID_NULL)
|
|
||||||
LuaSetParam( L, nId) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaCreateSurfTmRectangle( lua_State* L)
|
|
||||||
{
|
|
||||||
// 4 o 5 parametri : ParentId, PtO, PtL, PtT [, nRefType]
|
|
||||||
int nParentId ;
|
|
||||||
LuaCheckParam( L, 1, nParentId)
|
|
||||||
Point3d ptO ;
|
|
||||||
LuaCheckParam( L, 2, ptO)
|
|
||||||
Point3d ptL ;
|
|
||||||
LuaCheckParam( L, 3, ptL)
|
|
||||||
Point3d ptT ;
|
|
||||||
LuaCheckParam( L, 4, ptT)
|
|
||||||
int nRefType = RTY_DEFAULT ;
|
|
||||||
LuaGetParam( L, 5, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// creo STM rettangolo
|
|
||||||
int nId = ExeCreateSurfTmRectangle( nParentId, ptO, ptL, ptT, nRefType) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nId != GDB_ID_NULL)
|
|
||||||
LuaSetParam( L, nId) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaCreateSurfTmByFlatContour( lua_State* L)
|
LuaCreateSurfTmByFlatContour( lua_State* L)
|
||||||
@@ -659,41 +603,6 @@ LuaCreateSurfTmRectSwept( lua_State* L)
|
|||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaCreateSurfTmSwept( lua_State* L)
|
LuaCreateSurfTmSwept( lua_State* L)
|
||||||
{
|
|
||||||
// 4, 5, 6 o 7 parametri : ParentId, SectId, GuideId [, vtAx], bCapEnds [, dTol] [, nRefType]
|
|
||||||
int nParentId ;
|
|
||||||
LuaCheckParam( L, 1, nParentId)
|
|
||||||
int nSectId ;
|
|
||||||
LuaCheckParam( L, 2, nSectId)
|
|
||||||
int nGuideId ;
|
|
||||||
LuaCheckParam( L, 3, nGuideId)
|
|
||||||
int nPar = 4 ;
|
|
||||||
Vector3d vtAx = V_NULL ;
|
|
||||||
if ( LuaGetParam( L, nPar, vtAx))
|
|
||||||
++ nPar ;
|
|
||||||
bool bCapEnds ;
|
|
||||||
LuaCheckParam( L, nPar, bCapEnds)
|
|
||||||
++ nPar ;
|
|
||||||
double dLinTol = LIN_TOL_SRF ;
|
|
||||||
if ( LuaGetParam( L, nPar, dLinTol))
|
|
||||||
++ nPar ;
|
|
||||||
int nRefType = RTY_DEFAULT ;
|
|
||||||
if ( LuaGetParam( L, nPar, nRefType))
|
|
||||||
++ nPar ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// creo STM swept
|
|
||||||
int nId = ExeCreateSurfTmSwept( nParentId, nSectId, nGuideId, vtAx, bCapEnds, dLinTol, nRefType) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nId != GDB_ID_NULL)
|
|
||||||
LuaSetParam( L, nId) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaCreateSurfTmTransSwept( lua_State* L)
|
|
||||||
{
|
{
|
||||||
// 4 o 5 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol]
|
// 4 o 5 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol]
|
||||||
int nParentId ;
|
int nParentId ;
|
||||||
@@ -707,8 +616,8 @@ LuaCreateSurfTmTransSwept( lua_State* L)
|
|||||||
double dLinTol = LIN_TOL_SRF ;
|
double dLinTol = LIN_TOL_SRF ;
|
||||||
LuaGetParam( L, 5, dLinTol) ;
|
LuaGetParam( L, 5, dLinTol) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// creo STM swept di traslazione
|
// creo STM swept
|
||||||
int nId = ExeCreateSurfTmTransSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol) ;
|
int nId = ExeCreateSurfTmSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol) ;
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
if ( nId != GDB_ID_NULL)
|
if ( nId != GDB_ID_NULL)
|
||||||
LuaSetParam( L, nId) ;
|
LuaSetParam( L, nId) ;
|
||||||
@@ -796,6 +705,26 @@ LuaCreateSurfTmBySewing( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaCreateSurfTmBySurfBezier( lua_State* L)
|
||||||
|
{
|
||||||
|
// 2 parametri : ParentId, nSbezId
|
||||||
|
int nParentId ;
|
||||||
|
LuaCheckParam( L, 1, nParentId)
|
||||||
|
int nZmapId ;
|
||||||
|
LuaCheckParam( L, 2, nZmapId)
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// creo STM partendo da superficie di Bezier
|
||||||
|
int nId = ExeCreateSurfTmBySurfBezier( nParentId, nZmapId) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
if ( nId != GDB_ID_NULL)
|
||||||
|
LuaSetParam( L, nId) ;
|
||||||
|
else
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaCreateSurfTmByVolZmap( lua_State* L)
|
LuaCreateSurfTmByVolZmap( lua_State* L)
|
||||||
@@ -887,96 +816,6 @@ LuaCreateSurfBezierRational( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaCreateSurfBezierLeaves( lua_State* L)
|
|
||||||
{
|
|
||||||
// 2, 3 o 4 parametri : ParentId, nId [, nTextHeight] [, bShowTrim]
|
|
||||||
int nParentId ;
|
|
||||||
LuaCheckParam( L, 1, nParentId)
|
|
||||||
int nSurfBzId ;
|
|
||||||
LuaCheckParam( L, 2, nSurfBzId)
|
|
||||||
int nTextHeight = 50 ;
|
|
||||||
bool bShowTrim = false ;
|
|
||||||
if ( LuaGetParam( L, 3, nTextHeight))
|
|
||||||
LuaGetParam( L, 4, bShowTrim) ;
|
|
||||||
else
|
|
||||||
LuaGetParam( L, 3, bShowTrim) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// creo la superficie
|
|
||||||
int nCount = 0 ;
|
|
||||||
int nId = ExeCreateSurfBezierLeaves( nParentId, nSurfBzId, nTextHeight, bShowTrim, &nCount) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nId != GDB_ID_NULL) {
|
|
||||||
LuaSetParam( L, nId) ;
|
|
||||||
LuaSetParam( L, nCount) ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
}
|
|
||||||
return 2 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaCreateSurfBezierTria2D( lua_State* L)
|
|
||||||
{
|
|
||||||
// 2, 3 o 4 parametri : ParentId, nId [, nTextHeight] [, bShowTrim]
|
|
||||||
int nParentId ;
|
|
||||||
LuaCheckParam( L, 1, nParentId)
|
|
||||||
int nSurfBzId ;
|
|
||||||
LuaCheckParam( L, 2, nSurfBzId)
|
|
||||||
int nTextHeight = 50 ;
|
|
||||||
bool bShowTrim = false ;
|
|
||||||
if ( LuaGetParam( L, 3, nTextHeight))
|
|
||||||
LuaGetParam( L, 4, bShowTrim) ;
|
|
||||||
else
|
|
||||||
LuaGetParam( L, 3, bShowTrim) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// creo la superficie
|
|
||||||
int nCount = 0 ;
|
|
||||||
int nId = ExeCreateSurfBezierTria2D( nParentId, nSurfBzId, nTextHeight, bShowTrim, &nCount) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nId != GDB_ID_NULL) {
|
|
||||||
LuaSetParam( L, nId) ;
|
|
||||||
LuaSetParam( L, nCount) ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
}
|
|
||||||
return 2 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaCreateBezierSphere( lua_State* L)
|
|
||||||
{
|
|
||||||
// 3 o 4 parametri : ParentId, ptCenter, dRad [, nRefType]
|
|
||||||
int nParentId ;
|
|
||||||
LuaCheckParam( L, 1, nParentId)
|
|
||||||
Point3d ptCenter ;
|
|
||||||
LuaCheckParam( L, 2, ptCenter)
|
|
||||||
double dRad ;
|
|
||||||
LuaCheckParam( L, 3, dRad)
|
|
||||||
int nRefType = RTY_DEFAULT ;
|
|
||||||
LuaGetParam( L, 4, nRefType) ;
|
|
||||||
// creo la superficie
|
|
||||||
int nCount = 0 ;
|
|
||||||
int nId = ExeCreateBezierSphere( nParentId, ptCenter, dRad, nRefType) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nId != GDB_ID_NULL) {
|
|
||||||
LuaSetParam( L, nId) ;
|
|
||||||
LuaSetParam( L, nCount) ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
}
|
|
||||||
return 2 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
|
LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
|
||||||
@@ -996,8 +835,6 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCylinder", LuaCreateSurfTmCylinder) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCylinder", LuaCreateSurfTmCylinder) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCone", LuaCreateSurfTmCone) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCone", LuaCreateSurfTmCone) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSphere", LuaCreateSurfTmSphere) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSphere", LuaCreateSurfTmSphere) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTriangle", LuaCreateSurfTmTriangle) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectangle", LuaCreateSurfTmRectangle) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByFlatContour", LuaCreateSurfTmByFlatContour) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByFlatContour", LuaCreateSurfTmByFlatContour) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRegion", LuaCreateSurfTmByRegion) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRegion", LuaCreateSurfTmByRegion) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByExtrusion", LuaCreateSurfTmByExtrusion) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByExtrusion", LuaCreateSurfTmByExtrusion) ;
|
||||||
@@ -1006,15 +843,12 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByScrewing", LuaCreateSurfTmByScrewing) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByScrewing", LuaCreateSurfTmByScrewing) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectSwept", LuaCreateSurfTmRectSwept) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectSwept", LuaCreateSurfTmRectSwept) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwept", LuaCreateSurfTmSwept) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwept", LuaCreateSurfTmSwept) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTransSwept", LuaCreateSurfTmTransSwept) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRuled", LuaCreateSurfTmRuled) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRuled", LuaCreateSurfTmRuled) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySurfBezier", LuaCreateSurfTmBySurfBezier) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByVolZmap", LuaCreateSurfTmByVolZmap) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByVolZmap", LuaCreateSurfTmByVolZmap) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezier", LuaCreateSurfBezier) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezier", LuaCreateSurfBezier) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierRat", LuaCreateSurfBezierRational) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierRat", LuaCreateSurfBezierRational) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierLeaves", LuaCreateSurfBezierLeaves) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierTria2D", LuaCreateSurfBezierTria2D) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateBezierSphere", LuaCreateBezierSphere) ;
|
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,42 +54,6 @@ LuaCreateVolZmapBox( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaCreateVolZmapEmpty( lua_State* L)
|
|
||||||
{
|
|
||||||
// 6 o 7 o 8 parametri : ParentId, PtIni, dDimX, dDimY, dDimZ, dPrec [, bTriDex] [, nRefType]
|
|
||||||
int nParentId ;
|
|
||||||
LuaCheckParam( L, 1, nParentId)
|
|
||||||
Point3d ptIni ;
|
|
||||||
LuaCheckParam( L, 2, ptIni)
|
|
||||||
double dDimX ;
|
|
||||||
LuaCheckParam( L, 3, dDimX)
|
|
||||||
double dDimY ;
|
|
||||||
LuaCheckParam( L, 4, dDimY)
|
|
||||||
double dDimZ ;
|
|
||||||
LuaCheckParam( L, 5, dDimZ)
|
|
||||||
double dPrec ;
|
|
||||||
LuaCheckParam( L, 6, dPrec)
|
|
||||||
bool bTriDex = true ;
|
|
||||||
int nRefType = RTY_DEFAULT ;
|
|
||||||
if ( ! LuaGetParam( L, 7, bTriDex))
|
|
||||||
LuaGetParam( L, 7, nRefType) ;
|
|
||||||
else
|
|
||||||
LuaGetParam( L, 8, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// creo VZM parallelepipedo
|
|
||||||
int nId = ExeCreateVolZmapEmpty( nParentId, ptIni, dDimX, dDimY, dDimZ, dPrec, bTriDex, nRefType) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nId != GDB_ID_NULL)
|
|
||||||
LuaSetParam( L, nId) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaCreateVolZmapByRegionExtrusion( lua_State* L)
|
LuaCreateVolZmapByRegionExtrusion( lua_State* L)
|
||||||
@@ -140,47 +104,13 @@ LuaCreateVolZmapFromSurfTm( lua_State* L)
|
|||||||
return 1 ;
|
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
|
bool
|
||||||
LuaInstallGdbCreateVol( LuaMgr& luaMgr)
|
LuaInstallGdbCreateVol( LuaMgr& luaMgr)
|
||||||
{
|
{
|
||||||
bool bOk = ( &luaMgr != nullptr) ;
|
bool bOk = ( &luaMgr != nullptr) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapBox", LuaCreateVolZmapBox) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapBox", LuaCreateVolZmapBox) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapEmpty", LuaCreateVolZmapEmpty) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapByRegionExtrusion", LuaCreateVolZmapByRegionExtrusion) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapByRegionExtrusion", LuaCreateVolZmapByRegionExtrusion) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapFromSurfTm", LuaCreateVolZmapFromSurfTm) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapFromSurfTm", LuaCreateVolZmapFromSurfTm) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateVolZmapByAddingSurfTm", LuaUpdateVolZmapByAddingSurfTm ) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtUniformZmap", LuaUniformVolZmap) ;
|
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,90 +0,0 @@
|
|||||||
//----------------------------------------------------------------------------
|
|
||||||
// EgalTech 2023-2023
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// File : LUA_GdbGetPocketing.cpp Data : 28.11.23 Versione : 2.5k6
|
|
||||||
// Contenuto : Funzioni di creazione percorsi di svuotatura o infill per LUA.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Modifiche : 29.11.23 RE Creazione modulo.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//--------------------------- Include ----------------------------------------
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "LUA.h"
|
|
||||||
#include "/EgtDev/Include/EXeExecutor.h"
|
|
||||||
|
|
||||||
using namespace std ;
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaPocketing( lua_State* L) {
|
|
||||||
// 7 parametri : nId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId) ;
|
|
||||||
double dRad ;
|
|
||||||
LuaCheckParam( L, 2, dRad) ;
|
|
||||||
double dStep ;
|
|
||||||
LuaCheckParam( L, 3, dStep) ;
|
|
||||||
double dAngle ;
|
|
||||||
LuaCheckParam( L, 4, dAngle) ;
|
|
||||||
int nType ;
|
|
||||||
LuaCheckParam( L, 5, nType) ;
|
|
||||||
bool bSmooth ;
|
|
||||||
LuaCheckParam( L, 6, bSmooth) ;
|
|
||||||
int nDestGrpId ;
|
|
||||||
LuaCheckParam( L, 7, nDestGrpId) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// calcolo delle curve elementari di svuotatura
|
|
||||||
int nFirstId = GDB_ID_NULL ;
|
|
||||||
int nCrvCount = 0 ;
|
|
||||||
bool bOk = ExePocketing( nId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId, nFirstId, nCrvCount) ;
|
|
||||||
if ( ! bOk)
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L, nFirstId) ;
|
|
||||||
LuaSetParam( L, nCrvCount) ;
|
|
||||||
return 2 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfFrGetZigZagInfill( lua_State* L)
|
|
||||||
{
|
|
||||||
// 6 parametri : nId, nDestGrpId, dSideStep, dAng, bSmooth, bRemoveOverlapLink
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
int nDestGrpId ;
|
|
||||||
LuaCheckParam( L, 2, nDestGrpId)
|
|
||||||
double dStep ;
|
|
||||||
LuaCheckParam( L, 3, dStep)
|
|
||||||
double dAng ;
|
|
||||||
LuaCheckParam( L, 4, dAng) ;
|
|
||||||
bool bSmooth ;
|
|
||||||
LuaCheckParam( L, 5, bSmooth) ;
|
|
||||||
bool bRemoveOverlapLink ;
|
|
||||||
LuaCheckParam( L, 6, bRemoveOverlapLink) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero i contorni della superficie
|
|
||||||
int nCount = 0 ;
|
|
||||||
int nNewId = ExeSurfFrGetZigZagInfill( nId, nDestGrpId, dStep, dAng, bSmooth, bRemoveOverlapLink, &nCount) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nNewId != GDB_ID_NULL)
|
|
||||||
LuaSetParam( L, nNewId) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L, nCount) ;
|
|
||||||
return 2 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
LuaInstallGdbGetPocketing( LuaMgr& luaMgr)
|
|
||||||
{
|
|
||||||
bool bOk = ( &luaMgr != nullptr) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPocketing", LuaPocketing) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfFrZigZagInfill", LuaSurfFrGetZigZagInfill) ;
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
+35
-126
@@ -237,6 +237,37 @@ LuaSurfFrRotateSimpleNoCollision( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaSurfFrGetZigZagInfill( lua_State* L)
|
||||||
|
{
|
||||||
|
// 6 parametri : nId, nDestGrpId, dSideStep, dAng, bAllowStepCorrection, bInvert
|
||||||
|
int nId ;
|
||||||
|
LuaCheckParam( L, 1, nId)
|
||||||
|
int nDestGrpId ;
|
||||||
|
LuaCheckParam( L, 2, nDestGrpId)
|
||||||
|
double dStep ;
|
||||||
|
LuaCheckParam( L, 3, dStep)
|
||||||
|
double dAng ;
|
||||||
|
LuaCheckParam( L, 4, dAng) ;
|
||||||
|
bool bStepCorrection ;
|
||||||
|
LuaCheckParam( L, 5, bStepCorrection)
|
||||||
|
bool bInvert ;
|
||||||
|
LuaCheckParam( L, 6, bInvert)
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// recupero i contorni della superficie
|
||||||
|
int nCount = 0 ;
|
||||||
|
int nNewId = ExeSurfFrGetZigZagInfill( nId, nDestGrpId, dStep, dAng, bStepCorrection, bInvert, &nCount) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
if ( nNewId != GDB_ID_NULL)
|
||||||
|
LuaSetParam( L, nNewId) ;
|
||||||
|
else
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
LuaSetParam( L, nCount) ;
|
||||||
|
return 2 ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaSurfTmVertexCount( lua_State* L)
|
LuaSurfTmVertexCount( lua_State* L)
|
||||||
@@ -443,42 +474,6 @@ LuaSurfTmGetFacetBBoxRef( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfTmGetFacetOutlineInfo( lua_State* L)
|
|
||||||
{
|
|
||||||
// 2 o 3 parametri : Id, nFacet [, nRefId]
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
int nFacet ;
|
|
||||||
LuaCheckParam( L, 2, nFacet)
|
|
||||||
int nRefId = nId ;
|
|
||||||
LuaGetParam( L, 3, nRefId) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero le informazioni
|
|
||||||
int nStatus ;
|
|
||||||
BOOLVECTOR vbOpen ;
|
|
||||||
INTVECTOR vnAdj ;
|
|
||||||
VCT3DVECTOR vvtNorm ;
|
|
||||||
DBLVECTOR vdElev ;
|
|
||||||
DBLVECTOR vdLen ;
|
|
||||||
bool bOk = ExeSurfTmGetFacetOutlineInfo( nId, nFacet, nRefId, nStatus, vbOpen, vnAdj, vdLen, vvtNorm, vdElev) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( bOk) {
|
|
||||||
LuaSetParam( L, nStatus) ;
|
|
||||||
LuaSetParam( L, vbOpen) ;
|
|
||||||
LuaSetParam( L, vnAdj) ;
|
|
||||||
LuaSetParam( L, vdLen) ;
|
|
||||||
LuaSetParam( L, vvtNorm) ;
|
|
||||||
LuaSetParam( L, vdElev) ;
|
|
||||||
return 6 ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaSurfTmFacetAdjacencies( lua_State* L)
|
LuaSurfTmFacetAdjacencies( lua_State* L)
|
||||||
@@ -630,58 +625,6 @@ LuaSurfTmFacetMinAreaRectangle( lua_State* L)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfTmFacetElevationInBBox( lua_State* L)
|
|
||||||
{
|
|
||||||
// 3 o 4 o 5 parametri : Id, nFacet, b3Box [, bAcceptOutFacet] [, nRefId]
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
int nFacet ;
|
|
||||||
LuaCheckParam( L, 2, nFacet)
|
|
||||||
BBox3d b3Box ;
|
|
||||||
LuaCheckParam( L, 3, b3Box)
|
|
||||||
bool bAcceptOutFacet = false ;
|
|
||||||
int nRefId = nId ;
|
|
||||||
if ( ! LuaGetParam( L, 4, nRefId)) {
|
|
||||||
LuaGetParam( L, 4, bAcceptOutFacet) ;
|
|
||||||
LuaGetParam( L, 5, nRefId) ;
|
|
||||||
}
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// calcolo elevazione
|
|
||||||
double dElev ;
|
|
||||||
bool bOk = ExeSurfTmFacetElevationInBBox( nId, nFacet, b3Box, bAcceptOutFacet, nRefId, dElev) ;
|
|
||||||
if ( bOk)
|
|
||||||
LuaSetParam( L, dElev) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfTmFacetElevationInClosedSurfTm( lua_State* L)
|
|
||||||
{
|
|
||||||
// 3 o 4 parametri : nFacetStmId, nFacet, nClosedStmId [, bAcceptOutFacet]
|
|
||||||
int nFacetStmId ;
|
|
||||||
LuaCheckParam( L, 1, nFacetStmId)
|
|
||||||
int nFacet ;
|
|
||||||
LuaCheckParam( L, 2, nFacet)
|
|
||||||
int nClosedStmId ;
|
|
||||||
LuaCheckParam( L, 3, nClosedStmId)
|
|
||||||
bool bAcceptOutFacet = false ;
|
|
||||||
LuaGetParam( L, 4, bAcceptOutFacet) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// calcolo elevazione
|
|
||||||
double dElev ;
|
|
||||||
bool bOk = ExeSurfTmFacetElevationInClosedSurfTm( nFacetStmId, nFacet, nClosedStmId, bAcceptOutFacet, dElev) ;
|
|
||||||
if ( bOk)
|
|
||||||
LuaSetParam( L, dElev) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaSurfTmFacetOppositeSide( lua_State* L)
|
LuaSurfTmFacetOppositeSide( lua_State* L)
|
||||||
@@ -780,7 +723,7 @@ LuaExtractSurfTmLoops( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaGetSurfTmSilhouette( lua_State* L)
|
LuaGetSurfTmSilhouette( lua_State* L)
|
||||||
{
|
{
|
||||||
// 4 o 5 o 6 parametri : nId, vtDir, dToler, nDestGrpId [, nRefType [, bAllTria]]
|
// 4 o 5 parametri : nId, vtDir, dToler, nDestGrpId [, nRefType]
|
||||||
int nId ;
|
int nId ;
|
||||||
LuaCheckParam( L, 1, nId)
|
LuaCheckParam( L, 1, nId)
|
||||||
Vector3d vtDir ;
|
Vector3d vtDir ;
|
||||||
@@ -790,15 +733,11 @@ LuaGetSurfTmSilhouette( lua_State* L)
|
|||||||
int nDestGrpId ;
|
int nDestGrpId ;
|
||||||
LuaCheckParam( L, 4, nDestGrpId)
|
LuaCheckParam( L, 4, nDestGrpId)
|
||||||
int nRefType = RTY_DEFAULT ;
|
int nRefType = RTY_DEFAULT ;
|
||||||
bool bAllTria = false ;
|
LuaGetParam( L, 5, nRefType) ;
|
||||||
if ( LuaGetParam( L, 5, nRefType))
|
|
||||||
LuaGetParam( L, 6, bAllTria) ;
|
|
||||||
else
|
|
||||||
LuaGetParam( L, 5, bAllTria) ;
|
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// recupero i contorni della superficie
|
// recupero i contorni della superficie
|
||||||
int nCount = 0 ;
|
int nCount = 0 ;
|
||||||
int nNewId = ExeGetSurfTmSilhouette( nId, vtDir, dToler, nDestGrpId, nRefType, &nCount, bAllTria) ;
|
int nNewId = ExeGetSurfTmSilhouette( nId, vtDir, dToler, nDestGrpId, nRefType, &nCount) ;
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
if ( nNewId != GDB_ID_NULL)
|
if ( nNewId != GDB_ID_NULL)
|
||||||
LuaSetParam( L, nNewId) ;
|
LuaSetParam( L, nNewId) ;
|
||||||
@@ -854,33 +793,6 @@ LuaCopySurfTmFacet( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfTmGetEdges( lua_State* L)
|
|
||||||
{
|
|
||||||
// 2 o 3 parametri : nId, nDestGrpId [, bSmoothAng]
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
int nDestGrpId ;
|
|
||||||
LuaCheckParam( L, 2, nDestGrpId)
|
|
||||||
bool bSmoothAng = true ;
|
|
||||||
LuaGetParam( L, 3, bSmoothAng) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// calcolo gli spigoli della superficie
|
|
||||||
int nCount ;
|
|
||||||
int nFirstId = ExeSurfTmGetEdges( nId, nDestGrpId, bSmoothAng, &nCount) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nFirstId != GDB_ID_NULL || nCount != -1) {
|
|
||||||
LuaSetParam( L, nFirstId) ;
|
|
||||||
LuaSetParam( L, nCount) ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
}
|
|
||||||
return 2 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaSurfBezierGetPoint( lua_State* L)
|
LuaSurfBezierGetPoint( lua_State* L)
|
||||||
@@ -1132,6 +1044,7 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfFrChunkLoops", LuaExtractSurfFrChunkLoops) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfFrChunkLoops", LuaExtractSurfFrChunkLoops) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrMoveSimpleNoCollision", LuaSurfFrMoveSimpleNoCollision) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrMoveSimpleNoCollision", LuaSurfFrMoveSimpleNoCollision) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrRotateSimpleNoCollision", LuaSurfFrRotateSimpleNoCollision) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrRotateSimpleNoCollision", LuaSurfFrRotateSimpleNoCollision) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfFrZigZagInfill", LuaSurfFrGetZigZagInfill) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmVertexCount", LuaSurfTmVertexCount) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmVertexCount", LuaSurfTmVertexCount) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCount", LuaSurfTmFacetCount) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCount", LuaSurfTmFacetCount) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPartCount", LuaSurfTmPartCount) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPartCount", LuaSurfTmPartCount) ;
|
||||||
@@ -1142,22 +1055,18 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBox", LuaSurfTmGetFacetBBox) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBox", LuaSurfTmGetFacetBBox) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxGlob", LuaSurfTmGetFacetBBoxGlob) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxGlob", LuaSurfTmGetFacetBBoxGlob) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxRef", LuaSurfTmGetFacetBBoxRef) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxRef", LuaSurfTmGetFacetBBoxRef) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetOutlineInfo", LuaSurfTmGetFacetOutlineInfo) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetAdjacencies", LuaSurfTmFacetAdjacencies) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetAdjacencies", LuaSurfTmFacetAdjacencies) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestEndPoint", LuaSurfTmFacetNearestEndPoint) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestEndPoint", LuaSurfTmFacetNearestEndPoint) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestMidPoint", LuaSurfTmFacetNearestMidPoint) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestMidPoint", LuaSurfTmFacetNearestMidPoint) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCenter", LuaSurfTmFacetCenter) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCenter", LuaSurfTmFacetCenter) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNormVersor", LuaSurfTmFacetNormVersor) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNormVersor", LuaSurfTmFacetNormVersor) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetMinAreaRectangle", LuaSurfTmFacetMinAreaRectangle) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetMinAreaRectangle", LuaSurfTmFacetMinAreaRectangle) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetElevationInBBox", LuaSurfTmFacetElevationInBBox) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetElevationInClosedSurfTm", LuaSurfTmFacetElevationInClosedSurfTm) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetOppositeSide", LuaSurfTmFacetOppositeSide) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetOppositeSide", LuaSurfTmFacetOppositeSide) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetsContact", LuaSurfTmFacetsContact) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetsContact", LuaSurfTmFacetsContact) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmLoops", LuaExtractSurfTmLoops) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmLoops", LuaExtractSurfTmLoops) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfTmSilhouette", LuaGetSurfTmSilhouette) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfTmSilhouette", LuaGetSurfTmSilhouette) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmFacetLoops", LuaExtractSurfTmFacetLoops) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmFacetLoops", LuaExtractSurfTmFacetLoops) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCopySurfTmFacet", LuaCopySurfTmFacet) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCopySurfTmFacet", LuaCopySurfTmFacet) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetEdges", LuaSurfTmGetEdges) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPoint", LuaSurfBezierGetPoint) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPoint", LuaSurfBezierGetPoint) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointD1", LuaSurfBezierGetPointD1) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointD1", LuaSurfBezierGetPointD1) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointNrmD1", LuaSurfBezierGetPointNrmD1) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointNrmD1", LuaSurfBezierGetPointNrmD1) ;
|
||||||
|
|||||||
+1
-2
@@ -211,7 +211,6 @@ LuaVolZmapGetDepth( lua_State* L)
|
|||||||
}
|
}
|
||||||
return 2 ;
|
return 2 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaVolZmapGetEdges( lua_State* L)
|
LuaVolZmapGetEdges( lua_State* L)
|
||||||
@@ -222,7 +221,7 @@ LuaVolZmapGetEdges( lua_State* L)
|
|||||||
int nDestGrpId ;
|
int nDestGrpId ;
|
||||||
LuaCheckParam( L, 2, nDestGrpId)
|
LuaCheckParam( L, 2, nDestGrpId)
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// calcolo gli spigoli del solido
|
// eseguo calcolo profondità dal punto lungo la direzione
|
||||||
int nCount ;
|
int nCount ;
|
||||||
int nFirstId = ExeVolZmapGetEdges( nId, nDestGrpId, &nCount) ;
|
int nFirstId = ExeVolZmapGetEdges( nId, nDestGrpId, &nCount) ;
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
|
|||||||
+5
-197
@@ -19,7 +19,6 @@
|
|||||||
#include "/EgtDev/Include/EXeConst.h"
|
#include "/EgtDev/Include/EXeConst.h"
|
||||||
#include "/EgtDev/Include/EGkCurve.h"
|
#include "/EgtDev/Include/EGkCurve.h"
|
||||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||||
#include "/EgtDev/Include/EGkCalcPocketing.h"
|
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
@@ -60,19 +59,17 @@ LuaOffsetCurve( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaOffsetCurveAdv( lua_State* L)
|
LuaOffsetCurveAdv( lua_State* L)
|
||||||
{
|
{
|
||||||
// 2 o 3 o 4 parametri : Id, dDist [, nType] [, dLinTol]
|
// 2 o 3 parametri : Id, dDist [, nType]
|
||||||
int nId ;
|
int nId ;
|
||||||
LuaCheckParam( L, 1, nId)
|
LuaCheckParam( L, 1, nId)
|
||||||
double dDist ;
|
double dDist ;
|
||||||
LuaCheckParam( L, 2, dDist)
|
LuaCheckParam( L, 2, dDist)
|
||||||
int nType = ICurve::OFF_FILLET ;
|
int nType = ICurve::OFF_FILLET ;
|
||||||
LuaGetParam( L, 3, nType) ;
|
LuaGetParam( L, 3, nType) ;
|
||||||
double dLinTol = 10 * EPS_SMALL ;
|
|
||||||
LuaGetParam( L, 4, dLinTol) ;
|
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// offset della curva
|
// offset della curva
|
||||||
int nCount ;
|
int nCount ;
|
||||||
int nNewId = ExeOffsetCurveAdv( nId, dDist, nType, &nCount, dLinTol) ;
|
int nNewId = ExeOffsetCurveAdv( nId, dDist, nType, &nCount) ;
|
||||||
if ( nCount >= 0) {
|
if ( nCount >= 0) {
|
||||||
LuaSetParam( L, nNewId) ;
|
LuaSetParam( L, nNewId) ;
|
||||||
LuaSetParam( L, nCount) ;
|
LuaSetParam( L, nCount) ;
|
||||||
@@ -105,18 +102,16 @@ LuaCurveMedialAxis( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaApproxCurve( lua_State* L)
|
LuaApproxCurve( lua_State* L)
|
||||||
{
|
{
|
||||||
// 2 o 3 o 4 parametri : Id, nApprType [, dLinTol [, dMaxSegmLen]]
|
// 2 o 3 parametri : Id, nApprType [, dLinTol]
|
||||||
int nId ;
|
int nId ;
|
||||||
LuaCheckParam( L, 1, nId)
|
LuaCheckParam( L, 1, nId)
|
||||||
int nApprType ;
|
int nApprType ;
|
||||||
LuaCheckParam( L, 2, nApprType)
|
LuaCheckParam( L, 2, nApprType)
|
||||||
double dLinTol = 0.01 ;
|
double dLinTol = 0.01 ;
|
||||||
double dMaxSegmLen = INFINITO ;
|
LuaGetParam( L, 3, dLinTol) ;
|
||||||
if ( LuaGetParam( L, 3, dLinTol))
|
|
||||||
LuaGetParam( L, 4, dMaxSegmLen) ;
|
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// approssimazione della curva con rette
|
// approssimazione della curva con rette
|
||||||
bool bOk = ExeApproxCurve( nId, nApprType, dLinTol, dMaxSegmLen) ;
|
bool bOk = ExeApproxCurve( nId, nApprType, dLinTol) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
@@ -949,186 +944,6 @@ LuaReorderCurvesInGroup( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaProjectCurveOnSurfTm( lua_State* L)
|
|
||||||
{
|
|
||||||
// 4, 5, 6 o 7 parametri : nCurveId, nSurfTmId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, nRefType]]
|
|
||||||
int nCurveId ;
|
|
||||||
LuaCheckParam( L, 1, nCurveId)
|
|
||||||
int nSurfTmId ;
|
|
||||||
LuaCheckParam( L, 2, nSurfTmId)
|
|
||||||
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 = ExeProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, nRefType) ;
|
|
||||||
LuaSetParam( L, bOk) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaProjectCurveOnSurfTmExt( lua_State* L)
|
|
||||||
{
|
|
||||||
// 4, 5, 6 o 7 parametri : nCurveId, nSurfTmId, nGuideId, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromGuide]]
|
|
||||||
int nCurveId ;
|
|
||||||
LuaCheckParam( L, 1, nCurveId)
|
|
||||||
int nSurfTmId ;
|
|
||||||
LuaCheckParam( L, 2, nSurfTmId)
|
|
||||||
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 = 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) ;
|
|
||||||
LuaSetParam( L, bOk) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaCurveGetVoronoi( lua_State* L)
|
|
||||||
{
|
|
||||||
// 2 o 3 parametri : Id, nDestGrpId [, nBound]
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
int nDestGrpId ;
|
|
||||||
LuaCheckParam( L, 2, nDestGrpId)
|
|
||||||
int nBound = 3 ; // VORONOI_STD_BOUND
|
|
||||||
LuaGetParam( L, 3, nBound) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo
|
|
||||||
int nCount = 0 ;
|
|
||||||
int nNewId = ExeCurveGetVoronoi( nId, nDestGrpId, nBound, &nCount) ;
|
|
||||||
if ( nNewId != GDB_ID_NULL)
|
|
||||||
LuaSetParam( L, nNewId) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L, nCount) ;
|
|
||||||
|
|
||||||
return 2 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaCurveMedialAxisAdv( lua_State* L)
|
|
||||||
{
|
|
||||||
// 2 o 3 parametri : Id, nDestGrpId [, nSide]
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
int nDestGrpId ;
|
|
||||||
LuaCheckParam( L, 2, nDestGrpId)
|
|
||||||
int nSide = 1 ; // WMAT_LEFT
|
|
||||||
LuaGetParam( L, 3, nSide) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo
|
|
||||||
int nCount = 0 ;
|
|
||||||
int nNewId = ExeCurveGetMedialAxis( nId, nDestGrpId, nSide, &nCount) ;
|
|
||||||
if ( nNewId != GDB_ID_NULL)
|
|
||||||
LuaSetParam( L, nNewId) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L, nCount) ;
|
|
||||||
|
|
||||||
return 2 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaCurveGetFatCurve( lua_State* L)
|
|
||||||
{
|
|
||||||
// 4 o 5 parametri : Id, nDestGrpId, dRad, bSquare [, bSquareMids]
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
int nDestGrpId ;
|
|
||||||
LuaCheckParam( L, 2, nDestGrpId)
|
|
||||||
double dRad ;
|
|
||||||
LuaCheckParam( L, 3, dRad)
|
|
||||||
bool bSquareEnds ;
|
|
||||||
LuaCheckParam( L, 4, bSquareEnds)
|
|
||||||
bool bSquareMids = bSquareEnds ;
|
|
||||||
LuaGetParam( L, 5, bSquareMids) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo
|
|
||||||
int nCount = 0 ;
|
|
||||||
int nNewId = ExeCurveGetFatCurve( nId, nDestGrpId, dRad, bSquareEnds, bSquareMids, &nCount) ;
|
|
||||||
if ( nNewId != GDB_ID_NULL)
|
|
||||||
LuaSetParam( L, nNewId) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L, nCount) ;
|
|
||||||
|
|
||||||
return 2 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
|
LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
|
||||||
@@ -1184,12 +999,5 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveCurveCompoUndercutOnY", LuaRemoveCurveCompoUndercutOnY) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveCurveCompoUndercutOnY", LuaRemoveCurveCompoUndercutOnY) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtChainCurvesInGroup", LuaChainCurvesInGroup) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtChainCurvesInGroup", LuaChainCurvesInGroup) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtReorderCurvesInGroup", LuaReorderCurvesInGroup) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtReorderCurvesInGroup", LuaReorderCurvesInGroup) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfTm", LuaProjectCurveOnSurfTm) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfTmExt", LuaProjectCurveOnSurfTmExt) ;
|
|
||||||
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) ;
|
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-239
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaInvertSurf( lua_State* L)
|
LuaInvertSurf( lua_State* L)
|
||||||
@@ -61,16 +62,14 @@ LuaExplodeSurf( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaApproxSurf( lua_State* L)
|
LuaApproxSurf( lua_State* L)
|
||||||
{
|
{
|
||||||
// 1 o 2 parametri : Id [, dLinTol [, dTriaMinSide]]
|
// 1 o 2 parametri : Id [, dLinTol]
|
||||||
int nId ;
|
int nId ;
|
||||||
LuaCheckParam( L, 1, nId)
|
LuaCheckParam( L, 1, nId)
|
||||||
double dLinTol = LIN_TOL_SRF ;
|
double dLinTol = LIN_TOL_SRF ;
|
||||||
double dTriaMinSide = 100 * EPS_SMALL ;
|
LuaGetParam( L, 2, dLinTol) ;
|
||||||
if ( LuaGetParam( L, 2, dLinTol))
|
|
||||||
LuaGetParam( L, 3, dTriaMinSide) ;
|
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// approssimazione della superficie
|
// approssimazione della superficie
|
||||||
bool bOk = ExeApproxSurface( nId, dLinTol, dTriaMinSide) ;
|
bool bOk = ExeApproxSurface( nId, dLinTol) ;
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
@@ -142,29 +141,6 @@ LuaSurfFrOffset( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfFrOffsetAdv( lua_State* L)
|
|
||||||
{
|
|
||||||
// 3 parametri : Id, dDist, nType
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
double dDist ;
|
|
||||||
LuaCheckParam( L, 2, dDist)
|
|
||||||
int nType = ICurve::OFF_FILLET ;
|
|
||||||
LuaGetParam( L, 3, nType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo l'offset della regione
|
|
||||||
int nNewId = GDB_ID_NULL ;
|
|
||||||
bool bOk = ExeSurfFrOffsetAdv( nId, dDist, nType, nNewId) ;
|
|
||||||
if ( bOk)
|
|
||||||
LuaSetParam( L, nNewId) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaSurfTmMoveVertex( lua_State* L)
|
LuaSurfTmMoveVertex( lua_State* L)
|
||||||
@@ -189,30 +165,6 @@ LuaSurfTmMoveVertex( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfTmMoveFacet( lua_State* L)
|
|
||||||
{
|
|
||||||
// 3 o 4 o 5 parametri : nId, nFacet, vtMove [, nRefId] [, bUpdate]
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
int nFacet ;
|
|
||||||
LuaCheckParam( L, 2, nFacet)
|
|
||||||
Vector3d vtMove ;
|
|
||||||
LuaCheckParam( L, 3, vtMove)
|
|
||||||
int nRefType = RTY_DEFAULT ;
|
|
||||||
bool bUpdate = true ;
|
|
||||||
if ( LuaGetParam( L, 4, nRefType))
|
|
||||||
LuaGetParam( L, 5, bUpdate) ;
|
|
||||||
else
|
|
||||||
LuaGetParam( L, 4, bUpdate) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// sposto la faccia di indice dato della trimesh
|
|
||||||
bool bOk = ExeSurfTmMoveFacet( nId, nFacet, vtMove, nRefType, bUpdate) ;
|
|
||||||
LuaSetParam( L, bOk) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaSurfTmToTriangles( lua_State* L)
|
LuaSurfTmToTriangles( lua_State* L)
|
||||||
@@ -308,29 +260,6 @@ LuaCutSurfTmPlane( lua_State* L)
|
|||||||
return 1 ;
|
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
|
static int
|
||||||
LuaCutSurfTmClosedCurve( lua_State* L)
|
LuaCutSurfTmClosedCurve( lua_State* L)
|
||||||
@@ -404,6 +333,20 @@ LuaSurfTmIntersect( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaSurfTmResetTwoColors( lua_State* L)
|
||||||
|
{
|
||||||
|
// 1 parametro : Id
|
||||||
|
int nId ;
|
||||||
|
LuaCheckParam( L, 1, nId)
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// eseguo reset TFlag per annullare due colori
|
||||||
|
bool bOk = ExeSurfTmResetTwoColors( nId) ;
|
||||||
|
LuaSetParam( L, bOk) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaSurfTmSplit( lua_State* L)
|
LuaSurfTmSplit( lua_State* L)
|
||||||
@@ -445,159 +388,6 @@ LuaSurfTmCut( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfTmSubtractProjectedFacesOnFace( lua_State* L)
|
|
||||||
{
|
|
||||||
// 3 o 4 o 5 parametri : nSurfId, nFaceInd, nDestGrpId [, vSurfsId] [, bOCFlag]
|
|
||||||
int nSurfId ;
|
|
||||||
LuaCheckParam( L, 1, nSurfId) ;
|
|
||||||
int nFaceInd ;
|
|
||||||
LuaCheckParam( L, 2, nFaceInd) ;
|
|
||||||
int nDestGrpId ;
|
|
||||||
LuaCheckParam( L, 3, nDestGrpId) ;
|
|
||||||
INTVECTOR vSurfsId ;
|
|
||||||
bool bOCFlag = true ;
|
|
||||||
if ( LuaGetParam( L, 4, vSurfsId))
|
|
||||||
LuaGetParam( L, 5, bOCFlag) ;
|
|
||||||
else
|
|
||||||
LuaGetParam( L, 4, bOCFlag) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// sottraggo alla faccia scelta la proiezione delle altre TriMesh
|
|
||||||
int nNewId = GDB_ID_NULL;
|
|
||||||
bool bExistProjection = false ;
|
|
||||||
int nNewFaceNbr = 0 ;
|
|
||||||
bool bOk = ExeSurfTmSubtractProjectedFacesOnFace( nSurfId, nFaceInd, nDestGrpId, vSurfsId,
|
|
||||||
bOCFlag, bExistProjection, nNewId, nNewFaceNbr) ;
|
|
||||||
LuaSetParam( L, bOk) ;
|
|
||||||
LuaSetParam( L, bExistProjection) ;
|
|
||||||
if ( nNewId != GDB_ID_NULL)
|
|
||||||
LuaSetParam( L, nNewId) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L, nNewFaceNbr) ;
|
|
||||||
return 4 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfTmSetFaceColor( lua_State* L)
|
|
||||||
{
|
|
||||||
// 3 parametri : Id, nFacet, nColor
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
int nFacet ;
|
|
||||||
LuaCheckParam( L, 2, nFacet)
|
|
||||||
int nColor ;
|
|
||||||
LuaCheckParam( L, 3, nColor)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// imposto il colore alla faccia della superficie TM
|
|
||||||
bool bOk = ExeSurfTmSetFaceColor( nId, nFacet, nColor) ;
|
|
||||||
LuaSetParam( L, bOk) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfTmGetTriaColor( lua_State* L)
|
|
||||||
{
|
|
||||||
// 2 parametri : Id, nTria
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
int nTria ;
|
|
||||||
LuaCheckParam( L, 2, nTria)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero il flag di colore del triangolo della superficie TM
|
|
||||||
int nColor ;
|
|
||||||
bool bOk = ExeSurfTmGetTriaColor( nId, nTria, nColor) ;
|
|
||||||
if ( bOk)
|
|
||||||
LuaSetParam( L, nColor) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfTmResetTwoColors( lua_State* L)
|
|
||||||
{
|
|
||||||
// 1 parametro : Id
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo reset TFlag per annullare due colori
|
|
||||||
bool bOk = ExeSurfTmResetTwoColors( nId) ;
|
|
||||||
LuaSetParam( L, bOk) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfTmSetShowEdges( lua_State* L)
|
|
||||||
{
|
|
||||||
// 2 parametri : Id, bShow
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
bool bShow ;
|
|
||||||
LuaCheckParam( L, 2, bShow) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// imposto flag visualizzazione spigoli vivi
|
|
||||||
bool bOk = ExeSurfTmSetShowEdges( nId, bShow) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
LuaSetParam( L, bOk) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfTmGetShowEdges( lua_State* L)
|
|
||||||
{
|
|
||||||
// 1 parametro : Id
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero il flag di visualizzazione degli spigoli vivi della superficie TM
|
|
||||||
bool bShow ;
|
|
||||||
bool bOk = ExeSurfTmGetShowEdges( nId, bShow) ;
|
|
||||||
if ( bOk)
|
|
||||||
LuaSetParam( L, bShow) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfBzTrim( lua_State* L)
|
|
||||||
{
|
|
||||||
// 2 parametri : nId, nCutterId
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
int nCutterId ;
|
|
||||||
LuaCheckParam( L, 2, nCutterId)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// taglio la prima superficie in base alla seconda
|
|
||||||
bool bOk = ExeSurfBzTrim( nId, nCutterId) ;
|
|
||||||
LuaSetParam( L, bOk) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfTmSetSmoothAng( lua_State* L)
|
|
||||||
{
|
|
||||||
// 2 parametri : nId, nCutterId
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
double dAngDeg ;
|
|
||||||
LuaCheckParam( L, 2, dAngDeg)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// aggiorno lo smooth angle della superficie
|
|
||||||
bool bOk = ExeSurfTmSetSmoothAng( nId, dAngDeg) ;
|
|
||||||
LuaSetParam( L, bOk) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
LuaInstallGdbModifySurf( LuaMgr& luaMgr)
|
LuaInstallGdbModifySurf( LuaMgr& luaMgr)
|
||||||
@@ -610,28 +400,18 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrSubtract", LuaSurfFrSubtract) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrSubtract", LuaSurfFrSubtract) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrIntersect", LuaSurfFrIntersect) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrIntersect", LuaSurfFrIntersect) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffsetAdv", LuaSurfFrOffsetAdv) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveVertex", LuaSurfTmMoveVertex) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveVertex", LuaSurfTmMoveVertex) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveFacet", LuaSurfTmMoveFacet) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwapFacets", LuaSurfTmSwapFacets) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwapFacets", LuaSurfTmSwapFacets) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemovePart", LuaSurfTmRemovePart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemovePart", LuaSurfTmRemovePart) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmPlane", LuaCutSurfTmPlane) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmPlane", LuaCutSurfTmPlane) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfBzPlane", LuaCutSurfBzPlane) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmClosedCurve", LuaCutSurfTmClosedCurve) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmClosedCurve", LuaCutSurfTmClosedCurve) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmAdd", LuaSurfTmAdd) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmAdd", LuaSurfTmAdd) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtract", LuaSurfTmSubtract) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtract", LuaSurfTmSubtract) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmIntersect", LuaSurfTmIntersect) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmIntersect", LuaSurfTmIntersect) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSplit", LuaSurfTmSplit) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSplit", LuaSurfTmSplit) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCut", LuaSurfTmCut) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCut", LuaSurfTmCut) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtractProjectedFacesOnFace", LuaSurfTmSubtractProjectedFacesOnFace) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetFaceColor", LuaSurfTmSetFaceColor) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetTriaColor", LuaSurfTmGetTriaColor) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetShowEdges", LuaSurfTmSetShowEdges) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetShowEdges", LuaSurfTmGetShowEdges) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzTrim", LuaSurfBzTrim) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetSmoothAng", LuaSurfTmSetSmoothAng) ;
|
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-48
@@ -56,23 +56,6 @@ LuaVolZmapChangeResolution( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaVolZmapSetShowEdges( lua_State* L)
|
|
||||||
{
|
|
||||||
// 2 parametri : Id, bShow
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
bool bShow ;
|
|
||||||
LuaCheckParam( L, 2, bShow) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// imposto flag visualizzazione spigoli vivi
|
|
||||||
bool bOk = ExeVolZmapSetShowEdges( nId, bShow) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
LuaSetParam( L, bOk) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaRemoveVolZmapPart( lua_State* L)
|
LuaRemoveVolZmapPart( lua_State* L)
|
||||||
@@ -152,7 +135,7 @@ LuaVolZmapSetAdvTool( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaVolZmapSetSawTool( lua_State* L)
|
LuaVolZmapSetSawTool( lua_State* L)
|
||||||
{
|
{
|
||||||
// 7 o 8 parametri : vIds, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR [, nFlag]
|
// 7 o 8 parametri : vIds, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR, nFlag
|
||||||
INTVECTOR vIds ;
|
INTVECTOR vIds ;
|
||||||
LuaCheckParam( L, 1, vIds)
|
LuaCheckParam( L, 1, vIds)
|
||||||
string sToolName ;
|
string sToolName ;
|
||||||
@@ -181,7 +164,7 @@ LuaVolZmapSetSawTool( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaVolZmapSetGenTool( lua_State* L)
|
LuaVolZmapSetGenTool( lua_State* L)
|
||||||
{
|
{
|
||||||
// 3 o 4 parametri : vIds, sToolName, ToolSectId [, nFlag]
|
// 3 o 4 parametri : vIds, sToolName, ToolSectId, nFlag
|
||||||
INTVECTOR vIds ;
|
INTVECTOR vIds ;
|
||||||
LuaCheckParam( L, 1, vIds)
|
LuaCheckParam( L, 1, vIds)
|
||||||
string sToolName ;
|
string sToolName ;
|
||||||
@@ -202,7 +185,7 @@ LuaVolZmapSetGenTool( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaVolZmapSetMortiserTool( lua_State* L)
|
LuaVolZmapSetMortiserTool( lua_State* L)
|
||||||
{
|
{
|
||||||
// 6 o 7 parametri : Id, sToolName, dLen, dWidth, dThick, dCornR [, nFlag]
|
// 6 o 7 parametri : Id, sToolName, dLen, dWidth, dThick, dCornR, nFlag
|
||||||
INTVECTOR vIds ;
|
INTVECTOR vIds ;
|
||||||
LuaCheckParam( L, 1, vIds)
|
LuaCheckParam( L, 1, vIds)
|
||||||
string sToolName ;
|
string sToolName ;
|
||||||
@@ -229,7 +212,7 @@ LuaVolZmapSetMortiserTool( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaVolZmapSetChiselTool( lua_State* L)
|
LuaVolZmapSetChiselTool( lua_State* L)
|
||||||
{
|
{
|
||||||
// 5 o 6 parametri : vIds, sToolName, dLen, dWidth, dThick [, nFlag]
|
// 5 o 6 parametri : vIds, sToolName, dLen, dWidth, dThick, nFlag
|
||||||
INTVECTOR vIds ;
|
INTVECTOR vIds ;
|
||||||
LuaCheckParam( L, 1, vIds)
|
LuaCheckParam( L, 1, vIds)
|
||||||
string sToolName ;
|
string sToolName ;
|
||||||
@@ -250,31 +233,6 @@ LuaVolZmapSetChiselTool( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaVolZmapSetAdditiveTool( lua_State* L)
|
|
||||||
{
|
|
||||||
// 5 o 6 parametri : vIds, sToolName, dLen, dDiam, dCornR [, nFlag]
|
|
||||||
INTVECTOR vIds ;
|
|
||||||
LuaCheckParam( L, 1, vIds)
|
|
||||||
string sToolName ;
|
|
||||||
LuaCheckParam( L, 2, sToolName)
|
|
||||||
double dLen ;
|
|
||||||
LuaCheckParam( L, 3, dLen)
|
|
||||||
double dDiam ;
|
|
||||||
LuaCheckParam( L, 4, dDiam)
|
|
||||||
double dCornR ;
|
|
||||||
LuaCheckParam( L, 5, dCornR)
|
|
||||||
int nFlag = 1 ;
|
|
||||||
LuaGetParam( L, 6, nFlag) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// imposto utensile additivo a Zmap indicati
|
|
||||||
bool bOk = ExeVolZmapSetAdditiveTool( vIds, sToolName, dLen, dDiam, dCornR, nFlag, true) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
LuaSetParam( L, bOk) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaVolZmapResetTool( lua_State* L)
|
LuaVolZmapResetTool( lua_State* L)
|
||||||
@@ -392,7 +350,6 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
|
|||||||
bool bOk = ( &luaMgr != nullptr) ;
|
bool bOk = ( &luaMgr != nullptr) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeVolume", LuaExplodeVolume) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeVolume", LuaExplodeVolume) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapChangeResolution", LuaVolZmapChangeResolution) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapChangeResolution", LuaVolZmapChangeResolution) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetShowEdges", LuaVolZmapSetShowEdges) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdvTool", LuaVolZmapSetAdvTool) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdvTool", LuaVolZmapSetAdvTool) ;
|
||||||
@@ -400,7 +357,6 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetGenTool", LuaVolZmapSetGenTool) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetGenTool", LuaVolZmapSetGenTool) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetMortiserTool", LuaVolZmapSetMortiserTool) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetMortiserTool", LuaVolZmapSetMortiserTool) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetChiselTool", LuaVolZmapSetChiselTool) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetChiselTool", LuaVolZmapSetChiselTool) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdditiveTool", LuaVolZmapSetAdditiveTool) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapResetTool", LuaVolZmapResetTool) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapResetTool", LuaVolZmapResetTool) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetToolOutline", LuaVolZmapGetToolOutline) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetToolOutline", LuaVolZmapGetToolOutline) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMillingStep", LuaVolZmapMillingStep) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMillingStep", LuaVolZmapMillingStep) ;
|
||||||
|
|||||||
+13
-3
@@ -519,8 +519,10 @@ LuaSetInfo( lua_State* L)
|
|||||||
} break ;
|
} break ;
|
||||||
case LUA_TTABLE :
|
case LUA_TTABLE :
|
||||||
{ Frame3d frVal ;
|
{ Frame3d frVal ;
|
||||||
BBox3d b3Val ;
|
BBox3d b3Val ;
|
||||||
DBLVECTOR vdVal ; // va bene anche per Vector3d, Point3d, vnVal
|
Vector3d vtVal ; // va bene anche per Point3d
|
||||||
|
INTVECTOR vnVal ;
|
||||||
|
DBLVECTOR vdVal ;
|
||||||
STRVECTOR vsVal ;
|
STRVECTOR vsVal ;
|
||||||
if ( LuaGetParam( L, 3, frVal)) {
|
if ( LuaGetParam( L, 3, frVal)) {
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
@@ -529,7 +531,15 @@ LuaSetInfo( lua_State* L)
|
|||||||
else if ( LuaGetParam( L, 3, b3Val)) {
|
else if ( LuaGetParam( L, 3, b3Val)) {
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
bOk = ExeSetInfo( nId, sKey, b3Val) ;
|
bOk = ExeSetInfo( nId, sKey, b3Val) ;
|
||||||
}
|
}
|
||||||
|
else if ( LuaGetParam( L, 3, vtVal)) {
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
bOk = ExeSetInfo( nId, sKey, vtVal) ;
|
||||||
|
}
|
||||||
|
else if ( LuaGetParam( L, 3, vnVal)) {
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
bOk = ExeSetInfo( nId, sKey, vnVal) ;
|
||||||
|
}
|
||||||
else if ( LuaGetParam( L, 3, vdVal)) {
|
else if ( LuaGetParam( L, 3, vdVal)) {
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
bOk = ExeSetInfo( nId, sKey, vdVal) ;
|
bOk = ExeSetInfo( nId, sKey, vdVal) ;
|
||||||
|
|||||||
@@ -277,21 +277,6 @@ LuaGetPrevLayer( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaIsGhostPart( lua_State* L)
|
|
||||||
{
|
|
||||||
// 1 parametro : nGhostId
|
|
||||||
int nGhostId ;
|
|
||||||
LuaCheckParam( L, 1, nGhostId)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// verifico sia un segnaposto di pezzo messo in grezzo
|
|
||||||
bool bOk = ExeIsGhostPart( nGhostId) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
LuaSetParam( L, bOk) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaGetFirstGhostPart( lua_State* L)
|
LuaGetFirstGhostPart( lua_State* L)
|
||||||
@@ -469,42 +454,6 @@ LuaDuploList( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaDuploInRawCount( lua_State* L)
|
|
||||||
{
|
|
||||||
// 1 parametro : nSouId
|
|
||||||
int nSouId ;
|
|
||||||
LuaCheckParam( L, 1, nSouId)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero il numero di duplicati che sono riferiti da grezzi nei vari gruppi di lavoro del progetto
|
|
||||||
int nCount ;
|
|
||||||
bool bOk = ExeDuploInRawCount( nSouId, nCount) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( bOk)
|
|
||||||
LuaSetParam( L, nCount) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaDuploWithoutRawList( lua_State* L)
|
|
||||||
{
|
|
||||||
// nessun parametro
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero l'elenco dei duplicati
|
|
||||||
INTVECTOR vnDup ;
|
|
||||||
bool bOk = ExeDuploWithoutRawList( vnDup) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( bOk)
|
|
||||||
LuaSetParam( L, vnDup) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaDuploSetModified( lua_State* L)
|
LuaDuploSetModified( lua_State* L)
|
||||||
@@ -656,7 +605,6 @@ LuaInstallGdbPartLayer( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextLayer", LuaGetNextLayer) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextLayer", LuaGetNextLayer) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastLayer", LuaGetLastLayer) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastLayer", LuaGetLastLayer) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevLayer", LuaGetPrevLayer) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevLayer", LuaGetPrevLayer) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtIsGhostPart", LuaIsGhostPart) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstGhostPart", LuaGetFirstGhostPart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstGhostPart", LuaGetFirstGhostPart) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextGhostPart", LuaGetNextGhostPart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextGhostPart", LuaGetNextGhostPart) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseEmptyParts", LuaEraseEmptyParts) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseEmptyParts", LuaEraseEmptyParts) ;
|
||||||
@@ -668,8 +616,6 @@ LuaInstallGdbPartLayer( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploNew", LuaDuploNew) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploNew", LuaDuploNew) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploCount", LuaDuploCount) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploCount", LuaDuploCount) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploList", LuaDuploList) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploList", LuaDuploList) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploInRawCount", LuaDuploInRawCount) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploWithoutRawList", LuaDuploWithoutRawList) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploSetModified", LuaDuploSetModified) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploSetModified", LuaDuploSetModified) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploGetModified", LuaDuploGetModified) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploGetModified", LuaDuploGetModified) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploSetLocked", LuaDuploSetLocked) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploSetLocked", LuaDuploSetLocked) ;
|
||||||
|
|||||||
+7
-125
@@ -31,7 +31,6 @@
|
|||||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||||
#include "Windowsx.h"
|
#include "Windowsx.h"
|
||||||
#include "shlobj.h"
|
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
@@ -107,24 +106,6 @@ LuaPause( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaGetKeyPressed( lua_State* L)
|
|
||||||
{
|
|
||||||
// 1 parametro : nKeyCode
|
|
||||||
int nKeyCode ;
|
|
||||||
LuaCheckParam( L, 1, nKeyCode)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// se abilitata UI, controllo se il tasto indicato è premuto
|
|
||||||
bool bPressed = false ;
|
|
||||||
if ( ExeGetEnableUI()) {
|
|
||||||
bPressed = (( GetAsyncKeyState( nKeyCode) & 0x8000) != 0) ;
|
|
||||||
}
|
|
||||||
// restituisco il risultato
|
|
||||||
LuaSetParam( L, bPressed) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaStartCounter( lua_State* L)
|
LuaStartCounter( lua_State* L)
|
||||||
@@ -197,11 +178,11 @@ LuaSplitStringPlus( lua_State* L)
|
|||||||
// 2 parametri : sVal, sHea
|
// 2 parametri : sVal, sHea
|
||||||
string sVal ;
|
string sVal ;
|
||||||
string sHea ;
|
string sHea ;
|
||||||
bool bOk = LuaGetParam( L, 1, sVal) &&
|
bool bFound = LuaGetParam( L, 1, sVal) ;
|
||||||
LuaGetParam( L, 2, sHea) ;
|
LuaCheckParam( L, 2, sHea)
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// se ricevute stringhe, divido la prima in parti con intestazioni della seconda (che conservo)
|
// se ricevuta stringa, la divido in parti conservandone le intestazioni
|
||||||
if ( bOk) {
|
if ( bFound) {
|
||||||
STRVECTOR vsVal ;
|
STRVECTOR vsVal ;
|
||||||
TokenizePlus( sVal, sHea, vsVal) ;
|
TokenizePlus( sVal, sHea, vsVal) ;
|
||||||
// ritorno il risultato
|
// ritorno il risultato
|
||||||
@@ -213,25 +194,6 @@ LuaSplitStringPlus( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaReplaceString( lua_State* L)
|
|
||||||
{
|
|
||||||
// 3 parametri : sVal, sOld, sNew
|
|
||||||
string sVal ;
|
|
||||||
LuaCheckParam( L, 1, sVal)
|
|
||||||
string sOld ;
|
|
||||||
LuaCheckParam( L, 2, sOld)
|
|
||||||
string sNew ;
|
|
||||||
LuaCheckParam( L, 3, sNew)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo sostituzione nella stringa della sequenza indicata dal secondo parametro con quella del terzo
|
|
||||||
int nRes = ReplaceString( sVal, sOld, sNew) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
LuaSetParam( L, sVal) ;
|
|
||||||
LuaSetParam( L, nRes) ;
|
|
||||||
return 2 ;
|
|
||||||
}
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaSetVal( lua_State* L)
|
LuaSetVal( lua_State* L)
|
||||||
@@ -775,67 +737,6 @@ LuaCompareFilesLastWriteTime( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
CALLBACK DirectoryBoxProc( HWND hwndDlg, UINT uMsg, LPARAM lParam, LPARAM lpData)
|
|
||||||
{
|
|
||||||
if ( uMsg == BFFM_INITIALIZED)
|
|
||||||
SendMessage( hwndDlg, BFFM_SETSELECTION, TRUE, lpData) ;
|
|
||||||
return 0 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaDirectoryDialog( lua_State* L)
|
|
||||||
{
|
|
||||||
// 2 parametri : sText, sDir
|
|
||||||
string sText ;
|
|
||||||
LuaCheckParam( L, 1, sText)
|
|
||||||
string sDir ;
|
|
||||||
LuaCheckParam( L, 2, sDir)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// se abilitata UI, emetto la finestra di dialogo
|
|
||||||
if ( ExeGetEnableUI()) {
|
|
||||||
// Converto i parametri nel formato wide
|
|
||||||
AtoWEX<MAX_PATH> wsText( sText.c_str()) ;
|
|
||||||
AtoWEX<MAX_PATH> wsDirName( sDir.c_str()) ;
|
|
||||||
// Converto L'/' in L'\\' nel nome directory proposto
|
|
||||||
for ( wchar_t* pC = wsDirName.m_psz ; *pC != L'\0' ; ++ pC) {
|
|
||||||
if ( *pC == L'/')
|
|
||||||
*pC = L'\\' ;
|
|
||||||
}
|
|
||||||
// Riempio la struttura dati per il dialogo
|
|
||||||
BROWSEINFO bi = { 0} ;
|
|
||||||
bi.hwndOwner = ExeGetMainWindowHandle() ;
|
|
||||||
bi.lpszTitle = LPWSTR( wsText) ;
|
|
||||||
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_USENEWUI ;
|
|
||||||
bi.lpfn = DirectoryBoxProc ;
|
|
||||||
bi.lParam = (LPARAM) LPWSTR( wsDirName) ;
|
|
||||||
// Visualizzo il dialogo
|
|
||||||
LPITEMIDLIST pIdl = SHBrowseForFolder( &bi) ;
|
|
||||||
if ( pIdl != NULL) {
|
|
||||||
// recupero la path della directory
|
|
||||||
WCHAR wPath[MAX_PATH] ;
|
|
||||||
if ( SHGetPathFromIDList( pIdl, wPath) != FALSE)
|
|
||||||
LuaSetParam( L, wstrztoA( wPath)) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
// free memory used
|
|
||||||
IMalloc* pImalloc = NULL ;
|
|
||||||
if ( SUCCEEDED( SHGetMalloc( &pImalloc))) {
|
|
||||||
pImalloc->Free( pIdl) ;
|
|
||||||
pImalloc->Release() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaExistsDirectory( lua_State* L)
|
LuaExistsDirectory( lua_State* L)
|
||||||
@@ -1083,20 +984,6 @@ LuaGetMsg( lua_State* L)
|
|||||||
return 1 ;
|
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
|
static int
|
||||||
LuaWinExec( lua_State* L)
|
LuaWinExec( lua_State* L)
|
||||||
@@ -1128,10 +1015,9 @@ LuaCloseExe( lua_State* L)
|
|||||||
LuaGetParam( L, 1, nExitCode) ;
|
LuaGetParam( L, 1, nExitCode) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// eseguo chiusura forzata
|
// eseguo chiusura forzata
|
||||||
if ( ExeOnTerminateProcess( nExitCode))
|
bool bOk = ( TerminateProcess( GetCurrentProcess(), abs( nExitCode)) != FALSE) ;
|
||||||
TerminateProcess( GetCurrentProcess(), abs( nExitCode)) ;
|
// restituisco il risultato (in realtà il programma si è già concluso)
|
||||||
// restituisco il risultato (se arrivo qui vuol dire che non è consnetito terminare l'esecuzione)
|
LuaSetParam( L, bOk) ;
|
||||||
LuaSetParam( L, false) ;
|
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1354,13 +1240,11 @@ LuaInstallGeneral( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "print", MyPrint) ;
|
bOk = bOk && luaMgr.RegisterFunction( "print", MyPrint) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEvalNumExpr", LuaEvalNumExpr) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtEvalNumExpr", LuaEvalNumExpr) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPause", LuaPause) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtPause", LuaPause) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetKeyPressed", LuaGetKeyPressed) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtStartCounter", LuaStartCounter) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtStartCounter", LuaStartCounter) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtStopCounter", LuaStopCounter) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtStopCounter", LuaStopCounter) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtNumToString", LuaNumToString) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtNumToString", LuaNumToString) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitString", LuaSplitString) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitString", LuaSplitString) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitStringPlus", LuaSplitStringPlus) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitStringPlus", LuaSplitStringPlus) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtReplaceString", LuaReplaceString) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetVal", LuaSetVal) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetVal", LuaSetVal) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetVal", LuaGetVal) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetVal", LuaGetVal) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetUUID", LuaGetUUID) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetUUID", LuaGetUUID) ;
|
||||||
@@ -1382,7 +1266,6 @@ LuaInstallGeneral( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseFile", LuaEraseFile) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseFile", LuaEraseFile) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtFindAllFiles", LuaFindAllFiles) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtFindAllFiles", LuaFindAllFiles) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCompareFilesLastWriteTime", LuaCompareFilesLastWriteTime) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCompareFilesLastWriteTime", LuaCompareFilesLastWriteTime) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDirectoryDialog", LuaDirectoryDialog) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsDirectory", LuaExistsDirectory) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsDirectory", LuaExistsDirectory) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateDirectory", LuaCreateDirectory) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateDirectory", LuaCreateDirectory) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEmptyDirectory", LuaEmptyDirectory) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtEmptyDirectory", LuaEmptyDirectory) ;
|
||||||
@@ -1398,7 +1281,6 @@ LuaInstallGeneral( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtIs64bit", LuaIs64bit) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtIs64bit", LuaIs64bit) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLanguage", LuaGetLanguage) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLanguage", LuaGetLanguage) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMsg", LuaGetMsg) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtMsg", LuaGetMsg) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVerifyKeyOption", LuaVerifyKeyOption) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtWinExec", LuaWinExec) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtWinExec", LuaWinExec) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCloseExe", LuaCloseExe) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCloseExe", LuaCloseExe) ;
|
||||||
|
|||||||
@@ -530,83 +530,6 @@ LuaBBoxLocToLoc( lua_State* L)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaQuaternionFromAxisAngle( lua_State* L)
|
|
||||||
{
|
|
||||||
// 2 parametri : vtAx, dAngDeg
|
|
||||||
Vector3d vtAx ;
|
|
||||||
LuaCheckParam( L, 1, vtAx)
|
|
||||||
double dAngDeg ;
|
|
||||||
LuaCheckParam( L, 2, dAngDeg)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// calcolo il quaternione che produce la rotazione equivalente
|
|
||||||
Quaternion qtQ = FromAxisAngle( vtAx, dAngDeg) ;
|
|
||||||
if ( ! qtQ.IsSmall())
|
|
||||||
LuaSetParam( L, qtQ) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaQuaternionToAxisAngle( lua_State* L)
|
|
||||||
{
|
|
||||||
// 1 parametro : Quaternion
|
|
||||||
Quaternion qtQ ;
|
|
||||||
LuaCheckParam( L, 1, qtQ)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// calcolo l'asse e l'angolo di rotazione equivalenti
|
|
||||||
Vector3d vtAx ;
|
|
||||||
double dAngDeg ;
|
|
||||||
bool bOk = ToAxisAngle( qtQ, vtAx, dAngDeg) ;
|
|
||||||
if ( bOk) {
|
|
||||||
LuaSetParam( L, vtAx) ;
|
|
||||||
LuaSetParam( L, dAngDeg) ;
|
|
||||||
return 2 ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaQuaternionFromFrame( lua_State* L)
|
|
||||||
{
|
|
||||||
// 1 parametro : Frame
|
|
||||||
Frame3d frFrame ;
|
|
||||||
LuaCheckParam( L, 1, frFrame)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// calcolo il quaternione che produce l'orientamento di questo frame tramite rotazione dal globale
|
|
||||||
Quaternion qtQ = FromFrame( frFrame) ;
|
|
||||||
if ( ! qtQ.IsSmall())
|
|
||||||
LuaSetParam( L, qtQ) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaQuaternionToFrame( lua_State* L)
|
|
||||||
{
|
|
||||||
// 1 parametro : Quaternion
|
|
||||||
Quaternion qtQ ;
|
|
||||||
LuaCheckParam( L, 1, qtQ)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// calcolo il frame equivalente come orientamento a quello globale ruotato dal quaternione
|
|
||||||
Frame3d frFrame ;
|
|
||||||
bool bOk = ToFrame( qtQ, frFrame) ;
|
|
||||||
if ( bOk)
|
|
||||||
LuaSetParam( L, frFrame) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
LuaInstallGeoBase( LuaMgr& luaMgr)
|
LuaInstallGeoBase( LuaMgr& luaMgr)
|
||||||
@@ -634,9 +557,5 @@ LuaInstallGeoBase( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToGlob", LuaBBoxToGlob) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToGlob", LuaBBoxToGlob) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToLoc", LuaBBoxToLoc) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToLoc", LuaBBoxToLoc) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxLocToLoc", LuaBBoxLocToLoc) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxLocToLoc", LuaBBoxLocToLoc) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionFromAxisAngle", LuaQuaternionFromAxisAngle) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionToAxisAngle", LuaQuaternionToAxisAngle) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionFromFrame", LuaQuaternionFromFrame) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionToFrame", LuaQuaternionToFrame) ;
|
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
+129
-228
@@ -20,41 +20,6 @@
|
|||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaLineCurveInters( lua_State* L)
|
|
||||||
{
|
|
||||||
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
|
|
||||||
Point3d ptP ;
|
|
||||||
LuaCheckParam( L, 1, ptP)
|
|
||||||
Vector3d vtDir ;
|
|
||||||
LuaCheckParam( L, 2, vtDir)
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 3, nId)
|
|
||||||
int nRefType = nId ;
|
|
||||||
LuaGetParam( L, 4, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero i punti di intersezione tra linea e curva
|
|
||||||
INTDBLVECTOR vInters ;
|
|
||||||
if ( ExeLineCurveInters( ptP, vtDir, nId, nRefType, vInters)) {
|
|
||||||
LuaSetParam( L, true) ;
|
|
||||||
INTVECTOR vType( vInters.size()) ;
|
|
||||||
DBLVECTOR vPar( vInters.size()) ;
|
|
||||||
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
|
|
||||||
vType[i] = vInters[i].first ;
|
|
||||||
vPar[i] = vInters[i].second ;
|
|
||||||
}
|
|
||||||
LuaSetParam( L, vType) ;
|
|
||||||
LuaSetParam( L, vPar) ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
}
|
|
||||||
return 3 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaLineBoxInters( lua_State* L)
|
LuaLineBoxInters( lua_State* L)
|
||||||
@@ -88,6 +53,38 @@ LuaLineBoxInters( lua_State* L)
|
|||||||
return 3 ;
|
return 3 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaPlaneBoxInters( lua_State* L)
|
||||||
|
{
|
||||||
|
// 4 o 5 parametri : ptOn, vtN, b3Box, nDestGrpId [, nRefType]
|
||||||
|
Point3d ptOn ;
|
||||||
|
LuaCheckParam( L, 1, ptOn)
|
||||||
|
Vector3d vtN ;
|
||||||
|
LuaCheckParam( L, 2, vtN)
|
||||||
|
BBox3d b3Box ;
|
||||||
|
LuaCheckParam( L, 3, b3Box)
|
||||||
|
int nDestGrpId ;
|
||||||
|
LuaCheckParam( L, 4, nDestGrpId) ;
|
||||||
|
int nRefType = RTY_DEFAULT ;
|
||||||
|
LuaGetParam( L, 5, nRefType) ;
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// eseguo l'intersezione
|
||||||
|
int nPntCount = 0 ;
|
||||||
|
int nCrvCount = 0 ;
|
||||||
|
int nSrfCount = 0 ;
|
||||||
|
int nNewId = ExePlaneBoxInters( ptOn, vtN, b3Box, nDestGrpId, nRefType, &nPntCount, &nCrvCount, &nSrfCount) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
if ( nNewId != GDB_ID_NULL)
|
||||||
|
LuaSetParam( L, nNewId) ;
|
||||||
|
else
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
LuaSetParam( L, nPntCount) ;
|
||||||
|
LuaSetParam( L, nCrvCount) ;
|
||||||
|
LuaSetParam( L, nSrfCount) ;
|
||||||
|
return 4 ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaLineSurfTmInters( lua_State* L)
|
LuaLineSurfTmInters( lua_State* L)
|
||||||
@@ -123,136 +120,6 @@ LuaLineSurfTmInters( lua_State* L)
|
|||||||
return 3 ;
|
return 3 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaLineSurfBzInters( lua_State* L)
|
|
||||||
{
|
|
||||||
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
|
|
||||||
Point3d ptP ;
|
|
||||||
LuaCheckParam( L, 1, ptP)
|
|
||||||
Vector3d vtDir ;
|
|
||||||
LuaCheckParam( L, 2, vtDir)
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 3, nId)
|
|
||||||
int nRefType = nId ;
|
|
||||||
LuaGetParam( L, 4, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero i punti di intersezione tra linea e superficie trimesh
|
|
||||||
INTDBLVECTOR vInters ;
|
|
||||||
if ( ExeLineSurfBzInters( ptP, vtDir, nId, nRefType, vInters)) {
|
|
||||||
LuaSetParam( L, true) ;
|
|
||||||
INTVECTOR vType( vInters.size()) ;
|
|
||||||
DBLVECTOR vPar( vInters.size()) ;
|
|
||||||
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
|
|
||||||
vType[i] = vInters[i].first ;
|
|
||||||
vPar[i] = vInters[i].second ;
|
|
||||||
}
|
|
||||||
LuaSetParam( L, vType) ;
|
|
||||||
LuaSetParam( L, vPar) ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
}
|
|
||||||
return 3 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaLineVolZmapInters( lua_State* L)
|
|
||||||
{
|
|
||||||
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
|
|
||||||
Point3d ptP ;
|
|
||||||
LuaCheckParam( L, 1, ptP)
|
|
||||||
Vector3d vtDir ;
|
|
||||||
LuaCheckParam( L, 2, vtDir)
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 3, nId)
|
|
||||||
int nRefType = nId ;
|
|
||||||
LuaGetParam( L, 4, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo calcolo intersezione
|
|
||||||
INTDBLVECTOR vInters ;
|
|
||||||
if ( ExeLineVolZmapInters( ptP, vtDir, nId, nRefType, vInters)) {
|
|
||||||
LuaSetParam( L, true) ;
|
|
||||||
INTVECTOR vType( vInters.size()) ;
|
|
||||||
DBLVECTOR vPar( vInters.size()) ;
|
|
||||||
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
|
|
||||||
vType[i] = vInters[i].first ;
|
|
||||||
vPar[i] = vInters[i].second ;
|
|
||||||
}
|
|
||||||
LuaSetParam( L, vType) ;
|
|
||||||
LuaSetParam( L, vPar) ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
}
|
|
||||||
return 3 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaPlaneCurveInters( lua_State* L)
|
|
||||||
{
|
|
||||||
// 4 o 5 parametri : ptOn, vtN, nId, nDestGrpId [, nRefType]
|
|
||||||
Point3d ptOn ;
|
|
||||||
LuaCheckParam( L, 1, ptOn)
|
|
||||||
Vector3d vtN ;
|
|
||||||
LuaCheckParam( L, 2, vtN)
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 3, nId)
|
|
||||||
int nDestGrpId ;
|
|
||||||
LuaCheckParam( L, 4, nDestGrpId) ;
|
|
||||||
int nRefType = RTY_DEFAULT ;
|
|
||||||
LuaGetParam( L, 5, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo l'intersezione
|
|
||||||
int nCount = 0 ;
|
|
||||||
int nNewId = ExePlaneCurveInters( ptOn, vtN, nId, nDestGrpId, nRefType, &nCount) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nNewId != GDB_ID_NULL)
|
|
||||||
LuaSetParam( L, nNewId) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L, nCount) ;
|
|
||||||
return 2 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaPlaneBoxInters( lua_State* L)
|
|
||||||
{
|
|
||||||
// 4 o 5 parametri : ptOn, vtN, b3Box, nDestGrpId [, nRefType]
|
|
||||||
Point3d ptOn ;
|
|
||||||
LuaCheckParam( L, 1, ptOn)
|
|
||||||
Vector3d vtN ;
|
|
||||||
LuaCheckParam( L, 2, vtN)
|
|
||||||
BBox3d b3Box ;
|
|
||||||
LuaCheckParam( L, 3, b3Box)
|
|
||||||
int nDestGrpId ;
|
|
||||||
LuaCheckParam( L, 4, nDestGrpId) ;
|
|
||||||
int nRefType = RTY_DEFAULT ;
|
|
||||||
LuaGetParam( L, 5, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo l'intersezione
|
|
||||||
int nPntCount = 0 ;
|
|
||||||
int nCrvCount = 0 ;
|
|
||||||
int nSrfCount = 0 ;
|
|
||||||
int nNewId = ExePlaneBoxInters( ptOn, vtN, b3Box, nDestGrpId, nRefType, &nPntCount, &nCrvCount, &nSrfCount) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nNewId != GDB_ID_NULL)
|
|
||||||
LuaSetParam( L, nNewId) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L, nPntCount) ;
|
|
||||||
LuaSetParam( L, nCrvCount) ;
|
|
||||||
LuaSetParam( L, nSrfCount) ;
|
|
||||||
return 4 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaPlaneSurfTmInters( lua_State* L)
|
LuaPlaneSurfTmInters( lua_State* L)
|
||||||
@@ -321,32 +188,59 @@ LuaParPlanesSurfTmInters( lua_State* L)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaPlaneVolZmapInters( lua_State* L)
|
LuaSurfTmSurfTmInters( lua_State* L)
|
||||||
{
|
{
|
||||||
// 4 o 5 parametri : ptP, vtN, nId, nDestGrpId [, nRefType]
|
// 3 o 4 parametri : Id1, nId2, nDestGrpId [, dToler]
|
||||||
Point3d ptP ;
|
int nId1 ;
|
||||||
LuaCheckParam( L, 1, ptP)
|
LuaCheckParam( L, 1, nId1)
|
||||||
|
int nId2 ;
|
||||||
|
LuaCheckParam( L, 2, nId2)
|
||||||
|
int nDestGrpId ;
|
||||||
|
LuaCheckParam( L, 3, nDestGrpId) ;
|
||||||
|
double dToler = 20 * EPS_SMALL ;
|
||||||
|
LuaGetParam( L, 4, dToler) ;
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// eseguo l'intersezione
|
||||||
|
int nPntCount = 0 ;
|
||||||
|
int nCrvCount = 0 ;
|
||||||
|
int nSrfCount = 0 ;
|
||||||
|
int nNewId = ExeSurfTmSurfTmInters( nId1, nId2, nDestGrpId, dToler, &nPntCount, &nCrvCount, &nSrfCount) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
if ( nNewId != GDB_ID_NULL)
|
||||||
|
LuaSetParam( L, nNewId) ;
|
||||||
|
else
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
LuaSetParam( L, nPntCount) ;
|
||||||
|
LuaSetParam( L, nCrvCount) ;
|
||||||
|
LuaSetParam( L, nSrfCount) ;
|
||||||
|
return 4 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaPlaneCurveInters( lua_State* L)
|
||||||
|
{
|
||||||
|
// 4 o 5 parametri : ptOn, vtN, nId, nDestGrpId [, nRefType]
|
||||||
|
Point3d ptOn ;
|
||||||
|
LuaCheckParam( L, 1, ptOn)
|
||||||
Vector3d vtN ;
|
Vector3d vtN ;
|
||||||
LuaCheckParam( L, 2, vtN)
|
LuaCheckParam( L, 2, vtN)
|
||||||
int nId ;
|
int nId ;
|
||||||
LuaCheckParam( L, 3, nId)
|
LuaCheckParam( L, 3, nId)
|
||||||
int nDestGrpId ;
|
int nDestGrpId ;
|
||||||
LuaCheckParam( L, 4, nDestGrpId)
|
LuaCheckParam( L, 4, nDestGrpId) ;
|
||||||
int nRefType = RTY_DEFAULT ;
|
int nRefType = RTY_DEFAULT ;
|
||||||
LuaGetParam( L, 5, nRefType) ;
|
LuaGetParam( L, 5, nRefType) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// eseguo calcolo intersezione
|
// eseguo l'intersezione
|
||||||
int nCount ;
|
int nCount = 0 ;
|
||||||
int nFirstId = ExePlaneVolZmapInters( ptP, vtN, nId, nDestGrpId, nRefType, &nCount) ;
|
int nNewId = ExePlaneCurveInters( ptOn, vtN, nId, nDestGrpId, nRefType, &nCount) ;
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
if ( nFirstId != GDB_ID_NULL) {
|
if ( nNewId != GDB_ID_NULL)
|
||||||
LuaSetParam( L, nFirstId) ;
|
LuaSetParam( L, nNewId) ;
|
||||||
LuaSetParam( L, nCount) ;
|
else
|
||||||
}
|
|
||||||
else {
|
|
||||||
LuaSetParam( L) ;
|
LuaSetParam( L) ;
|
||||||
LuaSetParam( L) ;
|
LuaSetParam( L, nCount) ;
|
||||||
}
|
|
||||||
return 2 ;
|
return 2 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,58 +272,68 @@ LuaCurveCurveInters( lua_State* L)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaCurveSurfTmInters( lua_State* L)
|
LuaLineVolZmapInters( lua_State* L)
|
||||||
{
|
{
|
||||||
// 3 parametri : nCrvId, nStmId, nDestGrpId
|
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
|
||||||
int nCrvId ;
|
Point3d ptP ;
|
||||||
LuaCheckParam( L, 1, nCrvId)
|
LuaCheckParam( L, 1, ptP)
|
||||||
int nStmId ;
|
Vector3d vtDir ;
|
||||||
LuaCheckParam( L, 2, nStmId)
|
LuaCheckParam( L, 2, vtDir)
|
||||||
int nDestGrpId ;
|
int nId ;
|
||||||
LuaCheckParam( L, 3, nDestGrpId) ;
|
LuaCheckParam( L, 3, nId)
|
||||||
|
int nRefType = nId ;
|
||||||
|
LuaGetParam( L, 4, nRefType) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// eseguo l'intersezione
|
// eseguo calcolo intersezione
|
||||||
int nPntCount = 0 ;
|
INTDBLVECTOR vInters ;
|
||||||
int nCrvCount = 0 ;
|
if ( ExeLineVolZmapInters( ptP, vtDir, nId, nRefType, vInters)) {
|
||||||
int nNewId = ExeCurveSurfTmInters( nCrvId, nStmId, nDestGrpId, &nPntCount, &nCrvCount) ;
|
LuaSetParam( L, true) ;
|
||||||
// restituisco il risultato
|
INTVECTOR vType( vInters.size()) ;
|
||||||
if ( nNewId != GDB_ID_NULL)
|
DBLVECTOR vPar( vInters.size()) ;
|
||||||
LuaSetParam( L, nNewId) ;
|
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
|
||||||
else
|
vType[i] = vInters[i].first ;
|
||||||
|
vPar[i] = vInters[i].second ;
|
||||||
|
}
|
||||||
|
LuaSetParam( L, vType) ;
|
||||||
|
LuaSetParam( L, vPar) ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
LuaSetParam( L) ;
|
LuaSetParam( L) ;
|
||||||
LuaSetParam( L, nPntCount) ;
|
LuaSetParam( L) ;
|
||||||
LuaSetParam( L, nCrvCount) ;
|
LuaSetParam( L) ;
|
||||||
|
}
|
||||||
return 3 ;
|
return 3 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaSurfTmSurfTmInters( lua_State* L)
|
LuaPlaneVolZmapInters( lua_State* L)
|
||||||
{
|
{
|
||||||
// 3 o 4 parametri : Id1, nId2, nDestGrpId [, dToler]
|
// 4 o 5 parametri : ptP, vtN, nId, nDestGrpId [, nRefType]
|
||||||
int nId1 ;
|
Point3d ptP ;
|
||||||
LuaCheckParam( L, 1, nId1)
|
LuaCheckParam( L, 1, ptP)
|
||||||
int nId2 ;
|
Vector3d vtN ;
|
||||||
LuaCheckParam( L, 2, nId2)
|
LuaCheckParam( L, 2, vtN)
|
||||||
|
int nId ;
|
||||||
|
LuaCheckParam( L, 3, nId)
|
||||||
int nDestGrpId ;
|
int nDestGrpId ;
|
||||||
LuaCheckParam( L, 3, nDestGrpId) ;
|
LuaCheckParam( L, 4, nDestGrpId)
|
||||||
double dToler = 20 * EPS_SMALL ;
|
int nRefType = RTY_DEFAULT ;
|
||||||
LuaGetParam( L, 4, dToler) ;
|
LuaGetParam( L, 5, nRefType) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// eseguo l'intersezione
|
// eseguo calcolo intersezione
|
||||||
int nPntCount = 0 ;
|
int nCount ;
|
||||||
int nCrvCount = 0 ;
|
int nFirstId = ExePlaneVolZmapInters( ptP, vtN, nId, nDestGrpId, nRefType, &nCount) ;
|
||||||
int nSrfCount = 0 ;
|
|
||||||
int nNewId = ExeSurfTmSurfTmInters( nId1, nId2, nDestGrpId, dToler, &nPntCount, &nCrvCount, &nSrfCount) ;
|
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
if ( nNewId != GDB_ID_NULL)
|
if ( nFirstId != GDB_ID_NULL) {
|
||||||
LuaSetParam( L, nNewId) ;
|
LuaSetParam( L, nFirstId) ;
|
||||||
else
|
LuaSetParam( L, nCount) ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
LuaSetParam( L) ;
|
LuaSetParam( L) ;
|
||||||
LuaSetParam( L, nPntCount) ;
|
LuaSetParam( L) ;
|
||||||
LuaSetParam( L, nCrvCount) ;
|
}
|
||||||
LuaSetParam( L, nSrfCount) ;
|
return 2 ;
|
||||||
return 4 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
@@ -437,18 +341,15 @@ bool
|
|||||||
LuaInstallGeoInters( LuaMgr& luaMgr)
|
LuaInstallGeoInters( LuaMgr& luaMgr)
|
||||||
{
|
{
|
||||||
bool bOk = ( &luaMgr != nullptr) ;
|
bool bOk = ( &luaMgr != nullptr) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtLineCurveInters", LuaLineCurveInters) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtLineBoxInters", LuaLineBoxInters) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtLineBoxInters", LuaLineBoxInters) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfTmInters", LuaLineSurfTmInters) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfBzInters", LuaLineSurfBzInters) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtLineVolZmapInters", LuaLineVolZmapInters) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneCurveInters", LuaPlaneCurveInters) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneBoxInters", LuaPlaneBoxInters) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneBoxInters", LuaPlaneBoxInters) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfTmInters", LuaLineSurfTmInters) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneSurfTmInters", LuaPlaneSurfTmInters) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneSurfTmInters", LuaPlaneSurfTmInters) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtParPlanesSurfTmInters", LuaParPlanesSurfTmInters) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtParPlanesSurfTmInters", LuaParPlanesSurfTmInters) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneVolZmapInters", LuaPlaneVolZmapInters) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCurveInters", LuaCurveCurveInters) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSurfTmInters", LuaCurveSurfTmInters) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneCurveInters", LuaPlaneCurveInters) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCurveInters", LuaCurveCurveInters) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtLineVolZmapInters", LuaLineVolZmapInters) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneVolZmapInters", LuaPlaneVolZmapInters) ;
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
+31
-171
@@ -262,24 +262,6 @@ LuaRemoveMachGroup( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaChangeMachGroupName( lua_State* L)
|
|
||||||
{
|
|
||||||
// 2 parametri : identificativo del gruppo, nuovo nome
|
|
||||||
int nMGroupInd ;
|
|
||||||
LuaCheckParam( L, 1, nMGroupInd)
|
|
||||||
string sNewName ;
|
|
||||||
LuaCheckParam( L, 2, sNewName)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// cambio il nome della macchinata
|
|
||||||
string sName ;
|
|
||||||
bool bOk = ExeChangeMachGroupName( nMGroupInd, sNewName) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
LuaSetParam( L, bOk) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaGetMachGroupName( lua_State* L)
|
LuaGetMachGroupName( lua_State* L)
|
||||||
@@ -1752,12 +1734,10 @@ LuaFindToolInCurrSetup( lua_State* L)
|
|||||||
string sTool ;
|
string sTool ;
|
||||||
LuaGetParam( L, 1, sTool) ;
|
LuaGetParam( L, 1, sTool) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// verifico attrezzaggio utensile e ne recupero l'eventuale posizione
|
// verifico l'attrezzaggio della macchinata corrente
|
||||||
string sTcPos ;
|
bool bOk = ExeFindToolInCurrSetup( sTool) ;
|
||||||
bool bOk = ExeGetToolSetupPosInCurrSetup( sTool, sTcPos) ;
|
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
LuaSetParam( L, sTcPos) ;
|
return 1 ;
|
||||||
return 2 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -2997,18 +2977,14 @@ LuaGetClEntFlag( lua_State* L)
|
|||||||
LuaGetParam( L, 1, nEntId) ;
|
LuaGetParam( L, 1, nEntId) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// recupero il flag
|
// recupero il flag
|
||||||
int nFlag, nFlag2 ;
|
int nFlag ;
|
||||||
bool bOk = ExeGetClEntFlag( nEntId, nFlag, nFlag2) ;
|
bool bOk = ExeGetClEntFlag( nEntId, nFlag) ;
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
if ( bOk) {
|
if ( bOk)
|
||||||
LuaSetParam( L, nFlag) ;
|
LuaSetParam( L, nFlag) ;
|
||||||
LuaSetParam( L, nFlag2) ;
|
else
|
||||||
}
|
|
||||||
else {
|
|
||||||
LuaSetParam( L) ;
|
LuaSetParam( L) ;
|
||||||
LuaSetParam( L) ;
|
return 1 ;
|
||||||
}
|
|
||||||
return 2 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -3030,44 +3006,6 @@ LuaGetClEntIndex( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaGetClEntAxesMask( lua_State* L)
|
|
||||||
{
|
|
||||||
// 1 parametro : nEntId
|
|
||||||
int nEntId ;
|
|
||||||
LuaGetParam( L, 1, nEntId) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero la mascheratura del movimento assi
|
|
||||||
int nMask ;
|
|
||||||
bool bOk = ExeGetClEntAxesMask( nEntId, nMask) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( bOk)
|
|
||||||
LuaSetParam( L, nMask) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaGetClEntAxesVal( lua_State* L)
|
|
||||||
{
|
|
||||||
// 1 parametro : nEntId
|
|
||||||
int nEntId ;
|
|
||||||
LuaGetParam( L, 1, nEntId) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero il valore degli assi
|
|
||||||
DBLVECTOR vAxes ;
|
|
||||||
bool bOk = ExeGetClEntAxesVal( nEntId, vAxes) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( bOk)
|
|
||||||
LuaSetParam( L, vAxes) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
// Simulation
|
// Simulation
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
@@ -3373,19 +3311,26 @@ LuaSetRotAxisBlock( lua_State* L)
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaGetCalcTable( lua_State* L)
|
LuaGetRotAxisBlocked( lua_State* L)
|
||||||
{
|
{
|
||||||
// nessun parametro
|
// 1 parametro : nInd ( 0-based)
|
||||||
|
int nInd ;
|
||||||
|
LuaCheckParam( L, 1, nInd)
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// recupero la tavola correnti
|
// recupero dati bloccaggio asse in posizione nInd
|
||||||
string sTable ;
|
string sAxis ;
|
||||||
bool bOk = ExeGetCalcTable( sTable) ;
|
double dVal ;
|
||||||
|
bool bOk = ExeGetRotAxisBlocked( nInd, sAxis, dVal) ;
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
if ( bOk)
|
if ( bOk) {
|
||||||
LuaSetParam( L, sTable) ;
|
LuaSetParam( L, sAxis) ;
|
||||||
else
|
LuaSetParam( L, dVal) ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
LuaSetParam( L) ;
|
LuaSetParam( L) ;
|
||||||
return 1 ;
|
LuaSetParam( L) ;
|
||||||
|
}
|
||||||
|
return 2 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
@@ -3413,47 +3358,6 @@ LuaGetCalcTool( lua_State* L)
|
|||||||
return 3 ;
|
return 3 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaGetAllCurrAxesNames( lua_State* L)
|
|
||||||
{
|
|
||||||
// nessun parametro
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// imposto l'utensile corrente per il calcolo
|
|
||||||
STRVECTOR vAxName ;
|
|
||||||
bool bOk = ExeGetAllCurrAxesNames( vAxName) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( bOk)
|
|
||||||
LuaSetParam( L, vAxName) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaGetRotAxisBlocked( lua_State* L)
|
|
||||||
{
|
|
||||||
// 1 parametro : nInd ( 0-based)
|
|
||||||
int nInd ;
|
|
||||||
LuaCheckParam( L, 1, nInd)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero dati bloccaggio asse in posizione nInd
|
|
||||||
string sAxis ;
|
|
||||||
double dVal ;
|
|
||||||
bool bOk = ExeGetRotAxisBlocked( nInd, sAxis, dVal) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( bOk) {
|
|
||||||
LuaSetParam( L, sAxis) ;
|
|
||||||
LuaSetParam( L, dVal) ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
}
|
|
||||||
return 2 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaGetCalcAngles( lua_State* L)
|
LuaGetCalcAngles( lua_State* L)
|
||||||
@@ -3521,7 +3425,7 @@ LuaGetCalcPositions( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaGetCalcTipFromPositions( lua_State* L)
|
LuaGetCalcTipFromPositions( lua_State* L)
|
||||||
{
|
{
|
||||||
// da 5 a 10 parametri : dX, dY, dZ, dAngR1[, dAngR2][, dAngR3][, dAngR4][, dAngR5][, dAngR6], bBottom
|
// da 5 a 8 parametri : dX, dY, dZ, dAngA [, dAngB] [, dAngC] [, dAngD], bBottom
|
||||||
double dX ;
|
double dX ;
|
||||||
LuaCheckParam( L, 1, dX)
|
LuaCheckParam( L, 1, dX)
|
||||||
double dY ;
|
double dY ;
|
||||||
@@ -3530,7 +3434,7 @@ LuaGetCalcTipFromPositions( lua_State* L)
|
|||||||
LuaCheckParam( L, 3, dZ)
|
LuaCheckParam( L, 3, dZ)
|
||||||
DBLVECTOR vAng ;
|
DBLVECTOR vAng ;
|
||||||
int i ;
|
int i ;
|
||||||
for ( i = 4 ; i <= 9 ; ++ i) {
|
for ( i = 4 ; i <= 7 ; ++ i) {
|
||||||
double dAng ;
|
double dAng ;
|
||||||
if ( LuaGetParam( L, i, dAng))
|
if ( LuaGetParam( L, i, dAng))
|
||||||
vAng.emplace_back( dAng) ;
|
vAng.emplace_back( dAng) ;
|
||||||
@@ -3555,9 +3459,9 @@ LuaGetCalcTipFromPositions( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaGetCalcToolDirFromAngles( lua_State* L)
|
LuaGetCalcToolDirFromAngles( lua_State* L)
|
||||||
{
|
{
|
||||||
// da 1 a 6 parametri : dAngR1, dAngR2, dAngR3, dAngR4, dAngR5, dAngR6
|
// da 1 a 4 parametri : dAngA, dAngB, dAngC, dAngD
|
||||||
DBLVECTOR vAng ;
|
DBLVECTOR vAng ;
|
||||||
for ( int i = 1 ; i <= 6 ; ++ i) {
|
for ( int i = 1 ; i <= 4 ; ++ i) {
|
||||||
double dAng ;
|
double dAng ;
|
||||||
if ( LuaGetParam( L, i, dAng))
|
if ( LuaGetParam( L, i, dAng))
|
||||||
vAng.emplace_back( dAng) ;
|
vAng.emplace_back( dAng) ;
|
||||||
@@ -3580,9 +3484,9 @@ LuaGetCalcToolDirFromAngles( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaGetCalcAuxDirFromAngles( lua_State* L)
|
LuaGetCalcAuxDirFromAngles( lua_State* L)
|
||||||
{
|
{
|
||||||
// da 1 a 6 parametri : dAngR1, dAngR2, dAngR3, dAngR4, dAngR5, dAngR6
|
// da 1 a 4 parametri : dAngA, dAngB, dAngC, dAngD
|
||||||
DBLVECTOR vAng ;
|
DBLVECTOR vAng ;
|
||||||
for ( int i = 1 ; i <= 6 ; ++ i) {
|
for ( int i = 1 ; i <= 4 ; ++ i) {
|
||||||
double dAng ;
|
double dAng ;
|
||||||
if ( LuaGetParam( L, i, dAng))
|
if ( LuaGetParam( L, i, dAng))
|
||||||
vAng.emplace_back( dAng) ;
|
vAng.emplace_back( dAng) ;
|
||||||
@@ -3737,26 +3641,6 @@ LuaGetHeadExitCount( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaGetExitId( lua_State* L)
|
|
||||||
{
|
|
||||||
// 2 parametri : sHead, nExit
|
|
||||||
string sHead ;
|
|
||||||
LuaCheckParam( L, 1, sHead)
|
|
||||||
int nExit ;
|
|
||||||
LuaCheckParam( L, 2, nExit)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero l'identificativo dell'Uscita della Testa indicata della macchina
|
|
||||||
int nId = ExeGetExitId( sHead, nExit) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nId != GDB_ID_NULL)
|
|
||||||
LuaSetParam( L, nId) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaGetTcPosId( lua_State* L)
|
LuaGetTcPosId( lua_State* L)
|
||||||
@@ -3868,23 +3752,6 @@ LuaGetAllTablesNames( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaGetAllAxesNames( lua_State* L)
|
|
||||||
{
|
|
||||||
// nessun parametro
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero l'elenco degli assi della macchina corrente
|
|
||||||
STRVECTOR vNames ;
|
|
||||||
bool bOk = ExeGetAllAxesNames( vNames) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( bOk)
|
|
||||||
LuaSetParam( L, vNames) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaGetAllHeadsNames( lua_State* L)
|
LuaGetAllHeadsNames( lua_State* L)
|
||||||
@@ -4138,7 +4005,6 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachGroup", LuaAddMachGroup) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachGroup", LuaAddMachGroup) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyMachGroup", LuaCopyMachGroup) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyMachGroup", LuaCopyMachGroup) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveMachGroup", LuaRemoveMachGroup) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveMachGroup", LuaRemoveMachGroup) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeMachGroupName", LuaChangeMachGroupName) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupName", LuaGetMachGroupName) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupName", LuaGetMachGroupName) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupMachineName", LuaGetMachGroupMachineName) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupMachineName", LuaGetMachGroupMachineName) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupId", LuaGetMachGroupId) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupId", LuaGetMachGroupId) ;
|
||||||
@@ -4295,8 +4161,6 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntMove", LuaGetClEntMove) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntMove", LuaGetClEntMove) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntFlag", LuaGetClEntFlag) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntFlag", LuaGetClEntFlag) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntIndex", LuaGetClEntIndex) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntIndex", LuaGetClEntIndex) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesMask", LuaGetClEntAxesMask) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesVal", LuaGetClEntAxesVal) ;
|
|
||||||
// Simulation
|
// Simulation
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSimInit", LuaSimInit) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSimInit", LuaSimInit) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSimStart", LuaSimStart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSimStart", LuaSimStart) ;
|
||||||
@@ -4319,24 +4183,20 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisId", LuaGetAxisId) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisId", LuaGetAxisId) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadId", LuaGetHeadId) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadId", LuaGetHeadId) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadExitCount", LuaGetHeadExitCount) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadExitCount", LuaGetHeadExitCount) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetExitId", LuaGetExitId) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTcPosId", LuaGetTcPosId) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTcPosId", LuaGetTcPosId) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisToken", LuaGetAxisToken) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisToken", LuaGetAxisToken) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisType", LuaGetAxisType) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisType", LuaGetAxisType) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisInvert", LuaGetAxisInvert) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisInvert", LuaGetAxisInvert) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisOffset", LuaGetAxisOffset) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisOffset", LuaGetAxisOffset) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllTablesNames", LuaGetAllTablesNames) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllTablesNames", LuaGetAllTablesNames) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllAxesNames", LuaGetAllAxesNames) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllHeadsNames", LuaGetAllHeadsNames) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllHeadsNames", LuaGetAllHeadsNames) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllTcPosNames", LuaGetAllTcPosNames) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllTcPosNames", LuaGetAllTcPosNames) ;
|
||||||
// Machine Calc
|
// Machine Calc
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTable", LuaSetCalcTable) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTable", LuaSetCalcTable) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTool", LuaSetCalcTool) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTool", LuaSetCalcTool) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetRotAxisBlock", LuaSetRotAxisBlock) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetRotAxisBlock", LuaSetRotAxisBlock) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTable", LuaGetCalcTable) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTool", LuaGetCalcTool) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllCurrAxesNames", LuaGetAllCurrAxesNames) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRotAxisBlocked", LuaGetRotAxisBlocked) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRotAxisBlocked", LuaGetRotAxisBlocked) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTool", LuaGetCalcTool) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAngles", LuaGetCalcAngles) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAngles", LuaGetCalcAngles) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcPositions", LuaGetCalcPositions) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcPositions", LuaGetCalcPositions) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTipFromPositions", LuaGetCalcTipFromPositions) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTipFromPositions", LuaGetCalcTipFromPositions) ;
|
||||||
|
|||||||
@@ -175,21 +175,6 @@ LuaZoomObject( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSetViewOrizzOffsStep( lua_State* L)
|
|
||||||
{
|
|
||||||
// 1 parametro : nDirOffsStep
|
|
||||||
int nDirOffsStep ;
|
|
||||||
LuaCheckParam( L, 1, nDirOffsStep)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// imposto offset angolare orizzontale a step di 90° per direzione di vista
|
|
||||||
bool bOk = ExeSetViewOrizzOffsStep( nDirOffsStep) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
LuaSetParam( L, bOk) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaSetView( lua_State* L)
|
LuaSetView( lua_State* L)
|
||||||
@@ -243,60 +228,6 @@ LuaSetViewCenter( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaGetViewOrizzOffsStep( lua_State* L)
|
|
||||||
{
|
|
||||||
// nessun parametro
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero offset angolare orizzontale a step di 90° per direzione di vista
|
|
||||||
int nDirOffsStep ;
|
|
||||||
bool bOk = ExeGetViewOrizzOffsStep( &nDirOffsStep) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( bOk)
|
|
||||||
LuaSetParam( L, nDirOffsStep) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaGetView( lua_State* L)
|
|
||||||
{
|
|
||||||
// nessun parametro
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero direzione di vista
|
|
||||||
int nViewDir ;
|
|
||||||
bool bOk = ExeGetView( &nViewDir) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( bOk)
|
|
||||||
LuaSetParam( L, nViewDir) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaGetGenericView( lua_State* L)
|
|
||||||
{
|
|
||||||
// nessun parametro
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// recupero angoli della direzione di vista
|
|
||||||
double dAngVertDeg ;
|
|
||||||
double dAngHorizDeg ;
|
|
||||||
bool bOk = ExeGetGenericView( &dAngVertDeg, &dAngHorizDeg) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( bOk) {
|
|
||||||
LuaSetParam( L, dAngVertDeg) ;
|
|
||||||
LuaSetParam( L, dAngHorizDeg) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 2 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaGetImage( lua_State* L)
|
LuaGetImage( lua_State* L)
|
||||||
@@ -336,13 +267,9 @@ LuaInstallScene( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomRadius", LuaZoomRadius) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomRadius", LuaZoomRadius) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtZoom", LuaZoom) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtZoom", LuaZoom) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomObject", LuaZoomObject) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomObject", LuaZoomObject) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewOrizzOffsStep", LuaSetViewOrizzOffsStep) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetView", LuaSetView) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetView", LuaSetView) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetGenericView", LuaSetGenericView) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetGenericView", LuaSetGenericView) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewCenter", LuaSetViewCenter) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewCenter", LuaSetViewCenter) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetViewOrizzOffsStep", LuaGetViewOrizzOffsStep) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetView", LuaGetView) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetGenericView", LuaGetGenericView) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImage", LuaGetImage) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImage", LuaGetImage) ;
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,202 +0,0 @@
|
|||||||
//----------------------------------------------------------------------------
|
|
||||||
// EgalTech 2024-2024
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// File : LUA_TestObjSurface.cpp Data : 24.03.24 Versione : 2.6c2
|
|
||||||
// Contenuto : Funzioni di verifica intersezione tra oggetti e superfici.
|
|
||||||
// Oggetti = Box, Sfere, Cilindri, Coni, RectPrismoid, SurfTriMesh
|
|
||||||
// Superfici = SurfTriMesh, ( Bezier).
|
|
||||||
//
|
|
||||||
// Modifiche : 24.03.24 DS Creazione modulo.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//--------------------------- Include ----------------------------------------
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "LUA.h"
|
|
||||||
#include "/EgtDev/Include/EXeExecutor.h"
|
|
||||||
#include "/EgtDev/Include/EXeConst.h"
|
|
||||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
|
||||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
|
||||||
|
|
||||||
using namespace std ;
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaTestBoxSurface( lua_State* L)
|
|
||||||
{
|
|
||||||
// 4 o 5 parametri : frBox, vtDiag, nSurfId, dSafeDist [, nRefType]
|
|
||||||
Frame3d frBox ;
|
|
||||||
LuaCheckParam( L, 1, frBox)
|
|
||||||
Vector3d vtDiag ;
|
|
||||||
LuaCheckParam( L, 2, vtDiag)
|
|
||||||
int nSurfId ;
|
|
||||||
LuaCheckParam( L, 3, nSurfId)
|
|
||||||
double dSafeDist ;
|
|
||||||
LuaCheckParam( L, 4, dSafeDist)
|
|
||||||
int nRefType = RTY_DEFAULT ;
|
|
||||||
LuaGetParam( L, 5, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo verifica di collisione
|
|
||||||
int nRes = ExeTestBoxSurface( frBox, vtDiag, nSurfId, dSafeDist, nRefType) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nRes >= 0)
|
|
||||||
LuaSetParam( L, ( nRes != 0)) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaTestRectPrismoidSurface( lua_State* L)
|
|
||||||
{
|
|
||||||
// 8 o 9 parametri : frBox, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, nSurfId, dSafeDist [, nRefType]
|
|
||||||
Frame3d frBox ;
|
|
||||||
LuaCheckParam( L, 1, frBox)
|
|
||||||
double dBaseLenX ;
|
|
||||||
LuaCheckParam( L, 2, dBaseLenX)
|
|
||||||
double dBaseLenY ;
|
|
||||||
LuaCheckParam( L, 3, dBaseLenY)
|
|
||||||
double dTopLenX ;
|
|
||||||
LuaCheckParam( L, 4, dTopLenX)
|
|
||||||
double dTopLenY ;
|
|
||||||
LuaCheckParam( L, 5, dTopLenY)
|
|
||||||
double dHeight ;
|
|
||||||
LuaCheckParam( L, 6, dHeight)
|
|
||||||
int nSurfId ;
|
|
||||||
LuaCheckParam( L, 7, nSurfId)
|
|
||||||
double dSafeDist ;
|
|
||||||
LuaCheckParam( L, 8, dSafeDist)
|
|
||||||
int nRefType = RTY_DEFAULT ;
|
|
||||||
LuaGetParam( L, 9, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo verifica di collisione
|
|
||||||
int nRes = ExeTestRectPrismoidSurface( frBox, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, nSurfId, dSafeDist, nRefType) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nRes >= 0)
|
|
||||||
LuaSetParam( L, ( nRes != 0)) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaTestCylSurface( lua_State* L)
|
|
||||||
{
|
|
||||||
// 5 o 6 parametri : frCyl, dR, dH, nSurfId, dSafeDist [, nRefType]
|
|
||||||
Frame3d frCyl ;
|
|
||||||
LuaCheckParam( L, 1, frCyl)
|
|
||||||
double dR ;
|
|
||||||
LuaCheckParam( L, 2, dR)
|
|
||||||
double dH ;
|
|
||||||
LuaCheckParam( L, 3, dH)
|
|
||||||
int nSurfId ;
|
|
||||||
LuaCheckParam( L, 4, nSurfId)
|
|
||||||
double dSafeDist ;
|
|
||||||
LuaCheckParam( L, 5, dSafeDist)
|
|
||||||
int nRefType = RTY_DEFAULT ;
|
|
||||||
LuaGetParam( L, 6, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo verifica di collisione
|
|
||||||
int nRes = ExeTestCylSurface( frCyl, dR, dH, nSurfId, dSafeDist, nRefType) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nRes >= 0)
|
|
||||||
LuaSetParam( L, ( nRes != 0)) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaTestConeSurface( lua_State* L)
|
|
||||||
{
|
|
||||||
// 6 o 7 parametri : frCone, dR1, dR2, dH, nSurfId, dSafeDist [, nRefType]
|
|
||||||
Frame3d frCone ;
|
|
||||||
LuaCheckParam( L, 1, frCone)
|
|
||||||
double dR1 ;
|
|
||||||
LuaCheckParam( L, 2, dR1)
|
|
||||||
double dR2 ;
|
|
||||||
LuaCheckParam( L, 3, dR2)
|
|
||||||
double dH ;
|
|
||||||
LuaCheckParam( L, 4, dH)
|
|
||||||
int nSurfId ;
|
|
||||||
LuaCheckParam( L, 5, nSurfId)
|
|
||||||
double dSafeDist ;
|
|
||||||
LuaCheckParam( L, 6, dSafeDist)
|
|
||||||
int nRefType = RTY_DEFAULT ;
|
|
||||||
LuaGetParam( L, 7, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo verifica di collisione
|
|
||||||
int nRes = ExeTestConeSurface( frCone, dR1, dR2, dH, nSurfId, dSafeDist, nRefType) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nRes >= 0)
|
|
||||||
LuaSetParam( L, ( nRes != 0)) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaTestSpheSurface( lua_State* L)
|
|
||||||
{
|
|
||||||
// 4 o 5 parametri : ptCen, dRad, nSurfId, dSafeDist [, nRefType]
|
|
||||||
Point3d ptCen ;
|
|
||||||
LuaCheckParam( L, 1, ptCen)
|
|
||||||
double dR ;
|
|
||||||
LuaCheckParam( L, 2, dR)
|
|
||||||
int nSurfId ;
|
|
||||||
LuaCheckParam( L, 3, nSurfId)
|
|
||||||
double dSafeDist ;
|
|
||||||
LuaCheckParam( L, 4, dSafeDist)
|
|
||||||
int nRefType = RTY_DEFAULT ;
|
|
||||||
LuaGetParam( L, 5, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo verifica di collisione
|
|
||||||
int nRes = ExeTestSpheSurface( ptCen, dR, nSurfId, dSafeDist, nRefType) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nRes >= 0)
|
|
||||||
LuaSetParam( L, ( nRes != 0)) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaTestSurfaceSurface( lua_State* L)
|
|
||||||
{
|
|
||||||
// 3 parametri : nSurf1Id, nSurf2Id, dSafeDist
|
|
||||||
int nSurf1Id ;
|
|
||||||
LuaCheckParam( L, 1, nSurf1Id)
|
|
||||||
int nSurf2Id ;
|
|
||||||
LuaCheckParam( L, 2, nSurf2Id)
|
|
||||||
double dSafeDist ;
|
|
||||||
LuaCheckParam( L, 3, dSafeDist)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo verifica di interferenza
|
|
||||||
int nRes = ExeTestSurfaceSurface( nSurf1Id, nSurf2Id, dSafeDist) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nRes >= 0)
|
|
||||||
LuaSetParam( L, ( nRes != 0)) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
LuaInstallTestObjSurface( LuaMgr& luaMgr)
|
|
||||||
{
|
|
||||||
bool bOk = ( &luaMgr != nullptr) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTestBoxSurface", LuaTestBoxSurface) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTestRectPrismoidSurface", LuaTestRectPrismoidSurface) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTestCylSurface", LuaTestCylSurface) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTestConeSurface", LuaTestConeSurface) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTestSpheSurface", LuaTestSpheSurface) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTestSurfaceSurface", LuaTestSurfaceSurface) ;
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user