Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 41c50a776e | |||
| f28da6d9e3 | |||
| c5b2121bd5 | |||
| 03785dcca3 | |||
| b4eccf1f18 | |||
| c169329660 | |||
| 94d76d3a68 | |||
| 9e725f3feb | |||
| d7db0a2d45 | |||
| fb388799ea | |||
| f6915d80fa | |||
| d412ce65cd | |||
| 61824a24ab |
+75
-178
@@ -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 ;
|
|
||||||
}
|
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
@@ -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)
|
||||||
|
|||||||
+735
-640
File diff suppressed because it is too large
Load Diff
@@ -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)
|
||||||
|
|||||||
Binary file not shown.
+4
-35
@@ -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 ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -980,7 +980,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 +1004,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
|
||||||
|
|||||||
@@ -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) ;
|
||||||
|
|||||||
+173
-137
@@ -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,32 @@ LuaCurveCurveInters( lua_State* L)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaLineVolZmapInters( lua_State* L)
|
LuaSurfTmSurfTmInters( lua_State* L)
|
||||||
{
|
{
|
||||||
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
|
// 3 o 4 parametri : Id1, nId2, nDestGrpId [, dToler]
|
||||||
Point3d ptP ;
|
int nId1 ;
|
||||||
LuaCheckParam( L, 1, ptP)
|
LuaCheckParam( L, 1, nId1)
|
||||||
Vector3d vtDir ;
|
int nId2 ;
|
||||||
LuaCheckParam( L, 2, vtDir)
|
LuaCheckParam( L, 2, nId2)
|
||||||
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)
|
|
||||||
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 +376,16 @@ 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( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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) ;
|
||||||
|
|||||||
Reference in New Issue
Block a user