EgtInterface 1.6b3 :
- aggiunta gestione messaggi da file per le diverse lingue - aggiunta gestione visualizzazione avanzata di triangoli si SurfTM - aggiunta creazione poligoni regolari da raggio e da apotema - cambiato nome di alcune funzioni di scena per gestire punto di vista.
This commit is contained in:
@@ -1558,6 +1558,90 @@ __stdcall EgtCreateRectangle3P( int nParentId, const double ptIni[3],
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreatePolygonFromRadius( int nParentId, int nNumSides, const double ptCen[3],
|
||||
const double ptCorn[3], const double vtN[3], int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti, la normale e il versore estrusione
|
||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
|
||||
Point3d ptCornL = GetPointLocal( pGeomDB, ptCorn, nRefType, frLoc) ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
// creo la curva composita
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
bOk = bOk && ! IsNull( pCrvCompo) ;
|
||||
// setto la curva
|
||||
bOk = bOk && pCrvCompo->PolygonCenterCorner( nNumSides, ptCenL, ptCornL, vtNL) ;
|
||||
// assegno il versore estrusione
|
||||
bOk = bOk && pCrvCompo->SetExtrusion( vtExtrL) ;
|
||||
// inserisco la curva nel DB
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvCompo)) : GDB_ID_NULL) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtPolygonFromRadius(" + ToString( nParentId) + "," +
|
||||
ToString( nNumSides) + ",{" +
|
||||
ToString( Point3d( ptCen)) + "},{" +
|
||||
ToString( Point3d( ptCorn)) + "},{" +
|
||||
ToString( Vector3d( vtN)) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreatePolygonFromApothem( int nParentId, int nNumSides, const double ptCen[3],
|
||||
const double ptMid[3], const double vtN[3], int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti, la normale e il versore estrusione
|
||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
|
||||
Point3d ptMidL = GetPointLocal( pGeomDB, ptMid, nRefType, frLoc) ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
// creo la curva composita
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
bOk = bOk && ! IsNull( pCrvCompo) ;
|
||||
// setto la curva
|
||||
bOk = bOk && pCrvCompo->PolygonCenterMidSide( nNumSides, ptCenL, ptMidL, vtNL) ;
|
||||
// assegno il versore estrusione
|
||||
bOk = bOk && pCrvCompo->SetExtrusion( vtExtrL) ;
|
||||
// inserisco la curva nel DB
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvCompo)) : GDB_ID_NULL) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtPolygonFromApothem(" + ToString( nParentId) + "," +
|
||||
ToString( nNumSides) + ",{" +
|
||||
ToString( Point3d( ptCen)) + "},{" +
|
||||
ToString( Point3d( ptMid)) + "},{" +
|
||||
ToString( Vector3d( vtN)) + "}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreatePolygonFromSide( int nParentId, int nNumSides, const double ptIni[3],
|
||||
|
||||
Reference in New Issue
Block a user