Compare commits

...

51 Commits

Author SHA1 Message Date
Riccardo Elitropi e4f45df79a EgtExecutor :
- aggiunta funzione per aggiornare uno Zmap con una  Trimesh
- aggiunta funzione per uniformare uno Zmap.
2024-05-15 11:02:15 +02:00
Dario Sassi 868efb69f1 EgtExecutor :
- correzioni alla funzione Exe e Lua SurfTmGetFacetOutlineInfo.
2024-05-09 18:48:31 +02:00
Dario Sassi 3d59a7ec24 EgtExecutor :
- migliorie alla funzione Exe e Lua SurfTmGetFacetOutlineInfo.
2024-05-09 11:18:51 +02:00
Dario Sassi 9219fe9792 EgtExecutor :
- modifiche estetiche.
2024-05-08 16:11:23 +02:00
Dario Sassi bf069c7f7a Merge commit '88904db10f8125e3478ebaf5708afd13e4bfc66d' 2024-05-08 15:53:46 +02:00
Dario Sassi f949e39d47 EgtExecutor :
- aggiunta funzione Exe e Lua SurfTmGetFacetOutlineInfo.
2024-05-08 15:53:02 +02:00
Daniele Bariletti 88904db10f EgtExecutor :
- aggiunte le funzioni per la proiezione di curve su una superficie di Bezier.
2024-05-07 14:50:56 +02:00
Daniele Bariletti 429b8d828c Merge branch 'master' into MoreBezier 2024-05-07 10:32:26 +02:00
Daniele Bariletti 1bf59acd00 EgtExecutor :
- cambio versione.
2024-05-07 10:18:45 +02:00
Daniele Bariletti a5a85a6723 EgtExecutor :
- cambio nome di una funzione.
2024-05-07 10:12:41 +02:00
Daniele Bariletti c523c46670 Merge branch 'MoreBezier' 2024-05-07 10:06:12 +02:00
Daniele Bariletti fb0b4f9621 EgtExecutor :
- tolto un commento.
2024-05-07 09:53:21 +02:00
Daniele Bariletti 7070032120 EgtExecutor :
- funzioni per la conversione di curve generiche in curve di Bezier.
- funzione per mostrare i punti di controllo di una curva di Bezier.
2024-05-06 15:34:25 +02:00
Dario Sassi 0b1461984c EgtExecutor 2.6e2 :
- correzione a ExeChangeClosedCurveStartPoint (si usava puntatore a curva anche se nullo).
2024-05-06 09:05:01 +02:00
Dario Sassi 4f7f5d97b2 EgtExecutor :
- aggiunta la funzione Lua EgtGetKeyPressed.
2024-05-03 12:01:41 +02:00
Dario Sassi 8cd72b2a4c EgtExecutor :
- aggiunte funzioni Exe e Lua SurfTmSetFaceColor, SurfTmGetTriaColor e SurfTmGetShowEdges.
2024-05-02 09:30:51 +02:00
Dario Sassi 7b3c24c2be EgtExecutor 2.6e1 :
- ricompilazione per modifiche a gestione chiave di rete.
2024-04-30 16:55:00 +02:00
Daniele Bariletti e5f296e712 Merge branch 'master' into MoreBezier 2024-04-30 15:21:17 +02:00
Dario Sassi 9e1f151bbc EgtExecutor :
- adattamenti per Zmap con virtual additive.
2024-04-26 11:33:16 +02:00
Dario Sassi ed6c8fb11d Merge commit '22774303af440f13f3db243c23798652b2fa7cc4' 2024-04-22 19:07:16 +02:00
Dario Sassi 9ef30272b4 EgtExecutor :
- aggiunta funzione Exe/Lua GetExitId.
2024-04-22 15:30:00 +02:00
Riccardo Elitropi 22774303af EgtExecutor :
- aggiunte funzioni per Vmill additivo.
2024-04-22 13:23:59 +02:00
Dario Sassi a3c905c33a EgtExecutor :
- adattamenti per Surf Bezier
- aggiunta funzione Exe/Lua CreateArc2PR.
2024-04-19 17:51:00 +02:00
Dario Sassi 66a72c92b2 EgtExecutor :
- nelle funzioni Lua EgtGetCalcTipFromPositions, EgtGetCalcToolDirFromAngles e EgtGetCalcAuxDirFromAngles ammessi sino a 6 assi rotanti (per robot).
2024-04-17 06:55:09 +02:00
Daniele Bariletti 8c0b0a97b8 EgtExecutor :
- corretto bug.
2024-04-15 12:35:17 +02:00
Daniele Bariletti f444c189d4 EgtExecutor :
- aggiunto anche alla funzione LUA dell' AdvancedImport il parametro nFlag.
2024-04-15 12:21:07 +02:00
Dario Sassi 4f79e4baf9 EgtExecutor 2.6d4 :
- aggiunta di alcune funzioni lua per i Quaternion.
2024-04-14 18:18:13 +02:00
Dario Sassi e66cfb74c0 EgtExecutor :
- eliminate funzioni Exe e Lua CreateSurfTmBySurfBezier perchè doppioni di ApproxSurface a cui è stato aggiunto il parametro dTriaMinSide.
2024-04-13 17:20:57 +02:00
Daniele Bariletti 2d2954f983 EgtExecutor :
- cambio versione.
2024-04-12 10:34:47 +02:00
Daniele Bariletti bea2a9f938 EgtExecutor :
- aggiunti i default per la chiamata della SurfTmByBezier.
2024-04-12 10:32:23 +02:00
Daniele Bariletti bcc44a5592 EgtExecutor :
- modificata l'importazione layer da file 3dm.
2024-04-12 10:31:55 +02:00
Daniele Bariletti e587f23dad EgtExecutor :
- aggiunti parametri per ottenere la trimesh di una Bezier con precisione richiesta.
2024-04-11 17:39:20 +02:00
Dario Sassi f4542dd7db Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2024-04-11 00:19:37 +02:00
Dario Sassi 1f66473764 EgtExecutor :
- aggiunto parametro Flag in AdvancedImport.
2024-04-11 00:18:34 +02:00
Daniele Bariletti b98e4ea359 EgtExecutor :
- errato commit precedente.
2024-04-10 18:34:16 +02:00
Daniele Bariletti 504e1d5472 EgtExecutor :
- modifica della funzione per l'estrazione dei loop aperti di una superficie di Bezier.
2024-04-10 18:08:54 +02:00
Dario Sassi f8bc7083a9 EgtExecutor 2.6d2 :
- estensione gestione chiave di rete per meglio identificare l'eventuale problema
- migliorie a proiezione di curva su superficie
- ricompilazione per modifiche a EgtLock.
2024-04-09 14:49:24 +02:00
Dario Sassi c4b4a12b9a EgtExecutor :
- aggiunta funzione Exe/Lua ProjectCurveOnSurfTmExt.
2024-04-08 09:42:02 +02:00
Dario Sassi 9473e5813d EgtExecutor :
aggiunta la funzione Lua EgtDirectoryDialog per la scelta di un direttorio.
2024-04-05 19:24:04 +02:00
Dario Sassi fd9e53711b EgtExecutor :
- modifiche a Exe e Lua CreateSurfTmSwept.
2024-04-05 16:56:41 +02:00
Dario Sassi 6c153c3db4 Merge commit '824e6e3ba1ff03936d2150d5660a8e1ff27b24e6' 2024-04-04 14:49:51 +02:00
Dario Sassi 841c0f6cfc EgtExecutor :
- aggiunta funzione Exe/Lua GetClEntAxesMask.
2024-04-03 08:12:19 +02:00
Dario Sassi 3990934446 EgtExecutor 2.6d1 :
- aggiunta funzione Exe e Lua GetAllAxesName.
2024-04-02 15:38:40 +02:00
Dario Sassi 399556a9a6 EgtExecutor 2.6c3 :
- cambio versione.
2024-03-27 16:43:26 +01:00
Daniele Bariletti 69f2c3d029 Merge branch 'CmdCreateSurfBezier' 2024-03-27 11:06:29 +01:00
Dario Sassi f1f23a3cf4 EgtExecutor :
- aggiunte funzioni Exe e Lua TestBoxSurface, TestRectPrismoidSurface, TestCylSurface, TestConeSurface, TestSpheSurface, TestSurfaceSurface.
2024-03-25 09:05:21 +01:00
Riccardo Elitropi 824e6e3ba1 EgtExecutor :
- correzione codice.
2024-03-18 13:21:21 +01:00
Riccardo Elitropi 88fa7ef54c EgtExecutor :
- rimozione codici di test.
- modifiche parametri LuaCreateSurfTmSwept.
2024-03-15 13:18:48 +01:00
Riccardo Elitropi 82633bf725 EgtExecutor :
- migliorie al codice.
2024-03-11 13:21:29 +01:00
Riccardo Elitropi a27dfd2b54 EgtExecutor :
- Codice di test per RMF aggiornato.
2024-03-07 10:52:39 +01:00
Riccardo Elitropi 2a106c4263 EgtExecutor :
- Codice di test per RMF.
2024-03-06 16:28:48 +01:00
31 changed files with 2104 additions and 198 deletions
+2 -2
View File
@@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// EgalTech 2020-2020
//----------------------------------------------------------------------------
// File : EXE_CDeObjClosedSurfTm.cpp Data : 09.01.20 Versione : 2.2a2
// File : EXE_CDeObjSolid.cpp Data : 09.01.20 Versione : 2.2a2
// Contenuto : Funzioni per verificare collisioni tra
// Objects e Closed SurftriMesh.
// Objects e Solidi (Closed SurftriMesh e Zmap).
//
//
// Modifiche : 09.01.20 DS Creazione modulo.
+5 -5
View File
@@ -410,8 +410,8 @@ ExeImport3dm( const string& sFilePath)
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// importo il file 3dm
// aggiungo un gruppo pezzo e un gruppo layer
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
//// aggiungo un gruppo pezzo e un gruppo layer
// int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
// preparo l'importatore
PtrOwner<IImport3dm> pImp3dm( MyCreateImport3dm()) ;
bOk = bOk && ! IsNull( pImp3dm) ;
@@ -424,7 +424,7 @@ ExeImport3dm( const string& sFilePath)
int nDecDig = DimSt.nDecDigit ;
string sFont = DimSt.sFont ;
double dTextHeight = DimSt.dTextHeight ;
bOk = bOk && pImp3dm->Import( sFilePath, pGseCtx->m_pGeomDB, nPartId,
bOk = bOk && pImp3dm->Import( sFilePath, pGseCtx->m_pGeomDB, GDB_ID_ROOT,
dTextHeight, dExtLine, dArrLen, dTextDist, bLenIsMM, nDecDig, sFont) ;
// aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty())
@@ -470,7 +470,7 @@ ExeAdvancedImportIsEnabled( void)
//-----------------------------------------------------------------------------
bool
ExeAdvancedImport( const string& sFilePath, double dToler)
ExeAdvancedImport( const string& sFilePath, double dToler, int nFlag)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
@@ -504,7 +504,7 @@ ExeAdvancedImport( const string& sFilePath, double dToler)
#endif
string sCmdLine = "\"" + sExec + "\" \"" + sFilePath + "\" \"" + sFileOut + "\" \"" +
ToString( dToler, 3) + "\" \"" + ToString( ExeGetDebugLevel()) + "\" \"" +
ExeGetKey() + "\" \"" + ExeGetLockId() + "\"" ;
ExeGetKey() + "\" \"" + ExeGetLockId() + "\" \"" + ToString( nFlag) + "\"" ;
STARTUPINFO si ;
PROCESS_INFORMATION pi ;
ZeroMemory( &si, sizeof( si)) ;
+107 -1
View File
@@ -40,11 +40,12 @@
#include "/EgtDev/Include/EGkChainCurves.h"
#include "/EgtDev/Include/EGkCurveByInterp.h"
#include "/EgtDev/Include/EGkCurveByApprox.h"
#include "/EgtDev/Include/EGkCurveAux.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
@@ -1088,6 +1089,45 @@ ExeCreateArc3P( int nParentId, const Point3d& ptP1,
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateArc2PR( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
double dRad, bool bCCW, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti, il versore normale e quelloe estrusione
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo l'arco
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
bOk = bOk && ( ! IsNull( pCrvArc) &&
pCrvArc->Set2PNRS( ptStartL, ptEndL, vtNormL, dRad, bCCW)) ;
// assegno il versore estrusione
bOk = bOk && pCrvArc->SetExtrusion( vtExtrL) ;
// inserisco l'arco nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtArc2PR(" + IdToString( nParentId) + ",{" +
ToString( ptStart) + "},{" +
ToString( ptEnd) + "}," +
ToString( dRad) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateArc2PB( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
@@ -2545,3 +2585,69 @@ CalcExtrusion( IGeomDB* pGeomDB, int nParentId, int nRefType)
vtExtr.LocToLoc( pGeomDB->GetGridFrame(), frEnt) ;
return vtExtr ;
}
//-------------------------------------------------------------------------------
static int
MyCreateCurveBezierForm( int nParentId, int nCrvId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento della curva
Frame3d frCrv ;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frCrv))
return GDB_ID_NULL ;
// recupero il riferimento di destinazione
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero la curva
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCurve == nullptr || ! pCurve->IsValid())
return GDB_ID_NULL ;
// recupero il vettore estrusione della curva e lo porto in locale al gruppo destinazione
Vector3d vtExtr ;
pCurve->GetExtrusion( vtExtr) ;
vtExtr.LocToLoc( frCrv, frLoc) ;
int nType = pCurve->GetType() ;
PtrOwner<ICurve> pCrv ;
switch ( nType ) {
case CRV_LINE :
pCrv.Set( LineToBezierCurve( GetCurveLine( pCurve))) ;
break ;
case CRV_ARC :
pCrv.Set( ArcToBezierCurve( GetCurveArc( pCurve))) ;
break ;
case CRV_BEZIER :
pCrv.Set( BezierToBasicBezierCurve( GetCurveBezier( pCurve))) ;
break ;
case CRV_COMPO :
pCrv.Set( CompositeToBezierCurve( GetCurveComposite( pCurve))) ;
break ;
default :
break ;
}
// setto l'estrusione
pCrv->SetExtrusion( vtExtr) ;
// aggiungo la curva in forma di Bezier al DB
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrv)) ;
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateCurveBezierForm( int nParentId, int nCrvId)
{
// eseguo
int nId = MyCreateCurveBezierForm( nParentId, nCrvId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCreateCurveBezierForm(" + IdToString( nParentId) + "," +
IdToString( nCrvId) + "," +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
+74 -88
View File
@@ -1,4 +1,4 @@
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// EgalTech 2014-2015
//----------------------------------------------------------------------------
// File : EXE_GdbCreateSurf.cpp Data : 04.05.15 Versione : 1.6e1
@@ -31,6 +31,7 @@
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EGkSbzStandard.h"
@@ -81,7 +82,7 @@ ExeCreateSurfFrRectangle( int nParentId, const Point3d& ptIni, const Point3d& pt
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -132,7 +133,7 @@ ExeCreateSurfFrRectangle3P( int nParentId, const Point3d& ptIni,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -181,7 +182,7 @@ ExeCreateSurfFrStadium( int nParentId, const Point3d& ptIni, const Point3d& ptCr
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -198,7 +199,7 @@ ExeCreateSurfFrDisk( int nParentId, const Point3d& ptOrig, double dRad, int nRef
// porto in locale il punto e calcolo la normale in locale
Point3d ptOrigL = GetPointLocal( pGeomDB, ptOrig, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// calcolo riferimento per l'entità
// calcolo riferimento per l'entità
Frame3d frEnt ;
bOk = bOk && frEnt.Set( ptOrigL, vtNL) ;
// creo il disco nel suo riferimento intrinseco
@@ -218,7 +219,7 @@ ExeCreateSurfFrDisk( int nParentId, const Point3d& ptOrig, double dRad, int nRef
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -262,7 +263,7 @@ ExeCreateSurfFrFatCurve( int nParentId, int nCrvId, double dRad, bool bSquaredEn
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -318,7 +319,7 @@ MyCreateSurfFlatRegion( int nParentId, const INTVECTOR& vCrvIds, int* pnCount)
// recupero la prossima superficie
pSfr = SfrCntr.GetSurf() ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entità
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
@@ -341,7 +342,7 @@ ExeCreateSurfFlatRegion( int nParentId, const INTVECTOR& vCrvIds, int* pnCount)
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nFirstId ;
}
@@ -390,7 +391,7 @@ ExeCreateSurfTmPlaneInBBox( int nParentId, const Point3d& ptP, const Vector3d& v
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -451,7 +452,7 @@ MyCreateSewPolygon( ISurfTriMesh* pStm, const Polygon3d& Polyg)
// verifico esistenza superficie
if ( pStm == nullptr)
return false ;
// se poligono vuoto, non devo fare alcunché
// se poligono vuoto, non devo fare alcunché
if ( Polyg.GetSideCount() == 0)
return true ;
// creo la superficie trimesh del poligono
@@ -581,7 +582,7 @@ ExeCreateSurfTmConvexHullInBBox( int nParentId, int nId, const BBox3d& b3Box, in
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -629,7 +630,7 @@ ExeCreateSurfTmBBox( int nParentId, const BBox3d& b3Box, bool bRegular, int nRef
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -684,7 +685,7 @@ ExeCreateSurfTmBox( int nParentId, const Point3d& ptIni, const Point3d& ptCross,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -741,7 +742,7 @@ ExeCreateSurfTmPyramid( int nParentId, const Point3d& ptIni, const Point3d& ptCr
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -783,7 +784,7 @@ ExeCreateSurfTmCylinder( int nParentId, const Point3d& ptOrig, const Vector3d& v
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -825,7 +826,7 @@ ExeCreateSurfTmCone( int nParentId, const Point3d& ptOrig, const Vector3d& vtN,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -861,7 +862,7 @@ ExeCreateSurfTmSphere( int nParentId, const Point3d& ptOrig,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -903,7 +904,7 @@ ExeCreateSurfTmTriangle( int nParentId, const Point3d& ptP1, const Point3d& ptP2
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -952,7 +953,7 @@ ExeCreateSurfTmRectangle( int nParentId, const Point3d& ptO, const Point3d& ptL,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -983,7 +984,7 @@ ExeCreateSurfTmByFlatContour( int nParentId, int nCrvId, double dLinTol)
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1029,7 +1030,7 @@ ExeCreateSurfTmByRegion( int nParentId, const INTVECTOR& vCrvIds, double dLinTol
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1084,7 +1085,7 @@ ExeCreateSurfTmByExtrusion( int nParentId, const INTVECTOR& vCrvIds, const Vecto
" -- Id=" + ToString( nFirstId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nFirstId ;
}
@@ -1128,7 +1129,7 @@ ExeCreateSurfTmByRegionExtrusion( int nParentId, const INTVECTOR& vCrvIds, const
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1168,7 +1169,7 @@ ExeCreateSurfTmByRevolve( int nParentId, int nCrvId,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1210,13 +1211,14 @@ ExeCreateSurfTmByScrewing( int nParentId, int nCrvId,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmRectSwept( int nParentId, double dDimH, double dDimV, double dBevelH, double dBevelV, int nGuideId, int nCapType, double dLinTol)
ExeCreateSurfTmRectSwept( int nParentId, double dDimH, double dDimV, double dBevelH, double dBevelV,
int nGuideId, int nCapType, double dLinTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -1247,13 +1249,14 @@ ExeCreateSurfTmRectSwept( int nParentId, double dDimH, double dDimV, double dBev
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, double dLinTol)
ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, const Vector3d& vtAx,
bool bCapEnds, double dLinTol, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -1262,29 +1265,53 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, d
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// recupero la sezione in locale
CurveLocal CrvSect( pGeomDB, nSectId, frLoc) ;
bOk = bOk && ( CrvSect.Get() != nullptr) ;
// recupero la guida in locale
CurveLocal CrvGuide( pGeomDB, nGuideId, frLoc) ;
bOk = bOk && ( CrvGuide.Get() != nullptr) ;
// creo la superficie trimesh
// porto in locale vettore asse
Vector3d vtAxL = GetVectorLocal( pGeomDB, vtAx, nRefType, frLoc) ;
// inizializzazione superficie e suo Id
ISurfTriMesh* pSTM = nullptr ;
pSTM = ( bOk ? GetSurfTriMeshSwept( CrvSect, CrvGuide, bCapEnds, dLinTol) : nullptr) ;
// inserisco la superficie trimesh nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
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( nGuideId) + ",{" +
ToString( vtAx) + "}," +
( bCapEnds ? "true" : "false") + "," +
ToString( dLinTol) + ")" +
ToString( dLinTol) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1321,7 +1348,7 @@ ExeCreateSurfTmTransSwept( int nParentId, int nSectId, int nGuideId, bool bCapEn
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1338,7 +1365,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// creo la superficie trimesh
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 &&
( pGeomDB->GetGeoType( nPtOrCrvId2) & GEO_CURVE) != 0) {
// recupero il punto in locale
@@ -1354,7 +1381,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
// calcolo la superficie
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 &&
pGeomDB->GetGeoType( nPtOrCrvId2) == GEO_PNT3D) {
// recupero la curva in locale
@@ -1398,7 +1425,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1509,7 +1536,7 @@ ExeCreateSurfTmBySewing( int nParentId, const INTVECTOR& vIds, bool bErase)
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStmS) ;
// lo esprimo rispetto a quello della prima superficie
frStmS.ToLoc( frLoc) ;
// se è la prima, copio
// se è la prima, copio
if ( bFirst) {
bOk = bOk && pStm->CopyFrom( pStmS) ;
bOk = bOk && pStm->ToGlob( frStmS) ;
@@ -1554,42 +1581,6 @@ ExeCreateSurfTmBySewing( int nParentId, const INTVECTOR& vIds, bool bErase)
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
bOk = bOk && 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
ExeCreateSurfTmByVolZmap( int nParentId, int nZmapId, int nPart)
@@ -1677,8 +1668,6 @@ ExeCreateSurfBezier( int nParentId, int nDegU, int nDegV, int nSpanU, int nSpanV
if ( ! pSurfBez->SetControlPoint( i, ptCtrl))
bOk = false ;
}
// calcolo eventuali poli
pSurfBez->CalcPoles() ;
// se superficie nulla (ovvero ridotta a punto), errore
bOk = bOk && ! pSurfBez->IsAPoint() ;
// inserisco la superficie nel DB
@@ -1700,7 +1689,7 @@ ExeCreateSurfBezier( int nParentId, int nDegU, int nDegV, int nSpanU, int nSpanV
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nId ;
}
@@ -1731,8 +1720,6 @@ ExeCreateSurfBezierRational( int nParentId, int nDegU, int nDegV, int nSpanU, in
if ( ! pSurfBez->SetControlPoint( i, ptCtrl, vPntW[i].second))
bOk = false ;
}
// calcolo eventuali poli
pSurfBez->CalcPoles() ;
// se superficie nulla (ovvero ridotta a punto), errore
bOk = bOk && ! pSurfBez->IsAPoint() ;
// inserisco la superficie nel DB
@@ -1754,7 +1741,7 @@ ExeCreateSurfBezierRational( int nParentId, int nDegU, int nDegV, int nSpanU, in
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nId ;
}
@@ -1908,7 +1895,6 @@ ExeCreateBezierSphere( int nParentId, const Point3d& ptCenter, double dR, int nR
Point3d ptCenterLoc = GetPointLocal( pGeomDB, ptCenter, nRefType, frLoc) ;
// Creo la superficie
PtrOwner<ISurfBezier> pSurfBez( CreateBezierSphere( ptCenterLoc, dR)) ;
pSurfBez->CalcPoles() ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSurfBez)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
@@ -1920,6 +1906,6 @@ ExeCreateBezierSphere( int nParentId, const Point3d& ptCenter, double dR, int nR
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// resituisco l'identificativo dell'entità creata
// resituisco l'identificativo dell'entit creata
return nId ;
}
+101 -4
View File
@@ -1,4 +1,4 @@
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// EgalTech 2016-2016
//----------------------------------------------------------------------------
// File : EXE_GdbCreateVol.cpp Data : 27.10.16 Versione : 1.6v7
@@ -64,7 +64,50 @@ ExeCreateVolZmap( int nParentId, const Point3d& ptIni, double dDimX, double dDim
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// 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 ;
}
@@ -103,7 +146,7 @@ ExeCreateVolZmapByRegionExtrusion( int nParentId, int nSfrId, double dDimZ, doub
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -141,6 +184,60 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
bool
ExeUpdateVolZmapByAddingSurfTm( int nVolZmapId, int nStmId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nVolZmapId)) ;
bool bOk = ( pVZM != nullptr) ;
// recupero la trimesh
PtrOwner<ISurfTriMesh> pStm( CloneSurfTriMesh( pGeomDB->GetGeoObj( nStmId))) ;
bOk = bOk && !IsNull( pStm) ;
// recupero il frame dello Zmap e della Trimesh
Frame3d frZmap, frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nVolZmapId, frZmap) &&
pGeomDB->GetGlobFrame( nStmId, frStm) ;
// porto la Stm nel frame dello Zmap
bOk = bOk && pStm->LocToLoc( frStm, frZmap) ;
// aggiorno lo Zmap con la nuova superficie
bOk = bOk && pVZM->AddSurfTm( pStm) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtUpdateVolZmapByAddingSurfTm(" + ToString( nVolZmapId) + "," +
ToString( nStmId) + ")"
" -- bOk =" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeUniformVolZmap( int nVolZmapId, double dToler)
{
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 ;
}
+34
View File
@@ -27,6 +27,7 @@
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
//----------------------------------------------------------------------------
bool
@@ -677,3 +678,36 @@ ExeCurveCompoNormVersor( int nId, int nSimpCrv, int nRefId, Vector3d& vtNorm)
// gestione trasformazione ( eventuale)
return TransformVector( pGeomDB, nId, nRefId, vtNorm) ;
}
//----------------------------------------------------------------------------
bool
ExeShowBezierCurveControlPoints( int nCrvId, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva di bezier
const ICurveBezier* pCrvBezier = GetCurveBezier( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCrvBezier == nullptr || pCrvBezier->GetType() != CRV_BEZIER)
return false ;
int nParent = pGeomDB->GetParentId( nCrvId) ;
int nDeg = pCrvBezier->GetDegree() ;
bool bRat = pCrvBezier->IsRational() ;
int nFirstId = -1 ;
int nCount = 0 ;
for ( int i = 0 ; i < nDeg + 1 ; ++i) {
IGeoPoint3d* pGeoPt( CreateGeoPoint3d()) ;
if ( ! bRat)
pGeoPt->Set( pCrvBezier->GetControlPoint( i)) ;
else
pGeoPt->Set( pCrvBezier->GetControlPoint( i) * pCrvBezier->GetControlWeight( i)) ;
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParent, pGeoPt) ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nId ;
if ( nId != GDB_ID_NULL)
++nCount ;
}
// restituisco i risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
+92
View File
@@ -1081,6 +1081,98 @@ ExeSurfTmGetFacetBBoxRef( int nId, int nFacet, int nFlag, const Frame3d& frRef,
return pStm->GetFacetBBox( nFacet, frGlobL, b3Box, nFlag) ;
}
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetFacetOutlineInfo( int nId, int nFacet, int nRefId,
int& nStatus, BOOLVECTOR& vbOpen, INTVECTOR& vnAdj, DBLVECTOR& vdLen, 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)
+359 -5
View File
@@ -20,6 +20,8 @@
#include "GeoTools.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveBezier.h"
@@ -27,21 +29,22 @@
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkCurveAux.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkMedialAxis.h"
#include "/EgtDev/Include/EGkChainCurves.h"
#include "/EgtDev/Include/EGkProjectCurveSurfTm.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EGkExtTExt.h"
#include "/EgtDev/Include/EGkGdbIterator.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkIntervals.h"
#include "/EgtDev/Include/EGkPolygon3d.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkCalcPocketing.h"
#include <EgtDev/Include/EGkSfrCreate.h>
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <functional>
@@ -331,10 +334,9 @@ ExeChangeClosedCurveStartPoint( int nId, const Point3d& ptP, int nRefType)
// porto in locale il punto vicino ad iniziale
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
// recupero la posizione parametrica della proiezione di questo punto sulla curva
DistPointCurve distPC( ptPL, *pCurve) ;
double dPar ;
int nFlag ;
bOk = bOk && distPC.GetParamAtMinDistPoint( 0, dPar, nFlag) ;
bOk = bOk && DistPointCurve( ptPL, *pCurve).GetParamAtMinDistPoint( 0, dPar, nFlag) ;
// cambio il punto iniziale
if ( bOk && pCurve->GetType() == CRV_ARC)
bOk = bOk && GetCurveArc(pCurve)->ChangeStartPoint(dPar) ;
@@ -2361,6 +2363,358 @@ ExeProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int
}
//-------------------------------------------------------------------------------
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)
+57 -4
View File
@@ -209,7 +209,7 @@ ExeExplodeSurface( int nId, int* pnCount)
//-------------------------------------------------------------------------------
bool
ExeApproxSurface( int nId, double dLinTol)
ExeApproxSurface( int nId, double dLinTol, double dTriaMinSide)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -230,8 +230,7 @@ ExeApproxSurface( int nId, double dLinTol)
else if ( nType == SRF_BEZIER) {
// recupero la superficie ausiliaria della Bezier
const ISurfBezier* pSbez = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
const ISurfTriMesh* pAuxSurf = ( pSbez != nullptr ? pSbez->GetAuxSurf() : nullptr) ;
pStm.Set( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ;
pStm.Set( ( pSbez != nullptr ? pSbez->GetApproxSurf( dLinTol, dTriaMinSide) : nullptr)) ;
}
bool bOk = ( ! IsNull( pStm)) ;
// semplificazione della trimesh
@@ -242,7 +241,8 @@ ExeApproxSurface( int nId, double dLinTol)
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtApproxSurf(" + ToString( nId) + "," +
ToString( dLinTol) + ")" +
ToString( dLinTol) + "," +
ToString( dTriaMinSide) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -1074,6 +1074,45 @@ ExeSurfTmSubtractProjectedFacesOnFace( int nSurfId, int nFaceInd, int nDestGrpId
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)
@@ -1118,6 +1157,20 @@ ExeSurfTmSetShowEdges( int nId, bool bShow)
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)
+28
View File
@@ -337,6 +337,34 @@ ExeVolZmapSetChiselTool( const INTVECTOR& vIds, const string& sToolName,
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapSetAdditiveTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dDiam, double dCornR, int nFlag, bool bFirst)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero gli Zmap e assegno i dati dell'utensile
bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( bOk && pVZM != nullptr && pVZM->SetAdditiveTool( sToolName, dLen, dDiam / 2, dCornR, nFlag, bFirst)) ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapSetAdditiveTool({" + IdListToString( vIds) + "}," +
sToolName + "," +
ToString( dLen) + "," +
ToString( dDiam) + "," +
ToString( dCornR) + "," +
ToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapResetTools( const INTVECTOR& vIds)
+7
View File
@@ -345,6 +345,13 @@ ExeSetNetHwKey( bool bNetHwKey, int nUserId, const string& sAddrPort)
return SetNetHwKey( s_bNetHwKey, nUserId, sAddrPort) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetNetHwKey( void)
{
return s_bNetHwKey ;
}
//-----------------------------------------------------------------------------
bool
ExeSetFont( const string& sNfeFontDir, const string& sDefaultFont)
+50 -10
View File
@@ -2914,6 +2914,16 @@ ExeGetClEntIndex( int nEntId, int& 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)
@@ -3202,16 +3212,6 @@ ExeSetCalcTool( const string& sTool, const string& sHead, int nExit)
return pMachMgr->SetCalcTool( sTool, sHead, nExit) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetAllCurrAxesName( STRVECTOR& vAxName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero gli assi correnti derivanti dalla scelta di tavola e utensile
return pMachMgr->GetAllCurrAxesName( vAxName) ;
}
//----------------------------------------------------------------------------
bool
ExeSetRotAxisBlock( const string& sAxis, double dVal)
@@ -3222,6 +3222,16 @@ ExeSetRotAxisBlock( const string& sAxis, double dVal)
return pMachMgr->SetRotAxisBlock( sAxis, dVal) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetCalcTable( string& sTable)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// restituisco la tavola corrente per il calcolo sulla macchina della macchinata corrente
return pMachMgr->GetCalcTable( sTable) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetCalcTool( string& sTool, string& sHead, int& nExit)
@@ -3232,6 +3242,16 @@ ExeGetCalcTool( string& sTool, string& sHead, int& nExit)
return ( pMachMgr->GetCalcTool( sTool) && pMachMgr->GetCalcHead( sHead) && pMachMgr->GetCalcExit( nExit)) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetAllCurrAxesNames( STRVECTOR& vAxName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero gli assi correnti derivanti dalla scelta di tavola e utensile
return pMachMgr->GetAllCurrAxesNames( vAxName) ;
}
//----------------------------------------------------------------------------
bool
ExeGetRotAxisBlocked( int nInd, string& sAxis, double& dVal)
@@ -3401,6 +3421,16 @@ ExeGetHeadExitCount( const string& sHead)
return pMachMgr->GetHeadExitCount( sHead) ;
}
//-----------------------------------------------------------------------------
int
ExeGetExitId( const string& sHead, int nExit)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// restituisco identificativo dell'uscita della testa indicata nella macchina della macchinata corrente
return pMachMgr->GetExitId( sHead, nExit) ;
}
//-----------------------------------------------------------------------------
int
ExeGetTcPosId( const string& sTcPos)
@@ -3461,6 +3491,16 @@ ExeGetAllTablesNames( STRVECTOR& vNames)
return pMachMgr->GetAllTablesNames( vNames) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetAllAxesNames( STRVECTOR& vNames)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero l'elenco degli assi
return pMachMgr->GetAllAxesNames( vNames) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetAllHeadsNames( STRVECTOR& vNames)
+316
View File
@@ -0,0 +1,316 @@
//----------------------------------------------------------------------------
// 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 ;
}
BIN
View File
Binary file not shown.
+2
View File
@@ -293,6 +293,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="EXE_Picture.cpp" />
<ClCompile Include="EXE_Scene.cpp" />
<ClCompile Include="EXE_ShortestPath.cpp" />
<ClCompile Include="EXE_TestObjSurface.cpp" />
<ClCompile Include="EXE_TscExec.cpp" />
<ClCompile Include="AuxTools.cpp" />
<ClCompile Include="DllExchange.cpp" />
@@ -316,6 +317,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="LUA_MaxFiller.cpp" />
<ClCompile Include="LUA_Picture.cpp" />
<ClCompile Include="LUA_PolynomialRoots.cpp" />
<ClCompile Include="LUA_TestObjSurface.cpp" />
<ClCompile Include="PictureObj.cpp" />
<ClCompile Include="LUA_Base.cpp" />
<ClCompile Include="LUA_GdbCreateCurve.cpp" />
+6
View File
@@ -401,6 +401,12 @@
<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>
<ResourceCompile Include="EgtExecutor.rc">
+5 -2
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2015
// EgalTech 2014-2024
//----------------------------------------------------------------------------
// File : LUA.h Data : 16.01.15 Versione : 1.6a3
// File : LUA.h Data : 24.03.24 Versione : 2.6c2
// Contenuto : Dichiarazioni locali per moduli LUA.
//
//
@@ -93,6 +93,9 @@ bool LuaInstallGeoInters( LuaMgr& luaMgr) ;
//-------------------------- Collision Detection -----------------------------
bool LuaInstallCDeObjSolid( LuaMgr& luaMgr) ;
//-------------------------- Test Interference -------------------------------
bool LuaInstallTestObjSurface( LuaMgr& luaMgr) ;
//-------------------------- MachMgr -----------------------------------------
bool LuaInstallMachMgr( LuaMgr& luaMgr) ;
+4
View File
@@ -130,6 +130,10 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
LOG_ERROR( GetLogger(), "Error in LuaInstallCDeObjSolid (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallTestObjSurface( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallTestObjSurface (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallMachMgr( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallMachMgr (LuaInstallEgtFunctions)")
return false ;
+4 -2
View File
@@ -188,14 +188,16 @@ LuaImport3dm( lua_State* L)
static int
LuaAdvancedImport( lua_State* L)
{
// 1 o 2 parametri : path del file da importare [, dLinToler]
// 1 o 2 o 3 parametri : path del file da importare [, dLinToler] [, nFlag]
string sFilePath ;
LuaCheckParam( L, 1, sFilePath)
double dLinToler = 0.1 ;
LuaGetParam( L, 2, dLinToler) ;
int nFlag = 0 ;
LuaGetParam( L, 3, nFlag) ;
LuaClearStack( L) ;
// apro il file
bool bOk = ExeAdvancedImport( sFilePath, dLinToler) ;
bool bOk = ExeAdvancedImport( sFilePath, dLinToler, nFlag) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
+50
View File
@@ -425,6 +425,34 @@ LuaCreateArc3P( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateArc2PR( lua_State* L)
{
// 5 o 6 parametri : ParentId, PtStart, PtEnd, dRad, bCCW [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptStart ;
LuaCheckParam( L, 2, ptStart)
Point3d ptEnd ;
LuaCheckParam( L, 3, ptEnd)
double dRad ;
LuaCheckParam( L, 4, dRad)
bool bCCW ;
LuaCheckParam( L, 5, bCCW) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 6, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = ExeCreateArc2PR( nParentId, ptStart, ptEnd, dRad, bCCW, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateArc2PB( lua_State* L)
@@ -1063,6 +1091,26 @@ LuaCreateCirclesAlongCurve( lua_State* L)
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateCurveBezierForm( lua_State* L)
{
// 2 parametri : ParentId, nCrvId
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId)
// creo la versione bezier della curva
int nId = ExeCreateCurveBezierForm( nParentId, nCrvId) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
@@ -1083,6 +1131,7 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2P", LuaCreateArcC2P) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2PEx", LuaCreateArcC2PEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc3P", LuaCreateArc3P) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PR", LuaCreateArc2PR) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PB", LuaCreateArc2PB) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PD", LuaCreateArc2PD) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PDEx", LuaCreateArc2PDEx) ;
@@ -1106,5 +1155,6 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromApothem", LuaCreatePolygonFromApothem) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromSide", LuaCreatePolygonFromSide) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCirclesAlongCurve", LuaCreateCirclesAlongCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierForm", LuaCreateCurveBezierForm) ;
return bOk ;
}
+13 -27
View File
@@ -660,20 +660,29 @@ LuaCreateSurfTmRectSwept( lua_State* L)
static int
LuaCreateSurfTmSwept( lua_State* L)
{
// 4 o 5 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol]
// 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, 4, bCapEnds)
LuaCheckParam( L, nPar, bCapEnds)
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 5, dLinTol) ;
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, bCapEnds, dLinTol) ;
int nId = ExeCreateSurfTmSwept( nParentId, nSectId, nGuideId, vtAx, bCapEnds, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -787,26 +796,6 @@ LuaCreateSurfTmBySewing( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmBySurfBezier( lua_State* L)
{
// 2 parametri : ParentId, nSbezId
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nZmapId ;
LuaCheckParam( L, 2, nZmapId)
LuaClearStack( L) ;
// creo STM partendo da superficie di Bezier
int nId = ExeCreateSurfTmBySurfBezier( nParentId, nZmapId) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmByVolZmap( lua_State* L)
@@ -960,8 +949,6 @@ LuaCreateSurfBezierTria2D( lua_State* L)
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateBezierSphere( lua_State* L)
@@ -1023,7 +1010,6 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRuled", LuaCreateSurfTmRuled) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySurfBezier", LuaCreateSurfTmBySurfBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByVolZmap", LuaCreateSurfTmByVolZmap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezier", LuaCreateSurfBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierRat", LuaCreateSurfBezierRational) ;
+70
View File
@@ -54,6 +54,42 @@ LuaCreateVolZmapBox( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateVolZmapEmpty( lua_State* L)
{
// 6 o 7 o 8 parametri : ParentId, PtIni, dDimX, dDimY, dDimZ, dPrec [, bTriDex] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptIni ;
LuaCheckParam( L, 2, ptIni)
double dDimX ;
LuaCheckParam( L, 3, dDimX)
double dDimY ;
LuaCheckParam( L, 4, dDimY)
double dDimZ ;
LuaCheckParam( L, 5, dDimZ)
double dPrec ;
LuaCheckParam( L, 6, dPrec)
bool bTriDex = true ;
int nRefType = RTY_DEFAULT ;
if ( ! LuaGetParam( L, 7, bTriDex))
LuaGetParam( L, 7, nRefType) ;
else
LuaGetParam( L, 8, nRefType) ;
LuaClearStack( L) ;
// creo VZM parallelepipedo
int nId = ExeCreateVolZmapEmpty( nParentId, ptIni, dDimX, dDimY, dDimZ, dPrec, bTriDex, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateVolZmapByRegionExtrusion( lua_State* L)
@@ -104,13 +140,47 @@ LuaCreateVolZmapFromSurfTm( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaUpdateVolZmapByAddingSurfTm( lua_State* L)
{
// 2 parametri : nVolZmapId, StmId,
int nVolZmapId ;
LuaCheckParam( L, 1, nVolZmapId) ;
int nStmId ;
LuaCheckParam( L, 2, nStmId) ;
LuaClearStack( L) ;
bool bOk = ExeUpdateVolZmapByAddingSurfTm( nVolZmapId, nStmId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaUniformVolZmap( lua_State* L)
{
// 1 o 2 parametri : nVolZmapId [, dToler]
int nVolZmapId ;
LuaCheckParam( L, 1, nVolZmapId) ;
double dToler = EPS_SMALL ;
LuaGetParam( L, 2, dToler) ;
LuaClearStack( L) ;
bool bOk = ExeUniformVolZmap( nVolZmapId, dToler) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbCreateVol( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapBox", LuaCreateVolZmapBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapEmpty", LuaCreateVolZmapEmpty) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapByRegionExtrusion", LuaCreateVolZmapByRegionExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapFromSurfTm", LuaCreateVolZmapFromSurfTm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateVolZmapByAddingSurfTm", LuaUpdateVolZmapByAddingSurfTm ) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtUniformZmap", LuaUniformVolZmap) ;
return bOk ;
}
+23
View File
@@ -531,6 +531,28 @@ LuaCurveCompoNormVersor( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaShowBezierCurveControlPoint( lua_State* L)
{
// 1 parametro : nCrvId
int nCrvId ;
LuaCheckParam( L, 1, nCrvId)
LuaClearStack( L) ;
int nCount = 0 ;
int nId = ExeShowBezierCurveControlPoints( nCrvId, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbGetCurve( LuaMgr& luaMgr)
@@ -562,5 +584,6 @@ LuaInstallGdbGetCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoRadius", LuaCurveCompoRadius) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoAngCenter", LuaCurveCompoAngCenter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoNormVersor", LuaCurveCompoNormVersor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtShowBezierCurveControlPoints", LuaShowBezierCurveControlPoint) ;
return bOk ;
}
+37
View File
@@ -443,6 +443,42 @@ LuaSurfTmGetFacetBBoxRef( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetFacetOutlineInfo( lua_State* L)
{
// 2 o 3 parametri : Id, nFacet [, nRefId]
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
int nRefId = nId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero le informazioni
int nStatus ;
BOOLVECTOR vbOpen ;
INTVECTOR vnAdj ;
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
LuaSurfTmFacetAdjacencies( lua_State* L)
@@ -1106,6 +1142,7 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBox", LuaSurfTmGetFacetBBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxGlob", LuaSurfTmGetFacetBBoxGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxRef", LuaSurfTmGetFacetBBoxRef) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetOutlineInfo", LuaSurfTmGetFacetOutlineInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetAdjacencies", LuaSurfTmFacetAdjacencies) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestEndPoint", LuaSurfTmFacetNearestEndPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestMidPoint", LuaSurfTmFacetNearestMidPoint) ;
+81
View File
@@ -975,6 +975,84 @@ LuaProjectCurveOnSurfTm( lua_State* L)
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)
@@ -1107,8 +1185,11 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtChainCurvesInGroup", LuaChainCurvesInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtReorderCurvesInGroup", LuaReorderCurvesInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfTm", LuaProjectCurveOnSurfTm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfTmExt", LuaProjectCurveOnSurfTmExt) ;
bOk = bOk && luaMgr.RegisterFunction( "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 ;
}
+64 -3
View File
@@ -61,14 +61,16 @@ LuaExplodeSurf( lua_State* L)
static int
LuaApproxSurf( lua_State* L)
{
// 1 o 2 parametri : Id [, dLinTol]
// 1 o 2 parametri : Id [, dLinTol [, dTriaMinSide]]
int nId ;
LuaCheckParam( L, 1, nId)
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 2, dLinTol) ;
double dTriaMinSide = 100 * EPS_SMALL ;
if ( LuaGetParam( L, 2, dLinTol))
LuaGetParam( L, 3, dTriaMinSide) ;
LuaClearStack( L) ;
// approssimazione della superficie
bool bOk = ExeApproxSurface( nId, dLinTol) ;
bool bOk = ExeApproxSurface( nId, dLinTol, dTriaMinSide) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -477,6 +479,44 @@ LuaSurfTmSubtractProjectedFacesOnFace( lua_State* L)
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)
@@ -508,6 +548,24 @@ LuaSurfTmSetShowEdges( lua_State* L)
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)
@@ -552,8 +610,11 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSplit", LuaSurfTmSplit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCut", LuaSurfTmCut) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtractProjectedFacesOnFace", LuaSurfTmSubtractProjectedFacesOnFace) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetFaceColor", LuaSurfTmSetFaceColor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetTriaColor", LuaSurfTmGetTriaColor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetShowEdges", LuaSurfTmSetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetShowEdges", LuaSurfTmGetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzTrim", LuaSurfBzTrim) ;
return bOk ;
}
+30 -4
View File
@@ -152,7 +152,7 @@ LuaVolZmapSetAdvTool( lua_State* L)
static int
LuaVolZmapSetSawTool( lua_State* L)
{
// 7 o 8 parametri : vIds, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR, nFlag
// 7 o 8 parametri : vIds, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR [, nFlag]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -181,7 +181,7 @@ LuaVolZmapSetSawTool( lua_State* L)
static int
LuaVolZmapSetGenTool( lua_State* L)
{
// 3 o 4 parametri : vIds, sToolName, ToolSectId, nFlag
// 3 o 4 parametri : vIds, sToolName, ToolSectId [, nFlag]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -202,7 +202,7 @@ LuaVolZmapSetGenTool( lua_State* L)
static int
LuaVolZmapSetMortiserTool( lua_State* L)
{
// 6 o 7 parametri : Id, sToolName, dLen, dWidth, dThick, dCornR, nFlag
// 6 o 7 parametri : Id, sToolName, dLen, dWidth, dThick, dCornR [, nFlag]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -229,7 +229,7 @@ LuaVolZmapSetMortiserTool( lua_State* L)
static int
LuaVolZmapSetChiselTool( lua_State* L)
{
// 5 o 6 parametri : vIds, sToolName, dLen, dWidth, dThick, nFlag
// 5 o 6 parametri : vIds, sToolName, dLen, dWidth, dThick [, nFlag]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -250,6 +250,31 @@ LuaVolZmapSetChiselTool( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaVolZmapSetAdditiveTool( lua_State* L)
{
// 5 o 6 parametri : vIds, sToolName, dLen, dDiam, dCornR [, nFlag]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
LuaCheckParam( L, 2, sToolName)
double dLen ;
LuaCheckParam( L, 3, dLen)
double dDiam ;
LuaCheckParam( L, 4, dDiam)
double dCornR ;
LuaCheckParam( L, 5, dCornR)
int nFlag = 1 ;
LuaGetParam( L, 6, nFlag) ;
LuaClearStack( L) ;
// imposto utensile additivo a Zmap indicati
bool bOk = ExeVolZmapSetAdditiveTool( vIds, sToolName, dLen, dDiam, dCornR, nFlag, true) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaVolZmapResetTool( lua_State* L)
@@ -375,6 +400,7 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetGenTool", LuaVolZmapSetGenTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetMortiserTool", LuaVolZmapSetMortiserTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetChiselTool", LuaVolZmapSetChiselTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdditiveTool", LuaVolZmapSetAdditiveTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapResetTool", LuaVolZmapResetTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetToolOutline", LuaVolZmapGetToolOutline) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMillingStep", LuaVolZmapMillingStep) ;
+82
View File
@@ -31,6 +31,7 @@
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "Windowsx.h"
#include "shlobj.h"
using namespace std ;
@@ -106,6 +107,24 @@ LuaPause( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetKeyPressed( lua_State* L)
{
// 1 parametro : nKeyCode
int nKeyCode ;
LuaCheckParam( L, 1, nKeyCode)
LuaClearStack( L) ;
// se abilitata UI, controllo se il tasto indicato è premuto
bool bPressed = false ;
if ( ExeGetEnableUI()) {
bPressed = (( GetAsyncKeyState( nKeyCode) & 0x8000) != 0) ;
}
// restituisco il risultato
LuaSetParam( L, bPressed) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaStartCounter( lua_State* L)
@@ -756,6 +775,67 @@ LuaCompareFilesLastWriteTime( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
int
CALLBACK DirectoryBoxProc( HWND hwndDlg, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
if ( uMsg == BFFM_INITIALIZED)
SendMessage( hwndDlg, BFFM_SETSELECTION, TRUE, lpData) ;
return 0 ;
}
//-------------------------------------------------------------------------------
static int
LuaDirectoryDialog( lua_State* L)
{
// 2 parametri : sText, sDir
string sText ;
LuaCheckParam( L, 1, sText)
string sDir ;
LuaCheckParam( L, 2, sDir)
LuaClearStack( L) ;
// se abilitata UI, emetto la finestra di dialogo
if ( ExeGetEnableUI()) {
// Converto i parametri nel formato wide
AtoWEX<MAX_PATH> wsText( sText.c_str()) ;
AtoWEX<MAX_PATH> wsDirName( sDir.c_str()) ;
// Converto L'/' in L'\\' nel nome directory proposto
for ( wchar_t* pC = wsDirName.m_psz ; *pC != L'\0' ; ++ pC) {
if ( *pC == L'/')
*pC = L'\\' ;
}
// Riempio la struttura dati per il dialogo
BROWSEINFO bi = { 0} ;
bi.hwndOwner = ExeGetMainWindowHandle() ;
bi.lpszTitle = LPWSTR( wsText) ;
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_USENEWUI ;
bi.lpfn = DirectoryBoxProc ;
bi.lParam = (LPARAM) LPWSTR( wsDirName) ;
// Visualizzo il dialogo
LPITEMIDLIST pIdl = SHBrowseForFolder( &bi) ;
if ( pIdl != NULL) {
// recupero la path della directory
WCHAR wPath[MAX_PATH] ;
if ( SHGetPathFromIDList( pIdl, wPath) != FALSE)
LuaSetParam( L, wstrztoA( wPath)) ;
else
LuaSetParam( L) ;
// free memory used
IMalloc* pImalloc = NULL ;
if ( SUCCEEDED( SHGetMalloc( &pImalloc))) {
pImalloc->Free( pIdl) ;
pImalloc->Release() ;
}
}
else
LuaSetParam( L) ;
}
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaExistsDirectory( lua_State* L)
@@ -1260,6 +1340,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "print", MyPrint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtEvalNumExpr", LuaEvalNumExpr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPause", LuaPause) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetKeyPressed", LuaGetKeyPressed) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtStartCounter", LuaStartCounter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtStopCounter", LuaStopCounter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtNumToString", LuaNumToString) ;
@@ -1287,6 +1368,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseFile", LuaEraseFile) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtFindAllFiles", LuaFindAllFiles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCompareFilesLastWriteTime", LuaCompareFilesLastWriteTime) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDirectoryDialog", LuaDirectoryDialog) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsDirectory", LuaExistsDirectory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateDirectory", LuaCreateDirectory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtEmptyDirectory", LuaEmptyDirectory) ;
+81
View File
@@ -530,6 +530,83 @@ LuaBBoxLocToLoc( lua_State* L)
}
}
//-------------------------------------------------------------------------------
static int
LuaQuaternionFromAxisAngle( lua_State* L)
{
// 2 parametri : vtAx, dAngDeg
Vector3d vtAx ;
LuaCheckParam( L, 1, vtAx)
double dAngDeg ;
LuaCheckParam( L, 2, dAngDeg)
LuaClearStack( L) ;
// calcolo il quaternione che produce la rotazione equivalente
Quaternion qtQ = FromAxisAngle( vtAx, dAngDeg) ;
if ( ! qtQ.IsSmall())
LuaSetParam( L, qtQ) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaQuaternionToAxisAngle( lua_State* L)
{
// 1 parametro : Quaternion
Quaternion qtQ ;
LuaCheckParam( L, 1, qtQ)
LuaClearStack( L) ;
// calcolo l'asse e l'angolo di rotazione equivalenti
Vector3d vtAx ;
double dAngDeg ;
bool bOk = ToAxisAngle( qtQ, vtAx, dAngDeg) ;
if ( bOk) {
LuaSetParam( L, vtAx) ;
LuaSetParam( L, dAngDeg) ;
return 2 ;
}
else {
LuaSetParam( L) ;
return 1 ;
}
}
//-------------------------------------------------------------------------------
static int
LuaQuaternionFromFrame( lua_State* L)
{
// 1 parametro : Frame
Frame3d frFrame ;
LuaCheckParam( L, 1, frFrame)
LuaClearStack( L) ;
// calcolo il quaternione che produce l'orientamento di questo frame tramite rotazione dal globale
Quaternion qtQ = FromFrame( frFrame) ;
if ( ! qtQ.IsSmall())
LuaSetParam( L, qtQ) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaQuaternionToFrame( lua_State* L)
{
// 1 parametro : Quaternion
Quaternion qtQ ;
LuaCheckParam( L, 1, qtQ)
LuaClearStack( L) ;
// calcolo il frame equivalente come orientamento a quello globale ruotato dal quaternione
Frame3d frFrame ;
bool bOk = ToFrame( qtQ, frFrame) ;
if ( bOk)
LuaSetParam( L, frFrame) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGeoBase( LuaMgr& luaMgr)
@@ -557,5 +634,9 @@ LuaInstallGeoBase( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToGlob", LuaBBoxToGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToLoc", LuaBBoxToLoc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxLocToLoc", LuaBBoxLocToLoc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionFromAxisAngle", LuaQuaternionFromAxisAngle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionToAxisAngle", LuaQuaternionToAxisAngle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionFromFrame", LuaQuaternionFromFrame) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionToFrame", LuaQuaternionToFrame) ;
return bOk ;
}
+118 -41
View File
@@ -3030,6 +3030,25 @@ LuaGetClEntIndex( lua_State* L)
return 1 ;
}
//-----------------------------------------------------------------------------
static int
LuaGetClEntAxesMask( lua_State* L)
{
// 1 parametro : nEntId
int nEntId ;
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero la mascheratura del movimento assi
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)
@@ -3335,23 +3354,6 @@ LuaSetCalcTool( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetAllCurrAxesName( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// imposto l'utensile corrente per il calcolo
STRVECTOR vAxName ;
bool bOk = ExeGetAllCurrAxesName( vAxName) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vAxName) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetRotAxisBlock( lua_State* L)
@@ -3371,26 +3373,19 @@ LuaSetRotAxisBlock( lua_State* L)
//-------------------------------------------------------------------------------
static int
LuaGetRotAxisBlocked( lua_State* L)
LuaGetCalcTable( lua_State* L)
{
// 1 parametro : nInd ( 0-based)
int nInd ;
LuaCheckParam( L, 1, nInd)
// nessun parametro
LuaClearStack( L) ;
// recupero dati bloccaggio asse in posizione nInd
string sAxis ;
double dVal ;
bool bOk = ExeGetRotAxisBlocked( nInd, sAxis, dVal) ;
// recupero la tavola correnti
string sTable ;
bool bOk = ExeGetCalcTable( sTable) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, sAxis) ;
LuaSetParam( L, dVal) ;
}
else {
if ( bOk)
LuaSetParam( L, sTable) ;
else
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
return 1 ;
}
//-------------------------------------------------------------------------------
@@ -3418,6 +3413,47 @@ LuaGetCalcTool( lua_State* L)
return 3 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetAllCurrAxesNames( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// imposto l'utensile corrente per il calcolo
STRVECTOR vAxName ;
bool bOk = ExeGetAllCurrAxesNames( vAxName) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vAxName) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetRotAxisBlocked( lua_State* L)
{
// 1 parametro : nInd ( 0-based)
int nInd ;
LuaCheckParam( L, 1, nInd)
LuaClearStack( L) ;
// recupero dati bloccaggio asse in posizione nInd
string sAxis ;
double dVal ;
bool bOk = ExeGetRotAxisBlocked( nInd, sAxis, dVal) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, sAxis) ;
LuaSetParam( L, dVal) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetCalcAngles( lua_State* L)
@@ -3485,7 +3521,7 @@ LuaGetCalcPositions( lua_State* L)
static int
LuaGetCalcTipFromPositions( lua_State* L)
{
// da 5 a 8 parametri : dX, dY, dZ, dAngA [, dAngB] [, dAngC] [, dAngD], bBottom
// da 5 a 10 parametri : dX, dY, dZ, dAngR1[, dAngR2][, dAngR3][, dAngR4][, dAngR5][, dAngR6], bBottom
double dX ;
LuaCheckParam( L, 1, dX)
double dY ;
@@ -3494,7 +3530,7 @@ LuaGetCalcTipFromPositions( lua_State* L)
LuaCheckParam( L, 3, dZ)
DBLVECTOR vAng ;
int i ;
for ( i = 4 ; i <= 7 ; ++ i) {
for ( i = 4 ; i <= 9 ; ++ i) {
double dAng ;
if ( LuaGetParam( L, i, dAng))
vAng.emplace_back( dAng) ;
@@ -3519,9 +3555,9 @@ LuaGetCalcTipFromPositions( lua_State* L)
static int
LuaGetCalcToolDirFromAngles( lua_State* L)
{
// da 1 a 4 parametri : dAngA, dAngB, dAngC, dAngD
// da 1 a 6 parametri : dAngR1, dAngR2, dAngR3, dAngR4, dAngR5, dAngR6
DBLVECTOR vAng ;
for ( int i = 1 ; i <= 4 ; ++ i) {
for ( int i = 1 ; i <= 6 ; ++ i) {
double dAng ;
if ( LuaGetParam( L, i, dAng))
vAng.emplace_back( dAng) ;
@@ -3544,9 +3580,9 @@ LuaGetCalcToolDirFromAngles( lua_State* L)
static int
LuaGetCalcAuxDirFromAngles( lua_State* L)
{
// da 1 a 4 parametri : dAngA, dAngB, dAngC, dAngD
// da 1 a 6 parametri : dAngR1, dAngR2, dAngR3, dAngR4, dAngR5, dAngR6
DBLVECTOR vAng ;
for ( int i = 1 ; i <= 4 ; ++ i) {
for ( int i = 1 ; i <= 6 ; ++ i) {
double dAng ;
if ( LuaGetParam( L, i, dAng))
vAng.emplace_back( dAng) ;
@@ -3701,6 +3737,26 @@ LuaGetHeadExitCount( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetExitId( lua_State* L)
{
// 2 parametri : sHead, nExit
string sHead ;
LuaCheckParam( L, 1, sHead)
int nExit ;
LuaCheckParam( L, 2, nExit)
LuaClearStack( L) ;
// recupero l'identificativo dell'Uscita della Testa indicata della macchina
int nId = ExeGetExitId( sHead, nExit) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetTcPosId( lua_State* L)
@@ -3812,6 +3868,23 @@ LuaGetAllTablesNames( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetAllAxesNames( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero l'elenco degli assi della macchina corrente
STRVECTOR vNames ;
bool bOk = ExeGetAllAxesNames( vNames) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vNames) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetAllHeadsNames( lua_State* L)
@@ -4222,6 +4295,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntMove", LuaGetClEntMove) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntFlag", LuaGetClEntFlag) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntIndex", LuaGetClEntIndex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesMask", LuaGetClEntAxesMask) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesVal", LuaGetClEntAxesVal) ;
// Simulation
bOk = bOk && luaMgr.RegisterFunction( "EgtSimInit", LuaSimInit) ;
@@ -4245,21 +4319,24 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisId", LuaGetAxisId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadId", LuaGetHeadId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadExitCount", LuaGetHeadExitCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetExitId", LuaGetExitId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTcPosId", LuaGetTcPosId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisToken", LuaGetAxisToken) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisType", LuaGetAxisType) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisInvert", LuaGetAxisInvert) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisOffset", LuaGetAxisOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllTablesNames", LuaGetAllTablesNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllAxesNames", LuaGetAllAxesNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllHeadsNames", LuaGetAllHeadsNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllTcPosNames", LuaGetAllTcPosNames) ;
// Machine Calc
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTable", LuaSetCalcTable) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTool", LuaSetCalcTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllCurrAxesName", LuaGetAllCurrAxesName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetRotAxisBlock", LuaSetRotAxisBlock) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRotAxisBlocked", LuaGetRotAxisBlocked) ;
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( "EgtGetCalcAngles", LuaGetCalcAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcPositions", LuaGetCalcPositions) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTipFromPositions", LuaGetCalcTipFromPositions) ;
+202
View File
@@ -0,0 +1,202 @@
//----------------------------------------------------------------------------
// 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 ;
}