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)
|
||||
|
||||
Reference in New Issue
Block a user