Compare commits

...

28 Commits

Author SHA1 Message Date
Riccardo Elitropi 824e6e3ba1 EgtExecutor :
- correzione codice.
2024-03-18 13:21:21 +01:00
Riccardo Elitropi 88fa7ef54c EgtExecutor :
- rimozione codici di test.
- modifiche parametri LuaCreateSurfTmSwept.
2024-03-15 13:18:48 +01:00
Riccardo Elitropi 82633bf725 EgtExecutor :
- migliorie al codice.
2024-03-11 13:21:29 +01:00
Riccardo Elitropi a27dfd2b54 EgtExecutor :
- Codice di test per RMF aggiornato.
2024-03-07 10:52:39 +01:00
Riccardo Elitropi 2a106c4263 EgtExecutor :
- Codice di test per RMF.
2024-03-06 16:28:48 +01:00
Dario Sassi 6c640b902f EgtExecuter :
- aggiunta funzione Exe/Lua CreateSurfTmTransSwept.
2024-02-27 18:18:52 +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
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
Dario Sassi e06dd65888 EgtExecutor 2.6b2 :
- a ApproxCurve e ProjectCurveOnSurfTm aggiunto parametro dMaxSegmLen.
2024-02-13 14:35: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
Daniele Bariletti 41c50a776e Merge branch 'master' into ExtDimension_angular 2024-02-05 15:44:46 +01:00
SaraP f28da6d9e3 EgtExecutor 2.6a4 :
- aggiunte funzioni Exe e Lua SurfFrOffsetAdv per calcolare offset di una flat region creando una nuova superficie senza modificare quella di partenza.
2024-01-29 14:44:06 +01:00
Dario Sassi c5b2121bd5 EgtExecutor 2.6a3 :
- modifiche per Voronoi non più direttamente accessibile.
2024-01-29 09:30:19 +01:00
Dario Sassi 03785dcca3 EgtExecutor 2.6a2 :
- aggiunta ExeGetKeyAssLeftDays per avere il numero di giorni mancanti al termine dell'assistenza.
2024-01-25 18:20:31 +01:00
Dario Sassi b4eccf1f18 EgtExecutor :
- aggiunta funzione Exe e Lua LineCurveInters.
2024-01-17 13:22:34 +01:00
Dario Sassi c169329660 EgtExecutor :
- aggiunta funzione Exe e Lua ChangeMachGroupName.
2024-01-16 19:42:12 +01:00
Dario Sassi 94d76d3a68 EgtExecutor 2.6a1 :
- ricompilazione con cambio versione.
2024-01-16 15:14:05 +01:00
Daniele Bariletti 9e725f3feb EgtExecutor :
- correzione minore.
2023-09-18 11:47:19 +02:00
Daniele Bariletti d7db0a2d45 Merge branch 'master' into ExtDimension_angular 2023-09-18 11:46:26 +02:00
Daniele Bariletti fb388799ea EgtExecutor :
- modifica minore alle quote angolari.
2023-04-19 17:21:53 +02:00
Daniele Bariletti f6915d80fa EgtExecutor :
- modifica minore alle quote angolari.
2023-04-14 10:06:08 +02:00
Daniele Bariletti d412ce65cd EgtExecutor :
- aggiustamenti alle quote angolari.
2023-04-14 09:46:03 +02:00
Daniele Bariletti 61824a24ab Merge remote-tracking branch 'origin/master' into ExtDimension_angular 2023-04-12 10:43:11 +02:00
23 changed files with 1513 additions and 1098 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) + "," +
+75 -178
View File
@@ -480,7 +480,7 @@ MyCreateRadialDimension( int nParentId, int nCrvId, const Point3d& ptDim,
Point3d ptCenL = pArc->GetCenter() ; Point3d ptCenL = pArc->GetCenter() ;
ptCenL.LocToLoc( frArc, frLoc) ; ptCenL.LocToLoc( frArc, frLoc) ;
Vector3d vtNL = pArc->GetNormVersor() ; Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ; vtNL.LocToLoc( frArc, frLoc) ;
// porto ptDimL sulla circonferenza cui appartiene l'arco // porto ptDimL sulla circonferenza cui appartiene l'arco
Vector3d vtDir = ptDimL - ptCenL ; Vector3d vtDir = ptDimL - ptCenL ;
if ( ! vtDir.Normalize()) if ( ! vtDir.Normalize())
@@ -543,7 +543,7 @@ MyCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
Point3d ptCenL = pArc->GetCenter() ; Point3d ptCenL = pArc->GetCenter() ;
ptCenL.LocToLoc( frArc, frLoc) ; ptCenL.LocToLoc( frArc, frLoc) ;
Vector3d vtNL = pArc->GetNormVersor() ; Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ; vtNL.LocToLoc( frArc, frLoc) ;
// porto ptDimL sulla circonferenza // porto ptDimL sulla circonferenza
Vector3d vtDir = ptDimL - ptCenL ; Vector3d vtDir = ptDimL - ptCenL ;
if ( ! vtDir.Normalize()) if ( ! vtDir.Normalize())
@@ -583,7 +583,7 @@ ExeCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP0, const Point3d& ptP2, MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptV, const Point3d& ptP2,
const Point3d& ptDim, const string& sText, int nRefType) const Point3d& ptDim, const string& sText, int nRefType)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
@@ -594,7 +594,7 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc)) if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// porto in locale i punti e assegno i versori // porto in locale i punti e assegno i versori
Point3d ptP0L = GetPointLocal( pGeomDB, ptP0, nRefType, frLoc) ; Point3d ptVL = GetPointLocal( pGeomDB, ptV, nRefType, frLoc) ;
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ; Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ; Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ; Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
@@ -603,7 +603,7 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ; PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) || if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim ) || ! MySetDimensionStyle( pDim ) ||
! pDim->SetAngular( ptP1L, ptP0L, ptP2L, ptDimL, vtNL, sText)) ! pDim->SetAngular( ptP1L, ptVL, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// inserisco la quota nel DB // inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ; return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
@@ -611,16 +611,16 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
int int
ExeCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP0, const Point3d& ptP2, ExeCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptV, 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, ptP0, ptP2, ptDim, sText, nRefType) ; int nId = MyCreateAngularDimension( nParentId, ptP1, ptV, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtAngularDimension(" + IdToString( nParentId) + ",{" + string sLua = "EgtAngularDimension(" + IdToString( nParentId) + ",{" +
ToString( ptP0) + "},{" + ToString( ptV) + "},{" +
ToString( ptP1) + "},{" + ToString( ptP1) + "},{" +
ToString( ptP2) + "},{" + ToString( ptP2) + "},{" +
ToString( ptDim) + "},'" + ToString( ptDim) + "},'" +
@@ -645,27 +645,24 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
Frame3d frLoc ; Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc)) if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero le linee
//recupero le linee
ICurveLine* pCrv1 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[0])) ; ICurveLine* pCrv1 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[0])) ;
ICurveLine* pCrv2 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[1])) ; ICurveLine* pCrv2 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[1])) ;
if ( pCrv1 == nullptr || pCrv2 == nullptr) if ( pCrv1 == nullptr || pCrv2 == nullptr)
return GDB_ID_NULL ; return GDB_ID_NULL ;
PtrOwner<ICurveLine> pL1( pCrv1->Clone()) ; PtrOwner<ICurveLine> pL1( pCrv1->Clone()) ;
PtrOwner<ICurveLine> pL2( pCrv2->Clone()) ; PtrOwner<ICurveLine> pL2( pCrv2->Clone()) ;
if ( IsNull( pL1 ) || ! pL1->IsValid() || IsNull( pL2) || ! pL2->IsValid()) if ( IsNull( pL1 ) || ! pL1->IsValid() || IsNull( pL2) || ! pL2->IsValid())
return GDB_ID_NULL ; return GDB_ID_NULL ;
// porto tutto nel frLoc
//porto tutto nel frLoc
Frame3d frL1, frL2 ; Frame3d frL1, frL2 ;
if ( ! pGeomDB->GetGlobFrame( vLineIds[0], frL1) || ! pGeomDB->GetGlobFrame( vLineIds[1], frL2)) if ( ! pGeomDB->GetGlobFrame( vLineIds[0], frL1) || ! pGeomDB->GetGlobFrame( vLineIds[1], frL2))
return GDB_ID_NULL ; return GDB_ID_NULL ;
pL1->LocToLoc( frL1, frLoc) ; pL1->LocToLoc( frL1, frLoc) ;
pL2->LocToLoc( frL2, frLoc) ; pL2->LocToLoc( frL2, frLoc) ;
// recupero il punto lo porto nel riferimento locale
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ; Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; // recupero i punti e le direzioni
//recupero i punti e le direzioni
Point3d ptP1L, ptP2L, ptP3L, ptP4L ; Point3d ptP1L, ptP2L, ptP3L, ptP4L ;
Vector3d vtL1, vtL2 ; Vector3d vtL1, vtL2 ;
pL1->GetStartPoint( ptP1L) ; pL1->GetStartPoint( ptP1L) ;
@@ -674,15 +671,12 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL2->GetEndPoint( ptP4L) ; pL2->GetEndPoint( ptP4L) ;
pL1->GetStartDir( vtL1) ; pL1->GetStartDir( vtL1) ;
pL2->GetStartDir( vtL2) ; pL2->GetStartDir( vtL2) ;
// controllo se le rette sono coincidenti o parallele // controllo se le rette sono coincidenti o parallele
if ( AreSameOrOppositeVectorApprox( vtL1, vtL2)) if ( AreSameOrOppositeVectorApprox( vtL1, vtL2))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// verifico se le rette si intersecano già // verifico se le rette si intersecano già
Point3d ptP0L ; Point3d ptCenL ;
IntersCurveCurve pInters( *pL1, *pL2) ; IntersCurveCurve pInters( *pL1, *pL2) ;
IntCrvCrvInfo Info ;
int nNumeroInters = pInters.GetIntersCount() ; int nNumeroInters = pInters.GetIntersCount() ;
// se non ho intersezioni estendo // se non ho intersezioni estendo
if ( nNumeroInters == 0) { if ( nNumeroInters == 0) {
@@ -691,54 +685,54 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL2->ExtendStartByLen( dLen) ; pL2->ExtendStartByLen( dLen) ;
pL1->ExtendEndByLen( dLen) ; pL1->ExtendEndByLen( dLen) ;
pL2->ExtendEndByLen( dLen) ; pL2->ExtendEndByLen( dLen) ;
// faccio intersezione
//faccio intersezione
IntersCurveCurve pIntersExt( *pL1, *pL2) ; IntersCurveCurve pIntersExt( *pL1, *pL2) ;
nNumeroInters = pIntersExt.GetIntersCount() ; nNumeroInters = pIntersExt.GetIntersCount() ;
// le linee estese non si intersecano, quindi vuol dire che sono quasi parallele e lontanissime // le linee estese non si intersecano, quindi vuol dire che sono quasi parallele e lontanissime
if ( nNumeroInters == 0 ) if ( nNumeroInters == 0 )
return GDB_ID_NULL ; return GDB_ID_NULL ;
else { else {
IntCrvCrvInfo Info ;
pIntersExt.GetIntCrvCrvInfo( 0, Info) ; pIntersExt.GetIntCrvCrvInfo( 0, Info) ;
// controllo che non siano coincidenti // controllo che non siano coincidenti
if ( Info.bOverlap) if ( Info.bOverlap)
return false ; return false ;
else else
ptP0L = Info.IciA->ptI ; ptCenL = Info.IciA->ptI ;
} }
// seleziono i punti necessari // seleziono i punti necessari
// se ptDimL è più vicino a ptP0L rispetto agli estremi esterni delle linee, allora tengo gli estremi interni // se ptDimL è più vicino a ptCenL rispetto agli estremi esterni delle linee, allora tengo gli estremi interni
double dP1P0 = ( ptP1L - ptP0L ).Len() ; double dP1Cen = ( ptP1L - ptCenL).Len() ;
double dP2P0 = ( ptP2L - ptP0L ).Len() ; double dP2Cen = ( ptP2L - ptCenL).Len() ;
double dDimP0 = ( ptDimL - ptP0L ).Len() ; double dDimCen = ( ptDimL - ptCenL).Len() ;
if ( ( dDimP0 < dP1P0 || dDimP0 < dP2P0)) if ( ( dDimCen < dP1Cen || dDimCen < dP2Cen))
// se uno dei due punti è più vicino a ptP0L rispetto a ptDimL, allora tengo il punto più vicino a ptDimL // se uno dei due punti è più vicino a ptCenL rispetto a ptDimL, allora tengo il punto più vicino a ptDimL
ptP1L = ( ( ptDimL - ptP1L ).Len() < ( ptDimL - ptP2L ).Len() ? ptP1L : ptP2L) ; ptP1L = ( ( ptDimL - ptP1L ).Len() < ( ptDimL - ptP2L ).Len() ? ptP1L : ptP2L) ;
else else
ptP1L = ( dP1P0 < dP2P0 ? ptP2L : ptP1L ) ; ptP1L = ( dP1Cen < dP2Cen ? ptP2L : ptP1L ) ;
// rifaccio anche per l'altro lato // rifaccio anche per l'altro lato
double dP3P0 = ( ptP3L - ptP0L).Len() ; double dP3Cen = ( ptP3L - ptCenL).Len() ;
double dP4P0 = ( ptP4L - ptP0L).Len() ; double dP4Cen = ( ptP4L - ptCenL).Len() ;
if ( dDimP0 < dP3P0 || dDimP0 < dP4P0 ) if ( dDimCen < dP3Cen || dDimCen < dP4Cen)
ptP3L = ( ( ptDimL - ptP3L).Len() < ( ptDimL - ptP4L).Len() ? ptP3L : ptP4L ) ; ptP3L = ( ( ptDimL - ptP3L).Len() < ( ptDimL - ptP4L).Len() ? ptP3L : ptP4L) ;
else else
ptP3L = ( dP3P0 < dP4P0 ? ptP4L : ptP3L) ; ptP3L = ( dP3Cen < dP4Cen ? ptP4L : ptP3L) ;
} }
// se ho già intesezioni devo capire in quale quadrante si trova ptDim // se ho già intesezioni devo capire in quale quadrante si trova ptDim
else { else {
// recupero l'intersezione // recupero l'intersezione
IntCrvCrvInfo Info ;
pInters.GetIntCrvCrvInfo( 0, Info) ; pInters.GetIntCrvCrvInfo( 0, Info) ;
// controllo che non siano coincidenti // controllo che non siano coincidenti
if ( Info.bOverlap) if ( Info.bOverlap)
return false ; return false ;
// se non coincidono restituisco l'intersezione
else else
ptP0L = Info.IciA->ptI ; // se non coincidono restituisco l'intersezione ptCenL = Info.IciA->ptI ;
// se le due linee hanno un estremo in comune, estendo le linee da quel lato
// se le due linee hanno un estremo in comune, estendo le linee quel lato if ( ( AreSamePointApprox( ptCenL, ptP1L) || AreSamePointApprox( ptCenL, ptP2L)) &&
if ( ( AreSamePointApprox( ptP0L, ptP1L) || AreSamePointApprox( ptP0L, ptP2L)) && ( AreSamePointApprox( ptCenL, ptP3L) || AreSamePointApprox( ptCenL, ptP4L))) {
( AreSamePointApprox( ptP0L, ptP3L) || AreSamePointApprox( ptP0L, ptP4L))) { if ( AreSamePointApprox( ptCenL, ptP1L)) {
if ( AreSamePointApprox( ptP0L, ptP1L)) {
pL1->ExtendStartByLen(Dist( ptP1L, ptP2L) / 2) ; pL1->ExtendStartByLen(Dist( ptP1L, ptP2L) / 2) ;
pL1->GetStartPoint( ptP1L) ; pL1->GetStartPoint( ptP1L) ;
} }
@@ -746,8 +740,8 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL1->ExtendEndByLen(Dist( ptP1L, ptP2L) / 2) ; pL1->ExtendEndByLen(Dist( ptP1L, ptP2L) / 2) ;
pL1->GetEndPoint( ptP2L) ; pL1->GetEndPoint( ptP2L) ;
} }
if ( AreSamePointApprox( ptP0L, ptP3L) ) { if ( AreSamePointApprox( ptCenL, ptP3L)) {
pL2->ExtendStartByLen(Dist( ptP3L, ptP4L) / 2); pL2->ExtendStartByLen( Dist( ptP3L, ptP4L) / 2);
pL2->GetStartPoint( ptP3L) ; pL2->GetStartPoint( ptP3L) ;
} }
else { else {
@@ -755,36 +749,42 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL2->GetEndPoint( ptP4L) ; pL2->GetEndPoint( ptP4L) ;
} }
} }
// seleziono i punti necessari // seleziono i punti necessari
// proietto pdDim su vtLine1 e su vtLine2 // proietto pdDim su vtLine1 e su vtLine2
Point3d ptDim1, ptDim2 ; Point3d ptDim1, ptDim2 ;
DistPointCurve distPL1( ptDimL, *pL1, true) ; DistPointCurve distPL1( ptDimL, *pL1, true) ;
DistPointCurve distPL2( ptDimL, *pL2, true) ; DistPointCurve distPL2( ptDimL, *pL2, true) ;
int nFlag1, nFlag2 ; int nFlag1, nFlag2 ;
if ( ! distPL1.GetMinDistPoint( 0, ptDim1, nFlag1) || ! distPL2.GetMinDistPoint( 0, ptDim2, nFlag2) ) if ( ! distPL1.GetMinDistPoint( 0, ptDim1, nFlag1) || ! distPL2.GetMinDistPoint( 0, ptDim2, nFlag2) )
return false ; return false ;
if ( abs(( ptDim1 - ptP1L).Len() + ( ptP0L - ptDim1).Len() - ( ptP0L - ptP1L).Len()) < EPS_SMALL || if ( abs(( ptDim1 - ptP1L).Len() + ( ptCenL - ptDim1).Len() - ( ptCenL - ptP1L).Len()) < EPS_SMALL ||
abs(( ptDim1 - ptP1L).Len() + ( ptP0L - ptP1L ).Len() - ( ptDim1 - ptP0L).Len()) < EPS_SMALL) abs(( ptDim1 - ptP1L).Len() + ( ptCenL - ptP1L ).Len() - ( ptDim1 - ptCenL).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L, quindi tengo ptP1L // ptDim è dal lato di ptP1L, quindi tengo ptP1L
; ;
else else
// ptDim è dal lato di ptP2L // ptDim è dal lato di ptP2L
ptP1L = ptP2L ; ptP1L = ptP2L ;
if ( abs(( ptDim2 - ptP3L).Len() + ( ptP0L - ptDim2).Len() - ( ptP0L - ptP3L).Len()) < EPS_SMALL || if ( abs(( ptDim2 - ptP3L).Len() + ( ptCenL - ptDim2).Len() - ( ptCenL - ptP3L).Len()) < EPS_SMALL ||
abs(( ptDim2 - ptP3L).Len() + ( ptP0L - ptP3L).Len() - ( ptDim2 - ptP0L).Len()) < EPS_SMALL) abs(( ptDim2 - ptP3L).Len() + ( ptCenL - ptP3L).Len() - ( ptDim2 - ptCenL).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L, quindi tengo ptP3L // ptDim è dal lato di ptP1L
; ;
else else
// ptDim è dal lato di ptP2L // ptDim è dal lato di ptP2L
ptP3L = ptP4L ; ptP3L = ptP4L ;
} }
// recupero la normale al piano dell'angolo da quotare
Frame3d frArc;
frArc.Set(ptCenL, ptP1L, ptP3L);
Vector3d vtNL = frArc.VersZ() ;
if ( vtNL * Z_AX < - EPS_SMALL) {
frArc.Set(ptCenL, ptP3L, ptP1L);
vtNL = frArc.VersZ() ;
}
// creo la quota // creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ; PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim ) || if ( IsNull( pDim ) ||
! MySetDimensionStyle( pDim ) || ! MySetDimensionStyle( pDim ) ||
! pDim->SetAngular( ptP1L, ptP0L, ptP3L, ptDimL, vtNL, sText)) ! pDim->SetAngular( ptP1L, ptCenL, ptP3L, ptDimL, vtNL, sText))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// inserisco la quota nel DB // inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ; return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
@@ -825,50 +825,36 @@ MyCreateAngularDimensionFromArc( int nParentId, int nCrvId, const Point3d& ptDim
Frame3d frLoc ; Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc)) if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero l'arco e il suo frame // recupero l'arco e il suo frame
ICurveArc* pCurve = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ; ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCurve == nullptr) if ( pArc == nullptr)
return GDB_ID_NULL ; return GDB_ID_NULL ;
Frame3d frArc; Frame3d frArc ;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frArc)) if ( ! pGeomDB->GetGlobFrame( nCrvId, frArc))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero i punti e la normale e li porto nel frame locale
PtrOwner<ICurveArc> pCrv( pCurve->Clone()) ;
if ( IsNull( pCrv ) || ! pCrv->IsValid())
return GDB_ID_NULL ;
// porto tutto nel frLoc
pCrv->LocToLoc( frArc, frLoc ) ;
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ; Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ;
//recupero i punti e i versori Point3d ptCenL, ptP1L, ptP2L ;
Point3d ptP0L, ptP1L, ptP2L ; pArc->GetStartPoint( ptP1L) ;
pCrv->GetStartPoint( ptP1L) ; ptP1L.LocToLoc( frArc, frLoc) ;
pCrv->GetEndPoint( ptP2L) ; pArc->GetEndPoint( ptP2L) ;
pCrv->GetCenterPoint( ptP0L) ; ptP2L.LocToLoc( frArc, frLoc) ;
pArc->GetCenterPoint( ptCenL) ;
ptCenL.LocToLoc( frArc, frLoc) ;
// porto ptDimL nell'area di influenza dell'arco // porto ptDimL nell'area di influenza dell'arco
Point3d ptDimNew ;
double dDist = ( ptDimL - ptP0L).Len() ;
Point3d ptMid ; Point3d ptMid ;
pCrv->GetMidPoint( ptMid) ; pArc->GetMidPoint( ptMid) ;
Vector3d vtDir = ( ptMid - ptP0L) ; Vector3d vtDir = ( ptMid - ptCenL) ;
vtDir.Normalize() ; if ( ! vtDir.Normalize())
ptDimNew = ptP0L + dDist * vtDir ; return GDB_ID_NULL ;
// proietto il punto sul piano XY della griglia ptDimL = ptCenL + Dist( ptDimL, ptCenL) * vtDir ;
Frame3d frGrid = pGeomDB->GetGridFrame() ;
if ( ! frGrid.IsValid())
return GDB_ID_NULL ;
Point3d ptOrig = frGrid.Orig() ;
ptDimNew -= ( ptDimNew - ptOrig) * vtNL * vtNL;
// creo la quota // creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ; PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim ) || if ( IsNull( pDim ) ||
! MySetDimensionStyle( pDim) || ! MySetDimensionStyle( pDim) ||
! pDim->SetAngular( ptP1L, ptP0L, ptP2L, ptDimNew, vtNL, sText)) ! pDim->SetAngular( ptP1L, ptCenL, 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)) ;
@@ -894,93 +880,4 @@ ExeCreateAngularDimensionFromArc( int nParentId, int nCrvId, const Point3d& ptDi
} }
// restituisco l'identificativo del oggetto // restituisco l'identificativo del oggetto
return nId ; return nId ;
} }
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimensionFromCircle( int nParentId, int nCrvId, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptDim,
const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId ) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero il cerchio e il suo frame
ICurveArc* pCurve = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCurve == nullptr)
return GDB_ID_NULL ;
Frame3d frCrv;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frCrv))
return GDB_ID_NULL ;
PtrOwner<ICurveArc> pCrv( pCurve->Clone()) ;
if ( IsNull( pCrv ) || ! pCrv->IsValid())
return GDB_ID_NULL ;
// porto tutto nel frLoc
pCrv->LocToLoc( frCrv, frLoc ) ;
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// recupero il centro
Point3d ptP0L ;
pCrv->GetCenterPoint( ptP0L) ;
// verifico che i punti P1 e P2 siano sul cerchio, sennò prendo i più vicini
if ( ! pCrv->IsPointOn(ptP1L)) {
DistPointCurve distPC( ptP1L, *pCrv) ;
int nFlag ;
distPC.GetMinDistPoint(0,ptP1L,nFlag);
}
if ( ! pCrv->IsPointOn(ptP2L)) {
DistPointCurve distPC(ptP2L, *pCrv) ;
int nFlag ;
distPC.GetMinDistPoint(0, ptP2L, nFlag);
}
// proietto il punto sul piano XY della griglia
Frame3d frGrid = pGeomDB->GetGridFrame() ;
if ( ! frGrid.IsValid())
return GDB_ID_NULL ;
Point3d ptOrig = frGrid.Orig() ;
ptDimL -= ( ptDimL - ptOrig) * vtNL * vtNL;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim) ||
! pDim->SetAngular( ptP1L, ptP0L, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimensionFromCircle( int nParentId, int nCrvId, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimensionFromCircle( nParentId, nCrvId, ptP1, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimensionFromCircle(" + IdToString( nParentId) + "," +
IdToString( nCrvId) + ",{" +
ToString( ptP1) + "},'" +
ToString( ptP2) + "},'" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
+2 -5
View File
@@ -362,16 +362,13 @@ CreateLineTgTwoCurves( IGeomDB* pGeomDB, int nParentId,
if ( pCrv2 == nullptr) if ( pCrv2 == nullptr)
return nullptr ; return nullptr ;
// porto la seconda curva nel riferimento della prima // porto la seconda curva nel riferimento della prima
PtrOwner<ICurve> pCrv2Loc( pCrv2->Clone()) ; CurveLocal Crv2Loc( pGeomDB, nIdF, frCrv1) ;
if ( IsNull( pCrv2Loc))
return nullptr ;
pCrv2Loc->LocToLoc( frCrv2, frCrv1) ;
// porto il punto vicino al finale nel riferimento della prima curva // porto il punto vicino al finale nel riferimento della prima curva
Point3d ptN2loc( ptFin) ; Point3d ptN2loc( ptFin) ;
ptN2loc.LocToLoc( frDest, frCrv1) ; ptN2loc.LocToLoc( frDest, frCrv1) ;
// calcolo la retta tangente alle due curve // calcolo la retta tangente alle due curve
PtrOwner<ICurveLine> pCrvLine ; PtrOwner<ICurveLine> pCrvLine ;
pCrvLine.Set( GetLineTgTwoCurves( *pCrv1, ptN1loc, *pCrv2Loc, ptN2loc)) ; pCrvLine.Set( GetLineTgTwoCurves( *pCrv1, ptN1loc, *Crv2Loc, ptN2loc)) ;
if ( IsNull( pCrvLine)) if ( IsNull( pCrvLine))
return nullptr ; return nullptr ;
// porto la linea nel riferimento del gruppo destinazione // porto la linea nel riferimento del gruppo destinazione
+103 -42
View File
@@ -1,4 +1,4 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2014-2015 // EgalTech 2014-2015
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : EXE_GdbCreateSurf.cpp Data : 04.05.15 Versione : 1.6e1 // File : EXE_GdbCreateSurf.cpp Data : 04.05.15 Versione : 1.6e1
@@ -33,6 +33,7 @@
#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"
using namespace std ; using namespace std ;
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
@@ -79,7 +80,7 @@ ExeCreateSurfFrRectangle( int nParentId, const Point3d& ptIni, const Point3d& pt
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -130,7 +131,7 @@ ExeCreateSurfFrRectangle3P( int nParentId, const Point3d& ptIni,
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -179,7 +180,7 @@ ExeCreateSurfFrStadium( int nParentId, const Point3d& ptIni, const Point3d& ptCr
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -196,7 +197,7 @@ ExeCreateSurfFrDisk( int nParentId, const Point3d& ptOrig, double dRad, int nRef
// porto in locale il punto e calcolo la normale in locale // porto in locale il punto e calcolo la normale in locale
Point3d ptOrigL = GetPointLocal( pGeomDB, ptOrig, nRefType, frLoc) ; Point3d ptOrigL = GetPointLocal( pGeomDB, ptOrig, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// calcolo riferimento per l'entità // calcolo riferimento per l'entità
Frame3d frEnt ; Frame3d frEnt ;
bOk = bOk && frEnt.Set( ptOrigL, vtNL) ; bOk = bOk && frEnt.Set( ptOrigL, vtNL) ;
// creo il disco nel suo riferimento intrinseco // creo il disco nel suo riferimento intrinseco
@@ -216,7 +217,7 @@ ExeCreateSurfFrDisk( int nParentId, const Point3d& ptOrig, double dRad, int nRef
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -260,7 +261,7 @@ ExeCreateSurfFrFatCurve( int nParentId, int nCrvId, double dRad, bool bSquaredEn
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -316,7 +317,7 @@ MyCreateSurfFlatRegion( int nParentId, const INTVECTOR& vCrvIds, int* pnCount)
// recupero la prossima superficie // recupero la prossima superficie
pSfr = SfrCntr.GetSurf() ; pSfr = SfrCntr.GetSurf() ;
} }
// restituisco l'identificativo della prima nuova entità // restituisco l'identificativo della prima nuova entità
if ( pnCount != nullptr) if ( pnCount != nullptr)
*pnCount = nCount ; *pnCount = nCount ;
return nFirstId ; return nFirstId ;
@@ -339,7 +340,7 @@ ExeCreateSurfFlatRegion( int nParentId, const INTVECTOR& vCrvIds, int* pnCount)
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ; " -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nFirstId ; return nFirstId ;
} }
@@ -388,7 +389,7 @@ ExeCreateSurfTmPlaneInBBox( int nParentId, const Point3d& ptP, const Vector3d& v
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -449,7 +450,7 @@ MyCreateSewPolygon( ISurfTriMesh* pStm, const Polygon3d& Polyg)
// verifico esistenza superficie // verifico esistenza superficie
if ( pStm == nullptr) if ( pStm == nullptr)
return false ; return false ;
// se poligono vuoto, non devo fare alcunché // se poligono vuoto, non devo fare alcunché
if ( Polyg.GetSideCount() == 0) if ( Polyg.GetSideCount() == 0)
return true ; return true ;
// creo la superficie trimesh del poligono // creo la superficie trimesh del poligono
@@ -579,7 +580,7 @@ ExeCreateSurfTmConvexHullInBBox( int nParentId, int nId, const BBox3d& b3Box, in
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -627,7 +628,7 @@ ExeCreateSurfTmBBox( int nParentId, const BBox3d& b3Box, bool bRegular, int nRef
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -682,7 +683,7 @@ ExeCreateSurfTmBox( int nParentId, const Point3d& ptIni, const Point3d& ptCross,
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -739,7 +740,7 @@ ExeCreateSurfTmPyramid( int nParentId, const Point3d& ptIni, const Point3d& ptCr
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -781,7 +782,7 @@ ExeCreateSurfTmCylinder( int nParentId, const Point3d& ptOrig, const Vector3d& v
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -823,7 +824,7 @@ ExeCreateSurfTmCone( int nParentId, const Point3d& ptOrig, const Vector3d& vtN,
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -859,7 +860,7 @@ ExeCreateSurfTmSphere( int nParentId, const Point3d& ptOrig,
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -901,7 +902,7 @@ ExeCreateSurfTmTriangle( int nParentId, const Point3d& ptP1, const Point3d& ptP2
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -950,7 +951,7 @@ ExeCreateSurfTmRectangle( int nParentId, const Point3d& ptO, const Point3d& ptL,
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -981,7 +982,7 @@ ExeCreateSurfTmByFlatContour( int nParentId, int nCrvId, double dLinTol)
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -1027,7 +1028,7 @@ ExeCreateSurfTmByRegion( int nParentId, const INTVECTOR& vCrvIds, double dLinTol
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -1082,7 +1083,7 @@ ExeCreateSurfTmByExtrusion( int nParentId, const INTVECTOR& vCrvIds, const Vecto
" -- Id=" + ToString( nFirstId) ; " -- Id=" + ToString( nFirstId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nFirstId ; return nFirstId ;
} }
@@ -1126,7 +1127,7 @@ ExeCreateSurfTmByRegionExtrusion( int nParentId, const INTVECTOR& vCrvIds, const
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -1166,7 +1167,7 @@ ExeCreateSurfTmByRevolve( int nParentId, int nCrvId,
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -1208,7 +1209,7 @@ ExeCreateSurfTmByScrewing( int nParentId, int nCrvId,
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -1245,13 +1246,73 @@ ExeCreateSurfTmRectSwept( int nParentId, double dDimH, double dDimV, double dBev
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
int int
ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, double dLinTol) ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, double dLinTol, Vector3d* vtStatic)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// recupero la guida in locale
CurveLocal CrvGuide( pGeomDB, nGuideId, frLoc) ;
bOk = bOk && ( CrvGuide.Get() != nullptr) ;
// inizializzazione superficie e suo Id
ISurfTriMesh* pSTM = nullptr ;
int nNewId = GDB_ID_NULL ;
// recupero il tipo di entità della sezione
int nSecType = pGeomDB->GetGeoType( nSectId) ;
// controllo se la sezione è definita da una curva
if ( nSecType == CRV_LINE || nSecType == CRV_ARC ||
nSecType == CRV_BEZIER || nSecType == CRV_COMPO) {
// recupero la sezione in locale
CurveLocal CrvSect( pGeomDB, nSectId, frLoc) ;
bOk = bOk && ( CrvSect.Get() != nullptr) ;
// calcolo la Swept
pSTM = ( bOk ? GetSurfTriMeshSwept( CrvSect, CrvGuide, bCapEnds, dLinTol, vtStatic) : nullptr) ;
// inserisco la superficie trimesh nel DB
nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
}
// controllo se la sezione è definita da una regione piana
else if ( nSecType == SRF_FLATRGN) {
// recupero la sezione e la porto nel frame corrente
PtrOwner<ISurfFlatRegion> pSfrSec( CloneSurfFlatRegion( pGeomDB->GetGeoObj( nSectId))) ;
Frame3d frSec ;
if ( ! IsNull( pSfrSec) && pGeomDB->GetGlobFrame( nSectId, frSec) &&
pSfrSec->LocToLoc( frSec, frLoc)) {
// calcolo la Swept
pSTM = ( bOk ? GetSurfTriMeshSwept( pSfrSec, CrvGuide, bCapEnds, dLinTol, vtStatic) : nullptr) ;
// inserisco la superficie trimesh nel DB
nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
}
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmSwept(" + IdToString( nParentId) + "," +
ToString( nSectId) + "," +
ToString( nGuideId) + "," +
( bCapEnds ? "true" : "false") + "," +
ToString( dLinTol) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmTransSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, double dLinTol)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -1268,21 +1329,21 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, d
bOk = bOk && ( CrvGuide.Get() != nullptr) ; bOk = bOk && ( CrvGuide.Get() != nullptr) ;
// creo la superficie trimesh // creo la superficie trimesh
ISurfTriMesh* pSTM = nullptr ; ISurfTriMesh* pSTM = nullptr ;
pSTM = ( bOk ? GetSurfTriMeshSwept( CrvSect, CrvGuide, bCapEnds, dLinTol) : nullptr) ; pSTM = ( bOk ? GetSurfTriMeshTransSwept( CrvSect, CrvGuide, bCapEnds, dLinTol) : nullptr) ;
// inserisco la superficie trimesh nel DB // inserisco la superficie trimesh nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ; int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtSurfTmSwept(" + IdToString( nParentId) + "," + string sLua = "EgtSurfTmTransSwept(" + IdToString( nParentId) + "," +
ToString( nSectId) + "," + ToString( nSectId) + "," +
ToString( nGuideId) + "," + ToString( nGuideId) + "," +
( bCapEnds ? "true" : "false") + "," + ( bCapEnds ? "true" : "false") + "," +
ToString( dLinTol) + ")" + ToString( dLinTol) + ")" +
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -1299,7 +1360,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// creo la superficie trimesh // creo la superficie trimesh
ISurfTriMesh* pSTM = nullptr ; ISurfTriMesh* pSTM = nullptr ;
// se la prima entità è un punto e la seconda una curva // se la prima entità è un punto e la seconda una curva
if ( pGeomDB->GetGeoType( nPtOrCrvId1) == GEO_PNT3D && if ( pGeomDB->GetGeoType( nPtOrCrvId1) == GEO_PNT3D &&
( pGeomDB->GetGeoType( nPtOrCrvId2) & GEO_CURVE) != 0) { ( pGeomDB->GetGeoType( nPtOrCrvId2) & GEO_CURVE) != 0) {
// recupero il punto in locale // recupero il punto in locale
@@ -1315,7 +1376,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
// calcolo la superficie // calcolo la superficie
pSTM = ( bOk ? GetSurfTriMeshRuled( ptP, CrvLoc, dLinTol) : nullptr) ; pSTM = ( bOk ? GetSurfTriMeshRuled( ptP, CrvLoc, dLinTol) : nullptr) ;
} }
// se la prima entità è una curva e la seconda un punto // se la prima entità è una curva e la seconda un punto
else if ( ( pGeomDB->GetGeoType( nPtOrCrvId1) & GEO_CURVE) != 0 && else if ( ( pGeomDB->GetGeoType( nPtOrCrvId1) & GEO_CURVE) != 0 &&
pGeomDB->GetGeoType( nPtOrCrvId2) == GEO_PNT3D) { pGeomDB->GetGeoType( nPtOrCrvId2) == GEO_PNT3D) {
// recupero la curva in locale // recupero la curva in locale
@@ -1359,7 +1420,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -1470,7 +1531,7 @@ ExeCreateSurfTmBySewing( int nParentId, const INTVECTOR& vIds, bool bErase)
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStmS) ; bOk = bOk && pGeomDB->GetGlobFrame( nId, frStmS) ;
// lo esprimo rispetto a quello della prima superficie // lo esprimo rispetto a quello della prima superficie
frStmS.ToLoc( frLoc) ; frStmS.ToLoc( frLoc) ;
// se è la prima, copio // se è la prima, copio
if ( bFirst) { if ( bFirst) {
bOk = bOk && pStm->CopyFrom( pStmS) ; bOk = bOk && pStm->CopyFrom( pStmS) ;
bOk = bOk && pStm->ToGlob( frStmS) ; bOk = bOk && pStm->ToGlob( frStmS) ;
@@ -1536,7 +1597,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() ;
@@ -1659,7 +1720,7 @@ ExeCreateSurfBezier( int nParentId, int nDegU, int nDegV, int nSpanU, int nSpanV
" -- Id=" + ToString( nId) ; " -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nId ; return nId ;
} }
@@ -1711,7 +1772,7 @@ ExeCreateSurfBezierRational( int nParentId, int nDegU, int nDegV, int nSpanU, in
" -- Id=" + ToString( nId) ; " -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nId ; return nId ;
} }
-1
View File
@@ -27,7 +27,6 @@
#include "/EgtDev/Include/EGkDistPointCurve.h" #include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkIntersCurves.h" #include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h" #include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "EgtDev/Include/EGkVoronoi.h"
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
+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 ;
+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()) ;
+26
View File
@@ -368,6 +368,32 @@ ExeSurfFrOffset( int nId, double dDist, int nType)
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
bool
ExeSurfFrOffsetAdv( int nId, double dDist, int nType, int& nNewId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie FlatRegion
ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pSfr == nullptr)
return false ;
// eseguo l'offset
PtrOwner<ISurfFlatRegion> pSfrOffs( pSfr->CreateOffsetSurf( dDist, nType)) ;
if ( IsNull( pSfrOffs))
return false ;
// salvo la superficie di offset
nNewId = GDB_ID_NULL ;
if ( pSfr->GetChunkCount() > 0) {
// inserisco nel DB geometrico
nNewId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_AFTER, Release( pSfrOffs)) ;
// copio gli attributi
pGeomDB->CopyAttributes( nId, nNewId) ;
ExeSetModified() ;
}
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeSurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, int nRefType) ExeSurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, int nRefType)
+12 -3
View File
@@ -52,6 +52,7 @@ static string s_sKey ;
static int s_nKeyType = KEY_LOCK_TYPE_ANY ; static int s_nKeyType = KEY_LOCK_TYPE_ANY ;
static bool s_bNetHwKey = false ; static bool s_bNetHwKey = false ;
static int s_nKeyExpDays = 0 ; static int s_nKeyExpDays = 0 ;
static int s_nKeyAssExpDays = 0 ;
static int s_nKeyOptExpDays = 0 ; static int s_nKeyOptExpDays = 0 ;
static string s_sNestKey ; static string s_sNestKey ;
static string s_sLockId ; static string s_sLockId ;
@@ -519,7 +520,7 @@ bool
ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev) ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev)
{ {
// verifico la chiave e il livello // verifico la chiave e il livello
int nRet = GetKeyLevel( s_sKey, nProd, nVer, nLev, nKLev, s_nKeyExpDays) ; int nRet = GetKeyLevelEx( s_sKey, nProd, nVer, nLev, nKLev, s_nKeyExpDays, s_nKeyAssExpDays) ;
SetEGnKeyLevel( nRet, nKLev, s_nKeyExpDays) ; SetEGnKeyLevel( nRet, nKLev, s_nKeyExpDays) ;
if ( nRet != KEY_OK) { if ( nRet != KEY_OK) {
string sErr = "Error on Key (EGKL/" + ToString( nRet) + ")" ; string sErr = "Error on Key (EGKL/" + ToString( nRet) + ")" ;
@@ -527,7 +528,6 @@ ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev)
nKLev = - nRet ; nKLev = - nRet ;
return false ; return false ;
} }
return true ; return true ;
} }
@@ -551,7 +551,6 @@ ExeGetKeyOptions( int nProd, int nVer, int nLev, unsigned int& nOpt2)
LOG_ERROR( s_pGenLog, sErr.c_str()) ; LOG_ERROR( s_pGenLog, sErr.c_str()) ;
return true ; return true ;
} }
return true ; return true ;
} }
@@ -565,6 +564,16 @@ ExeGetKeyLeftDays( int& nLeftDays)
return true ; return true ;
} }
//-----------------------------------------------------------------------------
bool
ExeGetKeyAssLeftDays( int& nAssLeftDays)
{
if ( s_nKeyAssExpDays == 0)
return false ;
nAssLeftDays = s_nKeyAssExpDays - GetCurrDay() ;
return true ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeGetKeyOptLeftDays( int& nOptLeftDays) ExeGetKeyOptLeftDays( int& nOptLeftDays)
+760 -645
View File
File diff suppressed because it is too large Load Diff
+20
View File
@@ -284,6 +284,26 @@ ExeRemoveMachGroup( int nMGroupId)
return bOk ; return bOk ;
} }
//-----------------------------------------------------------------------------
bool
ExeChangeMachGroupName( int nId, const string& sNewName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// cambia il nome della macchinata
bool bOk = pMachMgr->ChangeMachGroupName( nId, sNewName) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtChangeMachGroupName(" + ToString( nId) + ",'" +
sNewName + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeGetMachGroupName( int nId, string& sName) ExeGetMachGroupName( int nId, string& sName)
+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.
+4 -35
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, ptP0, ptP2, ptDim, Text [, nRefType] // 6 o 7 parametri : ParentId, ptP1, ptV, ptP2, ptDim, Text [, nRefType]
int nParentId ; int nParentId ;
LuaCheckParam( L, 1, nParentId) LuaCheckParam( L, 1, nParentId)
Point3d ptP1 ; Point3d ptP1 ;
LuaCheckParam( L, 2, ptP1) ; LuaCheckParam( L, 2, ptP1) ;
Point3d ptP0 ; Point3d ptV ;
LuaCheckParam( L, 3, ptP0) ; LuaCheckParam( L, 3, ptV) ;
Point3d ptP2 ; Point3d ptP2 ;
LuaCheckParam( L, 4, ptP2) ; LuaCheckParam( L, 4, ptP2) ;
Point3d ptDim ; Point3d ptDim ;
@@ -417,7 +417,7 @@ LuaCreateAngularDimension(lua_State* L)
LuaGetParam( L, 7, nRefType) ; LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// creo la quota angolare // creo la quota angolare
int nId = ExeCreateAngularDimension( nParentId, ptP1, ptP0, ptP2, ptDim, sText, nRefType) ; int nId = ExeCreateAngularDimension( nParentId, ptP1, ptV, 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) ;
@@ -478,36 +478,6 @@ LuaCreateAngularDimensionFromArc( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCreateAngularDimensionFromCircle( lua_State* L)
{
// 6 o 7 parametri : nParentId, nCrvId, ptP1, ptP2, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId) ;
Point3d ptP1 ;
LuaCheckParam( L, 3, ptP1) ;
Point3d ptP2 ;
LuaCheckParam( L, 4, ptP2) ;
Point3d ptDim ;
LuaCheckParam( L, 5, ptDim) ;
string sText ;
LuaCheckParam( L, 6, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ;
// creo la quota allineata
int nId = ExeCreateAngularDimensionFromCircle( nParentId, nCrvId, ptP1, ptP2, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallGdbCreate( LuaMgr& luaMgr) LuaInstallGdbCreate( LuaMgr& luaMgr)
@@ -530,6 +500,5 @@ LuaInstallGdbCreate( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension); bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension);
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromCircle", LuaCreateAngularDimensionFromCircle) ;
return bOk ; return bOk ;
} }
+33 -2
View File
@@ -659,6 +659,36 @@ LuaCreateSurfTmRectSwept( lua_State* L)
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaCreateSurfTmSwept( lua_State* L) LuaCreateSurfTmSwept( lua_State* L)
{
// 4, 5 o 6 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol] [, vtStatic]
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 ;
Vector3d vtStatic = V_INVALID ;
if ( LuaGetParam( L, 5, dLinTol)) {
LuaGetParam( L, 6, vtStatic) ;
}
LuaClearStack( L) ;
// creo STM swept
int nId = ExeCreateSurfTmSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol,
vtStatic.IsValid() ? &vtStatic : nullptr) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmTransSwept( lua_State* L)
{ {
// 4 o 5 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol] // 4 o 5 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol]
int nParentId ; int nParentId ;
@@ -672,8 +702,8 @@ LuaCreateSurfTmSwept( lua_State* L)
double dLinTol = LIN_TOL_SRF ; double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 5, dLinTol) ; LuaGetParam( L, 5, dLinTol) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// creo STM swept // creo STM swept di traslazione
int nId = ExeCreateSurfTmSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol) ; int nId = ExeCreateSurfTmTransSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol) ;
// restituisco il risultato // restituisco il risultato
if ( nId != GDB_ID_NULL) if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ; LuaSetParam( L, nId) ;
@@ -932,6 +962,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) ;
-1
View File
@@ -18,7 +18,6 @@
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h" #include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGkVoronoi.h"
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
+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 ;
+13 -9
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 ;
} }
@@ -980,7 +984,7 @@ LuaCurveGetVoronoi( lua_State* L)
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, nId)
int nDestGrpId ; int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId) LuaCheckParam( L, 2, nDestGrpId)
int nBound = VORONOI_STD_BOUND ; int nBound = 3 ; // VORONOI_STD_BOUND
LuaGetParam( L, 3, nBound) ; LuaGetParam( L, 3, nBound) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// eseguo // eseguo
@@ -1004,7 +1008,7 @@ LuaCurveMedialAxisAdv( lua_State* L)
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, nId)
int nDestGrpId ; int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId) LuaCheckParam( L, 2, nDestGrpId)
int nSide = Voronoi::WMAT_LEFT ; int nSide = 1 ; // WMAT_LEFT
LuaGetParam( L, 3, nSide) ; LuaGetParam( L, 3, nSide) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// eseguo // eseguo
+24
View File
@@ -141,6 +141,29 @@ LuaSurfFrOffset( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaSurfFrOffsetAdv( lua_State* L)
{
// 3 parametri : Id, dDist, nType
int nId ;
LuaCheckParam( L, 1, nId)
double dDist ;
LuaCheckParam( L, 2, dDist)
int nType = ICurve::OFF_FILLET ;
LuaGetParam( L, 3, nType) ;
LuaClearStack( L) ;
// eseguo l'offset della regione
int nNewId = GDB_ID_NULL ;
bool bOk = ExeSurfFrOffsetAdv( nId, dDist, nType, nNewId) ;
if ( bOk)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfTmMoveVertex( lua_State* L) LuaSurfTmMoveVertex( lua_State* L)
@@ -451,6 +474,7 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrSubtract", LuaSurfFrSubtract) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrSubtract", LuaSurfFrSubtract) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrIntersect", LuaSurfFrIntersect) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrIntersect", LuaSurfFrIntersect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffsetAdv", LuaSurfFrOffsetAdv) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveVertex", LuaSurfTmMoveVertex) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveVertex", LuaSurfTmMoveVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ;
+192 -129
View File
@@ -20,6 +20,41 @@
using namespace std ; using namespace std ;
//----------------------------------------------------------------------------
static int
LuaLineCurveInters( lua_State* L)
{
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir)
int nId ;
LuaCheckParam( L, 3, nId)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// recupero i punti di intersezione tra linea e curva
INTDBLVECTOR vInters ;
if ( ExeLineCurveInters( ptP, vtDir, nId, nRefType, vInters)) {
LuaSetParam( L, true) ;
INTVECTOR vType( vInters.size()) ;
DBLVECTOR vPar( vInters.size()) ;
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
vType[i] = vInters[i].first ;
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaLineBoxInters( lua_State* L) LuaLineBoxInters( lua_State* L)
@@ -53,38 +88,6 @@ LuaLineBoxInters( lua_State* L)
return 3 ; return 3 ;
} }
//----------------------------------------------------------------------------
static int
LuaPlaneBoxInters( lua_State* L)
{
// 4 o 5 parametri : ptOn, vtN, b3Box, nDestGrpId [, nRefType]
Point3d ptOn ;
LuaCheckParam( L, 1, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
BBox3d b3Box ;
LuaCheckParam( L, 3, b3Box)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nSrfCount = 0 ;
int nNewId = ExePlaneBoxInters( ptOn, vtN, b3Box, nDestGrpId, nRefType, &nPntCount, &nCrvCount, &nSrfCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
LuaSetParam( L, nSrfCount) ;
return 4 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaLineSurfTmInters( lua_State* L) LuaLineSurfTmInters( lua_State* L)
@@ -120,6 +123,101 @@ LuaLineSurfTmInters( lua_State* L)
return 3 ; return 3 ;
} }
//----------------------------------------------------------------------------
static int
LuaLineVolZmapInters( lua_State* L)
{
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir)
int nId ;
LuaCheckParam( L, 3, nId)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// eseguo calcolo intersezione
INTDBLVECTOR vInters ;
if ( ExeLineVolZmapInters( ptP, vtDir, nId, nRefType, vInters)) {
LuaSetParam( L, true) ;
INTVECTOR vType( vInters.size()) ;
DBLVECTOR vPar( vInters.size()) ;
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
vType[i] = vInters[i].first ;
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneCurveInters( lua_State* L)
{
// 4 o 5 parametri : ptOn, vtN, nId, nDestGrpId [, nRefType]
Point3d ptOn ;
LuaCheckParam( L, 1, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
int nId ;
LuaCheckParam( L, 3, nId)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nCount = 0 ;
int nNewId = ExePlaneCurveInters( ptOn, vtN, nId, nDestGrpId, nRefType, &nCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneBoxInters( lua_State* L)
{
// 4 o 5 parametri : ptOn, vtN, b3Box, nDestGrpId [, nRefType]
Point3d ptOn ;
LuaCheckParam( L, 1, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
BBox3d b3Box ;
LuaCheckParam( L, 3, b3Box)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nSrfCount = 0 ;
int nNewId = ExePlaneBoxInters( ptOn, vtN, b3Box, nDestGrpId, nRefType, &nPntCount, &nCrvCount, &nSrfCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
LuaSetParam( L, nSrfCount) ;
return 4 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaPlaneSurfTmInters( lua_State* L) LuaPlaneSurfTmInters( lua_State* L)
@@ -188,59 +286,32 @@ LuaParPlanesSurfTmInters( lua_State* L)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfTmSurfTmInters( lua_State* L) LuaPlaneVolZmapInters( lua_State* L)
{ {
// 3 o 4 parametri : Id1, nId2, nDestGrpId [, dToler] // 4 o 5 parametri : ptP, vtN, nId, nDestGrpId [, nRefType]
int nId1 ; Point3d ptP ;
LuaCheckParam( L, 1, nId1) LuaCheckParam( L, 1, ptP)
int nId2 ;
LuaCheckParam( L, 2, nId2)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
double dToler = 20 * EPS_SMALL ;
LuaGetParam( L, 4, dToler) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nSrfCount = 0 ;
int nNewId = ExeSurfTmSurfTmInters( nId1, nId2, nDestGrpId, dToler, &nPntCount, &nCrvCount, &nSrfCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
LuaSetParam( L, nSrfCount) ;
return 4 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneCurveInters( lua_State* L)
{
// 4 o 5 parametri : ptOn, vtN, nId, nDestGrpId [, nRefType]
Point3d ptOn ;
LuaCheckParam( L, 1, ptOn)
Vector3d vtN ; Vector3d vtN ;
LuaCheckParam( L, 2, vtN) LuaCheckParam( L, 2, vtN)
int nId ; int nId ;
LuaCheckParam( L, 3, nId) LuaCheckParam( L, 3, nId)
int nDestGrpId ; int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) ; LuaCheckParam( L, 4, nDestGrpId)
int nRefType = RTY_DEFAULT ; int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ; LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// eseguo l'intersezione // eseguo calcolo intersezione
int nCount = 0 ; int nCount ;
int nNewId = ExePlaneCurveInters( ptOn, vtN, nId, nDestGrpId, nRefType, &nCount) ; int nFirstId = ExePlaneVolZmapInters( ptP, vtN, nId, nDestGrpId, nRefType, &nCount) ;
// restituisco il risultato // restituisco il risultato
if ( nNewId != GDB_ID_NULL) if ( nFirstId != GDB_ID_NULL) {
LuaSetParam( L, nNewId) ; LuaSetParam( L, nFirstId) ;
else LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ; LuaSetParam( L) ;
LuaSetParam( L, nCount) ; LuaSetParam( L) ;
}
return 2 ; return 2 ;
} }
@@ -272,68 +343,58 @@ LuaCurveCurveInters( lua_State* L)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaLineVolZmapInters( lua_State* L) LuaCurveSurfTmInters( lua_State* L)
{ {
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId] // 3 parametri : nCrvId, nStmId, nDestGrpId
Point3d ptP ; int nCrvId ;
LuaCheckParam( L, 1, ptP) LuaCheckParam( L, 1, nCrvId)
Vector3d vtDir ; int nStmId ;
LuaCheckParam( L, 2, vtDir) LuaCheckParam( L, 2, nStmId)
int nId ; int nDestGrpId ;
LuaCheckParam( L, 3, nId) LuaCheckParam( L, 3, nDestGrpId) ;
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// eseguo calcolo intersezione // eseguo l'intersezione
INTDBLVECTOR vInters ; int nPntCount = 0 ;
if ( ExeLineVolZmapInters( ptP, vtDir, nId, nRefType, vInters)) { int nCrvCount = 0 ;
LuaSetParam( L, true) ; int nNewId = ExeCurveSurfTmInters( nCrvId, nStmId, nDestGrpId, &nPntCount, &nCrvCount) ;
INTVECTOR vType( vInters.size()) ; // restituisco il risultato
DBLVECTOR vPar( vInters.size()) ; if ( nNewId != GDB_ID_NULL)
for ( size_t i = 0 ; i < vInters.size() ; ++ i) { LuaSetParam( L, nNewId) ;
vType[i] = vInters[i].first ; else
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ; LuaSetParam( L) ;
LuaSetParam( L) ; LuaSetParam( L, nPntCount) ;
LuaSetParam( L) ; LuaSetParam( L, nCrvCount) ;
}
return 3 ; return 3 ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaPlaneVolZmapInters( lua_State* L) LuaSurfTmSurfTmInters( lua_State* L)
{ {
// 4 o 5 parametri : ptP, vtN, nId, nDestGrpId [, nRefType] // 3 o 4 parametri : Id1, nId2, nDestGrpId [, dToler]
Point3d ptP ; int nId1 ;
LuaCheckParam( L, 1, ptP) LuaCheckParam( L, 1, nId1)
Vector3d vtN ; int nId2 ;
LuaCheckParam( L, 2, vtN) LuaCheckParam( L, 2, nId2)
int nId ;
LuaCheckParam( L, 3, nId)
int nDestGrpId ; int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) LuaCheckParam( L, 3, nDestGrpId) ;
int nRefType = RTY_DEFAULT ; double dToler = 20 * EPS_SMALL ;
LuaGetParam( L, 5, nRefType) ; LuaGetParam( L, 4, dToler) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// eseguo calcolo intersezione // eseguo l'intersezione
int nCount ; int nPntCount = 0 ;
int nFirstId = ExePlaneVolZmapInters( ptP, vtN, nId, nDestGrpId, nRefType, &nCount) ; int nCrvCount = 0 ;
int nSrfCount = 0 ;
int nNewId = ExeSurfTmSurfTmInters( nId1, nId2, nDestGrpId, dToler, &nPntCount, &nCrvCount, &nSrfCount) ;
// restituisco il risultato // restituisco il risultato
if ( nFirstId != GDB_ID_NULL) { if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nFirstId) ; LuaSetParam( L, nNewId) ;
LuaSetParam( L, nCount) ; else
}
else {
LuaSetParam( L) ; LuaSetParam( L) ;
LuaSetParam( L) ; LuaSetParam( L, nPntCount) ;
} LuaSetParam( L, nCrvCount) ;
return 2 ; LuaSetParam( L, nSrfCount) ;
return 4 ;
} }
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
@@ -341,15 +402,17 @@ bool
LuaInstallGeoInters( LuaMgr& luaMgr) LuaInstallGeoInters( LuaMgr& luaMgr)
{ {
bool bOk = ( &luaMgr != nullptr) ; bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineCurveInters", LuaLineCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineBoxInters", LuaLineBoxInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtLineBoxInters", LuaLineBoxInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneBoxInters", LuaPlaneBoxInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfTmInters", LuaLineSurfTmInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfTmInters", LuaLineSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineVolZmapInters", LuaLineVolZmapInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneCurveInters", LuaPlaneCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneBoxInters", LuaPlaneBoxInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneSurfTmInters", LuaPlaneSurfTmInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneSurfTmInters", LuaPlaneSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtParPlanesSurfTmInters", LuaParPlanesSurfTmInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtParPlanesSurfTmInters", LuaParPlanesSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneCurveInters", LuaPlaneCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCurveInters", LuaCurveCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineVolZmapInters", LuaLineVolZmapInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneVolZmapInters", LuaPlaneVolZmapInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneVolZmapInters", LuaPlaneVolZmapInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCurveInters", LuaCurveCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSurfTmInters", LuaCurveSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
return bOk ; return bOk ;
} }
+19
View File
@@ -262,6 +262,24 @@ LuaRemoveMachGroup( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaChangeMachGroupName( lua_State* L)
{
// 2 parametri : identificativo del gruppo, nuovo nome
int nMGroupInd ;
LuaCheckParam( L, 1, nMGroupInd)
string sNewName ;
LuaCheckParam( L, 2, sNewName)
LuaClearStack( L) ;
// cambio il nome della macchinata
string sName ;
bool bOk = ExeChangeMachGroupName( nMGroupInd, sNewName) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaGetMachGroupName( lua_State* L) LuaGetMachGroupName( lua_State* L)
@@ -4047,6 +4065,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachGroup", LuaAddMachGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachGroup", LuaAddMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyMachGroup", LuaCopyMachGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCopyMachGroup", LuaCopyMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveMachGroup", LuaRemoveMachGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveMachGroup", LuaRemoveMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeMachGroupName", LuaChangeMachGroupName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupName", LuaGetMachGroupName) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupName", LuaGetMachGroupName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupMachineName", LuaGetMachGroupMachineName) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupMachineName", LuaGetMachGroupMachineName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupId", LuaGetMachGroupId) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupId", LuaGetMachGroupId) ;
+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 ;
} }