Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 73db521008 | |||
| 82d1465ecd | |||
| 047bff2f11 | |||
| 611c08bb4c | |||
| c69036ef2c | |||
| b0c1ba14e8 | |||
| 66a232a6a0 | |||
| 89e8b02316 | |||
| d1cb3d7de7 | |||
| 6c640b902f | |||
| 49d2600cc7 | |||
| ce92c8f6c9 | |||
| 303b7d8f0e | |||
| 308e50549d | |||
| 5f2c538ab8 | |||
| 8e85070df1 | |||
| 95ec7a83ef | |||
| ed1ba0543b | |||
| 26544984ad | |||
| e82c7417b6 | |||
| a3fa91244d | |||
| e06dd65888 | |||
| abbc5415ab | |||
| 603cb083cc | |||
| d9cfc375a9 | |||
| cce5e6ae76 | |||
| 407ca752ab | |||
| 41c50a776e | |||
| f28da6d9e3 | |||
| c5b2121bd5 | |||
| 03785dcca3 | |||
| b4eccf1f18 | |||
| c169329660 | |||
| 94d76d3a68 | |||
| 9e725f3feb | |||
| d7db0a2d45 | |||
| fb388799ea | |||
| f6915d80fa | |||
| d412ce65cd | |||
| 61824a24ab |
+19
-15
@@ -49,7 +49,7 @@ MyCDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, int nSurfTmI
|
|||||||
// porto in locale alla superficie il riferimento del box (il vettore è già in questo stesso riferimento)
|
// porto in locale alla superficie il riferimento del box (il vettore è già in questo stesso riferimento)
|
||||||
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frSurf) ;
|
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frSurf) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( CDeBoxClosedSurfTm( frBoxL, vtDiag, dSafeDist, *pStm) ? 1 : 0) ;
|
return ( CDeBoxClosedSurfTm( frBoxL, vtDiag, *pStm, dSafeDist) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -69,7 +69,7 @@ MyCDeBoxVolZmap( const Frame3d& frBox, const Vector3d& vtDiag, int nZmapId, doub
|
|||||||
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
|
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
|
||||||
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frLoc) ;
|
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frLoc) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( pVZM->AvoidBox( frBoxL, vtDiag, dSafeDist, false) ? 0 : 1) ;
|
return ( pVZM->CDeBox( frBoxL, vtDiag, dSafeDist, false) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -118,7 +118,7 @@ MyCDeRectPrismoidClosedSurfTm( const Frame3d& frPrismoid, double dBaseLenX, doub
|
|||||||
// porto in locale alla superficie il riferimento del prismoide rettangolare
|
// porto in locale alla superficie il riferimento del prismoide rettangolare
|
||||||
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frSurf) ;
|
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frSurf) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( CDeRectPrismoidClosedSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, *pStm) ? 1 : 0) ;
|
return ( CDeRectPrismoidClosedSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, *pStm, dSafeDist) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -140,7 +140,7 @@ MyCDeRectPrismoidVolZmap( const Frame3d& frPrismoid, double dBaseLenX, double dB
|
|||||||
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
|
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
|
||||||
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frLoc) ;
|
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frLoc) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( pVZM->AvoidRectPrismoid( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, false) ? 0 : 1) ;
|
return ( pVZM->CDeRectPrismoid( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, false) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -193,7 +193,7 @@ MyCDeCylClosedSurfTm( const Frame3d& frCyl, double dR, double dH, int nSurfTmId,
|
|||||||
// porto in locale alla superficie il riferimento del cilindro
|
// porto in locale alla superficie il riferimento del cilindro
|
||||||
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frSurf) ;
|
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frSurf) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( CDeCylClosedSurfTm( frCylL, dR, dH, dSafeDist, *pStm) ? 1 : 0) ;
|
return ( CDeCylClosedSurfTm( frCylL, dR, dH, *pStm, dSafeDist) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -213,7 +213,7 @@ MyCDeCylVolZmap( const Frame3d& frCyl, double dR, double dH, int nZmapId, double
|
|||||||
// porto in locale il riferimento
|
// porto in locale il riferimento
|
||||||
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frLoc) ;
|
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frLoc) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( pVZM->AvoidCylinder( frCylL, dR, dH, dSafeDist, false) ? 0 : 1) ;
|
return ( pVZM->CDeCylinder( frCylL, dR, dH, dSafeDist, false) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -261,7 +261,7 @@ MyCDeConeClosedSurfTm( const Frame3d& frCone, double dR1, double dR2, double dH,
|
|||||||
// porto in locale alla superficie il riferimento del cilindro
|
// porto in locale alla superficie il riferimento del cilindro
|
||||||
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frSurf) ;
|
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frSurf) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( CDeConeFrustumClosedSurfTm( frConeL, dR1, dR2, dH, dSafeDist, *pStm) ? 1 : 0) ;
|
return ( CDeConeFrustumClosedSurfTm( frConeL, dR1, dR2, dH, *pStm, dSafeDist) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -281,7 +281,7 @@ MyCDeConeVolZmap( const Frame3d& frCone, double dR1, double dR2, double dH, int
|
|||||||
// porto in locale il riferimento
|
// porto in locale il riferimento
|
||||||
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frLoc) ;
|
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frLoc) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( pVZM->AvoidConeFrustum( frConeL, dR1, dR2, dH, dSafeDist, false) ? 0 : 1) ;
|
return ( pVZM->CDeConeFrustum( frConeL, dR1, dR2, dH, dSafeDist, false) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -330,7 +330,7 @@ MyCDeSpheClosedSurfTm( const Point3d& ptCen, double dR, int nSurfTmId, double dS
|
|||||||
// porto in locale alla superficie il centro della sfera
|
// porto in locale alla superficie il centro della sfera
|
||||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ;
|
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( CDeSpheClosedSurfTm( ptCenL, dR, dSafeDist, *pStm) ? 1 : 0) ;
|
return ( CDeSpheClosedSurfTm( ptCenL, dR, *pStm, dSafeDist) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -350,7 +350,7 @@ MyCDeSpheVolZmap( const Point3d& ptCen, double dRad, int nZmapId, double dSafeDi
|
|||||||
// porto in locale il centro della sfera
|
// porto in locale il centro della sfera
|
||||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
|
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( pVZM->AvoidSphere( ptCenL, dRad, dSafeDist, false) ? 0 : 1) ;
|
return ( pVZM->CDeSphere( ptCenL, dRad, dSafeDist, false) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -420,7 +420,7 @@ MyCDeClosedSurfTmVolZmap( int nSurfTmId, int nZmapId, double dSafeDist)
|
|||||||
if ( pVZM == nullptr)
|
if ( pVZM == nullptr)
|
||||||
return -1 ;
|
return -1 ;
|
||||||
// verifico la collisione
|
// verifico la collisione
|
||||||
return ( pVZM->AvoidSurfTm( *pStm, dSafeDist, false) ? 0 : 1) ;
|
return ( pVZM->CDeSurfTm( *pStm, dSafeDist, false) ? 1 : 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -429,10 +429,14 @@ ExeCDeSolidSolid( int nSolid1Id, int nSolid2Id, double dSafeDist)
|
|||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
int nRes = -1 ;
|
int nRes = -1 ;
|
||||||
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
|
if ( pGeomDB != nullptr) {
|
||||||
nRes = MyCDeClosedSurfTmClosedSurfTm( nSolid1Id, nSolid2Id, dSafeDist) ;
|
if ( pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
|
||||||
else if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == VOL_ZMAP)
|
nRes = MyCDeClosedSurfTmClosedSurfTm( nSolid1Id, nSolid2Id, dSafeDist) ;
|
||||||
nRes = MyCDeClosedSurfTmVolZmap( nSolid1Id, nSolid2Id, dSafeDist) ;
|
else if ( pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == VOL_ZMAP)
|
||||||
|
nRes = MyCDeClosedSurfTmVolZmap( nSolid1Id, nSolid2Id, dSafeDist) ;
|
||||||
|
else if ( pGeomDB->GetGeoType( nSolid1Id) == VOL_ZMAP && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
|
||||||
|
nRes = MyCDeClosedSurfTmVolZmap( nSolid2Id, nSolid1Id, dSafeDist) ;
|
||||||
|
}
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
string sLua = "EgtCDeSolidSolid({" + IdToString( nSolid1Id) + "," +
|
string sLua = "EgtCDeSolidSolid({" + IdToString( nSolid1Id) + "," +
|
||||||
|
|||||||
+131
-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& ptV, const Point3d& ptP1, const Point3d& ptP2,
|
||||||
const Point3d& ptDim, const string& sText, int nRefType)
|
const Point3d& ptDim, const string& sText, int nRefType)
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
@@ -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( ptVL, ptP1L, ptP2L, ptDimL, vtNL, sText))
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// inserisco la quota nel DB
|
// inserisco la quota nel DB
|
||||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
|
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
|
||||||
@@ -611,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& ptV, const Point3d& ptP1, const Point3d& ptP2,
|
||||||
const Point3d& ptDim, const string& sText, int nRefType)
|
const Point3d& ptDim, const string& sText, int nRefType)
|
||||||
{
|
{
|
||||||
// eseguo
|
// eseguo
|
||||||
int nId = MyCreateAngularDimension( nParentId, ptP1, ptP0, ptP2, ptDim, sText, nRefType) ;
|
int nId = MyCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
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) + "},'" +
|
||||||
@@ -633,6 +633,62 @@ ExeCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& pt
|
|||||||
return nId ;
|
return nId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
MyCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
|
||||||
|
const Point3d& ptV2,const Point3d& ptP2, const Point3d& ptDim,
|
||||||
|
const string& sText, int nRefType)
|
||||||
|
{
|
||||||
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
|
nParentId = AdjustId( nParentId) ;
|
||||||
|
// recupero il riferimento locale
|
||||||
|
Frame3d frLoc ;
|
||||||
|
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
// porto in locale i punti e assegno i versori
|
||||||
|
Point3d ptV1L = GetPointLocal( pGeomDB, ptV1, nRefType, frLoc) ;
|
||||||
|
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
|
||||||
|
Point3d ptV2L = GetPointLocal( pGeomDB, ptV2, nRefType, frLoc) ;
|
||||||
|
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
|
||||||
|
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
|
||||||
|
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
|
||||||
|
// creo la quota
|
||||||
|
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
|
||||||
|
if ( IsNull( pDim) ||
|
||||||
|
! MySetDimensionStyle( pDim ) ||
|
||||||
|
! pDim->SetAngularEx( ptV1L, ptP1L, ptV2L, ptP2L, ptDimL, vtNL, sText))
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
// inserisco la quota nel DB
|
||||||
|
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
int
|
||||||
|
ExeCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
|
||||||
|
const Point3d& ptV2, const Point3d& ptP2, const Point3d& ptDim,
|
||||||
|
const string& sText, int nRefType)
|
||||||
|
{
|
||||||
|
// eseguo
|
||||||
|
int nId = MyCreateAngularDimensionEx( nParentId, ptV1, ptP1, ptV2, ptP2, ptDim, sText, nRefType) ;
|
||||||
|
ExeSetModified() ;
|
||||||
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
|
if ( IsCmdLog()) {
|
||||||
|
string sLua = "EgtAngularDimensionEx(" + IdToString( nParentId) + ",{" +
|
||||||
|
ToString( ptV1) + "},{" +
|
||||||
|
ToString( ptP1) + "},{" +
|
||||||
|
ToString( ptV2) + "},{" +
|
||||||
|
ToString( ptP2) + "},{" +
|
||||||
|
ToString( ptDim) + "},'" +
|
||||||
|
StringToLuaString( sText) + "'," +
|
||||||
|
RefTypeToString( nRefType) + ")" +
|
||||||
|
" -- Id=" + ToString( nId) ;
|
||||||
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
}
|
||||||
|
// restituisco l'identificativo del oggetto
|
||||||
|
return nId ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Point3d& ptDim,
|
MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Point3d& ptDim,
|
||||||
@@ -645,27 +701,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 +727,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 +741,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 +796,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 +805,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 +881,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 +936,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
|
||||||
|
|||||||
+142
-1
@@ -33,6 +33,8 @@
|
|||||||
#include "/EgtDev/Include/EGkCurveLocal.h"
|
#include "/EgtDev/Include/EGkCurveLocal.h"
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||||
#include "/EgtDev/Include/EGkExtText.h"
|
#include "/EgtDev/Include/EGkExtText.h"
|
||||||
|
#include "/EgtDev/Include/EGkSbzStandard.h"
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
@@ -1286,6 +1288,43 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, d
|
|||||||
return nNewId ;
|
return nNewId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
int
|
||||||
|
ExeCreateSurfTmTransSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, double dLinTol)
|
||||||
|
{
|
||||||
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
|
nParentId = AdjustId( nParentId) ;
|
||||||
|
bool bOk = true ;
|
||||||
|
// recupero il riferimento locale
|
||||||
|
Frame3d frLoc ;
|
||||||
|
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||||
|
// recupero la sezione in locale
|
||||||
|
CurveLocal CrvSect( pGeomDB, nSectId, frLoc) ;
|
||||||
|
bOk = bOk && ( CrvSect.Get() != nullptr) ;
|
||||||
|
// recupero la guida in locale
|
||||||
|
CurveLocal CrvGuide( pGeomDB, nGuideId, frLoc) ;
|
||||||
|
bOk = bOk && ( CrvGuide.Get() != nullptr) ;
|
||||||
|
// creo la superficie trimesh
|
||||||
|
ISurfTriMesh* pSTM = nullptr ;
|
||||||
|
pSTM = ( bOk ? GetSurfTriMeshTransSwept( CrvSect, CrvGuide, bCapEnds, dLinTol) : nullptr) ;
|
||||||
|
// inserisco la superficie trimesh nel DB
|
||||||
|
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
||||||
|
ExeSetModified() ;
|
||||||
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
|
if ( IsCmdLog()) {
|
||||||
|
string sLua = "EgtSurfTmTransSwept(" + IdToString( nParentId) + "," +
|
||||||
|
ToString( nSectId) + "," +
|
||||||
|
ToString( nGuideId) + "," +
|
||||||
|
( bCapEnds ? "true" : "false") + "," +
|
||||||
|
ToString( dLinTol) + ")" +
|
||||||
|
" -- Id=" + ToString( nNewId) ;
|
||||||
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
}
|
||||||
|
// restituisco l'identificativo della nuova entità
|
||||||
|
return nNewId ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType, double dLinTol)
|
ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType, double dLinTol)
|
||||||
@@ -1536,7 +1575,7 @@ ExeCreateSurfTmBySurfBezier( int nParentId, int nSbezId)
|
|||||||
PtrOwner<ISurfTriMesh> pStm( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ;
|
PtrOwner<ISurfTriMesh> pStm( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ;
|
||||||
bOk = bOk && ! IsNull( pStm) ;
|
bOk = bOk && ! IsNull( pStm) ;
|
||||||
// la porto nel riferimento destinazione
|
// la porto nel riferimento destinazione
|
||||||
pStm->LocToLoc( frSou, frLoc) ;
|
bOk = bOk && pStm->LocToLoc( frSou, frLoc) ;
|
||||||
// inserisco la superficie trimesh nel DB
|
// inserisco la superficie trimesh nel DB
|
||||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
|
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
@@ -1638,6 +1677,8 @@ ExeCreateSurfBezier( int nParentId, int nDegU, int nDegV, int nSpanU, int nSpanV
|
|||||||
if ( ! pSurfBez->SetControlPoint( i, ptCtrl))
|
if ( ! pSurfBez->SetControlPoint( i, ptCtrl))
|
||||||
bOk = false ;
|
bOk = false ;
|
||||||
}
|
}
|
||||||
|
// calcolo eventuali poli
|
||||||
|
pSurfBez->CalcPoles() ;
|
||||||
// se superficie nulla (ovvero ridotta a punto), errore
|
// se superficie nulla (ovvero ridotta a punto), errore
|
||||||
bOk = bOk && ! pSurfBez->IsAPoint() ;
|
bOk = bOk && ! pSurfBez->IsAPoint() ;
|
||||||
// inserisco la superficie nel DB
|
// inserisco la superficie nel DB
|
||||||
@@ -1690,6 +1731,8 @@ ExeCreateSurfBezierRational( int nParentId, int nDegU, int nDegV, int nSpanU, in
|
|||||||
if ( ! pSurfBez->SetControlPoint( i, ptCtrl, vPntW[i].second))
|
if ( ! pSurfBez->SetControlPoint( i, ptCtrl, vPntW[i].second))
|
||||||
bOk = false ;
|
bOk = false ;
|
||||||
}
|
}
|
||||||
|
// calcolo eventuali poli
|
||||||
|
pSurfBez->CalcPoles() ;
|
||||||
// se superficie nulla (ovvero ridotta a punto), errore
|
// se superficie nulla (ovvero ridotta a punto), errore
|
||||||
bOk = bOk && ! pSurfBez->IsAPoint() ;
|
bOk = bOk && ! pSurfBez->IsAPoint() ;
|
||||||
// inserisco la superficie nel DB
|
// inserisco la superficie nel DB
|
||||||
@@ -1782,3 +1825,101 @@ ExeCreateSurfBezierLeaves( int nParentId, int nSurfBzId, int nTextHeight, bool b
|
|||||||
*pnCount = nCount ;
|
*pnCount = nCount ;
|
||||||
return nFirstId ;
|
return nFirstId ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
int
|
||||||
|
ExeCreateSurfBezierTria2D( int nParentId, int nSurfBzId, int nTextHeight, bool bShowTrim, int* pnCount)
|
||||||
|
{
|
||||||
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
|
nParentId = AdjustId( nParentId) ;
|
||||||
|
// recupero la superficie
|
||||||
|
const ISurfBezier* pSurfBez = GetSurfBezier( pGeomDB->GetGeoObj( nSurfBzId)) ;
|
||||||
|
if ( pSurfBez == nullptr)
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
// disegno i triangoli
|
||||||
|
vector<tuple<int,Point3d,Point3d,Point3d>> vTria2D ;
|
||||||
|
pSurfBez->GetTriangles2D( vTria2D) ;
|
||||||
|
int nFirstId = GDB_ID_NULL ;
|
||||||
|
int nCount = 0 ;
|
||||||
|
bool bOk = true ;
|
||||||
|
for ( int k = 0 ; k < (int)vTria2D.size() ; ++ k) {
|
||||||
|
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
||||||
|
bOk = bOk && ! IsNull( pStm) ;
|
||||||
|
Point3d ptP1L = get<1>(vTria2D[k]) ;
|
||||||
|
Point3d ptP2L = get<2>(vTria2D[k]) ;
|
||||||
|
Point3d ptP3L = get<3>(vTria2D[k]) ;
|
||||||
|
// assegno il triangolo
|
||||||
|
if ( bOk) {
|
||||||
|
pStm->Init( 3, 1, 1) ;
|
||||||
|
int vV[3]{ pStm->AddVertex( ptP1L),
|
||||||
|
pStm->AddVertex( ptP2L),
|
||||||
|
pStm->AddVertex( ptP3L)} ;
|
||||||
|
bOk = ( pStm->AddTriangle( vV) != SVT_NULL) && pStm->AdjustTopology() ;
|
||||||
|
}
|
||||||
|
// inserisco la superficie nel DB
|
||||||
|
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
|
||||||
|
if ( nNewId == GDB_ID_NULL)
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
if ( nFirstId == GDB_ID_NULL)
|
||||||
|
nFirstId = nNewId ;
|
||||||
|
++ nCount ;
|
||||||
|
|
||||||
|
// creo il testo e lo riempio
|
||||||
|
string sText = ToString( get<0>( vTria2D[k])) ;
|
||||||
|
Point3d ptCenter( ( ptP1L + ptP2L + ptP3L) / 3) ;
|
||||||
|
PtrOwner<IExtText> pTXT( CreateExtText()) ;
|
||||||
|
if ( IsNull( pTXT) || ! pTXT->Set( ptCenter, Z_AX, X_AX, sText, "", false, nTextHeight))
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
// inserisco il testo nel DB
|
||||||
|
int nTxtId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) ;
|
||||||
|
if ( nTxtId == GDB_ID_NULL)
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
++ nCount ;
|
||||||
|
}
|
||||||
|
// se richiesto disegno la regione di trim
|
||||||
|
const ISurfFlatRegion* pSfr = pSurfBez->GetTrimRegion() ;
|
||||||
|
if ( bShowTrim && pSfr != nullptr) {
|
||||||
|
PtrOwner<ISurfFlatRegion> pTrimReg( pSfr->Clone()) ;
|
||||||
|
if ( ! IsNull( pTrimReg)) {
|
||||||
|
int nTrimId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTrimReg)) ;
|
||||||
|
if ( nTrimId == GDB_ID_NULL)
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
++ nCount ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// restituisco i risultati
|
||||||
|
if ( pnCount != nullptr)
|
||||||
|
*pnCount = nCount ;
|
||||||
|
return nFirstId ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
int
|
||||||
|
ExeCreateBezierSphere( int nParentId, const Point3d& ptCenter, double dR, int nRefType) {
|
||||||
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
|
nParentId = AdjustId( nParentId) ;
|
||||||
|
bool bOk = true ;
|
||||||
|
// recupero il riferimento di immersione della superficie
|
||||||
|
Frame3d frLoc ;
|
||||||
|
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||||
|
// reucpero il punto in locale
|
||||||
|
Point3d ptCenterLoc = GetPointLocal( pGeomDB, ptCenter, nRefType, frLoc) ;
|
||||||
|
// Creo la superficie
|
||||||
|
PtrOwner<ISurfBezier> pSurfBez( CreateBezierSphere( ptCenterLoc, dR)) ;
|
||||||
|
pSurfBez->CalcPoles() ;
|
||||||
|
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSurfBez)) : GDB_ID_NULL) ;
|
||||||
|
ExeSetModified() ;
|
||||||
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
|
if ( IsCmdLog()) {
|
||||||
|
string sLua = "EgtCreateBezierSphere(" + IdToString( nParentId) + "," +
|
||||||
|
ToString( ptCenter) + "," +
|
||||||
|
ToString( dR) + "," +
|
||||||
|
RefTypeToString( nRefType) + ")" +
|
||||||
|
" -- Id=" + ToString( nId) ;
|
||||||
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
}
|
||||||
|
// resituisco l'identificativo dell'entità creata
|
||||||
|
return nId ;
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||||
#include "/EgtDev/Include/EGkIntersCurves.h"
|
#include "/EgtDev/Include/EGkIntersCurves.h"
|
||||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||||
#include "EgtDev/Include/EGkVoronoi.h"
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
|
|||||||
+28
-17
@@ -1,7 +1,7 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2023-2023
|
// EgalTech 2023-2024
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : Exe_GdbGetPocketing.cpp Data : 28.11.23 Versione : 2.5k6
|
// File : Exe_GdbGetPocketing.cpp Data : 02.02.24 Versione : 2.6b1
|
||||||
// Contenuto : Funzioni di interrogazione di regioni piane del DBG per EXE.
|
// Contenuto : Funzioni di interrogazione di regioni piane del DBG per EXE.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "EXE.h"
|
#include "EXE.h"
|
||||||
#include "EXE_Macro.h"
|
#include "EXE_Macro.h"
|
||||||
#include "/EgtDev/Include/EXeExecutor.h"
|
#include "/EgtDev/Include/EXeExecutor.h"
|
||||||
|
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||||
#include "/EgtDev/Include/EGkCalcPocketing.h"
|
#include "/EgtDev/Include/EGkCalcPocketing.h"
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
@@ -25,14 +26,26 @@ bool
|
|||||||
ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId,
|
ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId,
|
||||||
int& nFirstId, int& nCrvCount)
|
int& nFirstId, int& nCrvCount)
|
||||||
{
|
{
|
||||||
// databse geometrico
|
// database geometrico
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, false) ;
|
VERIFY_GEOMDB( pGeomDB, false) ;
|
||||||
|
|
||||||
// recupero la FlatRegion per i percorsi
|
// recupero la FlatRegion da svuotare
|
||||||
|
PtrOwner<ISurfFlatRegion> pMySfr ;
|
||||||
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
|
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
|
||||||
if ( pSfr == nullptr)
|
if ( pSfr == nullptr) {
|
||||||
return false ;
|
// verifico se è una curva chiusa e piana che permette di definire una regione
|
||||||
|
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||||
|
Plane3d plPlane ;
|
||||||
|
if ( pCrv == nullptr || ! pCrv->IsFlat( plPlane, true, 10 * EPS_SMALL))
|
||||||
|
return false ;
|
||||||
|
SurfFlatRegionByContours SfrCntr ;
|
||||||
|
SfrCntr.AddCurve( pCrv->Clone()) ;
|
||||||
|
pMySfr.Set( SfrCntr.GetSurf()) ;
|
||||||
|
if ( IsNull( pMySfr))
|
||||||
|
return false ;
|
||||||
|
pSfr = pMySfr ;
|
||||||
|
}
|
||||||
|
|
||||||
// recupero il suo frame
|
// recupero il suo frame
|
||||||
Frame3d frSfr ;
|
Frame3d frSfr ;
|
||||||
@@ -44,23 +57,21 @@ ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType
|
|||||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// costruzione vettori di curve per Pocketing
|
|
||||||
ICRVCOMPOPOVECTOR vCrvCompoRes ;
|
|
||||||
|
|
||||||
// eseguo Pocketing
|
// eseguo Pocketing
|
||||||
|
ICRVCOMPOPOVECTOR vCrvCompoRes ;
|
||||||
bool bOk = CalcPocketing( pSfr, dRad, dStep, dAngle, nType, bSmooth, vCrvCompoRes) ;
|
bool bOk = CalcPocketing( pSfr, dRad, dStep, dAngle, nType, bSmooth, vCrvCompoRes) ;
|
||||||
nFirstId = GDB_ID_NULL ; // primo Id da restituire
|
nFirstId = GDB_ID_NULL ;
|
||||||
nCrvCount = int( vCrvCompoRes.size()) ;
|
nCrvCount = int( vCrvCompoRes.size()) ;
|
||||||
if ( bOk && int( vCrvCompoRes.size()) > 0) {
|
if ( bOk && nCrvCount > 0) {
|
||||||
// scorro le curve di Pocketing ottenute
|
// scorro le curve di Pocketing ottenute
|
||||||
for ( int u = 0 ; u < int( vCrvCompoRes.size()) ; ++ u) {
|
for ( int nI = 0 ; nI < nCrvCount ; ++ nI) {
|
||||||
vCrvCompoRes[u]->LocToLoc( frSfr, frDest) ;
|
vCrvCompoRes[nI]->LocToLoc( frSfr, frDest) ;
|
||||||
// inserisco la curva nel DB Geometrico
|
// inserisco la curva nel DB Geometrico
|
||||||
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrvCompoRes[u])) ;
|
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrvCompoRes[nI])) ;
|
||||||
if ( nCurrId == GDB_ID_NULL)
|
if ( nCurrId == GDB_ID_NULL)
|
||||||
return false ;
|
return false ;
|
||||||
if ( u == 0)
|
if ( nI == 0)
|
||||||
nFirstId = nCurrId ; // memorizzo il primo Id da restituire
|
nFirstId = nCurrId ;
|
||||||
}
|
}
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
}
|
}
|
||||||
@@ -73,7 +84,7 @@ ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType
|
|||||||
ToString( nType) + "," +
|
ToString( nType) + "," +
|
||||||
ToString( bSmooth) + "," +
|
ToString( bSmooth) + "," +
|
||||||
ToString( nDestGrpId) + ")" +
|
ToString( nDestGrpId) + ")" +
|
||||||
" -- Ok=" + ToString( bOk) + " FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCrvCount) ;
|
" FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCrvCount) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
return bOk ;
|
return bOk ;
|
||||||
|
|||||||
+14
-13
@@ -1462,25 +1462,26 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
|
|||||||
// richiedo i contorni della superficie e li inserisco nel DB
|
// richiedo i contorni della superficie e li inserisco nel DB
|
||||||
int nFirstId = GDB_ID_NULL ;
|
int nFirstId = GDB_ID_NULL ;
|
||||||
int nCount = 0 ;
|
int nCount = 0 ;
|
||||||
int nL = 0 ;
|
ICRVCOMPOPOVECTOR vCC ;
|
||||||
PtrOwner<ICurve> pCrv( bOk ? pSbz->GetLoop( nL) : nullptr) ;
|
pSbz->GetLoops( vCC , true) ;
|
||||||
while ( ! IsNull( pCrv)) {
|
for ( int i = 0 ; i < int( vCC.size()) ; ++i) {
|
||||||
// porto la curva nel riferimento destinazione
|
if ( IsNull( vCC[i]) || ! vCC[i]->IsValid())
|
||||||
bOk = bOk && pCrv->LocToLoc( frSurf, frDest) ;
|
continue ;
|
||||||
// la inserisco nel DB geometrico
|
// porto la curva nel riferimento destinazione
|
||||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCrv)) : GDB_ID_NULL) ;
|
bOk = bOk && vCC[i]->LocToLoc(frSurf, frDest) ;
|
||||||
|
// la inserisco nel DB geometrico
|
||||||
|
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCC[i])) : GDB_ID_NULL) ;
|
||||||
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
|
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
|
||||||
// copio il materiale
|
// copio il materiale
|
||||||
if ( ! pGeomDB->CopyMaterial( nId, nNewId))
|
if ( ! pGeomDB->CopyMaterial( nId, nNewId))
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// aggiorno contatori
|
// aggiorno contatori
|
||||||
if ( bOk && nFirstId == GDB_ID_NULL)
|
if ( bOk && nFirstId == GDB_ID_NULL)
|
||||||
nFirstId = nNewId ;
|
nFirstId = nNewId ;
|
||||||
if ( bOk)
|
if ( bOk)
|
||||||
++ nCount ;
|
++ nCount ;
|
||||||
// passo alla prossima curva
|
|
||||||
pCrv.Set( bOk ? pSbz->GetLoop( ++nL) : nullptr) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
@@ -1493,4 +1494,4 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
|
|||||||
if ( pnCount != nullptr)
|
if ( pnCount != nullptr)
|
||||||
*pnCount = nCount ;
|
*pnCount = nCount ;
|
||||||
return nFirstId ;
|
return nFirstId ;
|
||||||
}
|
}
|
||||||
+10
-6
@@ -186,7 +186,7 @@ ExeCurveMedialAxis( int nId)
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeApproxCurve( int nId, int nApprType, double dLinTol)
|
ExeApproxCurve( int nId, int nApprType, double dLinTol, double dMaxSegmLen)
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||||
@@ -200,7 +200,8 @@ ExeApproxCurve( int nId, int nApprType, double dLinTol)
|
|||||||
nApprType == APP_LEFT_LINES || nApprType == APP_LEFT_CONVEX_LINES ||
|
nApprType == APP_LEFT_LINES || nApprType == APP_LEFT_CONVEX_LINES ||
|
||||||
nApprType == APP_RIGHT_LINES || nApprType == APP_RIGHT_CONVEX_LINES) {
|
nApprType == APP_RIGHT_LINES || nApprType == APP_RIGHT_CONVEX_LINES) {
|
||||||
PolyLine PL ;
|
PolyLine PL ;
|
||||||
bOk = bOk && pCurve->ApproxWithLines( dLinTol, ANG_TOL_MAX_DEG, nApprType, PL) && pCC->FromPolyLine( PL) ;
|
bOk = bOk && pCurve->ApproxWithLines( dLinTol, ANG_TOL_MAX_DEG, nApprType, PL) &&
|
||||||
|
PL.AdjustForMaxSegmentLen( dMaxSegmLen) && pCC->FromPolyLine( PL) ;
|
||||||
// eliminazione di small Z
|
// eliminazione di small Z
|
||||||
bOk = bOk && pCC->RemoveSmallDefects( 0.5 * dLinTol, ANG_TOL_STD_DEG) ;
|
bOk = bOk && pCC->RemoveSmallDefects( 0.5 * dLinTol, ANG_TOL_STD_DEG) ;
|
||||||
}
|
}
|
||||||
@@ -2270,7 +2271,8 @@ ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static bool
|
static bool
|
||||||
MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId, double dLinTol, int nRefType)
|
MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId,
|
||||||
|
double dLinTol, double dMaxSegmLen, int nRefType)
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
@@ -2301,7 +2303,7 @@ MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int
|
|||||||
vtDirL.LocToLoc( frCrv, frStm) ;
|
vtDirL.LocToLoc( frCrv, frStm) ;
|
||||||
// eseguo la proiezione
|
// eseguo la proiezione
|
||||||
PNT5AXVECTOR vPt5ax ;
|
PNT5AXVECTOR vPt5ax ;
|
||||||
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, vtDirL, dLinTol, vPt5ax))
|
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, vtDirL, dLinTol, dMaxSegmLen, vPt5ax))
|
||||||
return false ;
|
return false ;
|
||||||
// inserisco la composita nel gruppo destinazione
|
// inserisco la composita nel gruppo destinazione
|
||||||
PtrOwner<ICurveComposite> pCompo ;
|
PtrOwner<ICurveComposite> pCompo ;
|
||||||
@@ -2338,9 +2340,10 @@ MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId, double dLinTol, int nRefType)
|
ExeProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId,
|
||||||
|
double dLinTol, double dMaxSegmLen, int nRefType)
|
||||||
{
|
{
|
||||||
bool bOk = MyProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, nRefType) ;
|
bool bOk = MyProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, nRefType) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
@@ -2349,6 +2352,7 @@ ExeProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int
|
|||||||
ToString( vtDir) + "}," +
|
ToString( vtDir) + "}," +
|
||||||
ToString( nDestGrpId) + "," +
|
ToString( nDestGrpId) + "," +
|
||||||
ToString( dLinTol) + "," +
|
ToString( dLinTol) + "," +
|
||||||
|
ToString( dMaxSegmLen) + "," +
|
||||||
RefTypeToString( nRefType) + ")" +
|
RefTypeToString( nRefType) + ")" +
|
||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
|||||||
+159
-32
@@ -77,7 +77,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
|
|||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// recupero il numero di componenti connesse
|
// recupero il numero di componenti connesse
|
||||||
int nParts = pStm->GetPartCount() ;
|
int nParts = pStm->GetPartCount() ;
|
||||||
// se ci sono pi� parti, separo queste
|
// se ci sono più parti, separo queste
|
||||||
if ( nParts > 1) {
|
if ( nParts > 1) {
|
||||||
int nFirstId = GDB_ID_NULL ;
|
int nFirstId = GDB_ID_NULL ;
|
||||||
nCount = 0 ;
|
nCount = 0 ;
|
||||||
@@ -104,7 +104,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
|
|||||||
}
|
}
|
||||||
// recupero il numero di facce
|
// recupero il numero di facce
|
||||||
int nFacets = pStm->GetFacetCount() ;
|
int nFacets = pStm->GetFacetCount() ;
|
||||||
// se ci sono pi� facce, separo queste
|
// se ci sono più facce, separo queste
|
||||||
if ( nFacets > 1) {
|
if ( nFacets > 1) {
|
||||||
// copio tutte le facce
|
// copio tutte le facce
|
||||||
int nFirstId = GDB_ID_NULL ;
|
int nFirstId = GDB_ID_NULL ;
|
||||||
@@ -130,7 +130,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
|
|||||||
// restituisco risultati
|
// restituisco risultati
|
||||||
return nFirstId ;
|
return nFirstId ;
|
||||||
}
|
}
|
||||||
// non devo fare alcunch�
|
// non devo fare alcunché
|
||||||
nCount = 1 ;
|
nCount = 1 ;
|
||||||
return nId ;
|
return nId ;
|
||||||
}
|
}
|
||||||
@@ -147,7 +147,7 @@ MyExplodeSurfFlatRegion( int nId, int& nCount)
|
|||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// recupero il numero di componenti connessi (chunk)
|
// recupero il numero di componenti connessi (chunk)
|
||||||
int nChunk = pSfr->GetChunkCount() ;
|
int nChunk = pSfr->GetChunkCount() ;
|
||||||
// se c'� un solo componente, non devo fare alcunch�
|
// se c'è un solo componente, non devo fare alcunché
|
||||||
if ( nChunk == 1) {
|
if ( nChunk == 1) {
|
||||||
nCount = 1 ;
|
nCount = 1 ;
|
||||||
return nId ;
|
return nId ;
|
||||||
@@ -296,7 +296,7 @@ ExeSurfFrSubtract( int nId1, int nId2)
|
|||||||
bOk = bOk && ( pSfr2L != nullptr) ;
|
bOk = bOk && ( pSfr2L != nullptr) ;
|
||||||
// eseguo la sottrazione della seconda superficie dalla prima
|
// eseguo la sottrazione della seconda superficie dalla prima
|
||||||
bOk = bOk && pSfr1->Subtract( *pSfr2L) ;
|
bOk = bOk && pSfr1->Subtract( *pSfr2L) ;
|
||||||
// se il risultato � vuoto, cancello la FlatRegion
|
// se il risultato è vuoto, cancello la FlatRegion
|
||||||
if ( bOk && ! pSfr1->IsValid())
|
if ( bOk && ! pSfr1->IsValid())
|
||||||
pGeomDB->Erase( nId1) ;
|
pGeomDB->Erase( nId1) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
@@ -328,7 +328,7 @@ ExeSurfFrIntersect( int nId1, int nId2)
|
|||||||
bOk = bOk && ( pSfr2L != nullptr) ;
|
bOk = bOk && ( pSfr2L != nullptr) ;
|
||||||
// eseguo l'intersezione tra le due superfici
|
// eseguo l'intersezione tra le due superfici
|
||||||
bOk = bOk && pSfr1->Intersect( *pSfr2L) ;
|
bOk = bOk && pSfr1->Intersect( *pSfr2L) ;
|
||||||
// se il risultato � vuoto, cancello la FlatRegion
|
// se il risultato è vuoto, cancello la FlatRegion
|
||||||
if ( bOk && ! pSfr1->IsValid())
|
if ( bOk && ! pSfr1->IsValid())
|
||||||
pGeomDB->Erase( nId1) ;
|
pGeomDB->Erase( nId1) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
@@ -353,7 +353,7 @@ ExeSurfFrOffset( int nId, double dDist, int nType)
|
|||||||
bool bOk = ( pSfr != nullptr) ;
|
bool bOk = ( pSfr != nullptr) ;
|
||||||
// eseguo l'offset
|
// eseguo l'offset
|
||||||
bOk = bOk && pSfr->Offset( dDist, nType) ;
|
bOk = bOk && pSfr->Offset( dDist, nType) ;
|
||||||
// se il risultato � vuoto, cancello la FlatRegion
|
// se il risultato è vuoto, cancello la FlatRegion
|
||||||
if ( bOk && ! pSfr->IsValid())
|
if ( bOk && ! pSfr->IsValid())
|
||||||
pGeomDB->Erase( nId) ;
|
pGeomDB->Erase( nId) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
@@ -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)
|
||||||
@@ -417,11 +443,11 @@ bool
|
|||||||
ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType, bool bUpdate)
|
ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType, bool bUpdate)
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
// recupero la superficie
|
// recupero la superficie
|
||||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||||
bool bOk = ( pStm != nullptr) ;
|
bool bOk = ( pStm != nullptr) ;
|
||||||
// recupero il riferimento in cui � immersa la superficie
|
// recupero il riferimento in cui è immersa la superficie
|
||||||
Frame3d frStm ;
|
Frame3d frStm ;
|
||||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
|
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
|
||||||
// eseguo la modifica
|
// eseguo la modifica
|
||||||
@@ -449,6 +475,50 @@ ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType,
|
|||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
ExeSurfTmMoveFacet( int nId, int nFacet, const Vector3d& vtMove, int nRefType, bool bUpdate)
|
||||||
|
{
|
||||||
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
|
// recupero la superficie
|
||||||
|
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||||
|
bool bOk = ( pStm != nullptr) ;
|
||||||
|
// recupero il riferimento in cui è immersa la superficie
|
||||||
|
Frame3d frStm ;
|
||||||
|
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
|
||||||
|
// porto in locale il movimento
|
||||||
|
Vector3d vtMoveL = GetVectorLocal( pGeomDB, vtMove, nRefType, frStm) ;
|
||||||
|
// recupero tutti i vertici della faccia
|
||||||
|
INTVECTOR vVert ;
|
||||||
|
bOk = bOk && pStm->GetAllVertInFacet( nFacet, vVert) ;
|
||||||
|
// sposto tutti i vertici della faccia della quantità desiderata
|
||||||
|
if ( bOk) {
|
||||||
|
for ( const auto nVert : vVert) {
|
||||||
|
// recupero la posizione originale del vertice
|
||||||
|
Point3d ptV ;
|
||||||
|
if ( pStm->GetVertex( nVert, ptV))
|
||||||
|
pStm->MoveVertex( nVert, ptV + vtMoveL) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// se richiesto, semplificazione della trimesh
|
||||||
|
if ( bUpdate)
|
||||||
|
bOk = bOk && pStm->DoCompacting() ;
|
||||||
|
ExeSetModified() ;
|
||||||
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
|
if ( IsCmdLog()) {
|
||||||
|
string sLua = "EgtSurfTmMoveFacet(" + IdToString( nId) + "," +
|
||||||
|
ToString( nFacet) + ",{" +
|
||||||
|
ToString( vtMove) + "}," +
|
||||||
|
RefTypeToString( nRefType) + "," +
|
||||||
|
( bUpdate ? "true" : "false") + ")" +
|
||||||
|
" -- Ok=" + ToString( bOk) ;
|
||||||
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
}
|
||||||
|
// restituisco risultato
|
||||||
|
return bOk ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
MySurfTmToTriangles( int nId, int& nCount)
|
MySurfTmToTriangles( int nId, int& nCount)
|
||||||
@@ -461,7 +531,7 @@ MySurfTmToTriangles( int nId, int& nCount)
|
|||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
// recupero il numero di triangoli
|
// recupero il numero di triangoli
|
||||||
int nTria = pStm->GetTriangleCount() ;
|
int nTria = pStm->GetTriangleCount() ;
|
||||||
// se ci sono pi� triangoli, li separo
|
// se ci sono più triangoli, li separo
|
||||||
if ( nTria > 1) {
|
if ( nTria > 1) {
|
||||||
// copio tutti triangoli
|
// copio tutti triangoli
|
||||||
int nFirstId = GDB_ID_NULL ;
|
int nFirstId = GDB_ID_NULL ;
|
||||||
@@ -487,7 +557,7 @@ MySurfTmToTriangles( int nId, int& nCount)
|
|||||||
// restituisco risultati
|
// restituisco risultati
|
||||||
return nFirstId ;
|
return nFirstId ;
|
||||||
}
|
}
|
||||||
// non devo fare alcunch�
|
// non devo fare alcunché
|
||||||
nCount = 1 ;
|
nCount = 1 ;
|
||||||
return nId ;
|
return nId ;
|
||||||
}
|
}
|
||||||
@@ -622,6 +692,41 @@ ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSave
|
|||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
ExeCutSurfBzPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSaveOnEq, int nRefType)
|
||||||
|
{
|
||||||
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
|
// recupero la superficie TriMesh
|
||||||
|
ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
|
||||||
|
bool bOk = ( pSbz != nullptr) ;
|
||||||
|
// recupero il riferimento locale
|
||||||
|
Frame3d frLoc ;
|
||||||
|
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||||
|
// porto in locale il punto e la normale del piano
|
||||||
|
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ;
|
||||||
|
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
|
||||||
|
// calcolo il piano di taglio
|
||||||
|
Plane3d plPlane ;
|
||||||
|
bOk = bOk && plPlane.Set( ptOnL, vtNL) ;
|
||||||
|
// eseguo il taglio
|
||||||
|
bOk = bOk && pSbz->Cut( plPlane, bSaveOnEq) ;
|
||||||
|
ExeSetModified() ;
|
||||||
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
|
if ( IsCmdLog()) {
|
||||||
|
string sLua = "EgtCutSurfBzPlane(" + IdToString( nId) + ",{" +
|
||||||
|
ToString( ptOn) + "},{" +
|
||||||
|
ToString( vtN) + "}," +
|
||||||
|
( bSaveOnEq ? "true" : "false") + "," +
|
||||||
|
RefTypeToString( nRefType) + ")" +
|
||||||
|
" -- Ok=" + ToString( bOk) ;
|
||||||
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
}
|
||||||
|
// restituisco risultato
|
||||||
|
return bOk ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq)
|
ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq)
|
||||||
@@ -758,27 +863,6 @@ ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors)
|
|||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
ExeSurfTmResetTwoColors( int nId)
|
|
||||||
{
|
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
|
||||||
// recupero la superficie TriMesh
|
|
||||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
|
||||||
bool bOk = ( pStm != nullptr) ;
|
|
||||||
// reset dei flag sui triangoli per i due colori
|
|
||||||
bOk = bOk && pStm->ResetTFlags() ;
|
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtSurfTmResetTwoColors(" + ToString( nId) + ")" +
|
|
||||||
" -- Ok=" + ToString( bOk) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static ISurfTriMesh*
|
static ISurfTriMesh*
|
||||||
MyCreateSubSurfTm( const ISurfTriMesh* pStm, const INTVECTOR& vTria, const INTVECTOR& vTria2)
|
MyCreateSubSurfTm( const ISurfTriMesh* pStm, const INTVECTOR& vTria, const INTVECTOR& vTria2)
|
||||||
@@ -990,6 +1074,49 @@ ExeSurfTmSubtractProjectedFacesOnFace( int nSurfId, int nFaceInd, int nDestGrpId
|
|||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
ExeSurfTmResetTwoColors( int nId)
|
||||||
|
{
|
||||||
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
|
// recupero la superficie TriMesh
|
||||||
|
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||||
|
bool bOk = ( pStm != nullptr) ;
|
||||||
|
// reset dei flag sui triangoli per i due colori
|
||||||
|
bOk = bOk && pStm->ResetTFlags() ;
|
||||||
|
ExeSetModified() ;
|
||||||
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
|
if ( IsCmdLog()) {
|
||||||
|
string sLua = "EgtSurfTmResetTwoColors(" + ToString( nId) + ")" +
|
||||||
|
" -- Ok=" + ToString( bOk) ;
|
||||||
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
}
|
||||||
|
return bOk ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
ExeSurfTmSetShowEdges( int nId, bool bShow)
|
||||||
|
{
|
||||||
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
|
// recupero la superficie trimesh
|
||||||
|
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||||
|
bool bOk = ( pStm != nullptr) ;
|
||||||
|
// imposto lo stato di visualizzazione degli spigoli vivi
|
||||||
|
if ( bOk)
|
||||||
|
pStm->SetShowEdges( bShow) ;
|
||||||
|
ExeSetModified() ;
|
||||||
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
|
if ( IsCmdLog()) {
|
||||||
|
string sLua = "EgtSurfTmSetShowEdges(" + ToString( nId) + "," +
|
||||||
|
ToString( bShow) + ")" +
|
||||||
|
" -- Ok=" + ToString( bOk) ;
|
||||||
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
}
|
||||||
|
return bOk ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static bool
|
static bool
|
||||||
|
|||||||
+25
-3
@@ -104,10 +104,9 @@ ExeVolZmapChangeResolution( int nId, int nNewRes)
|
|||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
// recupero lo Zmap
|
// recupero lo Zmap
|
||||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||||
if ( pVZM == nullptr)
|
bool bOk = ( pVZM != nullptr) ;
|
||||||
return false ;
|
|
||||||
// cambio la risoluzione (rapporto Voxel/Dexel, valori ammessi 1 e 2)
|
// cambio la risoluzione (rapporto Voxel/Dexel, valori ammessi 1 e 2)
|
||||||
bool bOk = pVZM->ChangeResolution( nNewRes) ;
|
bOk = bOk && pVZM->ChangeResolution( nNewRes) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
@@ -120,6 +119,29 @@ ExeVolZmapChangeResolution( int nId, int nNewRes)
|
|||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
ExeVolZmapSetShowEdges( int nId, bool bShow)
|
||||||
|
{
|
||||||
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
|
// recupero lo Zmap
|
||||||
|
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||||
|
bool bOk = ( pVZM != nullptr) ;
|
||||||
|
// imposto lo stato di visualizzazione degli spigoli vivi
|
||||||
|
if ( bOk)
|
||||||
|
pVZM->SetShowEdges( bShow) ;
|
||||||
|
ExeSetModified() ;
|
||||||
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
|
if ( IsCmdLog()) {
|
||||||
|
string sLua = "EgtVolZmapSetShowEdges(" + ToString( nId) + "," +
|
||||||
|
ToString( bShow) + ")" +
|
||||||
|
" -- Ok=" + ToString( bOk) ;
|
||||||
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
}
|
||||||
|
return bOk ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeRemoveVolZmapPart( int nId, int nPart)
|
ExeRemoveVolZmapPart( int nId, int nPart)
|
||||||
|
|||||||
+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)
|
||||||
|
|||||||
+825
-654
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)
|
||||||
|
|||||||
@@ -1613,6 +1613,50 @@ ExeCalcFlatPartUpRegion( int nPartId, bool bCalc)
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static bool
|
||||||
|
IgnoreOutlineFillet( IGeomDB* pGeomDB, int nCrvId, int nLayId)
|
||||||
|
{
|
||||||
|
// verifico se la curva nCrvId è un raccordo che deve essere ignorato, ovvero se si tratta di un arco non inclinato, in tangenza
|
||||||
|
// e consecutivo ad almeno un lato inclinato
|
||||||
|
|
||||||
|
// verifico se arco
|
||||||
|
if ( pGeomDB->GetGeoType( nCrvId) == CRV_ARC) {
|
||||||
|
// verifico se non inclinato
|
||||||
|
double dSideAng = 0, dSideAng2 = 0 ;
|
||||||
|
pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) ;
|
||||||
|
pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) ;
|
||||||
|
if ( abs( dSideAng) < EPS_ANG_SMALL && abs( dSideAng2) < EPS_ANG_SMALL) {
|
||||||
|
// verifico se in tangenza con curve consecutive
|
||||||
|
double dPrevAng = ANG_RIGHT, dNextAng = ANG_RIGHT ;
|
||||||
|
pGeomDB->GetInfo( nCrvId, MCH_KEY_PREVANG, dPrevAng) ;
|
||||||
|
pGeomDB->GetInfo( nCrvId, MCH_KEY_NEXTANG, dNextAng) ;
|
||||||
|
if ( abs( dPrevAng) < EPS_ANG_SMALL && abs( dNextAng) < EPS_ANG_SMALL) {
|
||||||
|
// verifico se è inclinata almeno una tra la curva precedente e quella successiva
|
||||||
|
int nPrevId = pGeomDB->GetPrev( nCrvId) ;
|
||||||
|
if ( nPrevId == GDB_ID_NULL)
|
||||||
|
nPrevId = pGeomDB->GetLastInGroup( nLayId) ;
|
||||||
|
if ( nPrevId == GDB_ID_NULL)
|
||||||
|
return false ;
|
||||||
|
double dSideAng, dSideAng2 ;
|
||||||
|
if ( ( pGeomDB->GetInfo( nPrevId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) ||
|
||||||
|
( pGeomDB->GetInfo( nPrevId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL))
|
||||||
|
return true ;
|
||||||
|
|
||||||
|
int nNextId = pGeomDB->GetNext( nCrvId) ;
|
||||||
|
if ( nNextId == GDB_ID_NULL)
|
||||||
|
nNextId = pGeomDB->GetFirstInGroup( nLayId) ;
|
||||||
|
if ( nNextId == GDB_ID_NULL)
|
||||||
|
return false ;
|
||||||
|
if ( ( pGeomDB->GetInfo( nNextId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) ||
|
||||||
|
( pGeomDB->GetInfo( nNextId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL))
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static bool
|
static bool
|
||||||
AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOrig, int nLayReg, double dH)
|
AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOrig, int nLayReg, double dH)
|
||||||
@@ -1683,7 +1727,8 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
|||||||
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
||||||
if ( pCrv == nullptr)
|
if ( pCrv == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
pCrv->SimpleOffset( dCalcOffset) ;
|
if ( ! pCrv->SimpleOffset( dCalcOffset))
|
||||||
|
pGeomDB->Erase( nNewId) ;
|
||||||
}
|
}
|
||||||
else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) {
|
else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) {
|
||||||
double dOffset2 = 0 ;
|
double dOffset2 = 0 ;
|
||||||
@@ -1696,8 +1741,12 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
|||||||
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
||||||
if ( pCrv == nullptr)
|
if ( pCrv == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
pCrv->SimpleOffset( dCalcOffset) ;
|
if ( ! pCrv->SimpleOffset( dCalcOffset))
|
||||||
|
pGeomDB->Erase( nNewId) ;
|
||||||
}
|
}
|
||||||
|
// verifico se raccordo da ignorare per poter calcolare la regione
|
||||||
|
else if ( IgnoreOutlineFillet( pGeomDB, nCrvId, nLayId))
|
||||||
|
pGeomDB->Erase( nNewId) ;
|
||||||
}
|
}
|
||||||
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
|
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
|
||||||
if ( ! AdjustLayerCurves( pGeomDB, nTmpLayId))
|
if ( ! AdjustLayerCurves( pGeomDB, nTmpLayId))
|
||||||
@@ -1720,7 +1769,7 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
|||||||
if ( nNewId == GDB_ID_NULL)
|
if ( nNewId == GDB_ID_NULL)
|
||||||
return false ;
|
return false ;
|
||||||
// determino ed eseguo offset
|
// determino ed eseguo offset
|
||||||
double dSideAng ;
|
double dSideAng, dSideAng2 ;
|
||||||
if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) {
|
if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) {
|
||||||
double dOffset = 0 ;
|
double dOffset = 0 ;
|
||||||
pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET, dOffset) ;
|
pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET, dOffset) ;
|
||||||
@@ -1728,8 +1777,22 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
|||||||
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
||||||
if ( pCrv == nullptr)
|
if ( pCrv == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
pCrv->SimpleOffset( dCalcOffset) ;
|
if ( ! pCrv->SimpleOffset( dCalcOffset))
|
||||||
|
pGeomDB->Erase( nNewId) ;
|
||||||
}
|
}
|
||||||
|
else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) {
|
||||||
|
double dOffset2 = 0 ;
|
||||||
|
pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET2, dOffset2) ;
|
||||||
|
double dCalcOffset = dOffset2 ;
|
||||||
|
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
||||||
|
if ( pCrv == nullptr)
|
||||||
|
return false ;
|
||||||
|
if ( ! pCrv->SimpleOffset( dCalcOffset))
|
||||||
|
pGeomDB->Erase( nNewId) ;
|
||||||
|
}
|
||||||
|
// verifico se raccordo da ignorare per poter calcolare la regione
|
||||||
|
else if ( IgnoreOutlineFillet( pGeomDB, nCrvId, nLayId))
|
||||||
|
pGeomDB->Erase( nNewId) ;
|
||||||
}
|
}
|
||||||
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
|
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
|
||||||
if ( ! AdjustLayerCurves( pGeomDB, nTmpLay2Id))
|
if ( ! AdjustLayerCurves( pGeomDB, nTmpLay2Id))
|
||||||
@@ -1769,10 +1832,13 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
|||||||
//if ( dStartProD > EPS_SMALL)
|
//if ( dStartProD > EPS_SMALL)
|
||||||
// pCrv->ExtendStartByLen( dStartProD) ;
|
// pCrv->ExtendStartByLen( dStartProD) ;
|
||||||
double dStartProMin = min( dStartProD, dStartProU) ;
|
double dStartProMin = min( dStartProD, dStartProU) ;
|
||||||
if ( dStartProMin < - EPS_SMALL)
|
if ( dStartProMin < - EPS_SMALL) {
|
||||||
pCrv->TrimStartAtLen( - dStartProMin) ;
|
pCrv->TrimStartAtLen( - dStartProMin) ;
|
||||||
if ( abs( dStartProD - dStartProU) > EPS_SMALL)
|
if ( abs( dStartProD - dStartProU) > EPS_SMALL)
|
||||||
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, abs( dStartProD - dStartProU)) ;
|
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, abs( dStartProD - dStartProU)) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, max( dStartProD, dStartProU)) ;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( dStartProD < - EPS_SMALL)
|
if ( dStartProD < - EPS_SMALL)
|
||||||
@@ -1799,9 +1865,11 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
|||||||
double dLen ;
|
double dLen ;
|
||||||
pCrv->GetLength( dLen) ;
|
pCrv->GetLength( dLen) ;
|
||||||
pCrv->TrimEndAtLen( dLen + dEndProMin) ;
|
pCrv->TrimEndAtLen( dLen + dEndProMin) ;
|
||||||
|
if ( abs( dEndProD - dEndProU) > EPS_SMALL)
|
||||||
|
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, abs( dEndProD - dEndProU)) ;
|
||||||
}
|
}
|
||||||
if ( abs( dEndProD - dEndProU) > EPS_SMALL)
|
else
|
||||||
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, abs( dEndProD - dEndProU)) ;
|
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, max( dEndProD, dEndProU)) ;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( dEndProD < - EPS_SMALL) {
|
if ( dEndProD < - EPS_SMALL) {
|
||||||
|
|||||||
@@ -640,6 +640,15 @@ ExeZoomWin( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
ExeSetViewOrizzOffsStep( int nDirOffsStep)
|
||||||
|
{
|
||||||
|
IEGrScene* pScene = GetCurrScene() ;
|
||||||
|
VERIFY_SCENE( pScene, false)
|
||||||
|
return pScene->SetCameraDirOrizzOffset( nDirOffsStep) ;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeSetView( int nDir, bool bRedraw)
|
ExeSetView( int nDir, bool bRedraw)
|
||||||
@@ -709,6 +718,19 @@ ExeRotateView( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
ExeGetViewOrizzOffsStep( int* pnDirOffsStep)
|
||||||
|
{
|
||||||
|
IEGrScene* pScene = GetCurrScene() ;
|
||||||
|
VERIFY_SCENE( pScene, false)
|
||||||
|
// recupero offset direzione di vista
|
||||||
|
if ( pnDirOffsStep == nullptr)
|
||||||
|
return false ;
|
||||||
|
*pnDirOffsStep = pScene->GetCameraDirOrizzOffset() ;
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeGetView( int* pnDir)
|
ExeGetView( int* pnDir)
|
||||||
|
|||||||
Binary file not shown.
+39
-37
@@ -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, ptV, ptP1, ptP2, ptDim, Text [, nRefType]
|
||||||
int nParentId ;
|
int nParentId ;
|
||||||
LuaCheckParam( L, 1, nParentId)
|
LuaCheckParam( L, 1, nParentId)
|
||||||
|
Point3d ptV ;
|
||||||
|
LuaCheckParam( L, 2, ptV) ;
|
||||||
Point3d ptP1 ;
|
Point3d ptP1 ;
|
||||||
LuaCheckParam( L, 2, ptP1) ;
|
LuaCheckParam( L, 3, ptP1) ;
|
||||||
Point3d ptP0 ;
|
|
||||||
LuaCheckParam( L, 3, ptP0) ;
|
|
||||||
Point3d ptP2 ;
|
Point3d ptP2 ;
|
||||||
LuaCheckParam( L, 4, ptP2) ;
|
LuaCheckParam( L, 4, ptP2) ;
|
||||||
Point3d ptDim ;
|
Point3d ptDim ;
|
||||||
@@ -417,7 +417,39 @@ LuaCreateAngularDimension(lua_State* L)
|
|||||||
LuaGetParam( L, 7, nRefType) ;
|
LuaGetParam( L, 7, nRefType) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// creo la quota angolare
|
// creo la quota angolare
|
||||||
int nId = ExeCreateAngularDimension( nParentId, ptP1, ptP0, ptP2, ptDim, sText, nRefType) ;
|
int nId = ExeCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
if ( nId != GDB_ID_NULL)
|
||||||
|
LuaSetParam( L, nId) ;
|
||||||
|
else
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaCreateAngularDimensionEx(lua_State* L)
|
||||||
|
{
|
||||||
|
// 7 o 8 parametri : ParentId, ptV1, ptP1, ptV2, ptP2, ptDim, Text [, nRefType]
|
||||||
|
int nParentId ;
|
||||||
|
LuaCheckParam( L, 1, nParentId)
|
||||||
|
Point3d ptV1 ;
|
||||||
|
LuaCheckParam( L, 2, ptV1) ;
|
||||||
|
Point3d ptP1 ;
|
||||||
|
LuaCheckParam( L, 3, ptP1) ;
|
||||||
|
Point3d ptV2 ;
|
||||||
|
LuaCheckParam( L, 4, ptV2) ;
|
||||||
|
Point3d ptP2 ;
|
||||||
|
LuaCheckParam( L, 5, ptP2) ;
|
||||||
|
Point3d ptDim ;
|
||||||
|
LuaCheckParam( L, 6, ptDim) ;
|
||||||
|
string sText ;
|
||||||
|
LuaCheckParam( L, 7, sText) ;
|
||||||
|
int nRefType = RTY_DEFAULT ;
|
||||||
|
LuaGetParam( L, 8, nRefType) ;
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// creo la quota angolare
|
||||||
|
int nId = ExeCreateAngularDimensionEx( nParentId, ptV1, ptP1, ptV2, ptP2, ptDim, sText, nRefType) ;
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
if ( nId != GDB_ID_NULL)
|
if ( nId != GDB_ID_NULL)
|
||||||
LuaSetParam( L, nId) ;
|
LuaSetParam( L, nId) ;
|
||||||
@@ -478,36 +510,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)
|
||||||
@@ -527,9 +529,9 @@ LuaInstallGdbCreate( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAlignedDimension", LuaCreateAlignedDimension) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAlignedDimension", LuaCreateAlignedDimension) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRadialDimension", LuaCreateRadialDimension) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtRadialDimension", LuaCreateRadialDimension) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDiametralDimension", LuaCreateDiametralDimension) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtDiametralDimension", LuaCreateDiametralDimension) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension);
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionEx", LuaCreateAngularDimensionEx) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromCircle", LuaCreateAngularDimensionFromCircle) ;
|
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -682,6 +682,32 @@ LuaCreateSurfTmSwept( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaCreateSurfTmTransSwept( lua_State* L)
|
||||||
|
{
|
||||||
|
// 4 o 5 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol]
|
||||||
|
int nParentId ;
|
||||||
|
LuaCheckParam( L, 1, nParentId)
|
||||||
|
int nSectId ;
|
||||||
|
LuaCheckParam( L, 2, nSectId)
|
||||||
|
int nGuideId ;
|
||||||
|
LuaCheckParam( L, 3, nGuideId)
|
||||||
|
bool bCapEnds ;
|
||||||
|
LuaCheckParam( L, 4, bCapEnds)
|
||||||
|
double dLinTol = LIN_TOL_SRF ;
|
||||||
|
LuaGetParam( L, 5, dLinTol) ;
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// creo STM swept di traslazione
|
||||||
|
int nId = ExeCreateSurfTmTransSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
if ( nId != GDB_ID_NULL)
|
||||||
|
LuaSetParam( L, nId) ;
|
||||||
|
else
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaCreateSurfTmRuled( lua_State* L)
|
LuaCreateSurfTmRuled( lua_State* L)
|
||||||
@@ -903,6 +929,67 @@ LuaCreateSurfBezierLeaves( lua_State* L)
|
|||||||
return 2 ;
|
return 2 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaCreateSurfBezierTria2D( lua_State* L)
|
||||||
|
{
|
||||||
|
// 2, 3 o 4 parametri : ParentId, nId [, nTextHeight] [, bShowTrim]
|
||||||
|
int nParentId ;
|
||||||
|
LuaCheckParam( L, 1, nParentId)
|
||||||
|
int nSurfBzId ;
|
||||||
|
LuaCheckParam( L, 2, nSurfBzId)
|
||||||
|
int nTextHeight = 50 ;
|
||||||
|
bool bShowTrim = false ;
|
||||||
|
if ( LuaGetParam( L, 3, nTextHeight))
|
||||||
|
LuaGetParam( L, 4, bShowTrim) ;
|
||||||
|
else
|
||||||
|
LuaGetParam( L, 3, bShowTrim) ;
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// creo la superficie
|
||||||
|
int nCount = 0 ;
|
||||||
|
int nId = ExeCreateSurfBezierTria2D( nParentId, nSurfBzId, nTextHeight, bShowTrim, &nCount) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
if ( nId != GDB_ID_NULL) {
|
||||||
|
LuaSetParam( L, nId) ;
|
||||||
|
LuaSetParam( L, nCount) ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
}
|
||||||
|
return 2 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaCreateBezierSphere( lua_State* L)
|
||||||
|
{
|
||||||
|
// 3 o 4 parametri : ParentId, ptCenter, dRad [, nRefType]
|
||||||
|
int nParentId ;
|
||||||
|
LuaCheckParam( L, 1, nParentId)
|
||||||
|
Point3d ptCenter ;
|
||||||
|
LuaCheckParam( L, 2, ptCenter)
|
||||||
|
double dRad ;
|
||||||
|
LuaCheckParam( L, 3, dRad)
|
||||||
|
int nRefType = RTY_DEFAULT ;
|
||||||
|
LuaGetParam( L, 4, nRefType) ;
|
||||||
|
// creo la superficie
|
||||||
|
int nCount = 0 ;
|
||||||
|
int nId = ExeCreateBezierSphere( nParentId, ptCenter, dRad, nRefType) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
if ( nId != GDB_ID_NULL) {
|
||||||
|
LuaSetParam( L, nId) ;
|
||||||
|
LuaSetParam( L, nCount) ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
}
|
||||||
|
return 2 ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
|
LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
|
||||||
@@ -932,6 +1019,7 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByScrewing", LuaCreateSurfTmByScrewing) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByScrewing", LuaCreateSurfTmByScrewing) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectSwept", LuaCreateSurfTmRectSwept) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectSwept", LuaCreateSurfTmRectSwept) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwept", LuaCreateSurfTmSwept) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwept", LuaCreateSurfTmSwept) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTransSwept", LuaCreateSurfTmTransSwept) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRuled", LuaCreateSurfTmRuled) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRuled", LuaCreateSurfTmRuled) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ;
|
||||||
@@ -940,5 +1028,7 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezier", LuaCreateSurfBezier) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezier", LuaCreateSurfBezier) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierRat", LuaCreateSurfBezierRational) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierRat", LuaCreateSurfBezierRational) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierLeaves", LuaCreateSurfBezierLeaves) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierLeaves", LuaCreateSurfBezierLeaves) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierTria2D", LuaCreateSurfBezierTria2D) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateBezierSphere", LuaCreateBezierSphere) ;
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ using namespace std ;
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaPocketing( lua_State* L) {
|
LuaPocketing( lua_State* L) {
|
||||||
// 7 parametri : vId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId
|
// 7 parametri : nId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId
|
||||||
int nId ;
|
int nId ;
|
||||||
LuaCheckParam( L, 1, nId) ;
|
LuaCheckParam( L, 1, nId) ;
|
||||||
double dRad ;
|
double dRad ;
|
||||||
|
|||||||
+13
-9
@@ -105,16 +105,18 @@ LuaCurveMedialAxis( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaApproxCurve( lua_State* L)
|
LuaApproxCurve( lua_State* L)
|
||||||
{
|
{
|
||||||
// 2 o 3 parametri : Id, nApprType [, dLinTol]
|
// 2 o 3 o 4 parametri : Id, nApprType [, dLinTol [, dMaxSegmLen]]
|
||||||
int nId ;
|
int nId ;
|
||||||
LuaCheckParam( L, 1, nId)
|
LuaCheckParam( L, 1, nId)
|
||||||
int nApprType ;
|
int nApprType ;
|
||||||
LuaCheckParam( L, 2, nApprType)
|
LuaCheckParam( L, 2, nApprType)
|
||||||
double dLinTol = 0.01 ;
|
double dLinTol = 0.01 ;
|
||||||
LuaGetParam( L, 3, dLinTol) ;
|
double dMaxSegmLen = INFINITO ;
|
||||||
|
if ( LuaGetParam( L, 3, dLinTol))
|
||||||
|
LuaGetParam( L, 4, dMaxSegmLen) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// approssimazione della curva con rette
|
// approssimazione della curva con rette
|
||||||
bool bOk = ExeApproxCurve( nId, nApprType, dLinTol) ;
|
bool bOk = ExeApproxCurve( nId, nApprType, dLinTol, dMaxSegmLen) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
@@ -951,7 +953,7 @@ LuaReorderCurvesInGroup( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaProjectCurveOnSurfTm( lua_State* L)
|
LuaProjectCurveOnSurfTm( lua_State* L)
|
||||||
{
|
{
|
||||||
// 4, 5 o 6 parametri : nCurveId, nSurfTmId, vtDir, nDestGrpId [, dLinTol [, nRefType]]
|
// 4, 5, 6 o 7 parametri : nCurveId, nSurfTmId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, nRefType]]
|
||||||
int nCurveId ;
|
int nCurveId ;
|
||||||
LuaCheckParam( L, 1, nCurveId)
|
LuaCheckParam( L, 1, nCurveId)
|
||||||
int nSurfTmId ;
|
int nSurfTmId ;
|
||||||
@@ -961,12 +963,14 @@ LuaProjectCurveOnSurfTm( lua_State* L)
|
|||||||
int nDestGrpId ;
|
int nDestGrpId ;
|
||||||
LuaCheckParam( L, 4, nDestGrpId)
|
LuaCheckParam( L, 4, nDestGrpId)
|
||||||
double dLinTol = 0.01 ;
|
double dLinTol = 0.01 ;
|
||||||
|
double dMaxSegmLen = INFINITO ;
|
||||||
int nRefType = RTY_DEFAULT ;
|
int nRefType = RTY_DEFAULT ;
|
||||||
if ( LuaGetParam( L, 5, dLinTol))
|
if ( LuaGetParam( L, 5, dLinTol) &&
|
||||||
LuaGetParam( L, 6, nRefType) ;
|
LuaGetParam( L, 6, dMaxSegmLen))
|
||||||
|
LuaGetParam( L, 7, nRefType) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// proietto la curva su una trimesh secondo la direzione data
|
// proietto la curva su una trimesh secondo la direzione data
|
||||||
bool bOk = ExeProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, nRefType) ;
|
bool bOk = ExeProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, nRefType) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
@@ -980,7 +984,7 @@ LuaCurveGetVoronoi( lua_State* L)
|
|||||||
LuaCheckParam( L, 1, nId)
|
LuaCheckParam( L, 1, nId)
|
||||||
int nDestGrpId ;
|
int nDestGrpId ;
|
||||||
LuaCheckParam( L, 2, nDestGrpId)
|
LuaCheckParam( L, 2, nDestGrpId)
|
||||||
int nBound = VORONOI_STD_BOUND ;
|
int nBound = 3 ; // VORONOI_STD_BOUND
|
||||||
LuaGetParam( L, 3, nBound) ;
|
LuaGetParam( L, 3, nBound) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// eseguo
|
// eseguo
|
||||||
@@ -1004,7 +1008,7 @@ LuaCurveMedialAxisAdv( lua_State* L)
|
|||||||
LuaCheckParam( L, 1, nId)
|
LuaCheckParam( L, 1, nId)
|
||||||
int nDestGrpId ;
|
int nDestGrpId ;
|
||||||
LuaCheckParam( L, 2, nDestGrpId)
|
LuaCheckParam( L, 2, nDestGrpId)
|
||||||
int nSide = Voronoi::WMAT_LEFT ;
|
int nSide = 1 ; // WMAT_LEFT
|
||||||
LuaGetParam( L, 3, nSide) ;
|
LuaGetParam( L, 3, nSide) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// eseguo
|
// eseguo
|
||||||
|
|||||||
+108
-19
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaInvertSurf( lua_State* L)
|
LuaInvertSurf( lua_State* L)
|
||||||
@@ -141,6 +140,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)
|
||||||
@@ -165,6 +187,30 @@ LuaSurfTmMoveVertex( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaSurfTmMoveFacet( lua_State* L)
|
||||||
|
{
|
||||||
|
// 3 o 4 o 5 parametri : nId, nFacet, vtMove [, nRefId] [, bUpdate]
|
||||||
|
int nId ;
|
||||||
|
LuaCheckParam( L, 1, nId)
|
||||||
|
int nFacet ;
|
||||||
|
LuaCheckParam( L, 2, nFacet)
|
||||||
|
Vector3d vtMove ;
|
||||||
|
LuaCheckParam( L, 3, vtMove)
|
||||||
|
int nRefType = RTY_DEFAULT ;
|
||||||
|
bool bUpdate = true ;
|
||||||
|
if ( LuaGetParam( L, 4, nRefType))
|
||||||
|
LuaGetParam( L, 5, bUpdate) ;
|
||||||
|
else
|
||||||
|
LuaGetParam( L, 4, bUpdate) ;
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// sposto la faccia di indice dato della trimesh
|
||||||
|
bool bOk = ExeSurfTmMoveFacet( nId, nFacet, vtMove, nRefType, bUpdate) ;
|
||||||
|
LuaSetParam( L, bOk) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaSurfTmToTriangles( lua_State* L)
|
LuaSurfTmToTriangles( lua_State* L)
|
||||||
@@ -260,6 +306,29 @@ LuaCutSurfTmPlane( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaCutSurfBzPlane( lua_State* L)
|
||||||
|
{
|
||||||
|
// 4 o 5 parametri : Id, ptOn, vtN, bSaveOnEq [, nRefType]
|
||||||
|
int nId ;
|
||||||
|
LuaCheckParam( L, 1, nId)
|
||||||
|
Point3d ptOn ;
|
||||||
|
LuaCheckParam( L, 2, ptOn)
|
||||||
|
Vector3d vtN ;
|
||||||
|
LuaCheckParam( L, 3, vtN)
|
||||||
|
bool bSaveOnEq ;
|
||||||
|
LuaGetParam( L, 4, bSaveOnEq) ;
|
||||||
|
int nRefType = RTY_DEFAULT ;
|
||||||
|
LuaGetParam( L, 5, nRefType) ;
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// taglio la superficie con ilpiano
|
||||||
|
bool bOk = ExeCutSurfBzPlane( nId, ptOn, vtN, bSaveOnEq, nRefType) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
LuaSetParam( L, bOk) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaCutSurfTmClosedCurve( lua_State* L)
|
LuaCutSurfTmClosedCurve( lua_State* L)
|
||||||
@@ -333,20 +402,6 @@ LuaSurfTmIntersect( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaSurfTmResetTwoColors( lua_State* L)
|
|
||||||
{
|
|
||||||
// 1 parametro : Id
|
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 1, nId)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// eseguo reset TFlag per annullare due colori
|
|
||||||
bool bOk = ExeSurfTmResetTwoColors( nId) ;
|
|
||||||
LuaSetParam( L, bOk) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaSurfTmSplit( lua_State* L)
|
LuaSurfTmSplit( lua_State* L)
|
||||||
@@ -422,18 +477,48 @@ LuaSurfTmSubtractProjectedFacesOnFace( lua_State* L)
|
|||||||
return 4 ;
|
return 4 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaSurfTmResetTwoColors( lua_State* L)
|
||||||
|
{
|
||||||
|
// 1 parametro : Id
|
||||||
|
int nId ;
|
||||||
|
LuaCheckParam( L, 1, nId)
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// eseguo reset TFlag per annullare due colori
|
||||||
|
bool bOk = ExeSurfTmResetTwoColors( nId) ;
|
||||||
|
LuaSetParam( L, bOk) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaSurfTmSetShowEdges( lua_State* L)
|
||||||
|
{
|
||||||
|
// 2 parametri : Id, bShow
|
||||||
|
int nId ;
|
||||||
|
LuaCheckParam( L, 1, nId)
|
||||||
|
bool bShow ;
|
||||||
|
LuaCheckParam( L, 2, bShow) ;
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// imposto flag visualizzazione spigoli vivi
|
||||||
|
bool bOk = ExeSurfTmSetShowEdges( nId, bShow) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
LuaSetParam( L, bOk) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaSurfBzTrim( lua_State* L)
|
LuaSurfBzTrim( lua_State* L)
|
||||||
{
|
{
|
||||||
// 2 parametri : nId, nCutterId
|
// 2 parametri : nId, nCutterId
|
||||||
int nId ;
|
int nId ;
|
||||||
LuaCheckParam( L, 1, nId)
|
LuaCheckParam( L, 1, nId)
|
||||||
int nCutterId ;
|
int nCutterId ;
|
||||||
LuaCheckParam( L, 2, nCutterId)
|
LuaCheckParam( L, 2, nCutterId)
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// taglio la prima superficie in base alla seconda
|
// taglio la prima superficie in base alla seconda
|
||||||
//bool bOk = ExeSurfTmCut( nId, nCutterId, bInVsOut, bOn) ;
|
|
||||||
bool bOk = ExeSurfBzTrim( nId, nCutterId) ;
|
bool bOk = ExeSurfBzTrim( nId, nCutterId) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
@@ -451,20 +536,24 @@ 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( "EgtSurfTmMoveFacet", LuaSurfTmMoveFacet) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwapFacets", LuaSurfTmSwapFacets) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwapFacets", LuaSurfTmSwapFacets) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemovePart", LuaSurfTmRemovePart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemovePart", LuaSurfTmRemovePart) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmPlane", LuaCutSurfTmPlane) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmPlane", LuaCutSurfTmPlane) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfBzPlane", LuaCutSurfBzPlane) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmClosedCurve", LuaCutSurfTmClosedCurve) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmClosedCurve", LuaCutSurfTmClosedCurve) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmAdd", LuaSurfTmAdd) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmAdd", LuaSurfTmAdd) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtract", LuaSurfTmSubtract) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtract", LuaSurfTmSubtract) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmIntersect", LuaSurfTmIntersect) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmIntersect", LuaSurfTmIntersect) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSplit", LuaSurfTmSplit) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSplit", LuaSurfTmSplit) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCut", LuaSurfTmCut) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCut", LuaSurfTmCut) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtractProjectedFacesOnFace", LuaSurfTmSubtractProjectedFacesOnFace) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtractProjectedFacesOnFace", LuaSurfTmSubtractProjectedFacesOnFace) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetShowEdges", LuaSurfTmSetShowEdges) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzTrim", LuaSurfBzTrim) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzTrim", LuaSurfBzTrim) ;
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,23 @@ LuaVolZmapChangeResolution( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaVolZmapSetShowEdges( lua_State* L)
|
||||||
|
{
|
||||||
|
// 2 parametri : Id, bShow
|
||||||
|
int nId ;
|
||||||
|
LuaCheckParam( L, 1, nId)
|
||||||
|
bool bShow ;
|
||||||
|
LuaCheckParam( L, 2, bShow) ;
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// imposto flag visualizzazione spigoli vivi
|
||||||
|
bool bOk = ExeVolZmapSetShowEdges( nId, bShow) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
LuaSetParam( L, bOk) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaRemoveVolZmapPart( lua_State* L)
|
LuaRemoveVolZmapPart( lua_State* L)
|
||||||
@@ -350,6 +367,7 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
|
|||||||
bool bOk = ( &luaMgr != nullptr) ;
|
bool bOk = ( &luaMgr != nullptr) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeVolume", LuaExplodeVolume) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeVolume", LuaExplodeVolume) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapChangeResolution", LuaVolZmapChangeResolution) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapChangeResolution", LuaVolZmapChangeResolution) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetShowEdges", LuaVolZmapSetShowEdges) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdvTool", LuaVolZmapSetAdvTool) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdvTool", LuaVolZmapSetAdvTool) ;
|
||||||
|
|||||||
+228
-129
@@ -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,136 @@ LuaLineSurfTmInters( lua_State* L)
|
|||||||
return 3 ;
|
return 3 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaLineSurfBzInters( lua_State* L)
|
||||||
|
{
|
||||||
|
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
|
||||||
|
Point3d ptP ;
|
||||||
|
LuaCheckParam( L, 1, ptP)
|
||||||
|
Vector3d vtDir ;
|
||||||
|
LuaCheckParam( L, 2, vtDir)
|
||||||
|
int nId ;
|
||||||
|
LuaCheckParam( L, 3, nId)
|
||||||
|
int nRefType = nId ;
|
||||||
|
LuaGetParam( L, 4, nRefType) ;
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// recupero i punti di intersezione tra linea e superficie trimesh
|
||||||
|
INTDBLVECTOR vInters ;
|
||||||
|
if ( ExeLineSurfBzInters( ptP, vtDir, nId, nRefType, vInters)) {
|
||||||
|
LuaSetParam( L, true) ;
|
||||||
|
INTVECTOR vType( vInters.size()) ;
|
||||||
|
DBLVECTOR vPar( vInters.size()) ;
|
||||||
|
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
|
||||||
|
vType[i] = vInters[i].first ;
|
||||||
|
vPar[i] = vInters[i].second ;
|
||||||
|
}
|
||||||
|
LuaSetParam( L, vType) ;
|
||||||
|
LuaSetParam( L, vPar) ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
}
|
||||||
|
return 3 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
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 +321,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 +378,58 @@ LuaCurveCurveInters( lua_State* L)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaLineVolZmapInters( lua_State* L)
|
LuaCurveSurfTmInters( lua_State* L)
|
||||||
{
|
{
|
||||||
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
|
// 3 parametri : nCrvId, nStmId, nDestGrpId
|
||||||
Point3d ptP ;
|
int nCrvId ;
|
||||||
LuaCheckParam( L, 1, ptP)
|
LuaCheckParam( L, 1, nCrvId)
|
||||||
Vector3d vtDir ;
|
int nStmId ;
|
||||||
LuaCheckParam( L, 2, vtDir)
|
LuaCheckParam( L, 2, nStmId)
|
||||||
int nId ;
|
int nDestGrpId ;
|
||||||
LuaCheckParam( L, 3, nId)
|
LuaCheckParam( L, 3, nDestGrpId) ;
|
||||||
int nRefType = nId ;
|
|
||||||
LuaGetParam( L, 4, nRefType) ;
|
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// eseguo calcolo intersezione
|
// eseguo l'intersezione
|
||||||
INTDBLVECTOR vInters ;
|
int nPntCount = 0 ;
|
||||||
if ( ExeLineVolZmapInters( ptP, vtDir, nId, nRefType, vInters)) {
|
int nCrvCount = 0 ;
|
||||||
LuaSetParam( L, true) ;
|
int nNewId = ExeCurveSurfTmInters( nCrvId, nStmId, nDestGrpId, &nPntCount, &nCrvCount) ;
|
||||||
INTVECTOR vType( vInters.size()) ;
|
// restituisco il risultato
|
||||||
DBLVECTOR vPar( vInters.size()) ;
|
if ( nNewId != GDB_ID_NULL)
|
||||||
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
|
LuaSetParam( L, nNewId) ;
|
||||||
vType[i] = vInters[i].first ;
|
else
|
||||||
vPar[i] = vInters[i].second ;
|
|
||||||
}
|
|
||||||
LuaSetParam( L, vType) ;
|
|
||||||
LuaSetParam( L, vPar) ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LuaSetParam( L) ;
|
LuaSetParam( L) ;
|
||||||
LuaSetParam( L) ;
|
LuaSetParam( L, nPntCount) ;
|
||||||
LuaSetParam( L) ;
|
LuaSetParam( L, nCrvCount) ;
|
||||||
}
|
|
||||||
return 3 ;
|
return 3 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaPlaneVolZmapInters( lua_State* L)
|
LuaSurfTmSurfTmInters( lua_State* L)
|
||||||
{
|
{
|
||||||
// 4 o 5 parametri : ptP, vtN, nId, nDestGrpId [, nRefType]
|
// 3 o 4 parametri : Id1, nId2, nDestGrpId [, dToler]
|
||||||
Point3d ptP ;
|
int nId1 ;
|
||||||
LuaCheckParam( L, 1, ptP)
|
LuaCheckParam( L, 1, nId1)
|
||||||
Vector3d vtN ;
|
int nId2 ;
|
||||||
LuaCheckParam( L, 2, vtN)
|
LuaCheckParam( L, 2, nId2)
|
||||||
int nId ;
|
|
||||||
LuaCheckParam( L, 3, nId)
|
|
||||||
int nDestGrpId ;
|
int nDestGrpId ;
|
||||||
LuaCheckParam( L, 4, nDestGrpId)
|
LuaCheckParam( L, 3, nDestGrpId) ;
|
||||||
int nRefType = RTY_DEFAULT ;
|
double dToler = 20 * EPS_SMALL ;
|
||||||
LuaGetParam( L, 5, nRefType) ;
|
LuaGetParam( L, 4, dToler) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// eseguo calcolo intersezione
|
// eseguo l'intersezione
|
||||||
int nCount ;
|
int nPntCount = 0 ;
|
||||||
int nFirstId = ExePlaneVolZmapInters( ptP, vtN, nId, nDestGrpId, nRefType, &nCount) ;
|
int nCrvCount = 0 ;
|
||||||
|
int nSrfCount = 0 ;
|
||||||
|
int nNewId = ExeSurfTmSurfTmInters( nId1, nId2, nDestGrpId, dToler, &nPntCount, &nCrvCount, &nSrfCount) ;
|
||||||
// restituisco il risultato
|
// restituisco il risultato
|
||||||
if ( nFirstId != GDB_ID_NULL) {
|
if ( nNewId != GDB_ID_NULL)
|
||||||
LuaSetParam( L, nFirstId) ;
|
LuaSetParam( L, nNewId) ;
|
||||||
LuaSetParam( L, nCount) ;
|
else
|
||||||
}
|
|
||||||
else {
|
|
||||||
LuaSetParam( L) ;
|
LuaSetParam( L) ;
|
||||||
LuaSetParam( L) ;
|
LuaSetParam( L, nPntCount) ;
|
||||||
}
|
LuaSetParam( L, nCrvCount) ;
|
||||||
return 2 ;
|
LuaSetParam( L, nSrfCount) ;
|
||||||
|
return 4 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
@@ -341,15 +437,18 @@ 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( "EgtLineSurfBzInters", LuaLineSurfBzInters) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtLineVolZmapInters", LuaLineVolZmapInters) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneCurveInters", LuaPlaneCurveInters) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneBoxInters", LuaPlaneBoxInters) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneSurfTmInters", LuaPlaneSurfTmInters) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneSurfTmInters", LuaPlaneSurfTmInters) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtParPlanesSurfTmInters", LuaParPlanesSurfTmInters) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtParPlanesSurfTmInters", LuaParPlanesSurfTmInters) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneCurveInters", LuaPlaneCurveInters) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCurveInters", LuaCurveCurveInters) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtLineVolZmapInters", LuaLineVolZmapInters) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneVolZmapInters", LuaPlaneVolZmapInters) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneVolZmapInters", LuaPlaneVolZmapInters) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCurveInters", LuaCurveCurveInters) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSurfTmInters", LuaCurveSurfTmInters) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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) ;
|
||||||
|
|||||||
@@ -175,6 +175,21 @@ LuaZoomObject( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaSetViewOrizzOffsStep( lua_State* L)
|
||||||
|
{
|
||||||
|
// 1 parametro : nDirOffsStep
|
||||||
|
int nDirOffsStep ;
|
||||||
|
LuaCheckParam( L, 1, nDirOffsStep)
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// imposto offset angolare orizzontale a step di 90° per direzione di vista
|
||||||
|
bool bOk = ExeSetViewOrizzOffsStep( nDirOffsStep) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
LuaSetParam( L, bOk) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaSetView( lua_State* L)
|
LuaSetView( lua_State* L)
|
||||||
@@ -228,6 +243,60 @@ LuaSetViewCenter( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaGetViewOrizzOffsStep( lua_State* L)
|
||||||
|
{
|
||||||
|
// nessun parametro
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// recupero offset angolare orizzontale a step di 90° per direzione di vista
|
||||||
|
int nDirOffsStep ;
|
||||||
|
bool bOk = ExeGetViewOrizzOffsStep( &nDirOffsStep) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
if ( bOk)
|
||||||
|
LuaSetParam( L, nDirOffsStep) ;
|
||||||
|
else
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaGetView( lua_State* L)
|
||||||
|
{
|
||||||
|
// nessun parametro
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// recupero direzione di vista
|
||||||
|
int nViewDir ;
|
||||||
|
bool bOk = ExeGetView( &nViewDir) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
if ( bOk)
|
||||||
|
LuaSetParam( L, nViewDir) ;
|
||||||
|
else
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaGetGenericView( lua_State* L)
|
||||||
|
{
|
||||||
|
// nessun parametro
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// recupero angoli della direzione di vista
|
||||||
|
double dAngVertDeg ;
|
||||||
|
double dAngHorizDeg ;
|
||||||
|
bool bOk = ExeGetGenericView( &dAngVertDeg, &dAngHorizDeg) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
if ( bOk) {
|
||||||
|
LuaSetParam( L, dAngVertDeg) ;
|
||||||
|
LuaSetParam( L, dAngHorizDeg) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
return 2 ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaGetImage( lua_State* L)
|
LuaGetImage( lua_State* L)
|
||||||
@@ -267,9 +336,13 @@ LuaInstallScene( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomRadius", LuaZoomRadius) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomRadius", LuaZoomRadius) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtZoom", LuaZoom) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtZoom", LuaZoom) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomObject", LuaZoomObject) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomObject", LuaZoomObject) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewOrizzOffsStep", LuaSetViewOrizzOffsStep) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetView", LuaSetView) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetView", LuaSetView) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetGenericView", LuaSetGenericView) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetGenericView", LuaSetGenericView) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewCenter", LuaSetViewCenter) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewCenter", LuaSetViewCenter) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetViewOrizzOffsStep", LuaGetViewOrizzOffsStep) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetView", LuaGetView) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetGenericView", LuaGetGenericView) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImage", LuaGetImage) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImage", LuaGetImage) ;
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user