EgtExecutor :
- Aggiunta funzione "EgtCutSurfFrPlane".
This commit is contained in:
@@ -491,6 +491,44 @@ ExeSurfFrRotateSimpleNoCollision( int nId1, int nId2, const Point3d& ptCen, doub
|
||||
return ( bOk && CAvSimpleSurfFrMove( *pSfr1, *pSfr2L).Rotate(ptCenL, dAngDeg)) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCutSurfFrPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bInVsOut, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la regione piana
|
||||
ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pSfr != nullptr) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// porto in locale il punto e la normale del piano
|
||||
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
|
||||
// calcolo il piano di taglio
|
||||
Plane3d plPlane ;
|
||||
bOk = bOk && plPlane.Set( ptOnL, vtNL) ;
|
||||
// se la parte da conservare è Out, allora inverto il piano
|
||||
if ( ! bInVsOut)
|
||||
plPlane.Invert() ;
|
||||
// eseguo il taglio
|
||||
bOk = bOk && pSfr->Cut( plPlane) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtCutSurfFrPlane(" + IdToString( nId) + ",{" +
|
||||
ToString( ptOn) + "},{" +
|
||||
ToString( vtN) + "}," +
|
||||
( bInVsOut ? "true" : "false") + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType, bool bUpdate)
|
||||
|
||||
Reference in New Issue
Block a user