Merge remote-tracking branch 'origin/ExtDimension_angular'

This commit is contained in:
DarioS
2023-04-08 11:42:53 +02:00
2 changed files with 854 additions and 110 deletions
+689 -110
View File
File diff suppressed because it is too large Load Diff
+165
View File
@@ -344,6 +344,165 @@ LuaCreateAlignedDimension( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateAngularDimension(lua_State* L)
{
// 6 o 7 parametri : ParentId, ptP1, ptP0, ptP2, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptP1 ;
LuaCheckParam( L, 2, ptP1) ;
Point3d ptP0 ;
LuaCheckParam( L, 3, ptP0) ;
Point3d ptP2 ;
LuaCheckParam( L, 4, ptP2) ;
Point3d ptDim ;
LuaCheckParam( L, 5, ptDim) ;
string sText ;
LuaCheckParam( L, 6, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ;
// creo la quota angolare
int nId = ExeCreateAngularDimension( nParentId, ptP1, ptP0, ptP2, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
static int
LuaCreateAngularDimensionFromLines( lua_State* L)
{
// 4 o 5 parametri : nParentId, vLineIds, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
INTVECTOR vLineIds ;
LuaCheckParam( L, 2, vLineIds) ;
Point3d ptDim ;
LuaCheckParam( L, 3, ptDim) ;
string sText ;
LuaCheckParam( L, 4, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L ) ;
// creo la quota allineata
int nId = ExeCreateAngularDimensionFromLines( nParentId, vLineIds, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L ) ;
return 1 ;
}
static int
LuaCreateAngularDimensionFromArc( lua_State* L)
{
// 4 o 5 parametri : nParentId, nCrvId, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId) ;
Point3d ptDim ;
LuaCheckParam( L, 3, ptDim) ;
string sText ;
LuaCheckParam( L, 4, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo la quota allineata
int nId = ExeCreateAngularDimensionFromArc( nParentId, nCrvId, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
static int
LuaCreateAngularDimensionFromCircle( lua_State* L)
{
// 6 o 7 parametri : nParentId, nCrvId, ptP1, ptP2, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId) ;
Point3d ptP1 ;
LuaCheckParam( L, 3, ptP1) ;
Point3d ptP2 ;
LuaCheckParam( L, 4, ptP2) ;
Point3d ptDim ;
LuaCheckParam( L, 5, ptDim) ;
string sText ;
LuaCheckParam( L, 6, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ;
// creo la quota allineata
int nId = ExeCreateAngularDimensionFromCircle( nParentId, nCrvId, ptP1, ptP2, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
static int
LuaCreateRadialDimension( lua_State* L)
{
// 4 o 5 parametri : nParentId, nCrvId, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId) ;
Point3d ptDim ;
LuaCheckParam( L, 3, ptDim) ;
string sText ;
LuaCheckParam( L, 4, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L ) ;
// creo la quota allineata
int nId = ExeCreateRadialDimension( nParentId, nCrvId, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
static int
LuaCreateDiametralDimension( lua_State* L )
{
// 4 o 5 parametri : nParentId, nCrvId, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId) ;
Point3d ptDim ;
LuaCheckParam( L, 3, ptDim) ;
string sText ;
LuaCheckParam( L, 4, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo la quota allineata
int nId = ExeCreateDiametralDimension( nParentId, nCrvId, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbCreate( LuaMgr& luaMgr)
@@ -361,5 +520,11 @@ LuaInstallGdbCreate( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtHorizontalDimension", LuaCreateHorizontalDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVerticalDimension", LuaCreateVerticalDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAlignedDimension", LuaCreateAlignedDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension);
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromCircle", LuaCreateAngularDimensionFromCircle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRadialDimension", LuaCreateRadialDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDiametralDimension", LuaCreateDiametralDimension) ;
return bOk ;
}