EgtInterface 1.6d4 :

- in selezione tutto si considerano solo i pezzi (non le parti per le lavorazioni)
- aggiunte EgtIsPart e EgtIsLayer a API e LUA
- migliorati controlli per riconoscimento pezzi e layer
- corretto errore in VerifySameFrame per GeoTransforms
- ImportDxf e Stl ora accettano anche fattore di scala API e LUA.
This commit is contained in:
Dario Sassi
2015-04-25 20:39:16 +00:00
parent 9d3dc5e537
commit d63fa552c6
8 changed files with 102 additions and 36 deletions
+45 -17
View File
@@ -51,6 +51,36 @@ EgtVerifyOrNext( IGeomDB* pGeomDB, int nId, bool bOnlyVisible)
return GDB_ID_NULL ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtIsPart( int nPartId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// verifico sia un pezzo (gruppo sotto la radice con livello utente)
if ( pGeomDB->GetGdbType( nPartId) == GDB_TY_GROUP &&
pGeomDB->GetParentId( nPartId) == GDB_ID_ROOT &&
EgtIsUserObj( pGeomDB, nPartId))
return TRUE ;
else
return FALSE ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtIsLayer( int nLayerId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// verifico sia un layer (gruppo sotto un pezzo con livello utente)
if ( pGeomDB->GetGdbType( nLayerId) == GDB_TY_GROUP &&
EgtIsPart( pGeomDB->GetParentId( nLayerId)) != FALSE &&
EgtIsUserObj( pGeomDB, nLayerId))
return TRUE ;
else
return FALSE ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtGetCurrPart( void)
@@ -80,7 +110,9 @@ __stdcall EgtSetCurrPartLayer( int nPartId, int nLayerId)
IGeomDB* pGeomDB = pGseCtx->m_pGeomDB ;
bool bOk = true ;
// verifico validità e visibilità pezzo
if ( pGeomDB->GetParentId( nPartId) == GDB_ID_ROOT && EgtIsVisibleObj( pGeomDB, nPartId)) {
if ( pGeomDB->GetParentId( nPartId) == GDB_ID_ROOT &&
EgtIsUserObj( pGeomDB, nPartId) &&
EgtIsVisibleObj( pGeomDB, nPartId)) {
if ( nPartId != pGseCtx->m_nCurrPart)
pGseCtx->m_nCurrLayer = GDB_ID_NULL ;
pGseCtx->m_nCurrPart = nPartId ;
@@ -93,7 +125,9 @@ __stdcall EgtSetCurrPartLayer( int nPartId, int nLayerId)
bOk = false ;
}
// verifico validità e visibilità layer
if ( pGeomDB->GetParentId( nLayerId) == nPartId && EgtIsVisibleObj( pGeomDB, nLayerId)) {
if ( pGeomDB->GetParentId( nLayerId) == nPartId &&
EgtIsUserObj( pGeomDB, nLayerId) &&
EgtIsVisibleObj( pGeomDB, nLayerId)) {
pGseCtx->m_nCurrLayer = nLayerId ;
}
else {
@@ -225,9 +259,8 @@ __stdcall EgtSelectPartObjs( int nPartId)
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
bool bOk = true ;
// verifico sia veramente un pezzo (gruppo sotto la radice)
if ( pGeomDB->GetGdbType( nPartId) == GDB_TY_GROUP &&
pGeomDB->GetParentId( nPartId) == GDB_ID_ROOT) {
// verifico sia veramente un pezzo
if ( EgtIsPart( nPartId) != FALSE) {
// ciclo sugli oggetti del pezzo
int nId = pGeomDB->GetFirstInGroup( nPartId) ;
while ( nId != GDB_ID_NULL) {
@@ -260,9 +293,8 @@ __stdcall EgtDeselectPartObjs( int nPartId)
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
bool bOk = true ;
// verifico sia veramente un pezzo (gruppo sotto la radice)
if ( pGeomDB->GetGdbType( nPartId) == GDB_TY_GROUP &&
pGeomDB->GetParentId( nPartId) == GDB_ID_ROOT) {
// verifico sia veramente un pezzo
if ( EgtIsPart( nPartId) != FALSE) {
// ciclo sugli oggetti del pezzo
int nId = pGeomDB->GetFirstInGroup( nPartId) ;
while ( nId != GDB_ID_NULL) {
@@ -295,9 +327,8 @@ __stdcall EgtSelectLayerObjs( int nLayerId)
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
bool bOk = true ;
// verifico sia veramente un layer (gruppo senza sottogruppi)
if ( pGeomDB->GetGdbType( nLayerId) == GDB_TY_GROUP &&
pGeomDB->GetFirstGroupInGroup( nLayerId) == GDB_ID_NULL) {
// verifico sia veramente un layer
if ( EgtIsLayer( nLayerId) != FALSE) {
// ciclo sugli oggetti del layer
int nId = pGeomDB->GetFirstInGroup( nLayerId) ;
while ( nId != GDB_ID_NULL) {
@@ -326,9 +357,8 @@ __stdcall EgtDeselectLayerObjs( int nLayerId)
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
bool bOk = true ;
// verifico sia veramente un layer (gruppo senza sottogruppi)
if ( pGeomDB->GetGdbType( nLayerId) == GDB_TY_GROUP &&
pGeomDB->GetFirstGroupInGroup( nLayerId) == GDB_ID_NULL) {
// verifico sia veramente un layer
if ( EgtIsLayer( nLayerId) != FALSE) {
// ciclo sugli oggetti del layer
int nId = pGeomDB->GetFirstInGroup( nLayerId) ;
while ( nId != GDB_ID_NULL) {
@@ -356,12 +386,10 @@ __stdcall EgtSelectPathObjs( int nId, BOOL bHaltOnFork)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
bool bOk = true ;
// verifico appartenga ad un layer
int nIdLayer = pGeomDB->GetParentId( nId) ;
int nIdPart = pGeomDB->GetParentId( nIdLayer) ;
int nIdRoot = pGeomDB->GetParentId( nIdPart) ;
bOk = bOk && ( nIdLayer != GDB_ID_NULL && nIdPart != GDB_ID_NULL && nIdRoot == GDB_ID_ROOT) ;
bool bOk = ( nIdLayer != GDB_ID_NULL && nIdPart != GDB_ID_NULL && ( EgtIsLayer( nIdLayer) != FALSE)) ;
// seleziono percorso a partire da entità indicata usando tutte le curve del pezzo
const int CHAIN_SIZE = 1000 ;
const double CHAIN_TOLER = 10 * EPS_SMALL ;