Compare commits

...

13 Commits

Author SHA1 Message Date
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
14 changed files with 1092 additions and 1002 deletions
+75 -178
View File
@@ -480,7 +480,7 @@ MyCreateRadialDimension( int nParentId, int nCrvId, const Point3d& ptDim,
Point3d ptCenL = pArc->GetCenter() ;
ptCenL.LocToLoc( frArc, frLoc) ;
Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ;
vtNL.LocToLoc( frArc, frLoc) ;
// porto ptDimL sulla circonferenza cui appartiene l'arco
Vector3d vtDir = ptDimL - ptCenL ;
if ( ! vtDir.Normalize())
@@ -543,7 +543,7 @@ MyCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
Point3d ptCenL = pArc->GetCenter() ;
ptCenL.LocToLoc( frArc, frLoc) ;
Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ;
vtNL.LocToLoc( frArc, frLoc) ;
// porto ptDimL sulla circonferenza
Vector3d vtDir = ptDimL - ptCenL ;
if ( ! vtDir.Normalize())
@@ -583,7 +583,7 @@ ExeCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
//-------------------------------------------------------------------------------
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)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
@@ -594,7 +594,7 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// 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 ptP2L = GetPointLocal( pGeomDB, ptP2, 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()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim ) ||
! pDim->SetAngular( ptP1L, ptP0L, ptP2L, ptDimL, vtNL, sText))
! pDim->SetAngular( ptP1L, ptVL, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
@@ -611,16 +611,16 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP
//-------------------------------------------------------------------------------
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)
{
// eseguo
int nId = MyCreateAngularDimension( nParentId, ptP1, ptP0, ptP2, ptDim, sText, nRefType) ;
int nId = MyCreateAngularDimension( nParentId, ptP1, ptV, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimension(" + IdToString( nParentId) + ",{" +
ToString( ptP0) + "},{" +
ToString( ptV) + "},{" +
ToString( ptP1) + "},{" +
ToString( ptP2) + "},{" +
ToString( ptDim) + "},'" +
@@ -645,27 +645,24 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
//recupero le linee
// recupero le linee
ICurveLine* pCrv1 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[0])) ;
ICurveLine* pCrv2 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[1])) ;
if ( pCrv1 == nullptr || pCrv2 == nullptr)
return GDB_ID_NULL ;
PtrOwner<ICurveLine> pL1( pCrv1->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 ;
//porto tutto nel frLoc
// porto tutto nel frLoc
Frame3d frL1, frL2 ;
if ( ! pGeomDB->GetGlobFrame( vLineIds[0], frL1) || ! pGeomDB->GetGlobFrame( vLineIds[1], frL2))
return GDB_ID_NULL ;
pL1->LocToLoc( frL1, frLoc) ;
pL2->LocToLoc( frL2, frLoc) ;
// recupero il punto lo porto nel riferimento locale
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 ;
Vector3d vtL1, vtL2 ;
pL1->GetStartPoint( ptP1L) ;
@@ -674,15 +671,12 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL2->GetEndPoint( ptP4L) ;
pL1->GetStartDir( vtL1) ;
pL2->GetStartDir( vtL2) ;
// controllo se le rette sono coincidenti o parallele
if ( AreSameOrOppositeVectorApprox( vtL1, vtL2))
return GDB_ID_NULL ;
// verifico se le rette si intersecano già
Point3d ptP0L ;
Point3d ptCenL ;
IntersCurveCurve pInters( *pL1, *pL2) ;
IntCrvCrvInfo Info ;
int nNumeroInters = pInters.GetIntersCount() ;
// se non ho intersezioni estendo
if ( nNumeroInters == 0) {
@@ -691,54 +685,54 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL2->ExtendStartByLen( dLen) ;
pL1->ExtendEndByLen( dLen) ;
pL2->ExtendEndByLen( dLen) ;
//faccio intersezione
// faccio intersezione
IntersCurveCurve pIntersExt( *pL1, *pL2) ;
nNumeroInters = pIntersExt.GetIntersCount() ;
// le linee estese non si intersecano, quindi vuol dire che sono quasi parallele e lontanissime
if ( nNumeroInters == 0 )
return GDB_ID_NULL ;
else {
IntCrvCrvInfo Info ;
pIntersExt.GetIntCrvCrvInfo( 0, Info) ;
// controllo che non siano coincidenti
if ( Info.bOverlap)
return false ;
else
ptP0L = Info.IciA->ptI ;
ptCenL = Info.IciA->ptI ;
}
// seleziono i punti necessari
// se ptDimL è più vicino a ptP0L rispetto agli estremi esterni delle linee, allora tengo gli estremi interni
double dP1P0 = ( ptP1L - ptP0L ).Len() ;
double dP2P0 = ( ptP2L - ptP0L ).Len() ;
double dDimP0 = ( ptDimL - ptP0L ).Len() ;
if ( ( dDimP0 < dP1P0 || dDimP0 < dP2P0))
// se uno dei due punti è più vicino a ptP0L rispetto a ptDimL, allora tengo il punto più vicino a ptDimL
// se ptDimL è più vicino a ptCenL rispetto agli estremi esterni delle linee, allora tengo gli estremi interni
double dP1Cen = ( ptP1L - ptCenL).Len() ;
double dP2Cen = ( ptP2L - ptCenL).Len() ;
double dDimCen = ( ptDimL - ptCenL).Len() ;
if ( ( dDimCen < dP1Cen || dDimCen < dP2Cen))
// 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) ;
else
ptP1L = ( dP1P0 < dP2P0 ? ptP2L : ptP1L ) ;
ptP1L = ( dP1Cen < dP2Cen ? ptP2L : ptP1L ) ;
// rifaccio anche per l'altro lato
double dP3P0 = ( ptP3L - ptP0L).Len() ;
double dP4P0 = ( ptP4L - ptP0L).Len() ;
if ( dDimP0 < dP3P0 || dDimP0 < dP4P0 )
ptP3L = ( ( ptDimL - ptP3L).Len() < ( ptDimL - ptP4L).Len() ? ptP3L : ptP4L ) ;
double dP3Cen = ( ptP3L - ptCenL).Len() ;
double dP4Cen = ( ptP4L - ptCenL).Len() ;
if ( dDimCen < dP3Cen || dDimCen < dP4Cen)
ptP3L = ( ( ptDimL - ptP3L).Len() < ( ptDimL - ptP4L).Len() ? ptP3L : ptP4L) ;
else
ptP3L = ( dP3P0 < dP4P0 ? ptP4L : ptP3L) ;
ptP3L = ( dP3Cen < dP4Cen ? ptP4L : ptP3L) ;
}
// se ho già intesezioni devo capire in quale quadrante si trova ptDim
else {
// recupero l'intersezione
IntCrvCrvInfo Info ;
pInters.GetIntCrvCrvInfo( 0, Info) ;
// controllo che non siano coincidenti
if ( Info.bOverlap)
return false ;
// se non coincidono restituisco l'intersezione
else
ptP0L = Info.IciA->ptI ; // se non coincidono restituisco l'intersezione
// se le due linee hanno un estremo in comune, estendo le linee quel lato
if ( ( AreSamePointApprox( ptP0L, ptP1L) || AreSamePointApprox( ptP0L, ptP2L)) &&
( AreSamePointApprox( ptP0L, ptP3L) || AreSamePointApprox( ptP0L, ptP4L))) {
if ( AreSamePointApprox( ptP0L, ptP1L)) {
ptCenL = Info.IciA->ptI ;
// se le due linee hanno un estremo in comune, estendo le linee da quel lato
if ( ( AreSamePointApprox( ptCenL, ptP1L) || AreSamePointApprox( ptCenL, ptP2L)) &&
( AreSamePointApprox( ptCenL, ptP3L) || AreSamePointApprox( ptCenL, ptP4L))) {
if ( AreSamePointApprox( ptCenL, ptP1L)) {
pL1->ExtendStartByLen(Dist( ptP1L, ptP2L) / 2) ;
pL1->GetStartPoint( ptP1L) ;
}
@@ -746,8 +740,8 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL1->ExtendEndByLen(Dist( ptP1L, ptP2L) / 2) ;
pL1->GetEndPoint( ptP2L) ;
}
if ( AreSamePointApprox( ptP0L, ptP3L) ) {
pL2->ExtendStartByLen(Dist( ptP3L, ptP4L) / 2);
if ( AreSamePointApprox( ptCenL, ptP3L)) {
pL2->ExtendStartByLen( Dist( ptP3L, ptP4L) / 2);
pL2->GetStartPoint( ptP3L) ;
}
else {
@@ -755,36 +749,42 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL2->GetEndPoint( ptP4L) ;
}
}
// seleziono i punti necessari
// proietto pdDim su vtLine1 e su vtLine2
Point3d ptDim1, ptDim2 ;
DistPointCurve distPL1( ptDimL, *pL1, true) ;
DistPointCurve distPL2( ptDimL, *pL2, true) ;
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 ;
if ( abs(( ptDim1 - ptP1L).Len() + ( ptP0L - ptDim1).Len() - ( ptP0L - ptP1L).Len()) < EPS_SMALL ||
abs(( ptDim1 - ptP1L).Len() + ( ptP0L - ptP1L ).Len() - ( ptDim1 - ptP0L).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L, quindi tengo ptP1L
if ( abs(( ptDim1 - ptP1L).Len() + ( ptCenL - ptDim1).Len() - ( ptCenL - ptP1L).Len()) < EPS_SMALL ||
abs(( ptDim1 - ptP1L).Len() + ( ptCenL - ptP1L ).Len() - ( ptDim1 - ptCenL).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L, quindi tengo ptP1L
;
else
// ptDim è dal lato di ptP2L
ptP1L = ptP2L ;
if ( abs(( ptDim2 - ptP3L).Len() + ( ptP0L - ptDim2).Len() - ( ptP0L - ptP3L).Len()) < EPS_SMALL ||
abs(( ptDim2 - ptP3L).Len() + ( ptP0L - ptP3L).Len() - ( ptDim2 - ptP0L).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L, quindi tengo ptP3L
;
if ( abs(( ptDim2 - ptP3L).Len() + ( ptCenL - ptDim2).Len() - ( ptCenL - ptP3L).Len()) < EPS_SMALL ||
abs(( ptDim2 - ptP3L).Len() + ( ptCenL - ptP3L).Len() - ( ptDim2 - ptCenL).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L
;
else
// ptDim è dal lato di ptP2L
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
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim ) ||
! MySetDimensionStyle( pDim ) ||
! pDim->SetAngular( ptP1L, ptP0L, ptP3L, ptDimL, vtNL, sText))
! pDim->SetAngular( ptP1L, ptCenL, ptP3L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
@@ -825,50 +825,36 @@ MyCreateAngularDimensionFromArc( int nParentId, int nCrvId, const Point3d& ptDim
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero l'arco e il suo frame
ICurveArc* pCurve = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCurve == nullptr)
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pArc == nullptr)
return GDB_ID_NULL ;
Frame3d frArc;
Frame3d frArc ;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frArc))
return GDB_ID_NULL ;
PtrOwner<ICurveArc> pCrv( pCurve->Clone()) ;
if ( IsNull( pCrv ) || ! pCrv->IsValid())
return GDB_ID_NULL ;
// porto tutto nel frLoc
pCrv->LocToLoc( frArc, frLoc ) ;
// recupero i punti e la normale e li porto nel frame locale
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
//recupero i punti e i versori
Point3d ptP0L, ptP1L, ptP2L ;
pCrv->GetStartPoint( ptP1L) ;
pCrv->GetEndPoint( ptP2L) ;
pCrv->GetCenterPoint( ptP0L) ;
Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ;
Point3d ptCenL, ptP1L, ptP2L ;
pArc->GetStartPoint( ptP1L) ;
ptP1L.LocToLoc( frArc, frLoc) ;
pArc->GetEndPoint( ptP2L) ;
ptP2L.LocToLoc( frArc, frLoc) ;
pArc->GetCenterPoint( ptCenL) ;
ptCenL.LocToLoc( frArc, frLoc) ;
// porto ptDimL nell'area di influenza dell'arco
Point3d ptDimNew ;
double dDist = ( ptDimL - ptP0L).Len() ;
Point3d ptMid ;
pCrv->GetMidPoint( ptMid) ;
Vector3d vtDir = ( ptMid - ptP0L) ;
vtDir.Normalize() ;
ptDimNew = ptP0L + dDist * vtDir ;
// proietto il punto sul piano XY della griglia
Frame3d frGrid = pGeomDB->GetGridFrame() ;
if ( ! frGrid.IsValid())
return GDB_ID_NULL ;
Point3d ptOrig = frGrid.Orig() ;
ptDimNew -= ( ptDimNew - ptOrig) * vtNL * vtNL;
pArc->GetMidPoint( ptMid) ;
Vector3d vtDir = ( ptMid - ptCenL) ;
if ( ! vtDir.Normalize())
return GDB_ID_NULL ;
ptDimL = ptCenL + Dist( ptDimL, ptCenL) * vtDir ;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim ) ||
! MySetDimensionStyle( pDim) ||
! pDim->SetAngular( ptP1L, ptP0L, ptP2L, ptDimNew, vtNL, sText))
! pDim->SetAngular( ptP1L, ptCenL, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
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
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)
return nullptr ;
// porto la seconda curva nel riferimento della prima
PtrOwner<ICurve> pCrv2Loc( pCrv2->Clone()) ;
if ( IsNull( pCrv2Loc))
return nullptr ;
pCrv2Loc->LocToLoc( frCrv2, frCrv1) ;
CurveLocal Crv2Loc( pGeomDB, nIdF, frCrv1) ;
// porto il punto vicino al finale nel riferimento della prima curva
Point3d ptN2loc( ptFin) ;
ptN2loc.LocToLoc( frDest, frCrv1) ;
// calcolo la retta tangente alle due curve
PtrOwner<ICurveLine> pCrvLine ;
pCrvLine.Set( GetLineTgTwoCurves( *pCrv1, ptN1loc, *pCrv2Loc, ptN2loc)) ;
pCrvLine.Set( GetLineTgTwoCurves( *pCrv1, ptN1loc, *Crv2Loc, ptN2loc)) ;
if ( IsNull( pCrvLine))
return nullptr ;
// porto la linea nel riferimento del gruppo destinazione
-1
View File
@@ -27,7 +27,6 @@
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "EgtDev/Include/EGkVoronoi.h"
//----------------------------------------------------------------------------
bool
+26
View File
@@ -368,6 +368,32 @@ ExeSurfFrOffset( int nId, double dDist, int nType)
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
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 bool s_bNetHwKey = false ;
static int s_nKeyExpDays = 0 ;
static int s_nKeyAssExpDays = 0 ;
static int s_nKeyOptExpDays = 0 ;
static string s_sNestKey ;
static string s_sLockId ;
@@ -519,7 +520,7 @@ bool
ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev)
{
// 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) ;
if ( nRet != KEY_OK) {
string sErr = "Error on Key (EGKL/" + ToString( nRet) + ")" ;
@@ -527,7 +528,6 @@ ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev)
nKLev = - nRet ;
return false ;
}
return true ;
}
@@ -551,7 +551,6 @@ ExeGetKeyOptions( int nProd, int nVer, int nLev, unsigned int& nOpt2)
LOG_ERROR( s_pGenLog, sErr.c_str()) ;
return true ;
}
return true ;
}
@@ -565,6 +564,16 @@ ExeGetKeyLeftDays( int& nLeftDays)
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeGetKeyAssLeftDays( int& nAssLeftDays)
{
if ( s_nKeyAssExpDays == 0)
return false ;
nAssLeftDays = s_nKeyAssExpDays - GetCurrDay() ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeGetKeyOptLeftDays( int& nOptLeftDays)
+735 -640
View File
File diff suppressed because it is too large Load Diff
+20
View File
@@ -284,6 +284,26 @@ ExeRemoveMachGroup( int nMGroupId)
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
ExeGetMachGroupName( int nId, string& sName)
BIN
View File
Binary file not shown.
+4 -35
View File
@@ -400,13 +400,13 @@ LuaCreateDiametralDimension( lua_State* L )
static int
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 ;
LuaCheckParam( L, 1, nParentId)
Point3d ptP1 ;
LuaCheckParam( L, 2, ptP1) ;
Point3d ptP0 ;
LuaCheckParam( L, 3, ptP0) ;
Point3d ptV ;
LuaCheckParam( L, 3, ptV) ;
Point3d ptP2 ;
LuaCheckParam( L, 4, ptP2) ;
Point3d ptDim ;
@@ -417,7 +417,7 @@ LuaCreateAngularDimension(lua_State* L)
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ;
// 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
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -478,36 +478,6 @@ LuaCreateAngularDimensionFromArc( lua_State* L)
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
LuaInstallGdbCreate( LuaMgr& luaMgr)
@@ -530,6 +500,5 @@ LuaInstallGdbCreate( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension);
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromCircle", LuaCreateAngularDimensionFromCircle) ;
return bOk ;
}
-1
View File
@@ -18,7 +18,6 @@
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGkVoronoi.h"
//----------------------------------------------------------------------------
static int
+2 -2
View File
@@ -980,7 +980,7 @@ LuaCurveGetVoronoi( lua_State* L)
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
int nBound = VORONOI_STD_BOUND ;
int nBound = 3 ; // VORONOI_STD_BOUND
LuaGetParam( L, 3, nBound) ;
LuaClearStack( L) ;
// eseguo
@@ -1004,7 +1004,7 @@ LuaCurveMedialAxisAdv( lua_State* L)
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
int nSide = Voronoi::WMAT_LEFT ;
int nSide = 1 ; // WMAT_LEFT
LuaGetParam( L, 3, nSide) ;
LuaClearStack( L) ;
// eseguo
+24
View File
@@ -141,6 +141,29 @@ LuaSurfFrOffset( lua_State* L)
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
LuaSurfTmMoveVertex( lua_State* L)
@@ -451,6 +474,7 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrSubtract", LuaSurfFrSubtract) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrIntersect", LuaSurfFrIntersect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffsetAdv", LuaSurfFrOffsetAdv) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveVertex", LuaSurfTmMoveVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ;
+173 -137
View File
@@ -20,6 +20,41 @@
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
LuaLineBoxInters( lua_State* L)
@@ -53,38 +88,6 @@ LuaLineBoxInters( lua_State* L)
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
LuaLineSurfTmInters( lua_State* L)
@@ -120,6 +123,101 @@ LuaLineSurfTmInters( lua_State* L)
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaLineVolZmapInters( lua_State* L)
{
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir)
int nId ;
LuaCheckParam( L, 3, nId)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// eseguo calcolo intersezione
INTDBLVECTOR vInters ;
if ( ExeLineVolZmapInters( ptP, vtDir, nId, nRefType, vInters)) {
LuaSetParam( L, true) ;
INTVECTOR vType( vInters.size()) ;
DBLVECTOR vPar( vInters.size()) ;
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
vType[i] = vInters[i].first ;
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneCurveInters( lua_State* L)
{
// 4 o 5 parametri : ptOn, vtN, nId, nDestGrpId [, nRefType]
Point3d ptOn ;
LuaCheckParam( L, 1, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
int nId ;
LuaCheckParam( L, 3, nId)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nCount = 0 ;
int nNewId = ExePlaneCurveInters( ptOn, vtN, nId, nDestGrpId, nRefType, &nCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneBoxInters( lua_State* L)
{
// 4 o 5 parametri : ptOn, vtN, b3Box, nDestGrpId [, nRefType]
Point3d ptOn ;
LuaCheckParam( L, 1, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
BBox3d b3Box ;
LuaCheckParam( L, 3, b3Box)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nSrfCount = 0 ;
int nNewId = ExePlaneBoxInters( ptOn, vtN, b3Box, nDestGrpId, nRefType, &nPntCount, &nCrvCount, &nSrfCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
LuaSetParam( L, nSrfCount) ;
return 4 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneSurfTmInters( lua_State* L)
@@ -188,59 +286,32 @@ LuaParPlanesSurfTmInters( lua_State* L)
//----------------------------------------------------------------------------
static int
LuaSurfTmSurfTmInters( lua_State* L)
LuaPlaneVolZmapInters( lua_State* L)
{
// 3 o 4 parametri : Id1, nId2, nDestGrpId [, dToler]
int nId1 ;
LuaCheckParam( L, 1, nId1)
int nId2 ;
LuaCheckParam( L, 2, nId2)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
double dToler = 20 * EPS_SMALL ;
LuaGetParam( L, 4, dToler) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nSrfCount = 0 ;
int nNewId = ExeSurfTmSurfTmInters( nId1, nId2, nDestGrpId, dToler, &nPntCount, &nCrvCount, &nSrfCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
LuaSetParam( L, nSrfCount) ;
return 4 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneCurveInters( lua_State* L)
{
// 4 o 5 parametri : ptOn, vtN, nId, nDestGrpId [, nRefType]
Point3d ptOn ;
LuaCheckParam( L, 1, ptOn)
// 4 o 5 parametri : ptP, vtN, nId, nDestGrpId [, nRefType]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
int nId ;
LuaCheckParam( L, 3, nId)
int nDestGrpId ;
LuaCheckParam( L, 4, 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) ;
// eseguo calcolo intersezione
int nCount ;
int nFirstId = ExePlaneVolZmapInters( ptP, vtN, nId, nDestGrpId, nRefType, &nCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
if ( nFirstId != GDB_ID_NULL) {
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
LuaSetParam( L) ;
}
return 2 ;
}
@@ -272,68 +343,32 @@ LuaCurveCurveInters( lua_State* L)
//----------------------------------------------------------------------------
static int
LuaLineVolZmapInters( lua_State* L)
LuaSurfTmSurfTmInters( 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
LuaPlaneVolZmapInters( lua_State* L)
{
// 4 o 5 parametri : ptP, vtN, nId, nDestGrpId [, nRefType]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
int nId ;
LuaCheckParam( L, 3, nId)
// 3 o 4 parametri : Id1, nId2, nDestGrpId [, dToler]
int nId1 ;
LuaCheckParam( L, 1, nId1)
int nId2 ;
LuaCheckParam( L, 2, nId2)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaCheckParam( L, 3, nDestGrpId) ;
double dToler = 20 * EPS_SMALL ;
LuaGetParam( L, 4, dToler) ;
LuaClearStack( L) ;
// eseguo calcolo intersezione
int nCount ;
int nFirstId = ExePlaneVolZmapInters( ptP, vtN, nId, nDestGrpId, nRefType, &nCount) ;
// 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 ( nFirstId != GDB_ID_NULL) {
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
}
else {
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
LuaSetParam( L, nSrfCount) ;
return 4 ;
}
//-------------------------------------------------------------------------------
@@ -341,15 +376,16 @@ bool
LuaInstallGeoInters( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineCurveInters", LuaLineCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineBoxInters", LuaLineBoxInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneBoxInters", LuaPlaneBoxInters) ;
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( "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( "EgtCurveCurveInters", LuaCurveCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
return bOk ;
}
}
+19
View File
@@ -262,6 +262,24 @@ LuaRemoveMachGroup( lua_State* L)
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
LuaGetMachGroupName( lua_State* L)
@@ -4047,6 +4065,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachGroup", LuaAddMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyMachGroup", LuaCopyMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveMachGroup", LuaRemoveMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeMachGroupName", LuaChangeMachGroupName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupName", LuaGetMachGroupName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupMachineName", LuaGetMachGroupMachineName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupId", LuaGetMachGroupId) ;