EgtExecutor 1.6f1 :

- corretto errore in trim/extend di curve chiuse
- aggiunta ExeCurveDomain
- aggiunta ExeCurveNearestExtremityToPoint
- modificata ExeGetMinDistPointCurve (aggiunto un parametro).
This commit is contained in:
Dario Sassi
2015-06-06 17:55:02 +00:00
parent e2b54a993b
commit 487f2b68ce
5 changed files with 80 additions and 7 deletions
+20 -3
View File
@@ -452,9 +452,9 @@ ExeTrimExtendCurveByLen( int nId, double dLen, const Point3d& ptNear, int nRefTy
// porto in locale il punto
Point3d ptNearL = GetPointLocal( pGeomDB, ptNear, nRefType, frLoc) ;
// cerco l'estremo più vicino al punto passato
Point3d ptStart, ptEnd ;
if ( bOk && pCurve->GetStartPoint( ptStart) && pCurve->GetEndPoint( ptEnd)) {
if ( SqDist( ptStart, ptNearL) < SqDist( ptEnd, ptNearL)) {
bool bStart ;
if ( bOk && pCurve->GetNearestExtremityToPoint( ptNearL, bStart)) {
if ( bStart) {
if ( dLen < - EPS_SMALL)
bOk = pCurve->TrimStartAtLen( - dLen) ;
else if ( dLen > EPS_SMALL)
@@ -469,6 +469,23 @@ ExeTrimExtendCurveByLen( int nId, double dLen, const Point3d& ptNear, int nRefTy
bOk = pCurve->ExtendEndByLen( dLen) ;
}
}
//Point3d ptStart, ptEnd ;
//if ( bOk && pCurve->GetStartPoint( ptStart) && pCurve->GetEndPoint( ptEnd)) {
// if ( SqDist( ptStart, ptNearL) < SqDist( ptEnd, ptNearL)) {
// if ( dLen < - EPS_SMALL)
// bOk = pCurve->TrimStartAtLen( - dLen) ;
// else if ( dLen > EPS_SMALL)
// bOk = pCurve->ExtendStartByLen( dLen) ;
// }
// else {
// if ( dLen < - EPS_SMALL) {
// double dCrvLen ;
// bOk = pCurve->GetLength( dCrvLen) && pCurve->TrimEndAtLen( dCrvLen + dLen) ;
// }
// else if ( dLen > EPS_SMALL)
// bOk = pCurve->ExtendEndByLen( dLen) ;
// }
//}
else
bOk = false ;
ExeSetModified() ;
+37 -3
View File
@@ -573,6 +573,23 @@ ExeFrame( int nId, int nRefId, Frame3d& frFrame)
return false ;
}
//----------------------------------------------------------------------------
bool
ExeCurveDomain( int nId, double* pdStart, double* pdEnd)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico i parametri
if ( pdStart == nullptr || pdEnd == nullptr)
return false ;
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
if ( pCurve == nullptr)
return false ;
// recupero il dominio
return pCurve->GetDomain( *pdEnd, *pdEnd) ;
}
//----------------------------------------------------------------------------
bool
ExeCurveLength( int nId, double* pdLen)
@@ -634,6 +651,18 @@ ExeCurveLengthAtPoint( int nId, const Point3d& ptOn, double dExtend, double* pdL
return false ;
}
//----------------------------------------------------------------------------
bool
ExeCurveNearestExtremityToPoint( int nId, const Point3d& ptP, bool& bStart)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
// recupero quale estremo è più vicino al punto
return ( pCurve != nullptr && pCurve->GetNearestExtremityToPoint( ptP, bStart)) ;
}
//----------------------------------------------------------------------------
bool
ExeCurveExtrusion( int nId, int nRefId, Vector3d& vtExtr)
@@ -666,11 +695,11 @@ ExeCurveThickness( int nId, double* pdThick)
//----------------------------------------------------------------------------
bool
ExeGetMinDistPointCurve( const Point3d& ptP, int nId, double* pdDist)
ExeGetMinDistPointCurve( const Point3d& ptP, int nId, double* pdDist, double* pdU)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico i parametri
// verifico il primo parametro di ritorno obbligatorio
if ( pdDist == nullptr)
return false ;
// recupero la curva
@@ -678,8 +707,13 @@ ExeGetMinDistPointCurve( const Point3d& ptP, int nId, double* pdDist)
if ( pCurve == nullptr)
return false ;
// calcolo la minima distanza
int nFlag ;
DistPointCurve distPC( ptP, *pCurve) ;
return distPC.GetDist( *pdDist) ;
if ( ! distPC.GetDist( *pdDist))
return false ;
if ( pdU != nullptr && ! distPC.GetParamAtMinDistPoint( 0, *pdU, nFlag))
return false ;
return true ;
}
//----------------------------------------------------------------------------
+1 -1
View File
@@ -15,7 +15,7 @@
#include "stdafx.h"
#include "EXE.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDEv/Include/EGnScan.h"
#include "/EgtDEv/Include/EGnScanner.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtLogger.h"
BIN
View File
Binary file not shown.
+22
View File
@@ -279,6 +279,27 @@ LuaFrame( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveDomain( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero il dominio della curva
double dStart, dEnd ;
if ( ExeCurveDomain( nId, &dStart, &dEnd) != FALSE) {
LuaSetReturn( L, dStart) ;
LuaSetReturn( L, dEnd) ;
return 2 ;
}
else {
LuaSetReturn( L) ;
return 1 ;
}
}
//----------------------------------------------------------------------------
static int
LuaCurveLength( lua_State* L)
@@ -566,6 +587,7 @@ LuaInstallGeoSnap( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtUV", LuaAtParamVector) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtFR", LuaFrame) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtET", LuaExtrusionByThickness) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveDomain", LuaCurveDomain) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveLength", LuaCurveLength) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveExtrusion", LuaCurveExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveThickness", LuaCurveThickness) ;