EgtExecutor :
- aggiunte funzioni Exe e Lua CreateSurfTmTriangle e CreateSurfTmRectangle - in Copy, CopyGlob, Relocate e RelocateGlob RefId ora accetta anche valori simbolici (layer corrente, ..).
This commit is contained in:
+92
-2
@@ -56,8 +56,7 @@ ExeCreateSurfFrRectangle( int nParentId, const Point3d& ptIni, const Point3d& pt
|
||||
if ( ( frEnt.VersZ() * vtZL) < 0)
|
||||
frEnt.PseudoMirror( frEnt.Orig(), frEnt.VersZ()) ;
|
||||
// ricavo le dimensioni della base
|
||||
Point3d ptCrossI = ptCrossL ;
|
||||
ptCrossI.ToLoc( frEnt) ;
|
||||
Point3d ptCrossI = GetToLoc( ptCrossL, frEnt) ;
|
||||
double dWidth = ptCrossI.x ;
|
||||
double dLen = ptCrossI.y ;
|
||||
// creo il rettangolo nel suo riferimento intrinseco
|
||||
@@ -863,6 +862,97 @@ ExeCreateSurfTmSphere( int nParentId, const Point3d& ptOrig,
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmTriangle( int nParentId, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
nParentId = AdjustId( nParentId) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale i punti
|
||||
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
|
||||
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
|
||||
Point3d ptP3L = GetPointLocal( pGeomDB, ptP3, nRefType, frLoc) ;
|
||||
// creo la superficie trimesh
|
||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
||||
bOk = bOk && ! IsNull( pStm) ;
|
||||
// assegno il triangolo
|
||||
if ( bOk) {
|
||||
pStm->Init( 3, 1, 1) ;
|
||||
int vV[3]{ pStm->AddVertex( ptP1L),
|
||||
pStm->AddVertex( ptP2L),
|
||||
pStm->AddVertex( ptP3L)} ;
|
||||
bOk = ( pStm->AddTriangle( vV) != SVT_NULL) && pStm->AdjustTopology() ;
|
||||
}
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmTriangle(" + IdToString( nParentId) + ",{" +
|
||||
ToString( ptP1) + "},{" +
|
||||
ToString( ptP2) + "},{" +
|
||||
ToString( ptP3) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmRectangle( int nParentId, const Point3d& ptO, const Point3d& ptL, const Point3d& ptT, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
nParentId = AdjustId( nParentId) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale i punti
|
||||
Point3d ptOL = GetPointLocal( pGeomDB, ptO, nRefType, frLoc) ;
|
||||
Point3d ptLL = GetPointLocal( pGeomDB, ptL, nRefType, frLoc) ;
|
||||
Point3d ptTL = GetPointLocal( pGeomDB, ptT, nRefType, frLoc) ;
|
||||
// modifico il punto trasversale per metterlo perpendicolare al lato Lungo
|
||||
ptTL -= ParallCompo( ptTL - ptOL, ptLL - ptOL) ;
|
||||
// calcolo il quarto punto
|
||||
Point3d ptVL = ptTL + ( ptLL - ptOL) ;
|
||||
// creo la superficie trimesh
|
||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
||||
bOk = bOk && ! IsNull( pStm) ;
|
||||
// assegno il triangolo
|
||||
if ( bOk) {
|
||||
pStm->Init( 4, 2, 1) ;
|
||||
int vV[4]{ pStm->AddVertex( ptOL),
|
||||
pStm->AddVertex( ptLL),
|
||||
pStm->AddVertex( ptTL),
|
||||
pStm->AddVertex( ptVL)} ;
|
||||
int vV1[3]{ vV[0], vV[1], vV[2] } ;
|
||||
int vV2[3]{ vV[2], vV[1], vV[3] } ;
|
||||
bOk = ( pStm->AddTriangle( vV1) != SVT_NULL) && ( pStm->AddTriangle( vV2) != SVT_NULL) && pStm->AdjustTopology() ;
|
||||
}
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmRectangle(" + IdToString( nParentId) + ",{" +
|
||||
ToString( ptO) + "},{" +
|
||||
ToString( ptL) + "},{" +
|
||||
ToString( ptT) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateSurfTmByFlatContour( int nParentId, int nCrvId, double dLinTol)
|
||||
|
||||
Reference in New Issue
Block a user