EgtExecutor :
- aggiunta CurveAreaXY in EXE e LUA - corretta ExeCreateOutRegion.
This commit is contained in:
@@ -575,6 +575,21 @@ ExeCurveLengthAtPoint( int nId, const Point3d& ptOn, double dExtend, double* pdL
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCurveAreaXY( int nId, double* pdArea)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( pdArea == nullptr)
|
||||
return false ;
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
// determino l'area
|
||||
return pCurve->GetAreaXY( *pdArea) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCurveNearestExtremityToPoint( int nId, const Point3d& ptP, bool& bStart)
|
||||
|
||||
@@ -196,17 +196,17 @@ ExeCreateOutRegion( int nParentId, int nOutCrvId)
|
||||
// accorcio inizio
|
||||
pCompo->TrimStartAtLen( 5 * EPS_SMALL) ;
|
||||
// creo curva della parte esterna
|
||||
PolyLine PL2 ;
|
||||
Point3d ptStart ;
|
||||
pCompo->GetStartPoint( ptStart) ;
|
||||
Point3d ptEnd ;
|
||||
pCompo->GetEndPoint( ptEnd) ;
|
||||
PolyLine PL2 ;
|
||||
PL2.AddUPoint( 0, ptEnd) ;
|
||||
PL2.AddUPoint( 1, b3Box.GetMax()) ;
|
||||
PL2.AddUPoint( 1, Point3d( ptEnd.x, b3Box.GetMax().y, b3Box.GetMin().z)) ;
|
||||
PL2.AddUPoint( 2, Point3d( b3Box.GetMin().x, b3Box.GetMax().y, b3Box.GetMin().z)) ;
|
||||
PL2.AddUPoint( 3, b3Box.GetMin()) ;
|
||||
PL2.AddUPoint( 4, Point3d( b3Box.GetMax().x, b3Box.GetMin().y, b3Box.GetMin().z)) ;
|
||||
PL2.AddUPoint( 5, b3Box.GetMax() - Vector3d( 0, 5 * EPS_SMALL, 0)) ;
|
||||
Point3d ptStart ;
|
||||
pCompo->GetStartPoint( ptStart) ;
|
||||
PL2.AddUPoint( 5, Point3d( b3Box.GetMax().x, ptStart.y, b3Box.GetMin().z)) ;
|
||||
PL2.AddUPoint( 6, ptStart) ;
|
||||
// la converto in curva composita
|
||||
PtrOwner<ICurveComposite> pCompo2( CreateCurveComposite()) ;
|
||||
|
||||
@@ -317,6 +317,23 @@ LuaCurveLength( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveAreaXY( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero l'area della curva proiettata sul piano XY
|
||||
double dArea ;
|
||||
if ( ExeCurveAreaXY( nId, &dArea))
|
||||
LuaSetParam( L, dArea) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveExtrusion( lua_State* L)
|
||||
@@ -693,6 +710,7 @@ LuaInstallGeoSnap( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtET", LuaExtrusionByThickness) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveDomain", LuaCurveDomain) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveLength", LuaCurveLength) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveAreaXY", LuaCurveAreaXY) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveExtrusion", LuaCurveExtrusion) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveThickness", LuaCurveThickness) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSelfIntersCount", LuaCurveSelfIntersCount) ;
|
||||
|
||||
Reference in New Issue
Block a user