EgtExecutor :

- aggiunta funzione Exe e Lua MoveCurveCompoCurve.
This commit is contained in:
Dario Sassi
2021-04-05 16:25:43 +00:00
parent 8d218b85b7
commit 53575c745b
2 changed files with 53 additions and 1 deletions
+32 -1
View File
@@ -1748,6 +1748,37 @@ ExeRemoveCurveCompoJoint( int nId, int nU)
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeMoveCurveCompoCurve( int nId, int nCrv, const Vector3d& vtMove, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// recupero la curva composita
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pCompo != nullptr) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale il movimento
Vector3d vtMoveL = GetVectorLocal( pGeomDB, vtMove, nRefType, frLoc) ;
// eseguo la modifica
bOk = bOk && pCompo->MoveCurve( nCrv, vtMove) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtMoveCurveCompoCurve(" + ToString( nId) + "," +
ToString( nCrv) + ",{" +
ToString( vtMove) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeModifyCurveCompoCurveToArc( int nId, int nCrv, const Point3d& ptMid, int nRefType)
@@ -1764,7 +1795,7 @@ ExeModifyCurveCompoCurveToArc( int nId, int nCrv, const Point3d& ptMid, int nRef
// porto in locale il nuovo punto
Point3d ptMidL = GetPointLocal( pGeomDB, ptMid, nRefType, frLoc) ;
// eseguo la modifica
bOk = bOk && pCompo-> ModifyCurveToArc( nCrv, ptMidL) ;
bOk = bOk && pCompo->ModifyCurveToArc( nCrv, ptMidL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
+21
View File
@@ -712,6 +712,26 @@ LuaRemoveCurveCompoJoint( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaMoveCurveCompoCurve( lua_State* L)
{
// 3 o 4 parametri : Id, nCrv, vtMove [, nRefType]
int nId ;
LuaCheckParam( L, 1, nId)
int nCrv ;
LuaCheckParam( L, 2, nCrv)
Vector3d vtMove ;
LuaCheckParam( L, 3, vtMove)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// muovo la curva
bool bOk = ExeMoveCurveCompoCurve( nId, nCrv, vtMove, nRefType) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaModifyCurveCompoCurveToArc( lua_State* L)
@@ -882,6 +902,7 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAddCurveCompoJoint", LuaAddCurveCompoJoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveCompoJoint", LuaModifyCurveCompoJoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveCurveCompoJoint", LuaRemoveCurveCompoJoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMoveCurveCompoCurve", LuaMoveCurveCompoCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveCompoCurveToArc", LuaModifyCurveCompoCurveToArc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveCompoCurveToLine", LuaModifyCurveCompoCurveToLine) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeCurveCompo", LuaExplodeCurveCompo) ;