EgtExecutor 2.4c2 :
- aggiunte funzioni Exe e Lua AddCurveCompoLineTg.
This commit is contained in:
@@ -1541,6 +1541,47 @@ ExeAddCurveCompoCurve( int nId, int nAddCrvId, bool bEraseOrig, bool bEndVsStart
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeAddCurveCompoLineTg( int nId, double dLen, bool bEndVsStart)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// recupero la curva composita
|
||||
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
|
||||
bOk = bOk && ( pCompo != nullptr) ;
|
||||
// calcolo punto di allungo
|
||||
Point3d ptNew ;
|
||||
if ( bEndVsStart) {
|
||||
Point3d ptEnd ;
|
||||
Vector3d vtEnd ;
|
||||
bOk = bOk && pCompo->GetEndPoint( ptEnd) && pCompo->GetEndDir( vtEnd) ;
|
||||
if ( bOk)
|
||||
ptNew = ptEnd + vtEnd * dLen ;
|
||||
}
|
||||
else {
|
||||
Point3d ptStart ;
|
||||
Vector3d vtStart ;
|
||||
bOk = bOk && pCompo->GetStartPoint( ptStart) && pCompo->GetStartDir( vtStart) ;
|
||||
if ( bOk)
|
||||
ptNew = ptStart - vtStart * dLen ;
|
||||
}
|
||||
// eseguo la modifica
|
||||
bOk = bOk && pCompo->AddLine( ptNew, bEndVsStart) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtAddCurveCompoLineTg(" + ToString( nId) + ",{" +
|
||||
ToString( dLen) + "}," +
|
||||
( bEndVsStart ? "true" : "false") + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeAddCurveCompoLine( int nId, const Point3d& ptP, bool bEndVsStart, int nRefType)
|
||||
|
||||
Binary file not shown.
@@ -590,6 +590,24 @@ LuaAddCurveCompoCurve( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAddCurveCompoLineTg( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, dLen [, bEndVsStart]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
double dLen ;
|
||||
LuaCheckParam( L, 2, dLen)
|
||||
bool bEndVsStart = true ;
|
||||
LuaGetParam( L, 3, bEndVsStart) ;
|
||||
LuaClearStack( L) ;
|
||||
// aggiungo una linea in coda alla curva composita
|
||||
bool bOk = ExeAddCurveCompoLineTg( nId, dLen, bEndVsStart) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAddCurveCompoLine( lua_State* L)
|
||||
@@ -909,6 +927,7 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcByFlip", LuaModifyArcByFlip) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCloseCurveCompo", LuaCloseCurveCompo) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddCurveCompoCurve", LuaAddCurveCompoCurve) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddCurveCompoLineTg", LuaAddCurveCompoLineTg) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddCurveCompoLine", LuaAddCurveCompoLine) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddCurveCompoArcTg", LuaAddCurveCompoArcTg) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddCurveCompoArc2P", LuaAddCurveCompoArc2P) ;
|
||||
|
||||
Reference in New Issue
Block a user