EgtExecutor :
- aggiunta funzione exe e lua CreateAngularDimensionEx.
This commit is contained in:
+60
-4
@@ -583,7 +583,7 @@ ExeCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptV, const Point3d& ptP2,
|
||||
MyCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2,
|
||||
const Point3d& ptDim, const string& sText, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
@@ -603,7 +603,7 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptV
|
||||
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
|
||||
if ( IsNull( pDim) ||
|
||||
! MySetDimensionStyle( pDim ) ||
|
||||
! pDim->SetAngular( ptP1L, ptVL, ptP2L, ptDimL, vtNL, sText))
|
||||
! pDim->SetAngular( ptVL, ptP1L, ptP2L, ptDimL, vtNL, sText))
|
||||
return GDB_ID_NULL ;
|
||||
// inserisco la quota nel DB
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
|
||||
@@ -611,11 +611,11 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptV
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptV, const Point3d& ptP2,
|
||||
ExeCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2,
|
||||
const Point3d& ptDim, const string& sText, int nRefType)
|
||||
{
|
||||
// eseguo
|
||||
int nId = MyCreateAngularDimension( nParentId, ptP1, ptV, ptP2, ptDim, sText, nRefType) ;
|
||||
int nId = MyCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
@@ -633,6 +633,62 @@ ExeCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& pt
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
MyCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
|
||||
const Point3d& ptV2,const Point3d& ptP2, const Point3d& ptDim,
|
||||
const string& sText, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
nParentId = AdjustId( nParentId) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti e assegno i versori
|
||||
Point3d ptV1L = GetPointLocal( pGeomDB, ptV1, nRefType, frLoc) ;
|
||||
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
|
||||
Point3d ptV2L = GetPointLocal( pGeomDB, ptV2, nRefType, frLoc) ;
|
||||
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
|
||||
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
|
||||
// creo la quota
|
||||
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
|
||||
if ( IsNull( pDim) ||
|
||||
! MySetDimensionStyle( pDim ) ||
|
||||
! pDim->SetAngularEx( ptV1L, ptP1L, ptV2L, ptP2L, ptDimL, vtNL, sText))
|
||||
return GDB_ID_NULL ;
|
||||
// inserisco la quota nel DB
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
|
||||
const Point3d& ptV2, const Point3d& ptP2, const Point3d& ptDim,
|
||||
const string& sText, int nRefType)
|
||||
{
|
||||
// eseguo
|
||||
int nId = MyCreateAngularDimensionEx( nParentId, ptV1, ptP1, ptV2, ptP2, ptDim, sText, nRefType) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtAngularDimensionEx(" + IdToString( nParentId) + ",{" +
|
||||
ToString( ptV1) + "},{" +
|
||||
ToString( ptP1) + "},{" +
|
||||
ToString( ptV2) + "},{" +
|
||||
ToString( ptP2) + "},{" +
|
||||
ToString( ptDim) + "},'" +
|
||||
StringToLuaString( sText) + "'," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo del oggetto
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Point3d& ptDim,
|
||||
|
||||
+39
-6
@@ -400,13 +400,13 @@ LuaCreateDiametralDimension( lua_State* L )
|
||||
static int
|
||||
LuaCreateAngularDimension(lua_State* L)
|
||||
{
|
||||
// 6 o 7 parametri : ParentId, ptP1, ptV, ptP2, ptDim, Text [, nRefType]
|
||||
// 6 o 7 parametri : ParentId, ptV, ptP1, ptP2, ptDim, Text [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptP1 ;
|
||||
LuaCheckParam( L, 2, ptP1) ;
|
||||
Point3d ptV ;
|
||||
LuaCheckParam( L, 3, ptV) ;
|
||||
LuaCheckParam( L, 2, ptV) ;
|
||||
Point3d ptP1 ;
|
||||
LuaCheckParam( L, 3, ptP1) ;
|
||||
Point3d ptP2 ;
|
||||
LuaCheckParam( L, 4, ptP2) ;
|
||||
Point3d ptDim ;
|
||||
@@ -417,7 +417,39 @@ LuaCreateAngularDimension(lua_State* L)
|
||||
LuaGetParam( L, 7, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo la quota angolare
|
||||
int nId = ExeCreateAngularDimension( nParentId, ptP1, ptV, ptP2, ptDim, sText, nRefType) ;
|
||||
int nId = ExeCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateAngularDimensionEx(lua_State* L)
|
||||
{
|
||||
// 7 o 8 parametri : ParentId, ptV1, ptP1, ptV2, ptP2, ptDim, Text [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptV1 ;
|
||||
LuaCheckParam( L, 2, ptV1) ;
|
||||
Point3d ptP1 ;
|
||||
LuaCheckParam( L, 3, ptP1) ;
|
||||
Point3d ptV2 ;
|
||||
LuaCheckParam( L, 4, ptV2) ;
|
||||
Point3d ptP2 ;
|
||||
LuaCheckParam( L, 5, ptP2) ;
|
||||
Point3d ptDim ;
|
||||
LuaCheckParam( L, 6, ptDim) ;
|
||||
string sText ;
|
||||
LuaCheckParam( L, 7, sText) ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 8, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo la quota angolare
|
||||
int nId = ExeCreateAngularDimensionEx( nParentId, ptV1, ptP1, ptV2, ptP2, ptDim, sText, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
@@ -497,7 +529,8 @@ LuaInstallGdbCreate( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAlignedDimension", LuaCreateAlignedDimension) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRadialDimension", LuaCreateRadialDimension) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDiametralDimension", LuaCreateDiametralDimension) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension);
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionEx", LuaCreateAngularDimensionEx) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ;
|
||||
return bOk ;
|
||||
|
||||
Reference in New Issue
Block a user