EgtExecutor 2.5i1 :
- aggiunta funzione Exe e Lua ProjectCurveOnSurfTm.
This commit is contained in:
+96
-7
@@ -31,12 +31,14 @@
|
||||
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
||||
#include "/EgtDev/Include/EGkMedialAxis.h"
|
||||
#include "/EgtDev/Include/EGkChainCurves.h"
|
||||
#include "/EgtDev/Include/EGkProjectCurveSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EGkExtTExt.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkIntervals.h"
|
||||
#include "/EgtDev/Include/EGkPolygon3d.h"
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <functional>
|
||||
|
||||
@@ -2135,7 +2137,7 @@ bool
|
||||
ExeMergeCurvesInCurveCompo( int nId, double dLinTol, bool bStartEnd)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva composita
|
||||
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pCompo != nullptr) ;
|
||||
@@ -2158,7 +2160,7 @@ bool
|
||||
ExeRemoveCurveCompoUndercutOnY( int nId, double dLinTol)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva composita
|
||||
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pCompo != nullptr) ;
|
||||
@@ -2180,7 +2182,7 @@ static bool
|
||||
MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
nGroupId = AdjustId( nGroupId) ;
|
||||
// recupero il riferimento del gruppo
|
||||
Frame3d frGrp ;
|
||||
@@ -2233,11 +2235,11 @@ MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, in
|
||||
bool
|
||||
ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
||||
{
|
||||
bool bOk = MyChainCurvesInGroup(nGroupId, ptNear, true, nRefType) ;
|
||||
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, true, nRefType) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtChainCurvesInGroup(" + ToString( nGroupId) + "," +
|
||||
string sLua = "EgtChainCurvesInGroup(" + ToString( nGroupId) + ",{" +
|
||||
ToString( ptNear) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
@@ -2250,11 +2252,11 @@ ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
||||
bool
|
||||
ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
||||
{
|
||||
bool bOk = MyChainCurvesInGroup(nGroupId, ptNear, false, nRefType) ;
|
||||
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, false, nRefType) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtReorderCurvesInGroup(" + ToString( nGroupId) + "," +
|
||||
string sLua = "EgtReorderCurvesInGroup(" + ToString( nGroupId) + ",{" +
|
||||
ToString( ptNear) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
@@ -2262,3 +2264,90 @@ ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static bool
|
||||
MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId, double dLinTol, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva e il suo riferimento
|
||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCurveId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
return false ;
|
||||
Frame3d frCrv ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv))
|
||||
return false ;
|
||||
// recupero la superficie trimesh e il suo riferimento
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
Frame3d frStm ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frStm))
|
||||
return false ;
|
||||
// recupero il riferimento del gruppo di destinazione
|
||||
nDestGrpId = AdjustId( nDestGrpId) ;
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
||||
return false ;
|
||||
// porto la curva e il vettore nel riferimento della superficie
|
||||
CurveLocal CrvLoc( pCrv, frCrv, frStm) ;
|
||||
if ( CrvLoc.Get() == nullptr)
|
||||
return false ;
|
||||
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frCrv) ;
|
||||
vtDirL.LocToLoc( frCrv, frStm) ;
|
||||
// eseguo la proiezione
|
||||
PNT5AXVECTOR vPt5ax ;
|
||||
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, vtDirL, dLinTol, vPt5ax))
|
||||
return false ;
|
||||
// inserisco la composita nel gruppo destinazione
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
for ( const auto& Pt5ax : vPt5ax) {
|
||||
if ( IsNull( pCompo)) {
|
||||
pCompo.Set( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo))
|
||||
return false ;
|
||||
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
|
||||
}
|
||||
else
|
||||
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
|
||||
}
|
||||
int nCompoId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCompo)) ;
|
||||
if ( nCompoId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// aggiungo i versori nel gruppo destinazione
|
||||
for ( const auto& Pt5ax : vPt5ax) {
|
||||
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
|
||||
if ( IsNull( pGeoVct))
|
||||
return false ;
|
||||
pGeoVct->Set( 10 * GetLocToLoc( Pt5ax.vtDir, frStm, frDest), GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
|
||||
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoVct)) ;
|
||||
if ( nNewId == GDB_ID_NULL)
|
||||
return false ;
|
||||
pGeomDB->SetInfo( nNewId, "Par", Pt5ax.dPar) ;
|
||||
pGeomDB->SetInfo( nNewId, "Flag", Pt5ax.nFlag) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId, double dLinTol, int nRefType)
|
||||
{
|
||||
bool bOk = MyProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, nRefType) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtProjectCurveOnSurfTm(" + ToString( nCurveId) + "," +
|
||||
ToString( nSurfTmId) + ",{" +
|
||||
ToString( vtDir) + "}," +
|
||||
ToString( nDestGrpId) + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return bOk ;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user