EgtInterface 1.6c3 :

- aggiunta gestione cambio inizio di curva chiusa
- corretta funzione lua EgtArc2PVNEx.
This commit is contained in:
Dario Sassi
2015-03-16 14:16:21 +00:00
parent 4fe226fd74
commit 10814a2d04
4 changed files with 62 additions and 3 deletions
+40
View File
@@ -103,6 +103,46 @@ __stdcall EgtOffsetCurve( int nId, double dDist, int nType)
return ( bOk ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtChangeClosedCurveStartPoint( int nId, const double ptP[3], int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pCurve != nullptr) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale il punto vicino ad iniziale
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
// recupero la posizione parametrica della proiezione di questo punto sulla curva
DistPointCurve distPC( ptPL, *pCurve) ;
double dPar ;
int nFlag ;
bOk = bOk && distPC.GetParamAtMinDistPoint( 0, dPar, nFlag) ;
// cambio il punto iniziale
if ( bOk && pCurve->GetType() == CRV_ARC)
bOk = bOk && dynamic_cast<ICurveArc*>(pCurve)->ChangeStartPoint(dPar) ;
else if ( bOk && pCurve->GetType() == CRV_COMPO)
bOk = bOk && dynamic_cast<ICurveComposite*>(pCurve)->ChangeStartPoint(dPar) ;
else
bOk = false ;
EgtSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtChangeClosedCurveStartPoint(" + ToString( nId) + ",{" +
ToString( Point3d( ptP)) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return ( bOk ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtModifyCurveStartPoint( int nId, const double ptP[3], int nRefType)
BIN
View File
Binary file not shown.
+3 -3
View File
@@ -406,11 +406,11 @@ LuaCreateCurveArc2PVNEx( lua_State* L)
int nIdE ;
LuaCheckParam( L, 5, nIdE)
Vector3d vtDirS ;
LuaCheckParam( L, 4, vtDirS)
LuaCheckParam( L, 6, vtDirS)
Vector3d vtNorm ;
LuaCheckParam( L, 5, vtNorm)
LuaCheckParam( L, 7, vtNorm)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 6, nRefType) ;
LuaGetRefType( L, 8, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = EgtCreateCurveArc2PVNEx( nParentId, ptStart.v, ptEnd.v, StringToSep( sSepE), nIdE,
+19
View File
@@ -63,6 +63,24 @@ LuaOffsetCurve( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaChangeClosedCurveStartPoint( lua_State* L)
{
// 2 o 3 parametri : Id, NewStart [, sRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptStart ;
LuaCheckParam( L, 2, ptStart)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 3, nRefType) ;
LuaClearStack( L) ;
// modifico il punto iniziale
bool bOk = ( EgtChangeClosedCurveStartPoint( nId, ptStart.v, nRefType) != FALSE) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaModifyCurveStartPoint( lua_State* L)
@@ -331,6 +349,7 @@ LuaInstallGdbModifyCurve( lua_State* L)
try {
lua_register( L, "EgtInvertCurve", LuaInvertCurve) ;
lua_register( L, "EgtOffsetCurve", LuaOffsetCurve) ;
lua_register( L, "EgtChangeClosedCurveStartPoint", LuaChangeClosedCurveStartPoint) ;
lua_register( L, "EgtModifyCurveStartPoint", LuaModifyCurveStartPoint) ;
lua_register( L, "EgtModifyCurveEndPoint", LuaModifyCurveEndPoint) ;
lua_register( L, "EgtModifyCurveExtrusion", LuaModifyCurveExtrusion) ;