EgtExecutor :
- aggiunta funzione per l'estensione di una superficie in tangenza. - cambiata chiamata alla offset3d.
This commit is contained in:
@@ -2761,15 +2761,9 @@ ExeOffsetCurve3d( int nId, int nSurfId, double dDist, int nType, int* pnCount, d
|
||||
PNT5AXVECTOR vPt5ax ;
|
||||
if ( ! ProjectCurveOnSurf( *pCurve, vpSurf, dLinTol, dMaxSegLen, bSharpEdges, vPt5ax))
|
||||
return GDB_ID_NULL ;
|
||||
PolyLine PL ;
|
||||
VCT3DVECTOR vOffDir ;
|
||||
for ( int i = 0 ; i < ssize( vPt5ax) ; ++i) {
|
||||
PL.AddUPoint( i, vPt5ax[i].ptP) ;
|
||||
vOffDir.push_back( vPt5ax[i].vtDir1) ;
|
||||
}
|
||||
// eseguo l'offset
|
||||
OffsetCurve3d OffsCrv( dLinTol) ;
|
||||
bool bOk = OffsCrv.Make( PL, vOffDir, dDist, nType) ;
|
||||
bool bOk = OffsCrv.Make( vPt5ax, dDist, nType) ;
|
||||
// salvo le curve di offset
|
||||
int nRefId = nId ;
|
||||
int nCount = 0 ;
|
||||
|
||||
@@ -3021,3 +3021,27 @@ ExeCreateSurfBzSwept( int nParentId, int nSectId, int nGuideId, const Vector3d&
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfExtension( int nParentId, int nSurfId, double dExtLen, int nCrv, int nSubCrv,
|
||||
int nType, double dLinTol)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
nParentId = AdjustId( nParentId) ;
|
||||
|
||||
// recupero la superficie
|
||||
const ISurfTriMesh* pSurf = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
|
||||
if ( pSurf == nullptr) {
|
||||
const ISurfBezier* pSurfBz = GetSurfBezier( pGeomDB->GetGeoObj( nSurfId)) ;
|
||||
if ( pSurfBz == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
pSurf = pSurfBz->GetAuxSurfRefined() ;
|
||||
}
|
||||
|
||||
ISurfTriMesh* pExtension = GetSurfExtension( pSurf, dExtLen, nCrv, nSubCrv, nType, dLinTol) ;
|
||||
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pExtension) ;
|
||||
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
@@ -1481,6 +1481,35 @@ LuaCreateSurfBzSwept( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfExtension( lua_State* L)
|
||||
{
|
||||
// 3 o 7 parametri : ParentId, nSurfId, dExtLen [, nCrv] [, nSubCrv] [, nType] [, dTol]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nSurfId ;
|
||||
LuaCheckParam( L, 2, nSurfId)
|
||||
double dExtLen ;
|
||||
LuaCheckParam( L, 3, dExtLen)
|
||||
int nCrv = 0 ; // di default loop 0
|
||||
int nSubCrv = -1 ; // di default tutto estendo la superficie lungo tutto il loop
|
||||
int nType = ICurve::OFF_CHAMFER ;
|
||||
double dTol = LIN_TOL_STD ;
|
||||
if ( LuaGetParam( L, 4, nCrv)) {
|
||||
LuaGetParam( L, 5, nSubCrv) ;
|
||||
LuaGetParam( L, 6, nType) ;
|
||||
LuaGetParam( L, 7, dTol) ;
|
||||
}
|
||||
LuaClearStack( L) ;
|
||||
int nId = ExeCreateSurfExtension( nParentId, nSurfId, dExtLen, nCrv, nSubCrv, nType, dTol) ;
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
|
||||
@@ -1537,5 +1566,6 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzRuledGuided", LuaCreateSurfBzRuledGuided) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzSkinned", LuaCreateSurfBzSkinned) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzSwept", LuaCreateSurfBzSwept) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfExtend", LuaCreateSurfExtension) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user