Compare commits

...

27 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
Dario Sassi 6c640b902f EgtExecuter :
- aggiunta funzione Exe/Lua CreateSurfTmTransSwept.
2024-02-27 18:18:52 +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
Dario Sassi 308e50549d EgtExecutor :
- aggiunta funzione Exe e Lua CurveSurfTmInters
- filtri su intersezioni portati in GeomKernel.
2024-02-26 15:09:35 +01:00
Daniele Bariletti 5f2c538ab8 EgtExecutor :
- correzione della chiamata di conversione da bezier a trimesh in caso di con bezier nulla.
2024-02-21 15:37:35 +01:00
SaraP 8e85070df1 EgtExecutor :
- modifiche a  AdjustLayerForSideAngle per gestire la creazione della regione anche nel caso di raccordi in tangenza.
2024-02-20 15:53:59 +01:00
Daniele Bariletti 95ec7a83ef EgtExecutor :
- aggiunta funzione per tagliare una superficie bezier con un piano.
2024-02-20 12:30:43 +01:00
Dario Sassi ed1ba0543b EgtExecutor 2.6b4 :
- aggiunta funzioni Exe e Lua Set/GetViewOrizzOffsStep
- aggiunte funzioni Lua EgtGetView e EgtGetGenericView.
2024-02-19 14:52:24 +01:00
Dario Sassi 26544984ad EgtExecutor 2.6b3 :
- adattamenti per modifiche a funzioni Collision Detection.
2024-02-16 08:46:02 +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
Dario Sassi e06dd65888 EgtExecutor 2.6b2 :
- a ApproxCurve e ProjectCurveOnSurfTm aggiunto parametro dMaxSegmLen.
2024-02-13 14:35:43 +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
Dario Sassi d9cfc375a9 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2024-02-05 19:58:31 +01:00
Dario Sassi cce5e6ae76 EgtExecutor 2.6b1 :
- modifiche a ExePocketing per accettare percorso piano e chiuso oltre che regione piana.
2024-02-05 19:56:31 +01:00
Daniele Bariletti 407ca752ab Merge branch 'ExtDimension_angular' 2024-02-05 15:55:46 +01:00
20 changed files with 1135 additions and 283 deletions
+19 -15
View File
@@ -49,7 +49,7 @@ MyCDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, int nSurfTmI
// porto in locale alla superficie il riferimento del box (il vettore è già in questo stesso riferimento) // porto in locale alla superficie il riferimento del box (il vettore è già in questo stesso riferimento)
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frSurf) ; Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frSurf) ;
// verifico la collisione // verifico la collisione
return ( CDeBoxClosedSurfTm( frBoxL, vtDiag, dSafeDist, *pStm) ? 1 : 0) ; return ( CDeBoxClosedSurfTm( frBoxL, vtDiag, *pStm, dSafeDist) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -69,7 +69,7 @@ MyCDeBoxVolZmap( const Frame3d& frBox, const Vector3d& vtDiag, int nZmapId, doub
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento) // porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frLoc) ; Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frLoc) ;
// verifico la collisione // verifico la collisione
return ( pVZM->AvoidBox( frBoxL, vtDiag, dSafeDist, false) ? 0 : 1) ; return ( pVZM->CDeBox( frBoxL, vtDiag, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -118,7 +118,7 @@ MyCDeRectPrismoidClosedSurfTm( const Frame3d& frPrismoid, double dBaseLenX, doub
// porto in locale alla superficie il riferimento del prismoide rettangolare // porto in locale alla superficie il riferimento del prismoide rettangolare
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frSurf) ; Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frSurf) ;
// verifico la collisione // verifico la collisione
return ( CDeRectPrismoidClosedSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, *pStm) ? 1 : 0) ; return ( CDeRectPrismoidClosedSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, *pStm, dSafeDist) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -140,7 +140,7 @@ MyCDeRectPrismoidVolZmap( const Frame3d& frPrismoid, double dBaseLenX, double dB
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento) // porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frLoc) ; Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frLoc) ;
// verifico la collisione // verifico la collisione
return ( pVZM->AvoidRectPrismoid( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, false) ? 0 : 1) ; return ( pVZM->CDeRectPrismoid( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -193,7 +193,7 @@ MyCDeCylClosedSurfTm( const Frame3d& frCyl, double dR, double dH, int nSurfTmId,
// porto in locale alla superficie il riferimento del cilindro // porto in locale alla superficie il riferimento del cilindro
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frSurf) ; Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frSurf) ;
// verifico la collisione // verifico la collisione
return ( CDeCylClosedSurfTm( frCylL, dR, dH, dSafeDist, *pStm) ? 1 : 0) ; return ( CDeCylClosedSurfTm( frCylL, dR, dH, *pStm, dSafeDist) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -213,7 +213,7 @@ MyCDeCylVolZmap( const Frame3d& frCyl, double dR, double dH, int nZmapId, double
// porto in locale il riferimento // porto in locale il riferimento
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frLoc) ; Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frLoc) ;
// verifico la collisione // verifico la collisione
return ( pVZM->AvoidCylinder( frCylL, dR, dH, dSafeDist, false) ? 0 : 1) ; return ( pVZM->CDeCylinder( frCylL, dR, dH, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -261,7 +261,7 @@ MyCDeConeClosedSurfTm( const Frame3d& frCone, double dR1, double dR2, double dH,
// porto in locale alla superficie il riferimento del cilindro // porto in locale alla superficie il riferimento del cilindro
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frSurf) ; Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frSurf) ;
// verifico la collisione // verifico la collisione
return ( CDeConeFrustumClosedSurfTm( frConeL, dR1, dR2, dH, dSafeDist, *pStm) ? 1 : 0) ; return ( CDeConeFrustumClosedSurfTm( frConeL, dR1, dR2, dH, *pStm, dSafeDist) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -281,7 +281,7 @@ MyCDeConeVolZmap( const Frame3d& frCone, double dR1, double dR2, double dH, int
// porto in locale il riferimento // porto in locale il riferimento
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frLoc) ; Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frLoc) ;
// verifico la collisione // verifico la collisione
return ( pVZM->AvoidConeFrustum( frConeL, dR1, dR2, dH, dSafeDist, false) ? 0 : 1) ; return ( pVZM->CDeConeFrustum( frConeL, dR1, dR2, dH, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -330,7 +330,7 @@ MyCDeSpheClosedSurfTm( const Point3d& ptCen, double dR, int nSurfTmId, double dS
// porto in locale alla superficie il centro della sfera // porto in locale alla superficie il centro della sfera
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ; Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ;
// verifico la collisione // verifico la collisione
return ( CDeSpheClosedSurfTm( ptCenL, dR, dSafeDist, *pStm) ? 1 : 0) ; return ( CDeSpheClosedSurfTm( ptCenL, dR, *pStm, dSafeDist) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -350,7 +350,7 @@ MyCDeSpheVolZmap( const Point3d& ptCen, double dRad, int nZmapId, double dSafeDi
// porto in locale il centro della sfera // porto in locale il centro della sfera
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ; Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
// verifico la collisione // verifico la collisione
return ( pVZM->AvoidSphere( ptCenL, dRad, dSafeDist, false) ? 0 : 1) ; return ( pVZM->CDeSphere( ptCenL, dRad, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -420,7 +420,7 @@ MyCDeClosedSurfTmVolZmap( int nSurfTmId, int nZmapId, double dSafeDist)
if ( pVZM == nullptr) if ( pVZM == nullptr)
return -1 ; return -1 ;
// verifico la collisione // verifico la collisione
return ( pVZM->AvoidSurfTm( *pStm, dSafeDist, false) ? 0 : 1) ; return ( pVZM->CDeSurfTm( *pStm, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -429,10 +429,14 @@ ExeCDeSolidSolid( int nSolid1Id, int nSolid2Id, double dSafeDist)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ; int nRes = -1 ;
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH) if ( pGeomDB != nullptr) {
nRes = MyCDeClosedSurfTmClosedSurfTm( nSolid1Id, nSolid2Id, dSafeDist) ; if ( pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
else if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == VOL_ZMAP) nRes = MyCDeClosedSurfTmClosedSurfTm( nSolid1Id, nSolid2Id, dSafeDist) ;
nRes = MyCDeClosedSurfTmVolZmap( nSolid1Id, nSolid2Id, dSafeDist) ; else if ( pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == VOL_ZMAP)
nRes = MyCDeClosedSurfTmVolZmap( nSolid1Id, nSolid2Id, dSafeDist) ;
else if ( pGeomDB->GetGeoType( nSolid1Id) == VOL_ZMAP && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
nRes = MyCDeClosedSurfTmVolZmap( nSolid2Id, nSolid1Id, dSafeDist) ;
}
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtCDeSolidSolid({" + IdToString( nSolid1Id) + "," + string sLua = "EgtCDeSolidSolid({" + IdToString( nSolid1Id) + "," +
+60 -4
View File
@@ -583,7 +583,7 @@ ExeCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int 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) const Point3d& ptDim, const string& sText, int nRefType)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
@@ -603,7 +603,7 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptV
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ; PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) || if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim ) || ! MySetDimensionStyle( pDim ) ||
! pDim->SetAngular( ptP1L, ptVL, ptP2L, ptDimL, vtNL, sText)) ! pDim->SetAngular( ptVL, ptP1L, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// inserisco la quota nel DB // inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ; return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
@@ -611,11 +611,11 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptV
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
int 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) const Point3d& ptDim, const string& sText, int nRefType)
{ {
// eseguo // eseguo
int nId = MyCreateAngularDimension( nParentId, ptP1, ptV, ptP2, ptDim, sText, nRefType) ; int nId = MyCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -633,6 +633,62 @@ ExeCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& pt
return nId ; return nId ;
} }
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
const Point3d& ptV2,const Point3d& ptP2, const Point3d& ptDim,
const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// porto in locale i punti e assegno i versori
Point3d ptV1L = GetPointLocal( pGeomDB, ptV1, nRefType, frLoc) ;
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
Point3d ptV2L = GetPointLocal( pGeomDB, ptV2, nRefType, frLoc) ;
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim ) ||
! pDim->SetAngularEx( ptV1L, ptP1L, ptV2L, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
const Point3d& ptV2, const Point3d& ptP2, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimensionEx( nParentId, ptV1, ptP1, ptV2, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimensionEx(" + IdToString( nParentId) + ",{" +
ToString( ptV1) + "},{" +
ToString( ptP1) + "},{" +
ToString( ptV2) + "},{" +
ToString( ptP2) + "},{" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Point3d& ptDim, MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Point3d& ptDim,
+142 -1
View File
@@ -33,6 +33,8 @@
#include "/EgtDev/Include/EGkCurveLocal.h" #include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkExtText.h" #include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EGkSbzStandard.h"
using namespace std ; using namespace std ;
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
@@ -1286,6 +1288,43 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, d
return nNewId ; return nNewId ;
} }
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmTransSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, double dLinTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// recupero la 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
ISurfTriMesh* pSTM = nullptr ;
pSTM = ( bOk ? GetSurfTriMeshTransSwept( CrvSect, CrvGuide, bCapEnds, dLinTol) : nullptr) ;
// inserisco la superficie trimesh nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmTransSwept(" + IdToString( nParentId) + "," +
ToString( nSectId) + "," +
ToString( nGuideId) + "," +
( bCapEnds ? "true" : "false") + "," +
ToString( dLinTol) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
int int
ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType, double dLinTol) ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType, double dLinTol)
@@ -1536,7 +1575,7 @@ ExeCreateSurfTmBySurfBezier( int nParentId, int nSbezId)
PtrOwner<ISurfTriMesh> pStm( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ; PtrOwner<ISurfTriMesh> pStm( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ;
bOk = bOk && ! IsNull( pStm) ; bOk = bOk && ! IsNull( pStm) ;
// la porto nel riferimento destinazione // la porto nel riferimento destinazione
pStm->LocToLoc( frSou, frLoc) ; bOk = bOk && pStm->LocToLoc( frSou, frLoc) ;
// inserisco la superficie trimesh nel DB // inserisco la superficie trimesh nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ; int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
ExeSetModified() ; ExeSetModified() ;
@@ -1638,6 +1677,8 @@ ExeCreateSurfBezier( int nParentId, int nDegU, int nDegV, int nSpanU, int nSpanV
if ( ! pSurfBez->SetControlPoint( i, ptCtrl)) if ( ! pSurfBez->SetControlPoint( i, ptCtrl))
bOk = false ; bOk = false ;
} }
// calcolo eventuali poli
pSurfBez->CalcPoles() ;
// se superficie nulla (ovvero ridotta a punto), errore // se superficie nulla (ovvero ridotta a punto), errore
bOk = bOk && ! pSurfBez->IsAPoint() ; bOk = bOk && ! pSurfBez->IsAPoint() ;
// inserisco la superficie nel DB // inserisco la superficie nel DB
@@ -1690,6 +1731,8 @@ ExeCreateSurfBezierRational( int nParentId, int nDegU, int nDegV, int nSpanU, in
if ( ! pSurfBez->SetControlPoint( i, ptCtrl, vPntW[i].second)) if ( ! pSurfBez->SetControlPoint( i, ptCtrl, vPntW[i].second))
bOk = false ; bOk = false ;
} }
// calcolo eventuali poli
pSurfBez->CalcPoles() ;
// se superficie nulla (ovvero ridotta a punto), errore // se superficie nulla (ovvero ridotta a punto), errore
bOk = bOk && ! pSurfBez->IsAPoint() ; bOk = bOk && ! pSurfBez->IsAPoint() ;
// inserisco la superficie nel DB // inserisco la superficie nel DB
@@ -1782,3 +1825,101 @@ ExeCreateSurfBezierLeaves( int nParentId, int nSurfBzId, int nTextHeight, bool b
*pnCount = nCount ; *pnCount = nCount ;
return nFirstId ; 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 ;
}
+28 -17
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2023-2023 // EgalTech 2023-2024
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : Exe_GdbGetPocketing.cpp Data : 28.11.23 Versione : 2.5k6 // File : Exe_GdbGetPocketing.cpp Data : 02.02.24 Versione : 2.6b1
// Contenuto : Funzioni di interrogazione di regioni piane del DBG per EXE. // Contenuto : Funzioni di interrogazione di regioni piane del DBG per EXE.
// //
// //
@@ -16,6 +16,7 @@
#include "EXE.h" #include "EXE.h"
#include "EXE_Macro.h" #include "EXE_Macro.h"
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkCalcPocketing.h" #include "/EgtDev/Include/EGkCalcPocketing.h"
using namespace std ; using namespace std ;
@@ -25,14 +26,26 @@ bool
ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId, ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId,
int& nFirstId, int& nCrvCount) int& nFirstId, int& nCrvCount)
{ {
// databse geometrico // database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) ; VERIFY_GEOMDB( pGeomDB, false) ;
// recupero la FlatRegion per i percorsi // recupero la FlatRegion da svuotare
PtrOwner<ISurfFlatRegion> pMySfr ;
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ; const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pSfr == nullptr) if ( pSfr == nullptr) {
return false ; // verifico se è una curva chiusa e piana che permette di definire una regione
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
Plane3d plPlane ;
if ( pCrv == nullptr || ! pCrv->IsFlat( plPlane, true, 10 * EPS_SMALL))
return false ;
SurfFlatRegionByContours SfrCntr ;
SfrCntr.AddCurve( pCrv->Clone()) ;
pMySfr.Set( SfrCntr.GetSurf()) ;
if ( IsNull( pMySfr))
return false ;
pSfr = pMySfr ;
}
// recupero il suo frame // recupero il suo frame
Frame3d frSfr ; Frame3d frSfr ;
@@ -44,23 +57,21 @@ ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest)) if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return false ; return false ;
// costruzione vettori di curve per Pocketing
ICRVCOMPOPOVECTOR vCrvCompoRes ;
// eseguo Pocketing // eseguo Pocketing
ICRVCOMPOPOVECTOR vCrvCompoRes ;
bool bOk = CalcPocketing( pSfr, dRad, dStep, dAngle, nType, bSmooth, vCrvCompoRes) ; bool bOk = CalcPocketing( pSfr, dRad, dStep, dAngle, nType, bSmooth, vCrvCompoRes) ;
nFirstId = GDB_ID_NULL ; // primo Id da restituire nFirstId = GDB_ID_NULL ;
nCrvCount = int( vCrvCompoRes.size()) ; nCrvCount = int( vCrvCompoRes.size()) ;
if ( bOk && int( vCrvCompoRes.size()) > 0) { if ( bOk && nCrvCount > 0) {
// scorro le curve di Pocketing ottenute // scorro le curve di Pocketing ottenute
for ( int u = 0 ; u < int( vCrvCompoRes.size()) ; ++ u) { for ( int nI = 0 ; nI < nCrvCount ; ++ nI) {
vCrvCompoRes[u]->LocToLoc( frSfr, frDest) ; vCrvCompoRes[nI]->LocToLoc( frSfr, frDest) ;
// inserisco la curva nel DB Geometrico // inserisco la curva nel DB Geometrico
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrvCompoRes[u])) ; int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrvCompoRes[nI])) ;
if ( nCurrId == GDB_ID_NULL) if ( nCurrId == GDB_ID_NULL)
return false ; return false ;
if ( u == 0) if ( nI == 0)
nFirstId = nCurrId ; // memorizzo il primo Id da restituire nFirstId = nCurrId ;
} }
ExeSetModified() ; ExeSetModified() ;
} }
@@ -73,7 +84,7 @@ ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType
ToString( nType) + "," + ToString( nType) + "," +
ToString( bSmooth) + "," + ToString( bSmooth) + "," +
ToString( nDestGrpId) + ")" + ToString( nDestGrpId) + ")" +
" -- Ok=" + ToString( bOk) + " FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCrvCount) ; " FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCrvCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
return bOk ; return bOk ;
+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 // richiedo i contorni della superficie e li inserisco nel DB
int nFirstId = GDB_ID_NULL ; int nFirstId = GDB_ID_NULL ;
int nCount = 0 ; int nCount = 0 ;
int nL = 0 ; ICRVCOMPOPOVECTOR vCC ;
PtrOwner<ICurve> pCrv( bOk ? pSbz->GetLoop( nL) : nullptr) ; pSbz->GetLoops( vCC , true) ;
while ( ! IsNull( pCrv)) { for ( int i = 0 ; i < int( vCC.size()) ; ++i) {
// porto la curva nel riferimento destinazione if ( IsNull( vCC[i]) || ! vCC[i]->IsValid())
bOk = bOk && pCrv->LocToLoc( frSurf, frDest) ; continue ;
// la inserisco nel DB geometrico // porto la curva nel riferimento destinazione
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCrv)) : GDB_ID_NULL) ; 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) ; bOk = bOk && ( nNewId != GDB_ID_NULL) ;
// copio il materiale // copio il materiale
if ( ! pGeomDB->CopyMaterial( nId, nNewId)) if ( ! pGeomDB->CopyMaterial( nId, nNewId))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// aggiorno contatori // aggiorno contatori
if ( bOk && nFirstId == GDB_ID_NULL) if ( bOk && nFirstId == GDB_ID_NULL)
nFirstId = nNewId ; nFirstId = nNewId ;
if ( bOk) if ( bOk)
++ nCount ; ++ nCount ;
// passo alla prossima curva
pCrv.Set( bOk ? pSbz->GetLoop( ++nL) : nullptr) ;
} }
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -1493,4 +1494,4 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
if ( pnCount != nullptr) if ( pnCount != nullptr)
*pnCount = nCount ; *pnCount = nCount ;
return nFirstId ; return nFirstId ;
} }
+10 -6
View File
@@ -186,7 +186,7 @@ ExeCurveMedialAxis( int nId)
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
ExeApproxCurve( int nId, int nApprType, double dLinTol) ExeApproxCurve( int nId, int nApprType, double dLinTol, double dMaxSegmLen)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -200,7 +200,8 @@ ExeApproxCurve( int nId, int nApprType, double dLinTol)
nApprType == APP_LEFT_LINES || nApprType == APP_LEFT_CONVEX_LINES || nApprType == APP_LEFT_LINES || nApprType == APP_LEFT_CONVEX_LINES ||
nApprType == APP_RIGHT_LINES || nApprType == APP_RIGHT_CONVEX_LINES) { nApprType == APP_RIGHT_LINES || nApprType == APP_RIGHT_CONVEX_LINES) {
PolyLine PL ; PolyLine PL ;
bOk = bOk && pCurve->ApproxWithLines( dLinTol, ANG_TOL_MAX_DEG, nApprType, PL) && pCC->FromPolyLine( PL) ; bOk = bOk && pCurve->ApproxWithLines( dLinTol, ANG_TOL_MAX_DEG, nApprType, PL) &&
PL.AdjustForMaxSegmentLen( dMaxSegmLen) && pCC->FromPolyLine( PL) ;
// eliminazione di small Z // eliminazione di small Z
bOk = bOk && pCC->RemoveSmallDefects( 0.5 * dLinTol, ANG_TOL_STD_DEG) ; bOk = bOk && pCC->RemoveSmallDefects( 0.5 * dLinTol, ANG_TOL_STD_DEG) ;
} }
@@ -2270,7 +2271,8 @@ ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static bool static bool
MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId, double dLinTol, int nRefType) MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId,
double dLinTol, double dMaxSegmLen, int nRefType)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
@@ -2301,7 +2303,7 @@ MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int
vtDirL.LocToLoc( frCrv, frStm) ; vtDirL.LocToLoc( frCrv, frStm) ;
// eseguo la proiezione // eseguo la proiezione
PNT5AXVECTOR vPt5ax ; PNT5AXVECTOR vPt5ax ;
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, vtDirL, dLinTol, vPt5ax)) if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, vtDirL, dLinTol, dMaxSegmLen, vPt5ax))
return false ; return false ;
// inserisco la composita nel gruppo destinazione // inserisco la composita nel gruppo destinazione
PtrOwner<ICurveComposite> pCompo ; PtrOwner<ICurveComposite> pCompo ;
@@ -2338,9 +2340,10 @@ MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
ExeProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId, double dLinTol, int nRefType) ExeProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId,
double dLinTol, double dMaxSegmLen, int nRefType)
{ {
bool bOk = MyProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, nRefType) ; bool bOk = MyProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, nRefType) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -2349,6 +2352,7 @@ ExeProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int
ToString( vtDir) + "}," + ToString( vtDir) + "}," +
ToString( nDestGrpId) + "," + ToString( nDestGrpId) + "," +
ToString( dLinTol) + "," + ToString( dLinTol) + "," +
ToString( dMaxSegmLen) + "," +
RefTypeToString( nRefType) + ")" + RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
+133 -32
View File
@@ -77,7 +77,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero il numero di componenti connesse // recupero il numero di componenti connesse
int nParts = pStm->GetPartCount() ; int nParts = pStm->GetPartCount() ;
// se ci sono pi parti, separo queste // se ci sono più parti, separo queste
if ( nParts > 1) { if ( nParts > 1) {
int nFirstId = GDB_ID_NULL ; int nFirstId = GDB_ID_NULL ;
nCount = 0 ; nCount = 0 ;
@@ -104,7 +104,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
} }
// recupero il numero di facce // recupero il numero di facce
int nFacets = pStm->GetFacetCount() ; int nFacets = pStm->GetFacetCount() ;
// se ci sono pi facce, separo queste // se ci sono più facce, separo queste
if ( nFacets > 1) { if ( nFacets > 1) {
// copio tutte le facce // copio tutte le facce
int nFirstId = GDB_ID_NULL ; int nFirstId = GDB_ID_NULL ;
@@ -130,7 +130,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
// restituisco risultati // restituisco risultati
return nFirstId ; return nFirstId ;
} }
// non devo fare alcunch // non devo fare alcunché
nCount = 1 ; nCount = 1 ;
return nId ; return nId ;
} }
@@ -147,7 +147,7 @@ MyExplodeSurfFlatRegion( int nId, int& nCount)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero il numero di componenti connessi (chunk) // recupero il numero di componenti connessi (chunk)
int nChunk = pSfr->GetChunkCount() ; int nChunk = pSfr->GetChunkCount() ;
// se c' un solo componente, non devo fare alcunch // se c'è un solo componente, non devo fare alcunché
if ( nChunk == 1) { if ( nChunk == 1) {
nCount = 1 ; nCount = 1 ;
return nId ; return nId ;
@@ -296,7 +296,7 @@ ExeSurfFrSubtract( int nId1, int nId2)
bOk = bOk && ( pSfr2L != nullptr) ; bOk = bOk && ( pSfr2L != nullptr) ;
// eseguo la sottrazione della seconda superficie dalla prima // eseguo la sottrazione della seconda superficie dalla prima
bOk = bOk && pSfr1->Subtract( *pSfr2L) ; bOk = bOk && pSfr1->Subtract( *pSfr2L) ;
// se il risultato vuoto, cancello la FlatRegion // se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr1->IsValid()) if ( bOk && ! pSfr1->IsValid())
pGeomDB->Erase( nId1) ; pGeomDB->Erase( nId1) ;
ExeSetModified() ; ExeSetModified() ;
@@ -328,7 +328,7 @@ ExeSurfFrIntersect( int nId1, int nId2)
bOk = bOk && ( pSfr2L != nullptr) ; bOk = bOk && ( pSfr2L != nullptr) ;
// eseguo l'intersezione tra le due superfici // eseguo l'intersezione tra le due superfici
bOk = bOk && pSfr1->Intersect( *pSfr2L) ; bOk = bOk && pSfr1->Intersect( *pSfr2L) ;
// se il risultato vuoto, cancello la FlatRegion // se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr1->IsValid()) if ( bOk && ! pSfr1->IsValid())
pGeomDB->Erase( nId1) ; pGeomDB->Erase( nId1) ;
ExeSetModified() ; ExeSetModified() ;
@@ -353,7 +353,7 @@ ExeSurfFrOffset( int nId, double dDist, int nType)
bool bOk = ( pSfr != nullptr) ; bool bOk = ( pSfr != nullptr) ;
// eseguo l'offset // eseguo l'offset
bOk = bOk && pSfr->Offset( dDist, nType) ; bOk = bOk && pSfr->Offset( dDist, nType) ;
// se il risultato vuoto, cancello la FlatRegion // se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr->IsValid()) if ( bOk && ! pSfr->IsValid())
pGeomDB->Erase( nId) ; pGeomDB->Erase( nId) ;
ExeSetModified() ; ExeSetModified() ;
@@ -443,11 +443,11 @@ bool
ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType, bool bUpdate) ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType, bool bUpdate)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie // recupero la superficie
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ; ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ; bool bOk = ( pStm != nullptr) ;
// recupero il riferimento in cui immersa la superficie // recupero il riferimento in cui è immersa la superficie
Frame3d frStm ; Frame3d frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ; bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
// eseguo la modifica // eseguo la modifica
@@ -475,6 +475,50 @@ ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType,
return bOk ; return bOk ;
} }
//-------------------------------------------------------------------------------
bool
ExeSurfTmMoveFacet( int nId, int nFacet, const Vector3d& vtMove, int nRefType, bool bUpdate)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero il riferimento in cui è immersa la superficie
Frame3d frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
// porto in locale il movimento
Vector3d vtMoveL = GetVectorLocal( pGeomDB, vtMove, nRefType, frStm) ;
// recupero tutti i vertici della faccia
INTVECTOR vVert ;
bOk = bOk && pStm->GetAllVertInFacet( nFacet, vVert) ;
// sposto tutti i vertici della faccia della quantità desiderata
if ( bOk) {
for ( const auto nVert : vVert) {
// recupero la posizione originale del vertice
Point3d ptV ;
if ( pStm->GetVertex( nVert, ptV))
pStm->MoveVertex( nVert, ptV + vtMoveL) ;
}
}
// se richiesto, semplificazione della trimesh
if ( bUpdate)
bOk = bOk && pStm->DoCompacting() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmMoveFacet(" + IdToString( nId) + "," +
ToString( nFacet) + ",{" +
ToString( vtMove) + "}," +
RefTypeToString( nRefType) + "," +
( bUpdate ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
MySurfTmToTriangles( int nId, int& nCount) MySurfTmToTriangles( int nId, int& nCount)
@@ -487,7 +531,7 @@ MySurfTmToTriangles( int nId, int& nCount)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero il numero di triangoli // recupero il numero di triangoli
int nTria = pStm->GetTriangleCount() ; int nTria = pStm->GetTriangleCount() ;
// se ci sono pi triangoli, li separo // se ci sono più triangoli, li separo
if ( nTria > 1) { if ( nTria > 1) {
// copio tutti triangoli // copio tutti triangoli
int nFirstId = GDB_ID_NULL ; int nFirstId = GDB_ID_NULL ;
@@ -513,7 +557,7 @@ MySurfTmToTriangles( int nId, int& nCount)
// restituisco risultati // restituisco risultati
return nFirstId ; return nFirstId ;
} }
// non devo fare alcunch // non devo fare alcunché
nCount = 1 ; nCount = 1 ;
return nId ; return nId ;
} }
@@ -648,6 +692,41 @@ ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSave
return bOk ; return bOk ;
} }
//-------------------------------------------------------------------------------
bool
ExeCutSurfBzPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSaveOnEq, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pSbz != nullptr) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale il punto e la normale del piano
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
// calcolo il piano di taglio
Plane3d plPlane ;
bOk = bOk && plPlane.Set( ptOnL, vtNL) ;
// eseguo il taglio
bOk = bOk && pSbz->Cut( plPlane, bSaveOnEq) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCutSurfBzPlane(" + IdToString( nId) + ",{" +
ToString( ptOn) + "},{" +
ToString( vtN) + "}," +
( bSaveOnEq ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq) ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq)
@@ -784,27 +863,6 @@ ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors)
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
bool
ExeSurfTmResetTwoColors( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// reset dei flag sui triangoli per i due colori
bOk = bOk && pStm->ResetTFlags() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmResetTwoColors(" + ToString( nId) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static ISurfTriMesh* static ISurfTriMesh*
MyCreateSubSurfTm( const ISurfTriMesh* pStm, const INTVECTOR& vTria, const INTVECTOR& vTria2) MyCreateSubSurfTm( const ISurfTriMesh* pStm, const INTVECTOR& vTria, const INTVECTOR& vTria2)
@@ -1016,6 +1074,49 @@ ExeSurfTmSubtractProjectedFacesOnFace( int nSurfId, int nFaceInd, int nDestGrpId
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
bool
ExeSurfTmResetTwoColors( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// reset dei flag sui triangoli per i due colori
bOk = bOk && pStm->ResetTFlags() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmResetTwoColors(" + ToString( nId) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
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 static bool
+25 -3
View File
@@ -104,10 +104,9 @@ ExeVolZmapChangeResolution( int nId, int nNewRes)
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap // recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ; IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
if ( pVZM == nullptr) bool bOk = ( pVZM != nullptr) ;
return false ;
// cambio la risoluzione (rapporto Voxel/Dexel, valori ammessi 1 e 2) // cambio la risoluzione (rapporto Voxel/Dexel, valori ammessi 1 e 2)
bool bOk = pVZM->ChangeResolution( nNewRes) ; bOk = bOk && pVZM->ChangeResolution( nNewRes) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -120,6 +119,29 @@ ExeVolZmapChangeResolution( int nId, int nNewRes)
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
bool
ExeVolZmapSetShowEdges( int nId, bool bShow)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pVZM != nullptr) ;
// imposto lo stato di visualizzazione degli spigoli vivi
if ( bOk)
pVZM->SetShowEdges( bShow) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapSetShowEdges(" + ToString( nId) + "," +
ToString( bShow) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
ExeRemoveVolZmapPart( int nId, int nPart) ExeRemoveVolZmapPart( int nId, int nPart)
+226 -150
View File
@@ -29,13 +29,17 @@
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h" #include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDev/Include/EGkSurfLocal.h" #include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkVolZmap.h" #include "/EgtDev/Include/EGkVolZmap.h"
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkIntersLineBox.h" #include "/EgtDev/Include/EGkIntersLineBox.h"
#include "/EgtDev/Include/EGkIntersPlaneBox.h"
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
#include "/EgtDev/Include/EGkIntersSurfTmSurfTm.h"
#include "/EgtDev/Include/EGkIntersLinePlane.h" #include "/EgtDev/Include/EGkIntersLinePlane.h"
#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"
#include "/EgtDev/Include/EGkIntersCurveSurfTm.h"
#include "/EgtDev/Include/EGkIntersSurfTmSurfTm.h"
#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EgtNumUtils.h" #include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EgtPointerOwner.h"
@@ -67,7 +71,7 @@ MyLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, const int nId, con
if ( ! CrvLoc->GetLocalBBox( b3Crv)) if ( ! CrvLoc->GetLocalBBox( b3Crv))
return false ; return false ;
b3Crv.Expand( 100 * EPS_SMALL) ; 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 dLen = 2 * floor( b3Crv.MaxDistFromPoint( ptP)) ;
double dOffs = -dLen / 2 ; double dOffs = -dLen / 2 ;
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ; PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
@@ -157,7 +161,7 @@ ExeLineBoxInters( const Point3d& ptP, const Vector3d& vtDir, const BBox3d& b3Box
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della prima nuova entità // restituisco l'identificativo della prima nuova entit
return bOk ; return bOk ;
} }
@@ -190,63 +194,9 @@ MyLineSurfTmInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRef
ILSIVECTOR vInfo ; ILSIVECTOR vInfo ;
if ( ! IntersLineSurfTm( ptPL, vtDirL, dLen, *pStm, vInfo, false)) if ( ! IntersLineSurfTm( ptPL, vtDirL, dLen, *pStm, vInfo, false))
return false ; return false ;
// ciclo sulle intersezioni
for ( const auto& Info : vInfo) { // filtro le intersezioni
// se intersezione puntuale FilterLineSurfTmInters( vInfo, vInters) ;
if ( Info.nILTT == ILTT_VERT || Info.nILTT == ILTT_EDGE || Info.nILTT == ILTT_IN) {
int nFlag = SLT_TOUCH ;
if ( Info.dCosDN > EPS_ZERO)
nFlag = SLT_OUT ;
else if ( Info.dCosDN < -EPS_ZERO)
nFlag = SLT_IN ;
vInters.emplace_back( nFlag, Info.dU) ;
}
// se altrimenti intersezione con coincidenza
else if ( Info.nILTT == ILTT_SEGM || Info.nILTT == ILTT_SEGM_ON_EDGE) {
vInters.emplace_back( SLT_TG_INI, Info.dU) ;
vInters.emplace_back( SLT_TG_FIN, Info.dU2) ;
}
}
// elimino intersezioni ripetute
for ( size_t j = 1 ; j < vInters.size() ; ) {
// intersezione precedente
size_t i = j - 1 ;
// se hanno lo stesso parametro
if ( abs( vInters[i].second - vInters[j].second) < EPS_SMALL) {
// se sono entrambe entranti o uscenti, elimino la seconda
if ( ( vInters[i].first == SLT_IN && vInters[j].first == SLT_IN) ||
( vInters[i].first == SLT_OUT && vInters[j].first == SLT_OUT)) {
vInters.erase( vInters.begin() + j) ;
continue ;
}
// se una entrante e l'altra uscente, cambio in touch ed elimino la seconda
else if ( ( vInters[i].first == SLT_IN && vInters[j].first == SLT_OUT) ||
( vInters[i].first == SLT_OUT && vInters[j].first == SLT_IN)) {
vInters[i].first = SLT_TOUCH ;
vInters.erase( vInters.begin() + j) ;
continue ;
}
// se una puntuale e l'altra inizio di coincidenza, elimino la prima
else if ( ( vInters[i].first == SLT_IN || vInters[i].first == SLT_OUT || vInters[i].first == SLT_TOUCH) && vInters[j].first == SLT_TG_INI) {
vInters.erase( vInters.begin() + i) ;
continue ;
}
// se una fine di coincidenza e l'altra puntuale, elimino la seconda
else if ( vInters[i].first == SLT_TG_FIN && ( vInters[j].first == SLT_IN || vInters[j].first == SLT_OUT || vInters[j].first == SLT_TOUCH)) {
vInters.erase( vInters.begin() + j) ;
continue ;
}
// se una fine di coincidenza e l'altra inizio di coincidenza, elimino entrambe
else if ( i > 0 && vInters[i].first == SLT_TG_FIN && vInters[j].first == SLT_TG_INI) {
vInters.erase( vInters.begin() + j) ;
vInters.erase( vInters.begin() + i) ;
-- j ;
continue ;
}
}
// passo alla successiva
++ j ;
}
return true ; return true ;
} }
@@ -254,26 +204,82 @@ MyLineSurfTmInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRef
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
ExeLineSurfTmInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType, 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) ; bool bOk = MyLineSurfTmInters( ptP, vtDir, nId, nRefType, vInters) ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtLineSurfTmInters({" + ToString( ptP) + "},{" + string sLua = "EgtLineSurfTmInters({" + ToString( ptP) + "},{" +
ToString( vtDir) + "}," + ToString( vtDir) + "}," +
ToString( nId) + "," + ToString( nId) + "," +
RefTypeToString( nRefType) + ")" + RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della prima nuova entità // restituisco l'identificativo della prima nuova entit
return bOk ; return bOk ;
} }
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static bool static bool
MyLineVolZmapInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType, INTDBLVECTOR& vInters) 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) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entit
return bOk ;
}
//-------------------------------------------------------------------------------
static bool
MyLineVolZmapInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
INTDBLVECTOR& vInters)
{ {
vInters.clear() ; vInters.clear() ;
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
@@ -290,78 +296,21 @@ MyLineVolZmapInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRe
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frZmap) ; Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frZmap) ;
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frZmap) ; Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frZmap) ;
vtDirL.Normalize() ; vtDirL.Normalize() ;
// calcolo l'ingombro dello Zmap
BBox3d b3Surf ;
if ( ! pVZM->GetLocalBBox( b3Surf))
return false ;
// calcolo l'intersezione // calcolo l'intersezione
ILZIVECTOR vInfo ; ILZIVECTOR vInfo ;
if ( ! pVZM->GetLineIntersection( ptPL, vtDirL, vInfo)) if ( ! IntersLineVolZmap( ptPL, vtDirL, *pVZM, vInfo))
return false ; return false ;
// ciclo sulle intersezioni
for ( const auto& Info : vInfo) { // filtro le intersezioni
// se intersezione puntuale FilterLineVolZmapInters( vInfo, vInters) ;
if ( Info.nILTT == ILTT_VERT || Info.nILTT == ILTT_EDGE || Info.nILTT == ILTT_IN) {
int nFlag = SLT_TOUCH ;
if ( vtDirL * Info.trTria.GetN() > EPS_ZERO)
nFlag = SLT_OUT ;
else if ( vtDirL * Info.trTria.GetN() < -EPS_ZERO)
nFlag = SLT_IN ;
vInters.emplace_back( nFlag, Info.dU) ;
}
// se altrimenti intersezione con coincidenza
else if ( Info.nILTT == ILTT_SEGM || Info.nILTT == ILTT_SEGM_ON_EDGE) {
vInters.emplace_back( SLT_TG_INI, Info.dU) ;
vInters.emplace_back( SLT_TG_FIN, Info.dU2) ;
}
}
// elimino intersezioni ripetute
for ( size_t j = 1 ; j < vInters.size() ; ) {
// intersezione precedente
size_t i = j - 1 ;
// se hanno lo stesso parametro
if ( abs( vInters[i].second - vInters[j].second) < EPS_SMALL) {
// se sono entrambe entranti o uscenti, elimino la seconda
if ( ( vInters[i].first == SLT_IN && vInters[j].first == SLT_IN) ||
( vInters[i].first == SLT_OUT && vInters[j].first == SLT_OUT)) {
vInters.erase( vInters.begin() + j) ;
continue ;
}
// se una entrante e l'altra uscente, cambio in touch ed elimino la seconda
else if ( ( vInters[i].first == SLT_IN && vInters[j].first == SLT_OUT) ||
( vInters[i].first == SLT_OUT && vInters[j].first == SLT_IN)) {
vInters[i].first = SLT_TOUCH ;
vInters.erase( vInters.begin() + j) ;
continue ;
}
// se una puntuale e l'altra inizio di coincidenza, elimino la prima
else if ( ( vInters[i].first == SLT_IN || vInters[i].first == SLT_OUT || vInters[i].first == SLT_TOUCH) && vInters[j].first == SLT_TG_INI) {
vInters.erase( vInters.begin() + i) ;
continue ;
}
// se una fine di coincidenza e l'altra puntuale, elimino la seconda
else if ( vInters[i].first == SLT_TG_FIN && ( vInters[j].first == SLT_IN || vInters[j].first == SLT_OUT || vInters[j].first == SLT_TOUCH)) {
vInters.erase( vInters.begin() + j) ;
continue ;
}
// se una fine di coincidenza e l'altra inizio di coincidenza, elimino entrambe
else if ( i > 0 && vInters[i].first == SLT_TG_FIN && vInters[j].first == SLT_TG_INI) {
vInters.erase( vInters.begin() + j) ;
vInters.erase( vInters.begin() + i) ;
-- j ;
continue ;
}
}
// passo alla successiva
++ j ;
}
return true ; return true ;
} }
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
ExeLineVolZmapInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType, INTDBLVECTOR& vInters) ExeLineVolZmapInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
INTDBLVECTOR& vInters)
{ {
// eseguo // eseguo
bool bOk = MyLineVolZmapInters( ptP, vtDir, nId, nRefType, vInters) ; bool bOk = MyLineVolZmapInters( ptP, vtDir, nId, nRefType, vInters) ;
@@ -597,7 +546,7 @@ MyPlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, con
EPS_SMALL, nPntCount, nCrvCount, nTmp) ; EPS_SMALL, nPntCount, nCrvCount, nTmp) ;
nCount = nPntCount + nCrvCount ; nCount = nPntCount + nCrvCount ;
// restituisco l'identificativo della prima entità creata // restituisco l'identificativo della prima entit creata
return nFirstId ; return nFirstId ;
} }
@@ -626,7 +575,7 @@ ExePlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, co
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della prima nuova entità // restituisco l'identificativo della prima nuova entit
return nFirstId ; return nFirstId ;
} }
@@ -797,7 +746,7 @@ MyPlaneBoxInters( const Point3d& ptOn, const Vector3d& vtN, const BBox3d& b3Box,
nFirstId = nNewId ; nFirstId = nNewId ;
++ nSrfCount ; ++ nSrfCount ;
} }
// restituisco l'identificativo della prima nuova entità // restituisco l'identificativo della prima nuova entit
return nFirstId ; return nFirstId ;
} }
@@ -830,7 +779,7 @@ ExePlaneBoxInters( const Point3d& ptOn, const Vector3d& vtN, const BBox3d& b3Box
", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ; ", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della prima nuova entità // restituisco l'identificativo della prima nuova entit
return nFirstId ; return nFirstId ;
} }
@@ -869,7 +818,7 @@ MyPlaneSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDes
// inserisco il risultato dell'intersezione nel DB // inserisco il risultato dell'intersezione nel DB
int nFirstId = MyAddPlaneIntersResultToGeomDB( pGeomDB, vPnt, vBpt, vTria, frSurf, frDest, nId, nDestGrpId, plPlane.GetVersN(), dToler, int nFirstId = MyAddPlaneIntersResultToGeomDB( pGeomDB, vPnt, vBpt, vTria, frSurf, frDest, nId, nDestGrpId, plPlane.GetVersN(), dToler,
nPntCount, nCrvCount, nSrfCount) ; nPntCount, nCrvCount, nSrfCount) ;
// restituisco l'identificativo della prima nuova entità // restituisco l'identificativo della prima nuova entit
return nFirstId ; return nFirstId ;
} }
@@ -903,7 +852,7 @@ ExePlaneSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe
", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ; ", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della prima nuova entità // restituisco l'identificativo della prima nuova entit
return nFirstId ; return nFirstId ;
} }
@@ -992,7 +941,7 @@ ExeParPlanesSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, const DBLVEC
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della prima nuova entità // restituisco l'identificativo della prima nuova entit
return nFirstId ; return nFirstId ;
} }
@@ -1020,7 +969,7 @@ MyPlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe
// recupero lo Zmap e calcolo l'intersezione // recupero lo Zmap e calcolo l'intersezione
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ; IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
ICURVEPOVECTOR vpLoop ; ICURVEPOVECTOR vpLoop ;
if ( pVZM == nullptr || ! pVZM->GetPlaneIntersection( plPlane, vpLoop)) if ( pVZM == nullptr || ! IntersPlaneVolZmap( plPlane, *pVZM, vpLoop))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// inserisco le curve nel gruppo destinazione // inserisco le curve nel gruppo destinazione
int nFirstId = GDB_ID_NULL ; int nFirstId = GDB_ID_NULL ;
@@ -1037,7 +986,7 @@ MyPlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe
nFirstId = nNewId ; nFirstId = nNewId ;
++ nCount ; ++ nCount ;
} }
// restituisco l'identificativo della prima nuova entità // restituisco l'identificativo della prima nuova entit
return nFirstId ; return nFirstId ;
} }
@@ -1061,7 +1010,7 @@ ExePlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nD
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ; " -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della prima nuova entità // restituisco l'identificativo della prima nuova entit
return nFirstId ; return nFirstId ;
} }
@@ -1155,7 +1104,134 @@ ExeCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int*
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della prima nuova entità // restituisco l'identificativo della prima nuova entit
return nFirstId ;
}
//-------------------------------------------------------------------------------
static string
GetCurveSurfTmIntersType( int nFlag)
{
switch ( nFlag) {
case CSIT_OUT_IN : return "OUT->IN" ;
case CSIT_IN_OUT : return "IN->OUT" ;
case CSIT_IN_IN : return "IN->IN" ;
case CSIT_OUT_OUT : return "OUT->OUT" ;
case CSIT_IN_ON : return "IN->ON" ;
case CSIT_ON_IN : return "ON->IN" ;
case CSIT_OUT_ON : return "OUT->ON" ;
case CSIT_ON_OUT : return "ON->OUT" ;
}
return "NONE" ;
}
//-------------------------------------------------------------------------------
static int
MyCurveSurfTmInters( const int nCrvId, const int nId2, const int nDestGrpId, int& nPntCount, int& nCrvCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
int nFirstId = GDB_ID_NULL ;
// recupero il riferimento del gruppo di destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return GDB_ID_NULL ;
// recupero la curva e la superficie in locale al gruppo destinazione
CurveLocal CrvLoc( pGeomDB, nCrvId, frDest) ;
const ICurve* pCrv = GetCurve( CrvLoc) ;
if ( pCrv == nullptr)
return GDB_ID_NULL ;
SurfLocal StmLoc( pGeomDB, nId2, frDest) ;
const ISurfTriMesh* pStm = GetSurfTriMesh( StmLoc) ;
if ( pStm == nullptr)
return GDB_ID_NULL ;
// intersezione filtrata tra la curva e la superficie locali
INTDBLVECTOR vInters ;
if ( ! IntersCurveSurfTmExt( *pCrv, *pStm, 10 * EPS_SMALL, vInters))
return GDB_ID_NULL ;
// recupero i punti e le curve risultanti
for ( int i = 0 ; i < int( vInters.size()) ; i++) {
// verifico se punto
if ( vInters[i].first == CSIT_OUT_IN || vInters[i].first == CSIT_IN_OUT ||
vInters[i].first == CSIT_IN_IN || vInters[i].first == CSIT_OUT_OUT || vInters[i].first == CSIT_NONE) {
PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ;
if ( IsNull( pGeoPnt))
return GDB_ID_NULL ;
Point3d ptP ;
pCrv->GetPointD1D2( vInters[i].second, ICurve::FROM_MINUS, ptP) ;
pGeoPnt->Set( ptP) ;
// lo inserisco nel DB geometrico
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoPnt)) ;
if ( nNewId == GDB_ID_NULL)
return GDB_ID_NULL ;
// aggiorno parametri
if ( nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
++ nPntCount ;
// assegno info di tipo
pGeomDB->SetInfo( nNewId, "CSI", GetCurveSurfTmIntersType( vInters[i].first) +
" (" + ToString( vInters[i].second) + ")") ;
}
// altrimenti dovrebbe essere sovrapposizione
else {
// indice di inizio
int h = ( i > 0 ? i - 1 : int( vInters.size()) - 1) ;
// verifico se sovrapposizione
if ( ( vInters[h].first == CSIT_IN_ON || vInters[h].first == CSIT_OUT_ON) &&
( vInters[i].first == CSIT_ON_IN || vInters[i].first == CSIT_ON_OUT)) {
PtrOwner<ICurve> pCrvRes( pCrv->CopyParamRange( vInters[h].second, vInters[i].second)) ;
if ( IsNull( pCrvRes))
return GDB_ID_NULL ;
// lo inserisco nel DB geometrico
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCrvRes)) ;
if ( nNewId == GDB_ID_NULL)
return GDB_ID_NULL ;
// aggiorno parametri
if ( nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
++ nCrvCount ;
// assegno info di tipo
pGeomDB->SetInfo( nNewId, "CSI_INI", GetCurveSurfTmIntersType( vInters[h].first) +
" (" + ToString( vInters[h].second) + ")") ;
pGeomDB->SetInfo( nNewId, "CSI_FIN", GetCurveSurfTmIntersType( vInters[i].first) +
" (" + ToString( vInters[i].second) + ")") ;
}
}
}
return nFirstId ;
}
//-------------------------------------------------------------------------------
int
ExeCurveSurfTmInters( const int nCrvId, const int nStmId, const int nDestGrpId, int* pnPntCount, int* pnCrvCount)
{
// eseguo
int nPntCount{ 0}, nCrvCount{ 0} ;
int nFirstId = MyCurveSurfTmInters( nCrvId, nStmId, nDestGrpId, nPntCount, nCrvCount) ;
// aggiorno contatori
if ( nFirstId != GDB_ID_NULL) {
if ( pnPntCount != nullptr)
*pnPntCount = nPntCount ;
if ( pnCrvCount != nullptr)
*pnCrvCount = nCrvCount ;
ExeSetModified() ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCurveSurfTmInters(" + ToString( nCrvId) + "," +
ToString( nStmId) + "," +
ToString( nDestGrpId) + ")" +
" -- Id=" + ToString( nFirstId) + ", nPntCnt=" + ToString( nPntCount) + ", nCrvCnt=" + ToString( nCrvCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entit
return nFirstId ; return nFirstId ;
} }
@@ -1288,7 +1364,7 @@ MySurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
const ISurfTriMesh* pStm2L = GetSurfTriMesh( Surf2Loc) ; const ISurfTriMesh* pStm2L = GetSurfTriMesh( Surf2Loc) ;
if ( pStm2L == nullptr) if ( pStm2L == nullptr)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// eseguo l'intersezione (già espressa nel riferimento destinazione) // eseguo l'intersezione (gi espressa nel riferimento destinazione)
PNTVECTOR vPnt ; PNTVECTOR vPnt ;
BIPNTVECTOR vBpt ; BIPNTVECTOR vBpt ;
TRIA3DVECTOR vTria ; TRIA3DVECTOR vTria ;
@@ -1344,7 +1420,7 @@ MySurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
nFirstId = nNewId ; nFirstId = nNewId ;
++ nSrfCount ; ++ nSrfCount ;
} }
// restituisco l'identificativo della prima nuova entità // restituisco l'identificativo della prima nuova entit
return nFirstId ; return nFirstId ;
} }
@@ -1376,6 +1452,6 @@ ExeSurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ; ", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della prima nuova entità // restituisco l'identificativo della prima nuova entit
return nFirstId ; return nFirstId ;
} }
+77 -9
View File
@@ -1613,6 +1613,50 @@ ExeCalcFlatPartUpRegion( int nPartId, bool bCalc)
return true ; return true ;
} }
//----------------------------------------------------------------------------
static bool
IgnoreOutlineFillet( IGeomDB* pGeomDB, int nCrvId, int nLayId)
{
// verifico se la curva nCrvId è un raccordo che deve essere ignorato, ovvero se si tratta di un arco non inclinato, in tangenza
// e consecutivo ad almeno un lato inclinato
// verifico se arco
if ( pGeomDB->GetGeoType( nCrvId) == CRV_ARC) {
// verifico se non inclinato
double dSideAng = 0, dSideAng2 = 0 ;
pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) ;
pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) ;
if ( abs( dSideAng) < EPS_ANG_SMALL && abs( dSideAng2) < EPS_ANG_SMALL) {
// verifico se in tangenza con curve consecutive
double dPrevAng = ANG_RIGHT, dNextAng = ANG_RIGHT ;
pGeomDB->GetInfo( nCrvId, MCH_KEY_PREVANG, dPrevAng) ;
pGeomDB->GetInfo( nCrvId, MCH_KEY_NEXTANG, dNextAng) ;
if ( abs( dPrevAng) < EPS_ANG_SMALL && abs( dNextAng) < EPS_ANG_SMALL) {
// verifico se è inclinata almeno una tra la curva precedente e quella successiva
int nPrevId = pGeomDB->GetPrev( nCrvId) ;
if ( nPrevId == GDB_ID_NULL)
nPrevId = pGeomDB->GetLastInGroup( nLayId) ;
if ( nPrevId == GDB_ID_NULL)
return false ;
double dSideAng, dSideAng2 ;
if ( ( pGeomDB->GetInfo( nPrevId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) ||
( pGeomDB->GetInfo( nPrevId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL))
return true ;
int nNextId = pGeomDB->GetNext( nCrvId) ;
if ( nNextId == GDB_ID_NULL)
nNextId = pGeomDB->GetFirstInGroup( nLayId) ;
if ( nNextId == GDB_ID_NULL)
return false ;
if ( ( pGeomDB->GetInfo( nNextId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) ||
( pGeomDB->GetInfo( nNextId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL))
return true ;
}
}
}
return false ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static bool static bool
AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOrig, int nLayReg, double dH) AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOrig, int nLayReg, double dH)
@@ -1683,7 +1727,8 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ; ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
if ( pCrv == nullptr) if ( pCrv == nullptr)
return false ; return false ;
pCrv->SimpleOffset( dCalcOffset) ; if ( ! pCrv->SimpleOffset( dCalcOffset))
pGeomDB->Erase( nNewId) ;
} }
else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) { else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) {
double dOffset2 = 0 ; double dOffset2 = 0 ;
@@ -1696,8 +1741,12 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ; ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
if ( pCrv == nullptr) if ( pCrv == nullptr)
return false ; return false ;
pCrv->SimpleOffset( dCalcOffset) ; if ( ! pCrv->SimpleOffset( dCalcOffset))
pGeomDB->Erase( nNewId) ;
} }
// verifico se raccordo da ignorare per poter calcolare la regione
else if ( IgnoreOutlineFillet( pGeomDB, nCrvId, nLayId))
pGeomDB->Erase( nNewId) ;
} }
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole) // aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
if ( ! AdjustLayerCurves( pGeomDB, nTmpLayId)) if ( ! AdjustLayerCurves( pGeomDB, nTmpLayId))
@@ -1720,7 +1769,7 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
if ( nNewId == GDB_ID_NULL) if ( nNewId == GDB_ID_NULL)
return false ; return false ;
// determino ed eseguo offset // determino ed eseguo offset
double dSideAng ; double dSideAng, dSideAng2 ;
if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) { if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) {
double dOffset = 0 ; double dOffset = 0 ;
pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET, dOffset) ; pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET, dOffset) ;
@@ -1728,8 +1777,22 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ; ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
if ( pCrv == nullptr) if ( pCrv == nullptr)
return false ; return false ;
pCrv->SimpleOffset( dCalcOffset) ; if ( ! pCrv->SimpleOffset( dCalcOffset))
pGeomDB->Erase( nNewId) ;
} }
else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) {
double dOffset2 = 0 ;
pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET2, dOffset2) ;
double dCalcOffset = dOffset2 ;
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
if ( pCrv == nullptr)
return false ;
if ( ! pCrv->SimpleOffset( dCalcOffset))
pGeomDB->Erase( nNewId) ;
}
// verifico se raccordo da ignorare per poter calcolare la regione
else if ( IgnoreOutlineFillet( pGeomDB, nCrvId, nLayId))
pGeomDB->Erase( nNewId) ;
} }
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole) // aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
if ( ! AdjustLayerCurves( pGeomDB, nTmpLay2Id)) if ( ! AdjustLayerCurves( pGeomDB, nTmpLay2Id))
@@ -1769,10 +1832,13 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
//if ( dStartProD > EPS_SMALL) //if ( dStartProD > EPS_SMALL)
// pCrv->ExtendStartByLen( dStartProD) ; // pCrv->ExtendStartByLen( dStartProD) ;
double dStartProMin = min( dStartProD, dStartProU) ; double dStartProMin = min( dStartProD, dStartProU) ;
if ( dStartProMin < - EPS_SMALL) if ( dStartProMin < - EPS_SMALL) {
pCrv->TrimStartAtLen( - dStartProMin) ; pCrv->TrimStartAtLen( - dStartProMin) ;
if ( abs( dStartProD - dStartProU) > EPS_SMALL) if ( abs( dStartProD - dStartProU) > EPS_SMALL)
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, abs( dStartProD - dStartProU)) ; pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, abs( dStartProD - dStartProU)) ;
}
else
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, max( dStartProD, dStartProU)) ;
} }
else { else {
if ( dStartProD < - EPS_SMALL) if ( dStartProD < - EPS_SMALL)
@@ -1799,9 +1865,11 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
double dLen ; double dLen ;
pCrv->GetLength( dLen) ; pCrv->GetLength( dLen) ;
pCrv->TrimEndAtLen( dLen + dEndProMin) ; pCrv->TrimEndAtLen( dLen + dEndProMin) ;
if ( abs( dEndProD - dEndProU) > EPS_SMALL)
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, abs( dEndProD - dEndProU)) ;
} }
if ( abs( dEndProD - dEndProU) > EPS_SMALL) else
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, abs( dEndProD - dEndProU)) ; pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, max( dEndProD, dEndProU)) ;
} }
else { else {
if ( dEndProD < - EPS_SMALL) { if ( dEndProD < - EPS_SMALL) {
+22
View File
@@ -640,6 +640,15 @@ ExeZoomWin( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
return true ; return true ;
} }
//-----------------------------------------------------------------------------
bool
ExeSetViewOrizzOffsStep( int nDirOffsStep)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
return pScene->SetCameraDirOrizzOffset( nDirOffsStep) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSetView( int nDir, bool bRedraw) ExeSetView( int nDir, bool bRedraw)
@@ -709,6 +718,19 @@ ExeRotateView( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
return true ; return true ;
} }
//-----------------------------------------------------------------------------
bool
ExeGetViewOrizzOffsStep( int* pnDirOffsStep)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// recupero offset direzione di vista
if ( pnDirOffsStep == nullptr)
return false ;
*pnDirOffsStep = pScene->GetCameraDirOrizzOffset() ;
return true ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeGetView( int* pnDir) ExeGetView( int* pnDir)
BIN
View File
Binary file not shown.
+39 -6
View File
@@ -400,13 +400,13 @@ LuaCreateDiametralDimension( lua_State* L )
static int static int
LuaCreateAngularDimension(lua_State* L) LuaCreateAngularDimension(lua_State* L)
{ {
// 6 o 7 parametri : ParentId, ptP1, ptV, ptP2, ptDim, Text [, nRefType] // 6 o 7 parametri : ParentId, ptV, ptP1, ptP2, ptDim, Text [, nRefType]
int nParentId ; int nParentId ;
LuaCheckParam( L, 1, nParentId) LuaCheckParam( L, 1, nParentId)
Point3d ptP1 ;
LuaCheckParam( L, 2, ptP1) ;
Point3d ptV ; Point3d ptV ;
LuaCheckParam( L, 3, ptV) ; LuaCheckParam( L, 2, ptV) ;
Point3d ptP1 ;
LuaCheckParam( L, 3, ptP1) ;
Point3d ptP2 ; Point3d ptP2 ;
LuaCheckParam( L, 4, ptP2) ; LuaCheckParam( L, 4, ptP2) ;
Point3d ptDim ; Point3d ptDim ;
@@ -417,7 +417,39 @@ LuaCreateAngularDimension(lua_State* L)
LuaGetParam( L, 7, nRefType) ; LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// creo la quota angolare // creo la quota angolare
int nId = ExeCreateAngularDimension( nParentId, 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 // restituisco il risultato
if ( nId != GDB_ID_NULL) if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ; LuaSetParam( L, nId) ;
@@ -497,7 +529,8 @@ LuaInstallGdbCreate( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAlignedDimension", LuaCreateAlignedDimension) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAlignedDimension", LuaCreateAlignedDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRadialDimension", LuaCreateRadialDimension) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRadialDimension", LuaCreateRadialDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDiametralDimension", LuaCreateDiametralDimension) ; bOk = bOk && luaMgr.RegisterFunction( "EgtDiametralDimension", LuaCreateDiametralDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension); bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionEx", LuaCreateAngularDimensionEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ;
return bOk ; return bOk ;
+90
View File
@@ -682,6 +682,32 @@ LuaCreateSurfTmSwept( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmTransSwept( lua_State* L)
{
// 4 o 5 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSectId ;
LuaCheckParam( L, 2, nSectId)
int nGuideId ;
LuaCheckParam( L, 3, nGuideId)
bool bCapEnds ;
LuaCheckParam( L, 4, bCapEnds)
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 5, dLinTol) ;
LuaClearStack( L) ;
// creo STM swept di traslazione
int nId = ExeCreateSurfTmTransSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaCreateSurfTmRuled( lua_State* L) LuaCreateSurfTmRuled( lua_State* L)
@@ -903,6 +929,67 @@ LuaCreateSurfBezierLeaves( lua_State* L)
return 2 ; return 2 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBezierTria2D( lua_State* L)
{
// 2, 3 o 4 parametri : ParentId, nId [, nTextHeight] [, bShowTrim]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSurfBzId ;
LuaCheckParam( L, 2, nSurfBzId)
int nTextHeight = 50 ;
bool bShowTrim = false ;
if ( LuaGetParam( L, 3, nTextHeight))
LuaGetParam( L, 4, bShowTrim) ;
else
LuaGetParam( L, 3, bShowTrim) ;
LuaClearStack( L) ;
// creo la superficie
int nCount = 0 ;
int nId = ExeCreateSurfBezierTria2D( nParentId, nSurfBzId, nTextHeight, bShowTrim, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateBezierSphere( lua_State* L)
{
// 3 o 4 parametri : ParentId, ptCenter, dRad [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptCenter ;
LuaCheckParam( L, 2, ptCenter)
double dRad ;
LuaCheckParam( L, 3, dRad)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 4, nRefType) ;
// creo la superficie
int nCount = 0 ;
int nId = ExeCreateBezierSphere( nParentId, ptCenter, dRad, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallGdbCreateSurf( LuaMgr& luaMgr) LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
@@ -932,6 +1019,7 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByScrewing", LuaCreateSurfTmByScrewing) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByScrewing", LuaCreateSurfTmByScrewing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectSwept", LuaCreateSurfTmRectSwept) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectSwept", LuaCreateSurfTmRectSwept) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwept", LuaCreateSurfTmSwept) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwept", LuaCreateSurfTmSwept) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTransSwept", LuaCreateSurfTmTransSwept) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRuled", LuaCreateSurfTmRuled) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRuled", LuaCreateSurfTmRuled) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ;
@@ -940,5 +1028,7 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezier", LuaCreateSurfBezier) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezier", LuaCreateSurfBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierRat", LuaCreateSurfBezierRational) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierRat", LuaCreateSurfBezierRational) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierLeaves", LuaCreateSurfBezierLeaves) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierLeaves", LuaCreateSurfBezierLeaves) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierTria2D", LuaCreateSurfBezierTria2D) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateBezierSphere", LuaCreateBezierSphere) ;
return bOk ; return bOk ;
} }
+1 -1
View File
@@ -21,7 +21,7 @@ using namespace std ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaPocketing( lua_State* L) { LuaPocketing( lua_State* L) {
// 7 parametri : vId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId // 7 parametri : nId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId
int nId ; int nId ;
LuaCheckParam( L, 1, nId) ; LuaCheckParam( L, 1, nId) ;
double dRad ; double dRad ;
+11 -7
View File
@@ -105,16 +105,18 @@ LuaCurveMedialAxis( lua_State* L)
static int static int
LuaApproxCurve( lua_State* L) LuaApproxCurve( lua_State* L)
{ {
// 2 o 3 parametri : Id, nApprType [, dLinTol] // 2 o 3 o 4 parametri : Id, nApprType [, dLinTol [, dMaxSegmLen]]
int nId ; int nId ;
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, nId)
int nApprType ; int nApprType ;
LuaCheckParam( L, 2, nApprType) LuaCheckParam( L, 2, nApprType)
double dLinTol = 0.01 ; double dLinTol = 0.01 ;
LuaGetParam( L, 3, dLinTol) ; double dMaxSegmLen = INFINITO ;
if ( LuaGetParam( L, 3, dLinTol))
LuaGetParam( L, 4, dMaxSegmLen) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// approssimazione della curva con rette // approssimazione della curva con rette
bool bOk = ExeApproxCurve( nId, nApprType, dLinTol) ; bool bOk = ExeApproxCurve( nId, nApprType, dLinTol, dMaxSegmLen) ;
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
} }
@@ -951,7 +953,7 @@ LuaReorderCurvesInGroup( lua_State* L)
static int static int
LuaProjectCurveOnSurfTm( lua_State* L) LuaProjectCurveOnSurfTm( lua_State* L)
{ {
// 4, 5 o 6 parametri : nCurveId, nSurfTmId, vtDir, nDestGrpId [, dLinTol [, nRefType]] // 4, 5, 6 o 7 parametri : nCurveId, nSurfTmId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, nRefType]]
int nCurveId ; int nCurveId ;
LuaCheckParam( L, 1, nCurveId) LuaCheckParam( L, 1, nCurveId)
int nSurfTmId ; int nSurfTmId ;
@@ -961,12 +963,14 @@ LuaProjectCurveOnSurfTm( lua_State* L)
int nDestGrpId ; int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) LuaCheckParam( L, 4, nDestGrpId)
double dLinTol = 0.01 ; double dLinTol = 0.01 ;
double dMaxSegmLen = INFINITO ;
int nRefType = RTY_DEFAULT ; int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 5, dLinTol)) if ( LuaGetParam( L, 5, dLinTol) &&
LuaGetParam( L, 6, nRefType) ; LuaGetParam( L, 6, dMaxSegmLen))
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// proietto la curva su una trimesh secondo la direzione data // proietto la curva su una trimesh secondo la direzione data
bool bOk = ExeProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, nRefType) ; bool bOk = ExeProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, nRefType) ;
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
} }
+84 -19
View File
@@ -23,7 +23,6 @@
using namespace std ; using namespace std ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaInvertSurf( lua_State* L) LuaInvertSurf( lua_State* L)
@@ -188,6 +187,30 @@ LuaSurfTmMoveVertex( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaSurfTmMoveFacet( lua_State* L)
{
// 3 o 4 o 5 parametri : nId, nFacet, vtMove [, nRefId] [, bUpdate]
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
Vector3d vtMove ;
LuaCheckParam( L, 3, vtMove)
int nRefType = RTY_DEFAULT ;
bool bUpdate = true ;
if ( LuaGetParam( L, 4, nRefType))
LuaGetParam( L, 5, bUpdate) ;
else
LuaGetParam( L, 4, bUpdate) ;
LuaClearStack( L) ;
// sposto la faccia di indice dato della trimesh
bool bOk = ExeSurfTmMoveFacet( nId, nFacet, vtMove, nRefType, bUpdate) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfTmToTriangles( lua_State* L) LuaSurfTmToTriangles( lua_State* L)
@@ -283,6 +306,29 @@ LuaCutSurfTmPlane( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaCutSurfBzPlane( lua_State* L)
{
// 4 o 5 parametri : Id, ptOn, vtN, bSaveOnEq [, nRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptOn ;
LuaCheckParam( L, 2, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 3, vtN)
bool bSaveOnEq ;
LuaGetParam( L, 4, bSaveOnEq) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// taglio la superficie con ilpiano
bool bOk = ExeCutSurfBzPlane( nId, ptOn, vtN, bSaveOnEq, nRefType) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaCutSurfTmClosedCurve( lua_State* L) LuaCutSurfTmClosedCurve( lua_State* L)
@@ -356,20 +402,6 @@ LuaSurfTmIntersect( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaSurfTmResetTwoColors( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// eseguo reset TFlag per annullare due colori
bool bOk = ExeSurfTmResetTwoColors( nId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaSurfTmSplit( lua_State* L) LuaSurfTmSplit( lua_State* L)
@@ -445,18 +477,48 @@ LuaSurfTmSubtractProjectedFacesOnFace( lua_State* L)
return 4 ; 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 static int
LuaSurfBzTrim( lua_State* L) LuaSurfBzTrim( lua_State* L)
{ {
// 2 parametri : nId, nCutterId // 2 parametri : nId, nCutterId
int nId ; int nId ;
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, nId)
int nCutterId ; int nCutterId ;
LuaCheckParam( L, 2, nCutterId) LuaCheckParam( L, 2, nCutterId)
LuaClearStack( L) ; LuaClearStack( L) ;
// taglio la prima superficie in base alla seconda // taglio la prima superficie in base alla seconda
//bool bOk = ExeSurfTmCut( nId, nCutterId, bInVsOut, bOn) ;
bool bOk = ExeSurfBzTrim( nId, nCutterId) ; bool bOk = ExeSurfBzTrim( nId, nCutterId) ;
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -476,19 +538,22 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffsetAdv", LuaSurfFrOffsetAdv) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffsetAdv", LuaSurfFrOffsetAdv) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveVertex", LuaSurfTmMoveVertex) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveVertex", LuaSurfTmMoveVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveFacet", LuaSurfTmMoveFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwapFacets", LuaSurfTmSwapFacets) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwapFacets", LuaSurfTmSwapFacets) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemovePart", LuaSurfTmRemovePart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemovePart", LuaSurfTmRemovePart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmPlane", LuaCutSurfTmPlane) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmPlane", LuaCutSurfTmPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfBzPlane", LuaCutSurfBzPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmClosedCurve", LuaCutSurfTmClosedCurve) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmClosedCurve", LuaCutSurfTmClosedCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmAdd", LuaSurfTmAdd) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmAdd", LuaSurfTmAdd) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtract", LuaSurfTmSubtract) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtract", LuaSurfTmSubtract) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmIntersect", LuaSurfTmIntersect) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmIntersect", LuaSurfTmIntersect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSplit", LuaSurfTmSplit) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSplit", LuaSurfTmSplit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCut", LuaSurfTmCut) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCut", LuaSurfTmCut) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtractProjectedFacesOnFace", LuaSurfTmSubtractProjectedFacesOnFace) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtractProjectedFacesOnFace", LuaSurfTmSubtractProjectedFacesOnFace) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetShowEdges", LuaSurfTmSetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzTrim", LuaSurfBzTrim) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzTrim", LuaSurfBzTrim) ;
return bOk ; return bOk ;
} }
+18
View File
@@ -56,6 +56,23 @@ LuaVolZmapChangeResolution( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaVolZmapSetShowEdges( lua_State* L)
{
// 2 parametri : Id, bShow
int nId ;
LuaCheckParam( L, 1, nId)
bool bShow ;
LuaCheckParam( L, 2, bShow) ;
LuaClearStack( L) ;
// imposto flag visualizzazione spigoli vivi
bool bOk = ExeVolZmapSetShowEdges( nId, bShow) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaRemoveVolZmapPart( lua_State* L) LuaRemoveVolZmapPart( lua_State* L)
@@ -350,6 +367,7 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
bool bOk = ( &luaMgr != nullptr) ; bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeVolume", LuaExplodeVolume) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeVolume", LuaExplodeVolume) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapChangeResolution", LuaVolZmapChangeResolution) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapChangeResolution", LuaVolZmapChangeResolution) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetShowEdges", LuaVolZmapSetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdvTool", LuaVolZmapSetAdvTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdvTool", LuaVolZmapSetAdvTool) ;
+63
View File
@@ -123,6 +123,41 @@ LuaLineSurfTmInters( lua_State* L)
return 3 ; return 3 ;
} }
//----------------------------------------------------------------------------
static int
LuaLineSurfBzInters( lua_State* L)
{
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir)
int nId ;
LuaCheckParam( L, 3, nId)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// recupero i punti di intersezione tra linea e superficie trimesh
INTDBLVECTOR vInters ;
if ( ExeLineSurfBzInters( ptP, vtDir, nId, nRefType, vInters)) {
LuaSetParam( L, true) ;
INTVECTOR vType( vInters.size()) ;
DBLVECTOR vPar( vInters.size()) ;
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
vType[i] = vInters[i].first ;
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaLineVolZmapInters( lua_State* L) LuaLineVolZmapInters( lua_State* L)
@@ -341,6 +376,32 @@ LuaCurveCurveInters( lua_State* L)
return 3 ; return 3 ;
} }
//----------------------------------------------------------------------------
static int
LuaCurveSurfTmInters( lua_State* L)
{
// 3 parametri : nCrvId, nStmId, nDestGrpId
int nCrvId ;
LuaCheckParam( L, 1, nCrvId)
int nStmId ;
LuaCheckParam( L, 2, nStmId)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nNewId = ExeCurveSurfTmInters( nCrvId, nStmId, nDestGrpId, &nPntCount, &nCrvCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
return 3 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfTmSurfTmInters( lua_State* L) LuaSurfTmSurfTmInters( lua_State* L)
@@ -379,6 +440,7 @@ LuaInstallGeoInters( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtLineCurveInters", LuaLineCurveInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtLineCurveInters", LuaLineCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineBoxInters", LuaLineBoxInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtLineBoxInters", LuaLineBoxInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfTmInters", LuaLineSurfTmInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfTmInters", LuaLineSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfBzInters", LuaLineSurfBzInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineVolZmapInters", LuaLineVolZmapInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtLineVolZmapInters", LuaLineVolZmapInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneCurveInters", LuaPlaneCurveInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneCurveInters", LuaPlaneCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneBoxInters", LuaPlaneBoxInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneBoxInters", LuaPlaneBoxInters) ;
@@ -386,6 +448,7 @@ LuaInstallGeoInters( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtParPlanesSurfTmInters", LuaParPlanesSurfTmInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtParPlanesSurfTmInters", LuaParPlanesSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneVolZmapInters", LuaPlaneVolZmapInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneVolZmapInters", LuaPlaneVolZmapInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCurveInters", LuaCurveCurveInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCurveInters", LuaCurveCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSurfTmInters", LuaCurveSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
return bOk ; return bOk ;
} }
+73
View File
@@ -175,6 +175,21 @@ LuaZoomObject( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaSetViewOrizzOffsStep( lua_State* L)
{
// 1 parametro : nDirOffsStep
int nDirOffsStep ;
LuaCheckParam( L, 1, nDirOffsStep)
LuaClearStack( L) ;
// imposto offset angolare orizzontale a step di 90° per direzione di vista
bool bOk = ExeSetViewOrizzOffsStep( nDirOffsStep) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaSetView( lua_State* L) LuaSetView( lua_State* L)
@@ -228,6 +243,60 @@ LuaSetViewCenter( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaGetViewOrizzOffsStep( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero offset angolare orizzontale a step di 90° per direzione di vista
int nDirOffsStep ;
bool bOk = ExeGetViewOrizzOffsStep( &nDirOffsStep) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nDirOffsStep) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetView( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero direzione di vista
int nViewDir ;
bool bOk = ExeGetView( &nViewDir) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nViewDir) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetGenericView( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero angoli della direzione di vista
double dAngVertDeg ;
double dAngHorizDeg ;
bool bOk = ExeGetGenericView( &dAngVertDeg, &dAngHorizDeg) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, dAngVertDeg) ;
LuaSetParam( L, dAngHorizDeg) ;
}
else
LuaSetParam( L) ;
return 2 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaGetImage( lua_State* L) LuaGetImage( lua_State* L)
@@ -267,9 +336,13 @@ LuaInstallScene( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomRadius", LuaZoomRadius) ; bOk = bOk && luaMgr.RegisterFunction( "EgtZoomRadius", LuaZoomRadius) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtZoom", LuaZoom) ; bOk = bOk && luaMgr.RegisterFunction( "EgtZoom", LuaZoom) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomObject", LuaZoomObject) ; bOk = bOk && luaMgr.RegisterFunction( "EgtZoomObject", LuaZoomObject) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewOrizzOffsStep", LuaSetViewOrizzOffsStep) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetView", LuaSetView) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetView", LuaSetView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetGenericView", LuaSetGenericView) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetGenericView", LuaSetGenericView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewCenter", LuaSetViewCenter) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewCenter", LuaSetViewCenter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetViewOrizzOffsStep", LuaGetViewOrizzOffsStep) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetView", LuaGetView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetGenericView", LuaGetGenericView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImage", LuaGetImage) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetImage", LuaGetImage) ;
return bOk ; return bOk ;
} }