EgtExecutor 3.1a4 :
- in Trimming aggiunte le funzioni per riconoscimento di fori e asole - in Trimming pulizia del codice.
This commit is contained in:
+99
-133
@@ -29,28 +29,30 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
static string s_sKey_Auto_Trim = "AutoTrim" ;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTrimmingAutoSearch( int nParentId, int nSurfLayerId, double dShapeLinTol, double dShapeAngTol,
|
||||
double dLinTol, double dEdgeLinTol, double dAngTol, double dAngFaceTol,
|
||||
const STRVECTOR& vsShapes)
|
||||
ExeTrimmingGetHoleBorder( int nParentId, const INTVECTOR& vSurfIds, const INTVECTOR& vOtherSurfIds,
|
||||
double dSurfLinTol, double dSurfAngTol, double dEdgeLinTol, double dEdgeAngTol,
|
||||
double dEdgeThick, int& nFirstId, int& nCount)
|
||||
{
|
||||
// Verifica database geometrico
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
|
||||
// Inizializzo i valori di ritorno
|
||||
nFirstId = GDB_ID_NULL ;
|
||||
nCount = 0 ;
|
||||
|
||||
// Se non ho geometrie da ricercare, non faccio nulla
|
||||
if ( vsShapes.empty())
|
||||
if ( vSurfIds.empty())
|
||||
return true ;
|
||||
|
||||
// Recupero le superfici presenti nel Layer
|
||||
CISURFPVECTOR vSurfs ; vSurfs.reserve( pGeomDB->GetGroupObjs( nSurfLayerId)) ;
|
||||
int nId = pGeomDB->GetFirstInGroup( nSurfLayerId) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// Recupero le superfici da cui estrarre i bordi
|
||||
CISURFPVECTOR vpSurfs ; vpSurfs.reserve( vSurfIds.size()) ;
|
||||
for ( int i = 0 ; i < ssize( vSurfIds) ; ++ i) {
|
||||
int nSurfId = vSurfIds[i] ;
|
||||
// Recupero l'entità
|
||||
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nId) ;
|
||||
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nSurfId) ;
|
||||
if ( pGeoObj != nullptr) {
|
||||
// Recupero il Tipo
|
||||
int nType = pGeoObj->GetType() ;
|
||||
@@ -58,81 +60,89 @@ ExeTrimmingAutoSearch( int nParentId, int nSurfLayerId, double dShapeLinTol, dou
|
||||
// Recupero la superficie
|
||||
const ISurf* pSurf = GetSurf( pGeoObj) ;
|
||||
if ( pSurf != nullptr && pSurf->IsValid())
|
||||
vSurfs.emplace_back( pSurf) ;
|
||||
vpSurfs.emplace_back( pSurf) ;
|
||||
}
|
||||
}
|
||||
nId = pGeomDB->GetNext( nId) ;
|
||||
}
|
||||
// Se non ho superfici non faccio nulla
|
||||
if ( vSurfs.empty())
|
||||
if ( vpSurfs.empty())
|
||||
return false ;
|
||||
|
||||
// Recupero Le Superfici Selezionate, Le Curve e Le Bezier rigate
|
||||
ISURFPOMATRIX matSelSurfMatrix ;
|
||||
ICRVCOMPOPOMATRIX matCompoBorders ;
|
||||
ISURFBEZPOVECTOR vSurfBz ;
|
||||
bool bOk = GetTrimmingAutoEntities( vSurfs, dShapeLinTol, dShapeAngTol, dLinTol, dEdgeLinTol, dAngTol, dAngFaceTol, vsShapes,
|
||||
matSelSurfMatrix, matCompoBorders, vSurfBz) ;
|
||||
|
||||
// Per sicurezza verifico che tutte le entità siano a dimensione corretta
|
||||
bOk = bOk && ( ssize( matSelSurfMatrix) == ssize( matCompoBorders)) &&
|
||||
( ssize( matSelSurfMatrix) == ssize( vSurfBz)) ;
|
||||
|
||||
// Per ogni Entità ricavata inserisco le Geometrie nel Layer
|
||||
// NB. Ordine di Inserimento : Surf -> Edges -> bezier
|
||||
// Una anomalia nella serie blocca il flusso corrente e passa al successivo
|
||||
int nCount = -1 ;
|
||||
for ( int i = 0 ; bOk && i < int( matSelSurfMatrix.size()) ; ++ i) {
|
||||
// Verifico che la Superficie sia Valida
|
||||
bool bOkEntity = true ;
|
||||
for ( int j = 0 ; bOkEntity && j < ssize( matSelSurfMatrix[i]) ; ++ j)
|
||||
bOkEntity = ( ! IsNull( matSelSurfMatrix[i][j]) && matSelSurfMatrix[i][j]->IsValid()) ;
|
||||
if ( ! bOkEntity)
|
||||
continue ; // anomalia serie livello superfici di selezione
|
||||
for ( int j = 0 ; bOk && j < ssize( matSelSurfMatrix[i]) ; ++ j) {
|
||||
int nSurfId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( matSelSurfMatrix[i][j])) ;
|
||||
bOk = ( ( nSurfId != GDB_ID_NULL) &&
|
||||
( pGeomDB->SetInfo( nSurfId, s_sKey_Auto_Trim, ToString( ++ nCount)))) ;
|
||||
// Calcolo il Centroide delle superfici complessive
|
||||
Point3d ptRef = P_INVALID ;
|
||||
if ( ! vOtherSurfIds.empty()) {
|
||||
int nToTSurf = 0 ;
|
||||
for ( const int& nOtherSurfId : vOtherSurfIds) {
|
||||
// Recupero l'entità
|
||||
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nOtherSurfId) ;
|
||||
if ( pGeoObj != nullptr) {
|
||||
// Recupero il Tipo
|
||||
int nType = pGeoObj->GetType() ;
|
||||
if ( nType == SRF_TRIMESH || nType == SRF_BEZIER) {
|
||||
// Recupero la superficie
|
||||
const ISurf* pSurf = GetSurf( pGeoObj) ;
|
||||
if ( pSurf != nullptr && pSurf->IsValid()) {
|
||||
// Recupero il Centroide
|
||||
Point3d ptCentroid ;
|
||||
pSurf->GetCentroid( ptCentroid) ;
|
||||
if ( ! ptRef.IsValid())
|
||||
ptRef = ptCentroid ;
|
||||
else
|
||||
ptRef += ptCentroid ;
|
||||
++ nToTSurf ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ! bOk)
|
||||
break ; // anomalia bloccante
|
||||
// Verifico che Le Curve di Edges ( Bezier ) siano Valide
|
||||
for ( int j = 0 ; bOkEntity && j < ssize( matCompoBorders[i]) ; ++ j)
|
||||
bOkEntity = ( ! IsNull( matCompoBorders[i][j]) && matCompoBorders[i][j]->IsValid()) ;
|
||||
if ( ! bOkEntity)
|
||||
continue ; // anomalia serie livello curve di bordo
|
||||
for ( int j = 0 ; bOk && j < ssize( matCompoBorders[i]) ; ++ j) {
|
||||
int nCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( matCompoBorders[i][j])) ;
|
||||
bOk = ( ( nCrvId != GDB_ID_NULL) &&
|
||||
( pGeomDB->SetInfo( nCrvId, s_sKey_Auto_Trim, ToString( nCount)))) ;
|
||||
if ( nToTSurf > 0) {
|
||||
for ( const ISurf* pSurf : vpSurfs) {
|
||||
Point3d ptCentroid ;
|
||||
pSurf->GetCentroid( ptCentroid) ;
|
||||
if ( ! ptRef.IsValid())
|
||||
ptRef = ptCentroid ;
|
||||
else
|
||||
ptRef += ptCentroid ;
|
||||
++ nToTSurf ;
|
||||
}
|
||||
ptRef /= nToTSurf ;
|
||||
}
|
||||
}
|
||||
|
||||
// Recupero i Bordi per fori ed asole
|
||||
ICRVCOMPOPOVECTOR vHoleBorders ;
|
||||
bool bOk = GetTrimmingHoleBorders( vpSurfs, ptRef, dSurfLinTol, dSurfAngTol, dEdgeLinTol, dEdgeAngTol,
|
||||
dEdgeThick, vHoleBorders) ;
|
||||
if ( bOk) {
|
||||
// Inserisco le curve nel DB e imposto i parametri di ritorno
|
||||
bool bFirst = true ;
|
||||
for ( int i = 0 ; bOk && i < ssize( vHoleBorders) ; ++ i) {
|
||||
// Verifico che sia valida
|
||||
if ( ! IsNull( vHoleBorders[i]) && vHoleBorders[i]->IsValid()) {
|
||||
int nCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vHoleBorders[i])) ;
|
||||
bOk = ( nCrvId != GDB_ID_NULL) ;
|
||||
if ( bOk) {
|
||||
++ nCount ;
|
||||
if ( bFirst) {
|
||||
nFirstId = nCrvId ;
|
||||
bFirst = false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ! bOk)
|
||||
break ; // anomalia bloccante
|
||||
// Verifico che le Superfici di Bezier rigate siano Valide
|
||||
bOkEntity = ( ! IsNull( vSurfBz[i]) && vSurfBz[i]->IsValid()) ;
|
||||
if ( ! bOkEntity)
|
||||
continue ; // anomalia seria livello Bezier Rigata
|
||||
int nBzId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vSurfBz[i])) ;
|
||||
bOk = ( ( nBzId != GDB_ID_NULL) &&
|
||||
( pGeomDB->SetInfo( nBzId, s_sKey_Auto_Trim, ToString( nCount)))) ;
|
||||
if ( ! bOk)
|
||||
break ; // anomali bloccante
|
||||
}
|
||||
|
||||
ExeSetModified() ;
|
||||
|
||||
// Se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTrimmingAutoSearch(" + ToString( nParentId) + "," +
|
||||
ToString( nSurfLayerId) + "," +
|
||||
ToString( dShapeLinTol) + "," +
|
||||
ToString( dShapeAngTol) + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
ToString( dEdgeLinTol) + "," +
|
||||
ToString( dAngTol) + "," +
|
||||
ToString( dAngFaceTol) + "," +
|
||||
ToString( vsShapes) + ")" +
|
||||
" -- bOk=" + ToString( bOk) ;
|
||||
string sLua = "EgtTrimmingGetHoleBorder(" + ToString( nParentId) + "," +
|
||||
ToString( vSurfIds) + "," +
|
||||
ToString( dSurfLinTol) + "," +
|
||||
ToString( dSurfAngTol) + "," +
|
||||
ToString( dEdgeLinTol) + "," +
|
||||
ToString( dEdgeAngTol) + "," +
|
||||
ToString( dEdgeThick) + ")" +
|
||||
" bOk=" + ToString( bOk) +
|
||||
" nNewSurfId=" + ToString( nFirstId) + ", nCount= " + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
@@ -141,7 +151,7 @@ ExeTrimmingAutoSearch( int nParentId, int nSurfLayerId, double dShapeLinTol, dou
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
int
|
||||
ExeTrimmingGetSurfTmFaceAdj( int nParentId, int nSurfId, const INTVECTOR& vTria, const PNTVECTOR& vPts,
|
||||
ExeTrimmingGetSurfTmFaceAdj( int nParentId, int nSurfId, int nTria, const Point3d& ptTria,
|
||||
double dAngTol, double dSize, double dSizeTol)
|
||||
{
|
||||
// Verifica database geometrico
|
||||
@@ -152,15 +162,12 @@ ExeTrimmingGetSurfTmFaceAdj( int nParentId, int nSurfId, const INTVECTOR& vTria,
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
|
||||
bool bOk = ( pStm != nullptr && pStm->IsValid()) ;
|
||||
|
||||
// Verifico che le facce appartengano alla superficie
|
||||
bOk = bOk && ( ! vTria.empty()) ;
|
||||
|
||||
// Recupero la superficie formata dai triangoli di adiacenza
|
||||
int nNewSurfId = GDB_ID_NULL ;
|
||||
if ( bOk) {
|
||||
PtrOwner<ISurfTriMesh> pStmAdjFace( CreateSurfTriMesh()) ;
|
||||
bOk = ( ! IsNull( pStmAdjFace) && pStmAdjFace->AdjustTopology()) ;
|
||||
bOk = GetTrimmingStmAdjTria( pStm, vTria, vPts, dAngTol, dSize, dSizeTol, pStmAdjFace) ;
|
||||
bOk = GetTrimmingStmAdjTria( pStm, nTria, ptTria, dAngTol, dSize, dSizeTol, pStmAdjFace) ;
|
||||
bOk = ( ! IsNull( pStmAdjFace) && pStmAdjFace->IsValid() && pStmAdjFace->GetTriangleCount() > 0) ;
|
||||
// Inserisco la Superficie nel DB geometrico
|
||||
if ( bOk) {
|
||||
@@ -174,7 +181,10 @@ ExeTrimmingGetSurfTmFaceAdj( int nParentId, int nSurfId, const INTVECTOR& vTria,
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTrimmingGetSurfTmFromFaceAdj(" + ToString( nParentId) + "," +
|
||||
ToString( nSurfId) + "," +
|
||||
ToString( vTria) + "," +
|
||||
ToString( nTria) + "," +
|
||||
"{ " + ToString( ptTria.x) + "," +
|
||||
ToString( ptTria.y) + "," +
|
||||
ToString( ptTria.z) + "}," +
|
||||
ToString( dAngTol) + ")" +
|
||||
" nNewSurfId=" + ToString( nNewSurfId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
@@ -379,7 +389,7 @@ ExeTrimmingGetBorders( int nParentId, const SELVECTOR& vIds, double dSurfLinTol,
|
||||
bool
|
||||
ExeTrimmingGetBordersByNormals( int nParentId, const SELVECTOR& vIds, double dSurfLinTol,
|
||||
double dSurfAngTol, double dLinTol, double dAngTol, double dThick,
|
||||
Point3d& ptNear, int& nFirstId, int& nCount)
|
||||
int& nFirstId, int& nCount)
|
||||
{
|
||||
// Verifica database geometrico
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
@@ -423,59 +433,15 @@ ExeTrimmingGetBordersByNormals( int nParentId, const SELVECTOR& vIds, double dSu
|
||||
ICRVCOMPOPOVECTOR vBezierEdges ;
|
||||
bOk = bOk && GetTrimmingFinalBorders( vpSurf, vFaces, dSurfLinTol, dSurfAngTol, dLinTol, dAngTol, dThick, vBezierEdges) ;
|
||||
if ( bOk) {
|
||||
// Se non ho un punto di vicinanza, le inserisco tutte
|
||||
if ( ! ptNear.IsValid()) {
|
||||
nCount = int( vBezierEdges.size()) ;
|
||||
// Scorro i gli Edges ottenuti
|
||||
for ( int nCrv = 0 ; bOk && nCrv < nCount ; ++ nCrv) {
|
||||
vBezierEdges[nCrv]->ToLoc( frDest) ;
|
||||
// Inserisco la curva nel DB Geometrico
|
||||
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vBezierEdges[nCrv])) ;
|
||||
bOk = ( nCurrId != GDB_ID_NULL) ;
|
||||
if ( nCrv == 0)
|
||||
nFirstId = nCurrId ;
|
||||
}
|
||||
}
|
||||
// Se ho un punto di vicinanza, cerco la coppia di curve più vicina
|
||||
else {
|
||||
// Se solo una coppia di curve, le inserisco e non ho ambiguità
|
||||
if ( int( vBezierEdges.size()) == 2) {
|
||||
nCount = int( vBezierEdges.size()) ;
|
||||
// Scorro gli Edges ottenuti
|
||||
for ( int nCrv = 0 ; bOk && nCrv < nCount ; ++ nCrv) {
|
||||
vBezierEdges[nCrv]->ToLoc( frDest) ;
|
||||
// Inserisco la curva nel DB Geometrico
|
||||
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vBezierEdges[nCrv])) ;
|
||||
bOk = ( nCurrId != GDB_ID_NULL) ;
|
||||
if ( nCrv == 0)
|
||||
nFirstId = nCurrId ;
|
||||
}
|
||||
}
|
||||
// altrimenti cerco la coppia più vicia
|
||||
else {
|
||||
double dSqMinDist = INFINITO ;
|
||||
int nInd = 0 ;
|
||||
for ( int i = 0 ; i + 1 < int( vBezierEdges.size()) ; i = i + 2) {
|
||||
double dSqDist = 0., dSqDist1 = 0. ;
|
||||
if ( DistPointCurve( ptNear, *vBezierEdges[i]).GetSqDist( dSqDist) &&
|
||||
DistPointCurve( ptNear, *vBezierEdges[i + 1]).GetSqDist( dSqDist1)) {
|
||||
double dCurrMinSqDist = min( dSqDist, dSqDist1) ;
|
||||
if ( dCurrMinSqDist < dSqMinDist) {
|
||||
dSqMinDist = dCurrMinSqDist ;
|
||||
nInd = i ;
|
||||
}
|
||||
}
|
||||
}
|
||||
vBezierEdges[nInd]->ToLoc( frDest) ;
|
||||
vBezierEdges[nInd + 1]->ToLoc( frDest) ;
|
||||
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vBezierEdges[nInd])) ;
|
||||
int nCurrId1 = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vBezierEdges[nInd + 1])) ;
|
||||
bOk = ( nCurrId != GDB_ID_NULL && nCurrId1 != GDB_ID_NULL) ;
|
||||
if ( bOk) {
|
||||
nFirstId = nCurrId1 ;
|
||||
nCount = 2 ;
|
||||
}
|
||||
}
|
||||
nCount = int( vBezierEdges.size()) ;
|
||||
// Scorro i gli Edges ottenuti
|
||||
for ( int nCrv = 0 ; bOk && nCrv < nCount ; ++ nCrv) {
|
||||
vBezierEdges[nCrv]->ToLoc( frDest) ;
|
||||
// Inserisco la curva nel DB Geometrico
|
||||
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vBezierEdges[nCrv])) ;
|
||||
bOk = ( nCurrId != GDB_ID_NULL) ;
|
||||
if ( nCrv == 0)
|
||||
nFirstId = nCurrId ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
+37
-55
@@ -21,49 +21,49 @@ using namespace std ;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimmingAutoSearch( lua_State* L)
|
||||
LuaTrimmingGetHoleBorder( lua_State* L)
|
||||
{
|
||||
// 9 parametri : nParentId, nSurfLayerId, dShapeLinTol, dShapeAngTol, dLinTol, dEdgeLinTol, dAngTol, dAngFaceTol, vsShapes
|
||||
// 7 parametri : nPartId, vSurfIds, vOtherSurfIds, dSurfLinTol, dSurfAngTol, dEdgeLinTol, dEdgeAngTol, dEdgeThick
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nSurfLayerId ;
|
||||
LuaCheckParam( L, 2, nSurfLayerId)
|
||||
double dShapeLinTol ;
|
||||
LuaCheckParam( L, 3, dShapeLinTol)
|
||||
double dShapeAngTol ;
|
||||
LuaCheckParam( L, 4, dShapeAngTol)
|
||||
double dLinTol ;
|
||||
LuaCheckParam( L, 5, dLinTol)
|
||||
LuaCheckParam( L, 1, nParentId) ;
|
||||
INTVECTOR vSurfIds ;
|
||||
LuaCheckParam( L, 2, vSurfIds) ;
|
||||
INTVECTOR vOtherSurfIds ;
|
||||
LuaCheckParam( L, 3, vOtherSurfIds) ;
|
||||
double dSurfLinTol ;
|
||||
LuaCheckParam( L, 4, dSurfLinTol) ;
|
||||
double dSurfAngTol ;
|
||||
LuaCheckParam( L, 5, dSurfAngTol) ;
|
||||
double dEdgeLinTol ;
|
||||
LuaCheckParam( L, 6, dEdgeLinTol)
|
||||
double dAngTol ;
|
||||
LuaCheckParam( L, 7, dAngTol)
|
||||
double dAngFaceTol ;
|
||||
LuaCheckParam( L, 8, dAngFaceTol)
|
||||
STRVECTOR vsShapes ;
|
||||
LuaCheckParam( L, 9, vsShapes)
|
||||
LuaCheckParam( L, 6, dEdgeLinTol) ;
|
||||
double dEdgeAngTol ;
|
||||
LuaCheckParam( L, 7, dEdgeAngTol) ;
|
||||
double dEdgeThick ;
|
||||
LuaCheckParam( L, 8, dEdgeThick) ;
|
||||
LuaClearStack( L) ;
|
||||
// Recupero le lavorazioni di Trimming associate
|
||||
INTVECTOR vOtherFaces ;
|
||||
bool bOk = ExeTrimmingAutoSearch( nParentId, nSurfLayerId, dShapeLinTol, dShapeAngTol, dLinTol,
|
||||
dEdgeLinTol, dAngTol, dAngFaceTol, vsShapes) ;
|
||||
// Recupero le Curve per Asole e Fori
|
||||
int nFirstId = GDB_ID_NULL, nCount = 0 ;
|
||||
bool bOk = ExeTrimmingGetHoleBorder( nParentId, vSurfIds, vOtherSurfIds, dSurfLinTol, dSurfAngTol, dEdgeLinTol,
|
||||
dEdgeAngTol, dEdgeThick, nFirstId, nCount) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
LuaSetParam( L, nFirstId) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
return 3 ;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimmingGetSurfTmFaceAdj( lua_State* L)
|
||||
{
|
||||
// 7 parametri : nParentId, nSurfId, vTria, vPts, dAngTol, dSize, dSizeTol
|
||||
// 7 parametri : nParentId, nSurfId, nTria, ptTria, dAngTol, dSize, dSizeTol
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId) ;
|
||||
int nSurfId ;
|
||||
LuaCheckParam( L, 2, nSurfId)
|
||||
INTVECTOR vTria ;
|
||||
LuaCheckParam( L, 3, vTria)
|
||||
PNTVECTOR vPts ;
|
||||
LuaCheckParam( L, 4, vPts)
|
||||
int nTria ;
|
||||
LuaCheckParam( L, 3, nTria)
|
||||
Point3d ptTria ;
|
||||
LuaCheckParam( L, 4, ptTria)
|
||||
double dAngTol ;
|
||||
LuaCheckParam( L, 5, dAngTol)
|
||||
double dSize ;
|
||||
@@ -73,25 +73,7 @@ LuaTrimmingGetSurfTmFaceAdj( lua_State* L)
|
||||
LuaClearStack( L) ;
|
||||
// Recupero le facce adiacenti in tolleranza angolare
|
||||
INTVECTOR vOtherFaces ;
|
||||
int nNewSurfId = ExeTrimmingGetSurfTmFaceAdj( nParentId, nSurfId, vTria, vPts, dAngTol, dSize, dSizeTol) ;
|
||||
LuaSetParam( L, nNewSurfId) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTrimmingGetSurfTmFromStmFaces( lua_State* L)
|
||||
{
|
||||
// 3 Parametri : nParentId, nSurfId, vFaces
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nSurfId ;
|
||||
LuaCheckParam( L, 2, nSurfId)
|
||||
INTVECTOR vFaces ;
|
||||
LuaCheckParam( L, 3, vFaces)
|
||||
LuaClearStack( L) ;
|
||||
// Eseguo
|
||||
int nNewSurfId = ExeTrimmingGetSurfTmFromStmFaces( nParentId, nSurfId, vFaces) ;
|
||||
int nNewSurfId = ExeTrimmingGetSurfTmFaceAdj( nParentId, nSurfId, nTria, ptTria, dAngTol, dSize, dSizeTol) ;
|
||||
LuaSetParam( L, nNewSurfId) ;
|
||||
return 1 ;
|
||||
}
|
||||
@@ -153,7 +135,7 @@ LuaTrimmingGetBorders( lua_State* L)
|
||||
static int
|
||||
LuaTrimmingGetBordersByNormals( lua_State* L)
|
||||
{
|
||||
// 7 o 8 parametri : nParentId, vIds, dLinTol, dAngTol, dThickness [, ptNear]
|
||||
// 7 o 8 parametri : nParentId, vIds, dSurfLinTol, dSurfAngTol, dThickness
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
SELVECTOR vIds ;
|
||||
@@ -168,13 +150,11 @@ LuaTrimmingGetBordersByNormals( lua_State* L)
|
||||
LuaCheckParam( L, 6, dAngTol)
|
||||
double dThickness ;
|
||||
LuaCheckParam( L, 7, dThickness)
|
||||
Point3d ptNear = P_INVALID ;
|
||||
LuaGetParam( L, 8, ptNear) ;
|
||||
LuaClearStack( L) ;
|
||||
// Creo le curve di Edge grezze
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
bool bOk = ExeTrimmingGetBordersByNormals( nParentId, vIds, dSurfLinTol, dSurfAngTol, dLinTol, dAngTol, dThickness, ptNear, nFirstId, nCount) ;
|
||||
bool bOk = ExeTrimmingGetBordersByNormals( nParentId, vIds, dSurfLinTol, dSurfAngTol, dLinTol, dAngTol, dThickness, nFirstId, nCount) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
LuaSetParam( L, nFirstId) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
@@ -277,16 +257,18 @@ bool
|
||||
LuaInstallTrimming( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
// ---
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingAutoSearch", LuaTrimmingAutoSearch) ;
|
||||
// ---
|
||||
// --- Ricerca Fori e Asole
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetHoleBorder", LuaTrimmingGetHoleBorder) ;
|
||||
// --- Ricerca Superifici
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetSurfTmFaceAdj", LuaTrimmingGetSurfTmFaceAdj) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetSurfTmFromStmFaces", LuaTrimmingGetSurfTmFromStmFaces) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetAdjSurfs", LuaTrimmingGetAdjSurfs) ;
|
||||
// --- Estrazione dei Bordi
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetBorders", LuaTrimmingGetBorders) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetBordersByNormals", LuaTrimmingGetBordersByNormals) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetFinalBorders", LuaTrimmingGetFinalBorders) ;
|
||||
// --- Recupero Surf Bezier Ruled
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetRuledBezier", LuaTrimmingGetRuledBezier) ;
|
||||
// --- Recupero linee di sincronizzazione
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetSurfBzSyncPoints", LuaTrimmingGetSurfBzSyncPoints) ;
|
||||
return bOk ;
|
||||
}
|
||||
Reference in New Issue
Block a user