Compare commits

...

17 Commits

Author SHA1 Message Date
Daniele Bariletti 73db521008 Merge branch 'master' into CmdCreateSurfBezier 2024-03-21 15:07:08 +01:00
Daniele Bariletti 82d1465ecd EgtExecutor :
- modificata la funzione per richiedere gli edge di una Bezier.
2024-03-21 15:01:35 +01:00
Dario Sassi 047bff2f11 EgtExecutor :
- aggiunta funzione exe e lua CreateAngularDimensionEx.
2024-03-14 20:02:39 +01:00
Dario Sassi 611c08bb4c EgtExecutor :
- aggiunta funzione Exe e Lua SurfTmMoveFacet.
2024-03-13 09:24:16 +01:00
Dario Sassi c69036ef2c EgtExecutor 2.6c2 :
- aggiunte funzioni Exe e Lua SurfTmSetShowEdges e VolZmapSetShowEdges.
2024-03-10 10:25:36 +01:00
Daniele Bariletti b0c1ba14e8 Merge branch 'master' into CmdCreateSurfBezier 2024-03-08 16:37:46 +01:00
Dario Sassi 66a232a6a0 EgtExecutor 2.6c1 :
- ricompilazione con cambio versione.
2024-03-05 08:56:19 +01:00
Daniele Bariletti 89e8b02316 EgtExecutor :
- spostato il filtro delle intersezioni line-SurfBz in GeomKernel.
2024-02-28 10:31:54 +01:00
Daniele Bariletti d1cb3d7de7 Merge branch 'master' into CmdCreateSurfBezier 2024-02-28 09:33:06 +01:00
Daniele Bariletti 49d2600cc7 EgtExecutor :
- correzione del merge.
2024-02-27 17:30:38 +01:00
Daniele Bariletti ce92c8f6c9 Merge branch 'master' into CmdCreateSurfBezier 2024-02-27 17:06:46 +01:00
Daniele Bariletti 303b7d8f0e EgtExecutor :
- aggiunta della funzione per disegnare i triangoli nello spazio parametrico di una superifcie Bezier
- aggiunto il calcolo dei punti di polo nelle funzioni che creano superfici di Bezier.
2024-02-27 16:36:08 +01:00
Daniele Bariletti 95ec7a83ef EgtExecutor :
- aggiunta funzione per tagliare una superficie bezier con un piano.
2024-02-20 12:30:43 +01:00
Daniele Bariletti e82c7417b6 Merge branch 'Dist-Inters_Bezier' into CmdCreateSurfBezier 2024-02-14 14:43:33 +01:00
Daniele Bariletti a3fa91244d EgtExecutor :
- aggiunta la funzione per creare una sfera come superficie bezier.
2024-02-14 14:42:16 +01:00
Daniele Bariletti abbc5415ab Merge branch 'master' into Dist-Inters_Bezier 2024-02-12 13:00:08 +01:00
Daniele Bariletti 603cb083cc EgtExecutor :
- aggiunte le funzioni per l'intersezione tra linea e sup. Bezier.
2024-02-12 12:59:43 +01:00
12 changed files with 655 additions and 100 deletions
+60 -4
View File
@@ -583,7 +583,7 @@ ExeCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptV, const Point3d& ptP2,
MyCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2,
const Point3d& ptDim, const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
@@ -603,7 +603,7 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptV
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim ) ||
! pDim->SetAngular( ptP1L, ptVL, ptP2L, ptDimL, vtNL, sText))
! pDim->SetAngular( ptVL, ptP1L, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
@@ -611,11 +611,11 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptV
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptV, const Point3d& ptP2,
ExeCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2,
const Point3d& ptDim, const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimension( nParentId, ptP1, ptV, ptP2, ptDim, sText, nRefType) ;
int nId = MyCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -633,6 +633,62 @@ ExeCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& pt
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
const Point3d& ptV2,const Point3d& ptP2, const Point3d& ptDim,
const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// porto in locale i punti e assegno i versori
Point3d ptV1L = GetPointLocal( pGeomDB, ptV1, nRefType, frLoc) ;
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
Point3d ptV2L = GetPointLocal( pGeomDB, ptV2, nRefType, frLoc) ;
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim ) ||
! pDim->SetAngularEx( ptV1L, ptP1L, ptV2L, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
const Point3d& ptV2, const Point3d& ptP2, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimensionEx( nParentId, ptV1, ptP1, ptV2, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimensionEx(" + IdToString( nParentId) + ",{" +
ToString( ptV1) + "},{" +
ToString( ptP1) + "},{" +
ToString( ptV2) + "},{" +
ToString( ptP2) + "},{" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Point3d& ptDim,
+104
View File
@@ -33,6 +33,8 @@
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EGkSbzStandard.h"
using namespace std ;
//-------------------------------------------------------------------------------
@@ -1675,6 +1677,8 @@ 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
@@ -1727,6 +1731,8 @@ 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
@@ -1819,3 +1825,101 @@ ExeCreateSurfBezierLeaves( int nParentId, int nSurfBzId, int nTextHeight, bool b
*pnCount = nCount ;
return nFirstId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfBezierTria2D( int nParentId, int nSurfBzId, int nTextHeight, bool bShowTrim, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero la superficie
const ISurfBezier* pSurfBez = GetSurfBezier( pGeomDB->GetGeoObj( nSurfBzId)) ;
if ( pSurfBez == nullptr)
return GDB_ID_NULL ;
// disegno i triangoli
vector<tuple<int,Point3d,Point3d,Point3d>> vTria2D ;
pSurfBez->GetTriangles2D( vTria2D) ;
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
bool bOk = true ;
for ( int k = 0 ; k < (int)vTria2D.size() ; ++ k) {
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
bOk = bOk && ! IsNull( pStm) ;
Point3d ptP1L = get<1>(vTria2D[k]) ;
Point3d ptP2L = get<2>(vTria2D[k]) ;
Point3d ptP3L = get<3>(vTria2D[k]) ;
// assegno il triangolo
if ( bOk) {
pStm->Init( 3, 1, 1) ;
int vV[3]{ pStm->AddVertex( ptP1L),
pStm->AddVertex( ptP2L),
pStm->AddVertex( ptP3L)} ;
bOk = ( pStm->AddTriangle( vV) != SVT_NULL) && pStm->AdjustTopology() ;
}
// inserisco la superficie nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
if ( nNewId == GDB_ID_NULL)
return GDB_ID_NULL ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
++ nCount ;
// creo il testo e lo riempio
string sText = ToString( get<0>( vTria2D[k])) ;
Point3d ptCenter( ( ptP1L + ptP2L + ptP3L) / 3) ;
PtrOwner<IExtText> pTXT( CreateExtText()) ;
if ( IsNull( pTXT) || ! pTXT->Set( ptCenter, Z_AX, X_AX, sText, "", false, nTextHeight))
return GDB_ID_NULL ;
// inserisco il testo nel DB
int nTxtId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) ;
if ( nTxtId == GDB_ID_NULL)
return GDB_ID_NULL ;
++ nCount ;
}
// se richiesto disegno la regione di trim
const ISurfFlatRegion* pSfr = pSurfBez->GetTrimRegion() ;
if ( bShowTrim && pSfr != nullptr) {
PtrOwner<ISurfFlatRegion> pTrimReg( pSfr->Clone()) ;
if ( ! IsNull( pTrimReg)) {
int nTrimId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTrimReg)) ;
if ( nTrimId == GDB_ID_NULL)
return GDB_ID_NULL ;
++ nCount ;
}
}
// restituisco i risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateBezierSphere( int nParentId, const Point3d& ptCenter, double dR, int nRefType) {
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento di immersione della superficie
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// reucpero il punto in locale
Point3d ptCenterLoc = GetPointLocal( pGeomDB, ptCenter, nRefType, frLoc) ;
// Creo la superficie
PtrOwner<ISurfBezier> pSurfBez( CreateBezierSphere( ptCenterLoc, dR)) ;
pSurfBez->CalcPoles() ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSurfBez)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCreateBezierSphere(" + IdToString( nParentId) + "," +
ToString( ptCenter) + "," +
ToString( dR) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// resituisco l'identificativo dell'entità creata
return nId ;
}
+14 -13
View File
@@ -1462,25 +1462,26 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
// richiedo i contorni della superficie e li inserisco nel DB
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
int nL = 0 ;
PtrOwner<ICurve> pCrv( bOk ? pSbz->GetLoop( nL) : nullptr) ;
while ( ! IsNull( pCrv)) {
// porto la curva nel riferimento destinazione
bOk = bOk && pCrv->LocToLoc( frSurf, frDest) ;
// la inserisco nel DB geometrico
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCrv)) : GDB_ID_NULL) ;
ICRVCOMPOPOVECTOR vCC ;
pSbz->GetLoops( vCC , true) ;
for ( int i = 0 ; i < int( vCC.size()) ; ++i) {
if ( IsNull( vCC[i]) || ! vCC[i]->IsValid())
continue ;
// porto la curva nel riferimento destinazione
bOk = bOk && vCC[i]->LocToLoc(frSurf, frDest) ;
// la inserisco nel DB geometrico
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCC[i])) : GDB_ID_NULL) ;
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
// copio il materiale
if ( ! pGeomDB->CopyMaterial( nId, nNewId))
// copio il materiale
if ( ! pGeomDB->CopyMaterial( nId, nNewId))
return GDB_ID_NULL ;
// aggiorno contatori
// aggiorno contatori
if ( bOk && nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
if ( bOk)
++ nCount ;
// passo alla prossima curva
pCrv.Set( bOk ? pSbz->GetLoop( ++nL) : nullptr) ;
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -1493,4 +1494,4 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
}
+133 -32
View File
@@ -77,7 +77,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
return GDB_ID_NULL ;
// recupero il numero di componenti connesse
int nParts = pStm->GetPartCount() ;
// se ci sono pi parti, separo queste
// se ci sono più parti, separo queste
if ( nParts > 1) {
int nFirstId = GDB_ID_NULL ;
nCount = 0 ;
@@ -104,7 +104,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
}
// recupero il numero di facce
int nFacets = pStm->GetFacetCount() ;
// se ci sono pi facce, separo queste
// se ci sono più facce, separo queste
if ( nFacets > 1) {
// copio tutte le facce
int nFirstId = GDB_ID_NULL ;
@@ -130,7 +130,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
// restituisco risultati
return nFirstId ;
}
// non devo fare alcunch
// non devo fare alcunché
nCount = 1 ;
return nId ;
}
@@ -147,7 +147,7 @@ MyExplodeSurfFlatRegion( int nId, int& nCount)
return GDB_ID_NULL ;
// recupero il numero di componenti connessi (chunk)
int nChunk = pSfr->GetChunkCount() ;
// se c' un solo componente, non devo fare alcunch
// se c'è un solo componente, non devo fare alcunché
if ( nChunk == 1) {
nCount = 1 ;
return nId ;
@@ -296,7 +296,7 @@ ExeSurfFrSubtract( int nId1, int nId2)
bOk = bOk && ( pSfr2L != nullptr) ;
// eseguo la sottrazione della seconda superficie dalla prima
bOk = bOk && pSfr1->Subtract( *pSfr2L) ;
// se il risultato vuoto, cancello la FlatRegion
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr1->IsValid())
pGeomDB->Erase( nId1) ;
ExeSetModified() ;
@@ -328,7 +328,7 @@ ExeSurfFrIntersect( int nId1, int nId2)
bOk = bOk && ( pSfr2L != nullptr) ;
// eseguo l'intersezione tra le due superfici
bOk = bOk && pSfr1->Intersect( *pSfr2L) ;
// se il risultato vuoto, cancello la FlatRegion
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr1->IsValid())
pGeomDB->Erase( nId1) ;
ExeSetModified() ;
@@ -353,7 +353,7 @@ ExeSurfFrOffset( int nId, double dDist, int nType)
bool bOk = ( pSfr != nullptr) ;
// eseguo l'offset
bOk = bOk && pSfr->Offset( dDist, nType) ;
// se il risultato vuoto, cancello la FlatRegion
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr->IsValid())
pGeomDB->Erase( nId) ;
ExeSetModified() ;
@@ -443,11 +443,11 @@ bool
ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType, bool bUpdate)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero il riferimento in cui immersa la superficie
// recupero il riferimento in cui è immersa la superficie
Frame3d frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
// eseguo la modifica
@@ -475,6 +475,50 @@ ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType,
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeSurfTmMoveFacet( int nId, int nFacet, const Vector3d& vtMove, int nRefType, bool bUpdate)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero il riferimento in cui è immersa la superficie
Frame3d frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
// porto in locale il movimento
Vector3d vtMoveL = GetVectorLocal( pGeomDB, vtMove, nRefType, frStm) ;
// recupero tutti i vertici della faccia
INTVECTOR vVert ;
bOk = bOk && pStm->GetAllVertInFacet( nFacet, vVert) ;
// sposto tutti i vertici della faccia della quantità desiderata
if ( bOk) {
for ( const auto nVert : vVert) {
// recupero la posizione originale del vertice
Point3d ptV ;
if ( pStm->GetVertex( nVert, ptV))
pStm->MoveVertex( nVert, ptV + vtMoveL) ;
}
}
// se richiesto, semplificazione della trimesh
if ( bUpdate)
bOk = bOk && pStm->DoCompacting() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmMoveFacet(" + IdToString( nId) + "," +
ToString( nFacet) + ",{" +
ToString( vtMove) + "}," +
RefTypeToString( nRefType) + "," +
( bUpdate ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-------------------------------------------------------------------------------
static int
MySurfTmToTriangles( int nId, int& nCount)
@@ -487,7 +531,7 @@ MySurfTmToTriangles( int nId, int& nCount)
return GDB_ID_NULL ;
// recupero il numero di triangoli
int nTria = pStm->GetTriangleCount() ;
// se ci sono pi triangoli, li separo
// se ci sono più triangoli, li separo
if ( nTria > 1) {
// copio tutti triangoli
int nFirstId = GDB_ID_NULL ;
@@ -513,7 +557,7 @@ MySurfTmToTriangles( int nId, int& nCount)
// restituisco risultati
return nFirstId ;
}
// non devo fare alcunch
// non devo fare alcunché
nCount = 1 ;
return nId ;
}
@@ -648,6 +692,41 @@ ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSave
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeCutSurfBzPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSaveOnEq, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pSbz != nullptr) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale il punto e la normale del piano
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
// calcolo il piano di taglio
Plane3d plPlane ;
bOk = bOk && plPlane.Set( ptOnL, vtNL) ;
// eseguo il taglio
bOk = bOk && pSbz->Cut( plPlane, bSaveOnEq) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCutSurfBzPlane(" + IdToString( nId) + ",{" +
ToString( ptOn) + "},{" +
ToString( vtN) + "}," +
( bSaveOnEq ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq)
@@ -784,27 +863,6 @@ ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors)
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmResetTwoColors( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// reset dei flag sui triangoli per i due colori
bOk = bOk && pStm->ResetTFlags() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmResetTwoColors(" + ToString( nId) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
static ISurfTriMesh*
MyCreateSubSurfTm( const ISurfTriMesh* pStm, const INTVECTOR& vTria, const INTVECTOR& vTria2)
@@ -1016,6 +1074,49 @@ ExeSurfTmSubtractProjectedFacesOnFace( int nSurfId, int nFaceInd, int nDestGrpId
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmResetTwoColors( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// reset dei flag sui triangoli per i due colori
bOk = bOk && pStm->ResetTFlags() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmResetTwoColors(" + ToString( nId) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmSetShowEdges( int nId, bool bShow)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// imposto lo stato di visualizzazione degli spigoli vivi
if ( bOk)
pStm->SetShowEdges( bShow) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmSetShowEdges(" + ToString( nId) + "," +
ToString( bShow) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
static bool
+25 -3
View File
@@ -104,10 +104,9 @@ ExeVolZmapChangeResolution( int nId, int nNewRes)
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
if ( pVZM == nullptr)
return false ;
bool bOk = ( pVZM != nullptr) ;
// cambio la risoluzione (rapporto Voxel/Dexel, valori ammessi 1 e 2)
bool bOk = pVZM->ChangeResolution( nNewRes) ;
bOk = bOk && pVZM->ChangeResolution( nNewRes) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -120,6 +119,29 @@ ExeVolZmapChangeResolution( int nId, int nNewRes)
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapSetShowEdges( int nId, bool bShow)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pVZM != nullptr) ;
// imposto lo stato di visualizzazione degli spigoli vivi
if ( bOk)
pVZM->SetShowEdges( bShow) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapSetShowEdges(" + ToString( nId) + "," +
ToString( bShow) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeRemoveVolZmapPart( int nId, int nPart)
+79 -23
View File
@@ -34,6 +34,7 @@
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
#include "/EgtDev/Include/EGkIntersLineVolZmap.h"
#include "/EgtDev/Include/EGkIntersPlaneBox.h"
#include "/EgtDev/Include/EGkIntersLineSurfBez.h"
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
#include "/EgtDev/Include/EGkIntersPlaneVolZmap.h"
#include "/EgtDev/Include/EGkIntersCurves.h"
@@ -70,7 +71,7 @@ MyLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, const int nId, con
if ( ! CrvLoc->GetLocalBBox( b3Crv))
return false ;
b3Crv.Expand( 100 * EPS_SMALL) ;
// definisco la linea (punto e direzione sono già nel riferimento di calcolo)
// definisco la linea (punto e direzione sono gi nel riferimento di calcolo)
double dLen = 2 * floor( b3Crv.MaxDistFromPoint( ptP)) ;
double dOffs = -dLen / 2 ;
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
@@ -160,7 +161,7 @@ ExeLineBoxInters( const Point3d& ptP, const Vector3d& vtDir, const BBox3d& b3Box
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entit
return bOk ;
}
@@ -193,8 +194,8 @@ MyLineSurfTmInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRef
ILSIVECTOR vInfo ;
if ( ! IntersLineSurfTm( ptPL, vtDirL, dLen, *pStm, vInfo, false))
return false ;
// filtro le intersezioni
// filtro le intersezioni
FilterLineSurfTmInters( vInfo, vInters) ;
return true ;
@@ -203,20 +204,75 @@ MyLineSurfTmInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRef
//-------------------------------------------------------------------------------
bool
ExeLineSurfTmInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
INTDBLVECTOR& vInters)
INTDBLVECTOR& vInters)
{
// eseguo
// eseguo
bool bOk = MyLineSurfTmInters( ptP, vtDir, nId, nRefType, vInters) ;
// se richiesto, salvo il comando Lua equivalente
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtLineSurfTmInters({" + ToString( ptP) + "},{" +
ToString( vtDir) + "}," +
ToString( nId) + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entit
return bOk ;
}
//-------------------------------------------------------------------------------
static bool
MyLineSurfBzInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType, INTDBLVECTOR& vInters)
{
vInters.clear() ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie Bezier
const ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
if ( pSbz == nullptr)
return false ;
// recupero il suo riferimento globale
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nId, frSurf))
return false ;
// porto in locale il punto e la direzione della linea
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frSurf) ;
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frSurf) ;
vtDirL.Normalize() ;
// calcolo l'ingombro della Bezier
BBox3d b3Surf ;
if ( ! pSbz->GetLocalBBox( b3Surf))
return false ;
// calcolo l'intersezione
double dLen = b3Surf.MaxDistFromPoint( ptPL) ;
ILSBIVECTOR vInfo ;
if ( ! IntersLineSurfBz( ptPL, vtDirL, dLen, pSbz, vInfo, false))
return false ;
// filtro le intersezioni
FilterLineSurfBzInters( vInfo, vInters) ;
return true ;
}
//-------------------------------------------------------------------------------
bool
ExeLineSurfBzInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
INTDBLVECTOR& vInters)
{
// eseguo
bool bOk = MyLineSurfBzInters( ptP, vtDir, nId, nRefType, vInters) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtLineSurfBzInters({" + ToString( ptP) + "},{" +
ToString( vtDir) + "}," +
ToString( nId) + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entit
return bOk ;
}
@@ -490,7 +546,7 @@ MyPlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, con
EPS_SMALL, nPntCount, nCrvCount, nTmp) ;
nCount = nPntCount + nCrvCount ;
// restituisco l'identificativo della prima entità creata
// restituisco l'identificativo della prima entit creata
return nFirstId ;
}
@@ -519,7 +575,7 @@ ExePlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, co
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entit
return nFirstId ;
}
@@ -690,7 +746,7 @@ MyPlaneBoxInters( const Point3d& ptOn, const Vector3d& vtN, const BBox3d& b3Box,
nFirstId = nNewId ;
++ nSrfCount ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entit
return nFirstId ;
}
@@ -723,7 +779,7 @@ ExePlaneBoxInters( const Point3d& ptOn, const Vector3d& vtN, const BBox3d& b3Box
", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entit
return nFirstId ;
}
@@ -762,7 +818,7 @@ MyPlaneSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDes
// inserisco il risultato dell'intersezione nel DB
int nFirstId = MyAddPlaneIntersResultToGeomDB( pGeomDB, vPnt, vBpt, vTria, frSurf, frDest, nId, nDestGrpId, plPlane.GetVersN(), dToler,
nPntCount, nCrvCount, nSrfCount) ;
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entit
return nFirstId ;
}
@@ -796,7 +852,7 @@ ExePlaneSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe
", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entit
return nFirstId ;
}
@@ -885,7 +941,7 @@ ExeParPlanesSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, const DBLVEC
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entit
return nFirstId ;
}
@@ -930,7 +986,7 @@ MyPlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe
nFirstId = nNewId ;
++ nCount ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entit
return nFirstId ;
}
@@ -954,7 +1010,7 @@ ExePlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nD
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entit
return nFirstId ;
}
@@ -1048,7 +1104,7 @@ ExeCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int*
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entit
return nFirstId ;
}
@@ -1175,7 +1231,7 @@ ExeCurveSurfTmInters( const int nCrvId, const int nStmId, const int nDestGrpId,
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entit
return nFirstId ;
}
@@ -1308,7 +1364,7 @@ MySurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
const ISurfTriMesh* pStm2L = GetSurfTriMesh( Surf2Loc) ;
if ( pStm2L == nullptr)
return GDB_ID_NULL ;
// eseguo l'intersezione (già espressa nel riferimento destinazione)
// eseguo l'intersezione (gi espressa nel riferimento destinazione)
PNTVECTOR vPnt ;
BIPNTVECTOR vBpt ;
TRIA3DVECTOR vTria ;
@@ -1364,7 +1420,7 @@ MySurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
nFirstId = nNewId ;
++ nSrfCount ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entit
return nFirstId ;
}
@@ -1396,6 +1452,6 @@ ExeSurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entit
return nFirstId ;
}
BIN
View File
Binary file not shown.
+39 -6
View File
@@ -400,13 +400,13 @@ LuaCreateDiametralDimension( lua_State* L )
static int
LuaCreateAngularDimension(lua_State* L)
{
// 6 o 7 parametri : ParentId, ptP1, ptV, ptP2, ptDim, Text [, nRefType]
// 6 o 7 parametri : ParentId, ptV, ptP1, ptP2, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptP1 ;
LuaCheckParam( L, 2, ptP1) ;
Point3d ptV ;
LuaCheckParam( L, 3, ptV) ;
LuaCheckParam( L, 2, ptV) ;
Point3d ptP1 ;
LuaCheckParam( L, 3, ptP1) ;
Point3d ptP2 ;
LuaCheckParam( L, 4, ptP2) ;
Point3d ptDim ;
@@ -417,7 +417,39 @@ LuaCreateAngularDimension(lua_State* L)
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ;
// creo la quota angolare
int nId = ExeCreateAngularDimension( nParentId, ptP1, ptV, ptP2, ptDim, sText, nRefType) ;
int nId = ExeCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateAngularDimensionEx(lua_State* L)
{
// 7 o 8 parametri : ParentId, ptV1, ptP1, ptV2, ptP2, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptV1 ;
LuaCheckParam( L, 2, ptV1) ;
Point3d ptP1 ;
LuaCheckParam( L, 3, ptP1) ;
Point3d ptV2 ;
LuaCheckParam( L, 4, ptV2) ;
Point3d ptP2 ;
LuaCheckParam( L, 5, ptP2) ;
Point3d ptDim ;
LuaCheckParam( L, 6, ptDim) ;
string sText ;
LuaCheckParam( L, 7, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 8, nRefType) ;
LuaClearStack( L) ;
// creo la quota angolare
int nId = ExeCreateAngularDimensionEx( nParentId, ptV1, ptP1, ptV2, ptP2, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -497,7 +529,8 @@ LuaInstallGdbCreate( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAlignedDimension", LuaCreateAlignedDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRadialDimension", LuaCreateRadialDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDiametralDimension", LuaCreateDiametralDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension);
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionEx", LuaCreateAngularDimensionEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ;
return bOk ;
+63
View File
@@ -929,6 +929,67 @@ LuaCreateSurfBezierLeaves( lua_State* L)
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBezierTria2D( lua_State* L)
{
// 2, 3 o 4 parametri : ParentId, nId [, nTextHeight] [, bShowTrim]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSurfBzId ;
LuaCheckParam( L, 2, nSurfBzId)
int nTextHeight = 50 ;
bool bShowTrim = false ;
if ( LuaGetParam( L, 3, nTextHeight))
LuaGetParam( L, 4, bShowTrim) ;
else
LuaGetParam( L, 3, bShowTrim) ;
LuaClearStack( L) ;
// creo la superficie
int nCount = 0 ;
int nId = ExeCreateSurfBezierTria2D( nParentId, nSurfBzId, nTextHeight, bShowTrim, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateBezierSphere( lua_State* L)
{
// 3 o 4 parametri : ParentId, ptCenter, dRad [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptCenter ;
LuaCheckParam( L, 2, ptCenter)
double dRad ;
LuaCheckParam( L, 3, dRad)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 4, nRefType) ;
// creo la superficie
int nCount = 0 ;
int nId = ExeCreateBezierSphere( nParentId, ptCenter, dRad, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
@@ -967,5 +1028,7 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezier", LuaCreateSurfBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierRat", LuaCreateSurfBezierRational) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierLeaves", LuaCreateSurfBezierLeaves) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierTria2D", LuaCreateSurfBezierTria2D) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateBezierSphere", LuaCreateBezierSphere) ;
return bOk ;
}
+84 -19
View File
@@ -23,7 +23,6 @@
using namespace std ;
//----------------------------------------------------------------------------
static int
LuaInvertSurf( lua_State* L)
@@ -188,6 +187,30 @@ LuaSurfTmMoveVertex( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmMoveFacet( lua_State* L)
{
// 3 o 4 o 5 parametri : nId, nFacet, vtMove [, nRefId] [, bUpdate]
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
Vector3d vtMove ;
LuaCheckParam( L, 3, vtMove)
int nRefType = RTY_DEFAULT ;
bool bUpdate = true ;
if ( LuaGetParam( L, 4, nRefType))
LuaGetParam( L, 5, bUpdate) ;
else
LuaGetParam( L, 4, bUpdate) ;
LuaClearStack( L) ;
// sposto la faccia di indice dato della trimesh
bool bOk = ExeSurfTmMoveFacet( nId, nFacet, vtMove, nRefType, bUpdate) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmToTriangles( lua_State* L)
@@ -283,6 +306,29 @@ LuaCutSurfTmPlane( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCutSurfBzPlane( lua_State* L)
{
// 4 o 5 parametri : Id, ptOn, vtN, bSaveOnEq [, nRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptOn ;
LuaCheckParam( L, 2, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 3, vtN)
bool bSaveOnEq ;
LuaGetParam( L, 4, bSaveOnEq) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// taglio la superficie con ilpiano
bool bOk = ExeCutSurfBzPlane( nId, ptOn, vtN, bSaveOnEq, nRefType) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCutSurfTmClosedCurve( lua_State* L)
@@ -356,20 +402,6 @@ LuaSurfTmIntersect( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmResetTwoColors( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// eseguo reset TFlag per annullare due colori
bool bOk = ExeSurfTmResetTwoColors( nId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmSplit( lua_State* L)
@@ -445,18 +477,48 @@ LuaSurfTmSubtractProjectedFacesOnFace( lua_State* L)
return 4 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmResetTwoColors( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// eseguo reset TFlag per annullare due colori
bool bOk = ExeSurfTmResetTwoColors( nId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmSetShowEdges( lua_State* L)
{
// 2 parametri : Id, bShow
int nId ;
LuaCheckParam( L, 1, nId)
bool bShow ;
LuaCheckParam( L, 2, bShow) ;
LuaClearStack( L) ;
// imposto flag visualizzazione spigoli vivi
bool bOk = ExeSurfTmSetShowEdges( nId, bShow) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfBzTrim( lua_State* L)
{
// 2 parametri : nId, nCutterId
// 2 parametri : nId, nCutterId
int nId ;
LuaCheckParam( L, 1, nId)
int nCutterId ;
LuaCheckParam( L, 2, nCutterId)
LuaClearStack( L) ;
// taglio la prima superficie in base alla seconda
//bool bOk = ExeSurfTmCut( nId, nCutterId, bInVsOut, bOn) ;
// taglio la prima superficie in base alla seconda
bool bOk = ExeSurfBzTrim( nId, nCutterId) ;
LuaSetParam( L, bOk) ;
return 1 ;
@@ -476,19 +538,22 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffsetAdv", LuaSurfFrOffsetAdv) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveVertex", LuaSurfTmMoveVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveFacet", LuaSurfTmMoveFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwapFacets", LuaSurfTmSwapFacets) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemovePart", LuaSurfTmRemovePart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmPlane", LuaCutSurfTmPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfBzPlane", LuaCutSurfBzPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmClosedCurve", LuaCutSurfTmClosedCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmAdd", LuaSurfTmAdd) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtract", LuaSurfTmSubtract) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmIntersect", LuaSurfTmIntersect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSplit", LuaSurfTmSplit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCut", LuaSurfTmCut) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtractProjectedFacesOnFace", LuaSurfTmSubtractProjectedFacesOnFace) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetShowEdges", LuaSurfTmSetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzTrim", LuaSurfBzTrim) ;
return bOk ;
}
+18
View File
@@ -56,6 +56,23 @@ LuaVolZmapChangeResolution( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaVolZmapSetShowEdges( lua_State* L)
{
// 2 parametri : Id, bShow
int nId ;
LuaCheckParam( L, 1, nId)
bool bShow ;
LuaCheckParam( L, 2, bShow) ;
LuaClearStack( L) ;
// imposto flag visualizzazione spigoli vivi
bool bOk = ExeVolZmapSetShowEdges( nId, bShow) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaRemoveVolZmapPart( lua_State* L)
@@ -350,6 +367,7 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeVolume", LuaExplodeVolume) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapChangeResolution", LuaVolZmapChangeResolution) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetShowEdges", LuaVolZmapSetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdvTool", LuaVolZmapSetAdvTool) ;
+36
View File
@@ -123,6 +123,41 @@ LuaLineSurfTmInters( lua_State* L)
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaLineSurfBzInters( lua_State* L)
{
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir)
int nId ;
LuaCheckParam( L, 3, nId)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// recupero i punti di intersezione tra linea e superficie trimesh
INTDBLVECTOR vInters ;
if ( ExeLineSurfBzInters( ptP, vtDir, nId, nRefType, vInters)) {
LuaSetParam( L, true) ;
INTVECTOR vType( vInters.size()) ;
DBLVECTOR vPar( vInters.size()) ;
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
vType[i] = vInters[i].first ;
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaLineVolZmapInters( lua_State* L)
@@ -405,6 +440,7 @@ LuaInstallGeoInters( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtLineCurveInters", LuaLineCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineBoxInters", LuaLineBoxInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfTmInters", LuaLineSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfBzInters", LuaLineSurfBzInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineVolZmapInters", LuaLineVolZmapInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneCurveInters", LuaPlaneCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneBoxInters", LuaPlaneBoxInters) ;