This commit is contained in:
Daniele Bariletti
2026-03-31 15:02:04 +02:00
9 changed files with 489 additions and 170 deletions
+40 -4
View File
@@ -45,7 +45,16 @@ ExeCreateVolZmap( int nParentId, const Point3d& ptIni, double dDimX, double dDim
// creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ;
bOk = bOk && pVZM->Create( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex) ;
if ( bOk) {
int nError = 0 ;
bOk = pVZM->Create( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex, &nError) ;
if ( ! bOk) {
if ( nError == 1)
ExeOutLog( "EgtVolZmapBox too big for a 32-bit system") ;
else
ExeOutLog( "EgtVolZmapBox error number : " + ToString( nError)) ;
}
}
// lo porto nel riferimento locale
bOk = bOk && pVZM->ToGlob( frBox) ;
// inserisco lo Zmap nel DB
@@ -88,7 +97,16 @@ int ExeCreateVolZmapEmpty( int nParentId, const Point3d& ptIni, double dDimX, do
// creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ;
bOk = bOk && pVZM->CreateEmpty( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex) ;
if ( bOk) {
int nError = 0 ;
bOk = pVZM->CreateEmpty( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex, &nError) ;
if ( ! bOk) {
if ( nError == 1)
ExeOutLog( "EgtVolZmapEmpty too big for a 32-bit system") ;
else
ExeOutLog( "EgtVolZmapEmpty error number : " + ToString( nError)) ;
}
}
// lo porto nel riferimento locale
bOk = bOk && pVZM->ToGlob( frBox) ;
// inserisco lo Zmap nel DB
@@ -130,7 +148,16 @@ ExeCreateVolZmapByRegionExtrusion( int nParentId, int nSfrId, double dDimZ, doub
// creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ;
bOk = bOk && pVZM->CreateFromFlatRegion( *pSfr, dDimZ, dPrec, bTriDex) ;
if ( bOk) {
int nError = 0 ;
bOk = pVZM->CreateFromFlatRegion( *pSfr, dDimZ, dPrec, bTriDex, &nError) ;
if ( ! bOk) {
if ( nError == 1)
ExeOutLog( "EgtVolZmapByRegionExtrusion too big for a 32-bit system") ;
else
ExeOutLog( "EgtVolZmapByRegionExtrusion error number : " + ToString( nError)) ;
}
}
// lo porto nel riferimento di destinazione
bOk = bOk && pVZM->LocToLoc( frSfr, frDest) ;
// inserisco lo Zmap nel DB
@@ -169,7 +196,16 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
// creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ;
bOk = bOk && pVZM->CreateFromTriMesh( *pStm, dPrec, bTriDex, dExtraBox) ;
if ( bOk) {
int nError = 0 ;
bOk = pVZM->CreateFromTriMesh( *pStm, dPrec, bTriDex, dExtraBox, &nError) ;
if ( ! bOk) {
if ( nError == 1)
ExeOutLog( "EgtVolZmapFromSurfTm too big for a 32-bit system") ;
else
ExeOutLog( "EgtVolZmapFromSurfTm error number : " + ToString( nError)) ;
}
}
// lo porto nel riferimento di destinazione
bOk = bOk && pVZM->LocToLoc( frStm, frDest) ;
// inserisco lo Zmap nel DB
+40
View File
@@ -249,6 +249,46 @@ ExeSurfFrChunkSimpleClassify( int nId1, int nChunk1, int nId2, int nChunk2, doub
return nRes ;
}
//----------------------------------------------------------------------------
// Resultati restituiti : REGC_NULL ( errore), REGC_OUT ( Chunks esterni), REGC_INTERS ( Chunk che si intersecano)
int
ExeSurfFlatRegionInterference( int nId1, int nChunk1, int nId2, int nChunk2, double dToler)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pSfr1 != nullptr) ;
// recupero il riferimento della superficie
Frame3d frSurf1 ;
bOk = bOk && pGeomDB->GetGlobFrame( nId1, frSurf1) ;
// recupero la seconda superficie FlatRegion
const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ;
bOk = bOk && ( pSfr2 != nullptr) ;
// recupero il riferimento della superficie
Frame3d frSurf2 ;
bOk = bOk && pGeomDB->GetGlobFrame( nId2, frSurf2) ;
// se riferimenti diversi, porto una copia della seconda nel riferimento della prima
const ISurfFlatRegion* pSfr2L = pSfr2 ;
PtrOwner<ISurfFlatRegion> pTmp ;
if ( bOk && ( abs( dToler) > EPS_SMALL || ! AreSameFrame( frSurf1, frSurf2))) {
pTmp.Set( pSfr2->Clone()) ;
bOk = ( ! IsNull( pTmp)) ;
bOk = bOk && pTmp->LocToLoc( frSurf2, frSurf1) ;
pTmp->Offset( - abs( dToler), ICurve::OFF_FILLET) ;
pSfr2L = pTmp ;
}
// verifico interferenza del Chunk della prima regione rispetto a quello della seconda
int nRes = REGC_NULL ;
if ( bOk) {
bool bInterference = false ;
bOk = pSfr1->CheckChunkInterference( nChunk1, *pSfr2L, nChunk2, bInterference) ;
if ( bOk)
nRes = ( bInterference ? REGC_INTERS : REGC_OUT) ;
}
return nRes ;
}
//----------------------------------------------------------------------------
bool
ExeSurfFrChunkCenter( int nId, int nChunk, int nRefId, Point3d& ptCen, Vector3d& vtN)
+10
View File
@@ -3647,6 +3647,16 @@ ExeVerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB,
return pMachMgr->VerifyOutstroke( dX, dY, dZ, dAngA, dAngB, nStat) ;
}
//-----------------------------------------------------------------------------
bool
ExeVerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// verifica l'extracorsa degli assi
return pMachMgr->VerifyOutstroke( dX, dY, dZ, vAng, true, nStat) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetOutstrokeInfo( string& sInfo)
+10 -10
View File
@@ -16,13 +16,13 @@
class IGeomDB ;
//----------------------------------------------------------------------------
int GetFlatPartRegion( IGeomDB* pGeomDB, int nId) ;
int GetFlatPartUpRegion( IGeomDB* pGeomDB, int nId) ;
int GetFlatPartDownRegion( IGeomDB* pGeomDB, int nId) ;
bool GetFlatPartCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ;
bool GetFlatPartDownCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ;
bool GetFlatPartInterpartGap(IGeomDB* pGeomDB, int nId, double& dGap);
int GetFlatPartFromRegion( IGeomDB* pGeomDB, int nId) ;
int GetFlatPartFromCut( IGeomDB* pGeomDB, int nId) ;
int GetGeometryFromCut( IGeomDB* pGeomDB, IMachMgr* pMachMgr, int nId) ;
bool GetFlatPartApproxContour( IGeomDB* pGeomDB, int nId, PolyLine& PL) ;
int GetFlatPartRegion( IGeomDB* pGeomDB, int nId) ;
int GetFlatPartUpRegion( IGeomDB* pGeomDB, int nId) ;
int GetFlatPartDownRegion( IGeomDB* pGeomDB, int nId) ;
bool GetFlatPartCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ;
bool GetFlatPartDownCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ;
bool GetFlatPartInterpartGap(IGeomDB* pGeomDB, int nId, double& dGap);
int GetFlatPartFromRegion( IGeomDB* pGeomDB, int nId) ;
int GetFlatPartFromCut( IGeomDB* pGeomDB, int nId) ;
INTVECTOR GetGeometryFromCut( IGeomDB* pGeomDB, IMachMgr* pMachMgr, int nId) ;
bool GetFlatPartApproxContour( IGeomDB* pGeomDB, int nId, PolyLine& PL) ;
+11 -10
View File
@@ -2184,24 +2184,25 @@ GetFlatPartFromCut( IGeomDB* pGeomDB, int nId)
}
//----------------------------------------------------------------------------
int
INTVECTOR
GetGeometryFromCut( IGeomDB* pGeomDB, IMachMgr* pMachMgr, int nId)
{
INTVECTOR vnIds ;
if ( pGeomDB == nullptr || pMachMgr == nullptr)
return GDB_ID_NULL ;
return vnIds ;
// verifico appartenga ad una lavorazione
int nMchId ;
if ( ! pGeomDB->GetInfo( pGeomDB->GetParentId( pGeomDB->GetParentId( nId)), "MId", nMchId))
return GDB_ID_NULL ;
return vnIds ;
// recupero la geometria di applicazione della lavorazione (deve essere una sola)
if ( ! pMachMgr->SetCurrMachining( nMchId))
return GDB_ID_NULL ;
SELVECTOR vIds ;
pMachMgr->GetMachiningGeometry( vIds) ;
if ( vIds.size() == 1)
return vIds[0].nId ;
else
return GDB_ID_NULL ;
return vnIds ;
SELVECTOR vSelIds ;
pMachMgr->GetMachiningGeometry( vSelIds) ;
vnIds.reserve( vSelIds.size()) ;
for ( const SelData& mySelData : vSelIds)
vnIds.emplace_back( mySelData.nId) ;
return vnIds ;
}
//----------------------------------------------------------------------------
+6 -6
View File
@@ -143,7 +143,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
// confronto la regione di attacco della lavorazione con le regioni degli altri pezzi
for ( int nMchRegId : vMchLiReg) {
for ( int nOthRegId : vOthReg) {
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_LI ;
}
}
@@ -152,7 +152,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
if ( vMchDwnLiReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nMchRegId = ( ( vMchDwnLiReg[i] != GDB_ID_NULL) ? vMchDwnLiReg[i] : vMchLiReg[i]) ;
int nOthRegId = ( ( vOthDwnReg[j] != GDB_ID_NULL) ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_LI ;
}
}
@@ -160,7 +160,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
// confronto la regione ridotta della lavorazione con le regioni degli altri pezzi
for ( int nMchRegId : vMchRReg) {
for ( int nOthRegId : vOthReg) {
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_RM ;
}
}
@@ -169,7 +169,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
if ( vMchDwnRReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nMchRegId = ( ( vMchDwnRReg[i] != GDB_ID_NULL) ? vMchDwnRReg[i] : vMchRReg[i]) ;
int nOthRegId = ( ( vOthDwnReg[j] != GDB_ID_NULL) ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_RM ;
}
}
@@ -177,7 +177,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
// confronto la regione di uscita della lavorazione con le regioni degli altri pezzi
for ( int nMchRegId : vMchLoReg) {
for ( int nOthRegId : vOthReg) {
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_LO ;
}
}
@@ -186,7 +186,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
if ( vMchDwnLoReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nMchRegId = ( ( vMchDwnLoReg[i] != GDB_ID_NULL) ? vMchDwnLoReg[i] : vMchLoReg[i]) ;
int nOthRegId = ( ( vOthDwnReg[j] != GDB_ID_NULL) ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_LO ;
}
}
+331 -132
View File
@@ -22,8 +22,10 @@
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkDistPointLine.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkCAvSimpleSurfFrMove.h"
#include "/EgtDev/Include/EGkCAvSurfFrMove.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EMkMachiningGeoConst.h"
#include "/EgtDev/Include/EGkIntervals.h"
@@ -32,6 +34,7 @@
using namespace std ;
//----------------------------------------------------------------------------
// collisioni semplici
struct SCollInfoEx : public SCollInfo
{
int nIdM ; // identificativo della regione mobile
@@ -43,7 +46,7 @@ struct SCollInfoEx : public SCollInfo
nIdF( GDB_ID_NULL), bIsCutF( false) {}
SCollInfoEx( const SCollInfo& Sou) : SCollInfo( Sou), nIdM( GDB_ID_NULL), bIsCutM( false),
nIdF( GDB_ID_NULL), bIsCutF( false) {}
} ;
} ;
//----------------------------------------------------------------------------
static const double SPESS = 100 ;
@@ -92,7 +95,7 @@ ExeCreateOutRegion( int nParentId, double dXmin, double dYmin, double dXmax, dou
dYmax < dYmin + GAP + 2 * EPS_SMALL)
return false ;
// se già esiste, posso uscire
// se già esiste, posso uscire
int nBoxId = pGeomDB->GetFirstNameInGroup( nParentId, NST_SHEET_OUTREG) ;
if ( nBoxId != GDB_ID_NULL)
return true ;
@@ -149,7 +152,7 @@ ExeCreateOutRegion( int nParentId, int nOutCrvId)
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se già esiste, posso uscire
// se già esiste, posso uscire
int nBoxId = pGeomDB->GetFirstNameInGroup( nParentId, NST_SHEET_OUTREG) ;
if ( nBoxId != GDB_ID_NULL)
return true ;
@@ -187,7 +190,7 @@ ExeCreateOutRegion( int nParentId, int nOutCrvId)
BBox3d b3Box ;
pCompo->GetLocalBBox( b3Box) ;
b3Box.Expand( SPESS, SPESS, 0) ;
// determino il punto più vicino al massimo del box e lo faccio diventare il nuovo inizio
// determino il punto più vicino al massimo del box e lo faccio diventare il nuovo inizio
int nFlag ;
double dU ;
DistPointCurve distPC( b3Box.GetMax(), *pCompo) ;
@@ -250,7 +253,7 @@ ExeCreateReferenceRegion( int nParentId, int nOutCrvId, bool bBottomUp)
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se già esiste, posso uscire
// se già esiste, posso uscire
int nRegId = pGeomDB->GetFirstNameInGroup( nParentId, NST_REFERENCE_REG) ;
if ( nRegId != GDB_ID_NULL)
return true ;
@@ -283,7 +286,7 @@ ExeCreateReferenceRegion( int nParentId, int nOutCrvId, bool bBottomUp)
// ne ricavo il bbox
BBox3d b3Box ;
PL.GetLocalBBox( b3Box) ;
// cerco i punti più vicini ai quattro vertici (0=BL, 1=BR, 2=TR, 3=TL)
// cerco i punti più vicini ai quattro vertici (0=BL, 1=BR, 2=TR, 3=TL)
double dU[4] = { -1, -1, -1, -1} ;
double dMinSqDist[4] = { SQ_INFINITO, SQ_INFINITO, SQ_INFINITO, SQ_INFINITO} ;
Point3d ptVert[4] ;
@@ -391,7 +394,7 @@ ExeCreateDamagedRegion( int nParentId, int nDmgCrvId)
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico se esiste già la regione associata
// verifico se esiste già la regione associata
int nRegId = pGeomDB->GetFirstNameInGroup( nParentId, NST_DAMAGED_REG) ;
while ( nRegId != GDB_ID_NULL) {
// recupero l'indice della curva di origine
@@ -710,7 +713,7 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
// box delle regioni dei pezzi rispetto al box dell'esterno
if ( ! b3Region.EnclosesXY( b3RegCluster))
return false ;
// regioni dei pezzi rispetto alla regione dell'esterno
// regioni dei pezzi rispetto alla regione dell'esterno (controllo semplice)
for ( int nRegId : vReg) {
if ( ExeSurfFrChunkSimpleClassify( nRegId, 0, nBoxId, 0) != REGC_OUT)
return false ;
@@ -721,7 +724,7 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
return false ;
}
// Verifico con l'eventuale regione di riferimento
// Verifico con l'eventuale regione di riferimento (controllo semplice)
// recupero la regione
int nRefReg = pGeomDB->GetFirstNameInGroup( nGroupId, NST_REFERENCE_REG) ;
if ( pGeomDB->ExistsInfo( nRefReg, KEY_NST_OFF))
@@ -749,17 +752,17 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
vDmgReg.emplace_back( nId) ;
nId = pGeomDB->GetNextName( nId, NST_DAMAGED_REG) ;
}
// regioni dei pezzi rispetto alle regioni delle aree danneggiate
// regioni dei pezzi rispetto alle regioni delle aree danneggiate (controllo completo)
for ( int nRegId : vReg) {
for ( int nDmgRegId : vDmgReg) {
if ( ExeSurfFrChunkSimpleClassify( nRegId, 0, nDmgRegId, 0) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nRegId, 0, nDmgRegId, 0) != REGC_OUT)
return false ;
}
}
for ( int nDwnRegId : vDwnReg) {
if ( nDwnRegId != GDB_ID_NULL) {
for ( int nDmgRegId : vDmgReg) {
if ( ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nDmgRegId, 0) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nDwnRegId, 0, nDmgRegId, 0) != REGC_OUT)
return false ;
}
}
@@ -800,59 +803,62 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
nId2 = ( bInRoot ? ExeGetNextPart( nId2, true) : ExeGetNextGroup( nId2)) ;
}
// Eseguo verifiche
// Eseguo verifiche (controllo completo)
// regioni dei pezzi
for ( size_t i = 0 ; i < vReg.size() ; ++ i) {
// verifico con le regioni degli altri pezzi (sempre regioni standard)
for ( int i = 0 ; i < ssize( vReg) ; ++ i) {
// verifico con le regioni degli altri pezzi
for ( int nOthRegId : vOthReg) {
if ( ExeSurfFrChunkSimpleClassify( vReg[i], 0, nOthRegId, 0) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( vReg[i], 0, nOthRegId, 0) != REGC_OUT)
return false ;
}
// e con le regioni dei tagli degli altri pezzi (se esistono le regioni up devo usarle)
int nRegUpId = ((vUpReg[i] == GDB_ID_NULL) ? vReg[i] : vUpReg[i]) ;
int nRegUpId = ( ( vUpReg[i] == GDB_ID_NULL) ? vReg[i] : vUpReg[i]) ;
for ( int nOthCutRegId : vOthCutReg) {
if ( ExeSurfFrChunkSimpleClassify( nRegUpId, 0, nOthCutRegId, 0) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nRegUpId, 0, nOthCutRegId, 0) != REGC_OUT)
return false ;
}
}
// regioni sotto dei pezzi
for ( size_t i = 0 ; i < vDwnReg.size() ; ++ i) {
// regioni sotto dei pezzi (controllo completo)
for ( int i = 0 ; i < ssize( vDwnReg) ; ++ i) {
// verifico con le regioni sotto degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
if ( vDwnReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nDwnRegId = ( vDwnReg[i] != GDB_ID_NULL ? vDwnReg[i] : vReg[i]) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nDwnRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
return false ;
}
}
// e con le regioni sotto dei tagli degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnCutReg.size() ; ++ j) {
for ( int j = 0 ; j < ssize( vOthDwnCutReg) ; ++ j) {
if ( vDwnReg[i] != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
int nDwnRegId = ( vDwnReg[i] != GDB_ID_NULL ? vDwnReg[i] : vReg[i]) ;
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nOthDwnCutRegId, 0) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nDwnRegId, 0, nOthDwnCutRegId, 0) != REGC_OUT)
return false ;
}
}
}
// regioni delle lavorazioni dei pezzi
for ( int nCutRegId : vCutReg) {
// le confronto con le regioni degli altri pezzi
for ( size_t j = 0 ; j < vOthReg.size() ; ++ j) {
int nOthUpRegId = (( vOthUpReg[j] == GDB_ID_NULL) ? vOthReg[j] : vOthUpReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nCutRegId, 0, nOthUpRegId, 0) != REGC_OUT)
// le confronto con le regioni degli altri pezzi (controllo completo)
for ( int j = 0 ; j < ssize( vOthReg) ; ++ j) {
int nOthUpRegId = ( ( vOthUpReg[j] == GDB_ID_NULL) ? vOthReg[j] : vOthUpReg[j]) ;
if ( ExeSurfFlatRegionInterference( nCutRegId, 0, nOthUpRegId, 0) != REGC_OUT)
return false ;
}
}
// regioni sotto delle lavorazioni dei pezzi
for ( size_t i = 0 ; i < vDwnCutReg.size() ; ++ i) {
// le confronto con le regioni sotto degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
for ( int i = 0 ; i < ssize( vDwnCutReg) ; ++ i) {
// le confronto con le regioni sotto degli altri pezzi (controllo completo)
for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
if ( vDwnCutReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nDwnCutRegId = ( vDwnCutReg[i] != GDB_ID_NULL ? vDwnCutReg[i] : vCutReg[i]) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nDwnCutRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nDwnCutRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
return false ;
}
}
@@ -1031,14 +1037,14 @@ ExePackPartCluster( const INTVECTOR& vIds, bool bReducedCut, bool bBottomUp)
double dRegClDimY = b3RegCluster.GetMax().y - b3RegCluster.GetMin().y ;
Point3d ptOrig = b3RegCluster.GetMin() ;
// Determino punto più in basso a sinistra del cluster
// Determino punto più in basso a sinistra del cluster
Point3d ptBL = b3RegCluster.GetMax() ;
double dDimBottom = 0 ;
for ( int nId : vTrueIds) {
// recupero l'approssimazione lineare del contorno del pezzo ( in globale)
PolyLine PL ;
if ( GetFlatPartApproxContour( pGeomDB, nId, PL)) {
// cerco il punto più in basso a sinistra
// cerco il punto più in basso a sinistra
Point3d ptP ;
bool bFound = PL.GetFirstPoint( ptP) ;
while ( bFound) {
@@ -1163,6 +1169,7 @@ UpdateCollId( double dLen, double dPrevLen, int nId1, int nId2, bool bIsCut1, bo
}
//----------------------------------------------------------------------------
// Collisione semplice
static bool
MySurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, SCollInfo& scInfo)
{
@@ -1170,23 +1177,27 @@ MySurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pSfr1 != nullptr) ;
if ( pSfr1 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf1 ;
bOk = bOk && pGeomDB->GetGlobFrame( nId1, frSurf1) ;
if ( ! pGeomDB->GetGlobFrame( nId1, frSurf1))
return false ;
// recupero la seconda superficie FlatRegion
const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ;
bOk = bOk && ( pSfr2 != nullptr) ;
if ( pSfr2 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf2 ;
bOk = bOk && pGeomDB->GetGlobFrame( nId2, frSurf2) ;
if ( ! pGeomDB->GetGlobFrame( nId2, frSurf2))
return false ;
// se riferimenti diversi, porto una copia della seconda nel riferimento della prima
const ISurfFlatRegion* pSfr2L = pSfr2 ;
PtrOwner<ISurfFlatRegion> pTmp ;
if ( ! AreSameFrame( frSurf1, frSurf2)) {
pTmp.Set( pSfr2->Clone()) ;
bOk = bOk && ! IsNull( pTmp) ;
bOk = bOk && pTmp->LocToLoc( frSurf2, frSurf1) ;
if ( IsNull( pTmp) || ! pTmp->LocToLoc( frSurf2, frSurf1))
return false ;
pSfr2L = pTmp ;
}
// porto in locale alla prima superficie il versore di movimento
@@ -1194,21 +1205,71 @@ MySurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double
vtDirL.ToLoc( frSurf1) ;
// calcolo massima lunghezza di traslazione della prima regione senza semplice collisione con la seconda
CAvSimpleSurfFrMove ScdSfrMove( *pSfr1, *pSfr2L) ;
bOk = bOk && ScdSfrMove.Translate( vtDirL, dLen) ;
if ( bOk) {
scInfo = ScdSfrMove.GetSCollInfo() ;
if ( scInfo.nType != SCI_NONE) {
scInfo.ptP1.ToGlob( frSurf1) ;
scInfo.vtDirM.ToGlob( frSurf1) ;
scInfo.vtDirF.ToGlob( frSurf1) ;
}
if ( scInfo.nType == SCI_LINE_LINE)
scInfo.ptP2.ToGlob( frSurf1) ;
if ( ! ScdSfrMove.Translate( vtDirL, dLen))
return false ;
scInfo = ScdSfrMove.GetSCollInfo() ;
if ( scInfo.nType != SCI_NONE) {
scInfo.ptP1.ToGlob( frSurf1) ;
scInfo.vtDirM.ToGlob( frSurf1) ;
scInfo.vtDirF.ToGlob( frSurf1) ;
}
return bOk ;
if ( scInfo.nType == SCI_LINE_LINE)
scInfo.ptP2.ToGlob( frSurf1) ;
return true ;
}
//----------------------------------------------------------------------------
// Collisione completa
static bool
MySurfFrMoveNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, SCollInfo& cInfo)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
if ( pSfr1 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf1 ;
if ( ! pGeomDB->GetGlobFrame( nId1, frSurf1))
return false ;
// recupero la seconda superficie FlatRegion
const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ;
if ( pSfr2 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf2 ;
if ( ! pGeomDB->GetGlobFrame( nId2, frSurf2))
return false ;
// se riferimenti diversi, porto una copia della seconda nel riferimento della prima
const ISurfFlatRegion* pSfr2L = pSfr2 ;
PtrOwner<ISurfFlatRegion> pTmp ;
if ( ! AreSameFrame( frSurf1, frSurf2)) {
pTmp.Set( pSfr2->Clone()) ;
if ( IsNull( pTmp) || ! pTmp->LocToLoc( frSurf2, frSurf1))
return false ;
pSfr2L = pTmp ;
}
// porto in locale alla prima superficie il versore di movimento
Vector3d vtDirL = vtDir ;
vtDirL.ToLoc( frSurf1) ;
// calcolo massima lunghezza di traslazione della prima regione senza collisione con la seconda
CAvSurfFrMove cdSfrMove( *pSfr1, *pSfr2L) ;
if ( ! cdSfrMove.Translate( vtDirL, dLen))
return false ;
cInfo = cdSfrMove.GetCollInfo() ;
if ( cInfo.nType != SCI_NONE) {
cInfo.ptP1.ToGlob( frSurf1) ;
cInfo.vtDirM.ToGlob( frSurf1) ;
cInfo.vtDirF.ToGlob( frSurf1) ;
}
if ( cInfo.nType == SCI_LINE_LINE)
cInfo.ptP2.ToGlob( frSurf1) ;
return true ;
}
//----------------------------------------------------------------------------
// Traslazione con CAvSurfFr
static bool
MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster, bool bReducedCut, Vector3d& vtMove)
{
@@ -1293,67 +1354,67 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
bOk = false ;
break ;
}
// la confronto con il box
// la confronto con il box (collisione semplice)
MySurfFrMoveSimpleNoCollision( nRegId, nBoxId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nBoxId, false, false, scInfoCurr) ;
// la confronto con la regione di riferimento
// la confronto con la regione di riferimento (collisione semplice)
if ( nRefReg != GDB_ID_NULL) {
MySurfFrMoveSimpleNoCollision( nRegId, nRefReg, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nRefReg, false, false, scInfoCurr) ;
}
// la confronto con le aree danneggiate
// la confronto con le aree danneggiate (collisione completa)
for ( int nDmgRegId : vDmgReg) {
MySurfFrMoveSimpleNoCollision( nRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nDmgRegId, false, false, scInfoCurr) ;
}
// la confronto con le regioni degli altri pezzi
// la confronto con le regioni degli altri pezzi (collisione completa)
for ( int nOthRegId : vOthReg) {
MySurfFrMoveSimpleNoCollision( nRegId, nOthRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nRegId, nOthRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nOthRegId, false, false, scInfoCurr) ;
}
// e con le regioni dei tagli degli altri pezzi
// recupero regione in alto del pezzo
// recupero regione in alto del pezzo (collisione completa)
int nUpRegId = GetFlatPartUpRegion( pGeomDB, nTrueId) ;
int nTestRegId = (( nUpRegId == GDB_ID_NULL) ? nRegId : nUpRegId) ;
for ( int nOthCutRegId : vOthCutReg) {
MySurfFrMoveSimpleNoCollision( nTestRegId, nOthCutRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nTestRegId, nOthCutRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nTestRegId, nOthCutRegId, false, true, scInfoCurr) ;
}
// -----------------------------------------
// recupero regione in basso del pezzo
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nTrueId) ;
// la confronto con il box
// la confronto con il box (collisone semplice)
if ( nDwnRegId != GDB_ID_NULL) {
MySurfFrMoveSimpleNoCollision( nDwnRegId, nBoxId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nBoxId, false, false, scInfoCurr) ;
}
// la confronto con la regione di riferimento
// la confronto con la regione di riferimento (collisione completa)
if ( nDwnRegId != GDB_ID_NULL && nRefReg != GDB_ID_NULL) {
MySurfFrMoveSimpleNoCollision( nDwnRegId, nRefReg, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nDwnRegId, nRefReg, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nRefReg, false, false, scInfoCurr) ;
}
// la confronto con le aree danneggiate
// la confronto con le aree danneggiate (collisione completa)
if ( nDwnRegId != GDB_ID_NULL) {
for ( int nDmgRegId : vDmgReg) {
MySurfFrMoveSimpleNoCollision( nDwnRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nDwnRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nDmgRegId, false, false, scInfoCurr) ;
}
}
// la confronto con le regioni in basso degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
// la confronto con le regioni in basso degli altri pezzi (collisione completa)
for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
MySurfFrMoveSimpleNoCollision( nTmpDwnRegId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nTmpDwnRegId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnRegId, false, false, scInfoCurr) ;
}
}
// e con le regioni in basso dei tagli degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnCutReg.size() ; ++ j) {
// e con le regioni in basso dei tagli degli altri pezzi (collisione completa)
for ( int j = 0 ; j < ssize( vOthDwnCutReg) ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
MySurfFrMoveSimpleNoCollision( nTmpDwnRegId, nOthDwnCutRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nTmpDwnRegId, nOthDwnCutRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnCutRegId, false, true, scInfoCurr) ;
}
}
@@ -1364,11 +1425,11 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
bOk = false ;
break ;
}
// le confronto con le regioni degli altri pezzi
// le confronto con le regioni degli altri pezzi (collisione completa)
for ( int nCrId : vCrId) {
for ( size_t k = 0 ; k < vOthReg.size() ; ++ k) {
for ( int k = 0 ; k < ssize( vOthReg) ; ++ k) {
int nOthRegId = ( vOthUpReg[k] == GDB_ID_NULL ? vOthReg[k] : vOthUpReg[k]) ;
MySurfFrMoveSimpleNoCollision( nCrId, nOthRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nCrId, nOthRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nCrId, nOthRegId, true, false, scInfoCurr) ;
}
}
@@ -1379,13 +1440,13 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
bOk = false ;
break ;
}
// le confronto con le regioni in basso degli altri pezzi
for ( size_t j = 0 ; j < vDwnCrId.size() ; ++ j) {
for ( size_t k = 0 ; k < vOthDwnReg.size() ; ++ k) {
// le confronto con le regioni in basso degli altri pezzi (collisione completa)
for ( int j = 0 ; j < ssize( vDwnCrId) ; ++ j) {
for ( int k = 0 ; k < ssize( vOthDwnReg) ; ++ k) {
if ( vDwnCrId[j] != GDB_ID_NULL || vOthDwnReg[k] != GDB_ID_NULL) {
int nTmpDwnCrId = ( vDwnCrId[j] != GDB_ID_NULL ? vDwnCrId[j] : vCrId[j]) ;
int nOthDwnRegId = ( vOthDwnReg[k] != GDB_ID_NULL ? vOthDwnReg[k] : vOthReg[k]) ;
MySurfFrMoveSimpleNoCollision( nTmpDwnCrId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nTmpDwnCrId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnCrId, nOthDwnRegId, true, false, scInfoCurr) ;
}
}
@@ -1419,7 +1480,7 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
}
}
// Se movimento risultante nullo, non faccio alcunché
// Se movimento risultante nullo, non faccio alcunché
vtMoveXY = vtDir * dLen ;
if ( vtMoveXY.IsSmall())
return true ;
@@ -1464,7 +1525,7 @@ ExeMovePartCluster( const INTVECTOR& vIds, bool bReducedCut, Vector3d& vtMove)
vtMove = vtM ;
return true ;
}
// altrimenti, riprovo con tagli standard
// altrimenti, riprovo con tagli standard
else {
// annullo il movimento
for ( int nId : vTrueIds)
@@ -1475,7 +1536,50 @@ ExeMovePartCluster( const INTVECTOR& vIds, bool bReducedCut, Vector3d& vtMove)
}
}
//----------------------------------------------------------------------------
static bool
MySurfFrRotateNoCollision( int nId1, int nId2, const Point3d& ptCen, double& dAngDeg, SCollInfo& cInfo)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
if ( pSfr1 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf1 ;
if ( ! pGeomDB->GetGlobFrame( nId1, frSurf1))
return false ;
// recupero la seconda superficie FlatRegion
const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ;
if ( pSfr2 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf2 ;
if ( ! pGeomDB->GetGlobFrame( nId2, frSurf2))
return false ;
// se riferimenti diversi, porto una copia della seconda nel riferimento della prima
const ISurfFlatRegion* pSfr2L = pSfr2 ;
PtrOwner<ISurfFlatRegion> pTmp ;
if ( ! AreSameFrame( frSurf1, frSurf2)) {
pTmp.Set( pSfr2->Clone()) ;
if ( IsNull( pTmp) || ! pTmp->LocToLoc( frSurf2, frSurf1))
return false ;
pSfr2L = pTmp ;
}
// porto in locale alla prima superficie il punto di rotazione
Point3d ptCenL = ptCen ;
ptCenL.ToLoc( frSurf1) ;
// calcolo massima lunghezza di traslazione della prima regione senza collisione con la seconda
CAvSurfFrMove cdSfrMove( *pSfr1, *pSfr2L) ;
if ( ! cdSfrMove.Rotate( ptCenL, dAngDeg))
return false ;
return true ;
}
//----------------------------------------------------------------------------
// Rotazione con CAvSurfFr
bool
MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Cluster, bool bReducedCut,
const Point3d& ptCen, double& dRotAngDeg)
@@ -1553,21 +1657,21 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
bOk = false ;
break ;
}
// la confronto con il box
// la confronto con il box (collisione semplice)
ExeSurfFrRotateSimpleNoCollision( nRegId, nBoxId, ptCen, dAng, RTY_GLOB) ;
// la confronto con la regione di riferimento
// la confronto con la regione di riferimento (collisione semplice)
if ( nRefReg != GDB_ID_NULL) {
ExeSurfFrRotateSimpleNoCollision( nRegId, nRefReg, ptCen, dAng, RTY_GLOB) ;
}
// la confronto con le aree danneggiate
// la confronto con le aree danneggiate (collisione completa)
for ( int nDmgRegId : vDmgReg) {
ExeSurfFrRotateSimpleNoCollision( nRegId, nDmgRegId, ptCen, dAng, RTY_GLOB) ;
MySurfFrRotateNoCollision( nRegId, nDmgRegId, ptCen, dAng, s_scInfo) ;
}
// la confronto con le regioni degli altri pezzi
// la confronto con le regioni degli altri pezzi (collisione completa)
for ( int nOthRegId : vOthReg) {
ExeSurfFrRotateSimpleNoCollision( nRegId, nOthRegId, ptCen, dAng, RTY_GLOB) ;
MySurfFrRotateNoCollision( nRegId, nOthRegId, ptCen, dAng, s_scInfo) ;
}
// e con le regioni dei tagli degli altri pezzi
// e con le regioni dei tagli degli altri pezzi (collisione completa)
// recupero regione in alto del pezzo
int nUpRegId = GetFlatPartUpRegion( pGeomDB, nTrueId) ;
int nTestRegId = (( nUpRegId == GDB_ID_NULL) ? nRegId : nUpRegId) ;
@@ -1577,33 +1681,33 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
// -----------------------------------------
// recupero regione in basso del pezzo
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nTrueId) ;
// la confronto con il box
// la confronto con il box (collisione semplice)
if ( nDwnRegId != GDB_ID_NULL)
ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nBoxId, ptCen, dAng, RTY_GLOB) ;
// la confronto con la regione di riferimento
// la confronto con la regione di riferimento (collisione semplice)
if ( nRefReg != GDB_ID_NULL) {
ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nRefReg, ptCen, dAng, RTY_GLOB) ;
}
// la confronto con le aree danneggiate
// la confronto con le aree danneggiate (collisione completa)
if ( nDwnRegId != GDB_ID_NULL) {
for ( int nDmgRegId : vDmgReg) {
ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nDmgRegId, ptCen, dAng, RTY_GLOB) ;
MySurfFrRotateNoCollision( nDwnRegId, nDmgRegId, ptCen, dAng, s_scInfo) ;
}
}
// la confronto con le regioni in basso degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
// la confronto con le regioni in basso degli altri pezzi (collisione completa)
for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
ExeSurfFrRotateSimpleNoCollision( nTmpDwnRegId, nOthDwnRegId, ptCen, dAng, RTY_GLOB) ;
MySurfFrRotateNoCollision( nTmpDwnRegId, nOthDwnRegId, ptCen, dAng, s_scInfo) ;
}
}
// e con le regioni in basso dei tagli degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnCutReg.size() ; ++ j) {
// e con le regioni in basso dei tagli degli altri pezzi (collisione completa)
for ( int j = 0 ; j < ssize( vOthDwnCutReg) ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
ExeSurfFrRotateSimpleNoCollision( nTmpDwnRegId, nOthDwnCutRegId, ptCen, dAng, RTY_GLOB) ;
MySurfFrRotateNoCollision( nTmpDwnRegId, nOthDwnCutRegId, ptCen, dAng, s_scInfo) ;
}
}
// -----------------------------------------
@@ -1613,11 +1717,11 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
bOk = false ;
break ;
}
// le confronto con le regioni degli altri pezzi
// le confronto con le regioni degli altri pezzi (collisione completa)
for ( int nCrId : vCrId) {
for ( size_t k = 0 ; k < vOthReg.size() ; ++ k) {
for ( int k = 0 ; k < ssize( vOthReg) ; ++ k) {
int nOthRegId = ( vOthUpReg[k] == GDB_ID_NULL ? vOthReg[k] : vOthUpReg[k]) ;
ExeSurfFrRotateSimpleNoCollision( nCrId, nOthRegId, ptCen, dAng, RTY_GLOB) ;
MySurfFrRotateNoCollision( nCrId, nOthRegId, ptCen, dAng, s_scInfo) ;
}
}
// -----------------------------------------
@@ -1627,13 +1731,13 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
bOk = false ;
break ;
}
// le confronto con le regioni in basso degli altri pezzi
for ( size_t j = 0 ; j < vDwnCrId.size() ; ++ j) {
for ( size_t k = 0 ; k < vOthDwnReg.size() ; ++ k) {
// le confronto con le regioni in basso degli altri pezzi (collisione completa)
for ( int j = 0 ; j < ssize( vDwnCrId) ; ++ j) {
for ( int k = 0 ; k < ssize( vOthDwnReg) ; ++ k) {
if ( vDwnCrId[j] != GDB_ID_NULL || vOthDwnReg[k] != GDB_ID_NULL) {
int nTmpDwnCrId = ( vDwnCrId[j] != GDB_ID_NULL ? vDwnCrId[j] : vCrId[j]) ;
int nOthDwnRegId = ( vOthDwnReg[k] != GDB_ID_NULL ? vOthDwnReg[k] : vOthReg[k]) ;
ExeSurfFrRotateSimpleNoCollision( nTmpDwnCrId, nOthDwnRegId, ptCen, dAng, RTY_GLOB) ;
MySurfFrRotateNoCollision( nTmpDwnCrId, nOthDwnRegId, ptCen, dAng, s_scInfo) ;
}
}
}
@@ -1643,7 +1747,7 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
if ( ! bOk)
return false ;
// Se movimento risultante nullo, non faccio alcunché
// Se movimento risultante nullo, non faccio alcunché
dRotAngDeg = dAng ;
if ( abs( dAng) < EPS_ANG_SMALL)
return true ;
@@ -1686,7 +1790,7 @@ GetObstacleTangent( Vector3d& vtTang)
//----------------------------------------------------------------------------
static bool
GetMovingTangent( Vector3d& vtTang)
GetMovingTangent( Vector3d& vtTang)
{
if ( s_scInfo.nType != SCI_LINE_PNT && s_scInfo.nType != SCI_LINE_LINE)
return false ;
@@ -1733,7 +1837,7 @@ ExeAlignPartClusterOnCollision( const INTVECTOR& vIds, bool bReducedCut, bool& b
Point3d ptCntL = s_scInfo.ptP1 ;
ptCntL.ToLoc( frSfr) ;
// cerco le direzioni tangenti prima e dopo il punto di contatto sulle parti mobili
PtrOwner<ICurve> pCrv( pSfr->GetLoop( s_scInfo.nChunkM, 0)) ;
PtrOwner<ICurve> pCrv( pSfr->GetLoop( s_scInfo.nChunkM, s_scInfo.nLoopM)) ;
if ( IsNull( pCrv))
return false ;
double dU ;
@@ -1760,7 +1864,7 @@ ExeAlignPartClusterOnCollision( const INTVECTOR& vIds, bool bReducedCut, bool& b
string sOut = "vtTp=(" + ToString( vtTp) + ") vtTn=(" + ToString( vtTn) + ")" ;
LOG_INFO( GetLogger(), sOut.c_str()) ;
}
// ruoto dalla parte dell'angolo più piccolo (componente più grande)
// ruoto dalla parte dell'angolo più piccolo (componente più grande)
double dRotAngDeg = ( abs( vtTp * s_scInfo.vtDirF) > abs( vtTn * s_scInfo.vtDirF)) ? 90 : - 90 ;
// provo a ruotare sul punto di collisione in senso orario
Point3d ptCen = s_scInfo.ptP1 ;
@@ -1784,6 +1888,7 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
// cerco i due tagli in collisione
int nCutM = GDB_ID_NULL ;
int nGeoM = GDB_ID_NULL ;
INTVECTOR vnGeoM, vnGeoF ;
Point3d ptStartM, ptEndM ;
Vector3d vtDirM ;
Frame3d frGeoM ;
@@ -1792,13 +1897,38 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
Point3d ptStartF, ptEndF ;
Vector3d vtDirF ;
Frame3d frGeoF ;
// se mobile è già un taglio, ne ricavo i dati
// se mobile è già un taglio, ne ricavo i dati
if ( s_scInfo.bIsCutM) {
if ( s_scInfo.nIdM == GDB_ID_NULL)
return false ;
nCutM = s_scInfo.nIdM ;
nGeoM = GetGeometryFromCut( pGeomDB, pMachMgr, nCutM) ;
ICurveLine* pLineM = GetCurveLine( pGeomDB->GetGeoObj( nGeoM)) ;
if ( nCutM == GDB_ID_NULL || nGeoM == GDB_ID_NULL ||
pLineM == nullptr || ! pGeomDB->GetGlobFrame( nGeoM, frGeoM))
vnGeoM = GetGeometryFromCut( pGeomDB, pMachMgr, nCutM) ;
if ( vnGeoM.empty())
return false ;
ICurveLine* pLineM = nullptr ;
// se ho un solo taglio, allora è quello
if ( ssize( vnGeoM) == 1) {
pLineM = GetCurveLine( pGeomDB->GetGeoObj( vnGeoM[0])) ;
nGeoM = vnGeoM[0] ;
}
// se più tagli, cerco quello più vicino alla linea corrente
else {
double dMinSqDist = INFINITO ;
for ( int i = 0 ; i < ssize( vnGeoM) ; ++ i) {
Frame3d frCurrGeoM ;
ICurveLine* pCurrLineM = GetCurveLine( pGeomDB->GetGeoObj( vnGeoM[i])) ;
if ( pCurrLineM == nullptr || ! pGeomDB->GetGlobFrame( vnGeoM[i], frCurrGeoM))
return false ;
double dCurrSqDist ;
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeoM), *pCurrLineM).GetSqDist( dCurrSqDist) ;
if ( dCurrSqDist < dMinSqDist) {
dMinSqDist = dCurrSqDist ;
pLineM = pCurrLineM ;
nGeoM = vnGeoM[i] ;
}
}
}
if ( pLineM == nullptr || ! pGeomDB->GetGlobFrame( nGeoM, frGeoM))
return false ;
ptStartM = pLineM->GetStart() ;
ptStartM.ToGlob( frGeoM) ;
@@ -1807,13 +1937,36 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
vtDirM = ptEndM - ptStartM ;
vtDirM.Normalize() ;
}
// se fisso è già un taglio, ne ricavo i dati
// se fisso è già un taglio, ne ricavo i dati
if ( s_scInfo.bIsCutF) {
if ( s_scInfo.nChunkF == GDB_ID_NULL)
return false ;
nCutF = s_scInfo.nIdF ;
nGeoF = GetGeometryFromCut( pGeomDB, pMachMgr, nCutF) ;
vnGeoF = GetGeometryFromCut( pGeomDB, pMachMgr, nCutF) ;
ICurveLine* pLineF = GetCurveLine( pGeomDB->GetGeoObj( nGeoF)) ;
if ( nCutF == GDB_ID_NULL || nGeoF == GDB_ID_NULL ||
pLineF == nullptr || ! pGeomDB->GetGlobFrame( nGeoF, frGeoF))
// se ho un solo taglio, allora è quello
if ( ssize( vnGeoF) == 1) {
pLineF = GetCurveLine( pGeomDB->GetGeoObj( vnGeoF[0])) ;
nGeoF = vnGeoF[0] ;
}
// se più tagli, cerco quello più vicino alla linea corrente
else {
double dMinSqDist = INFINITO ;
for ( int i = 0 ; i < ssize( vnGeoF) ; ++ i) {
Frame3d frCurrGeoF ;
ICurveLine* pCurrLineF = GetCurveLine( pGeomDB->GetGeoObj( vnGeoF[i])) ;
if ( pCurrLineF == nullptr || ! pGeomDB->GetGlobFrame( vnGeoF[i], frCurrGeoF))
return false ;
double dCurrSqDist ;
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeoF), *pCurrLineF).GetSqDist( dCurrSqDist) ;
if ( dCurrSqDist < dMinSqDist) {
dMinSqDist = dCurrSqDist ;
pLineF = pCurrLineF ;
nGeoF = vnGeoF[i] ;
}
}
}
if ( pLineF == nullptr || ! pGeomDB->GetGlobFrame( nGeoF, frGeoF))
return false ;
ptStartF = pLineF->GetStart() ;
ptStartF.ToGlob( frGeoF) ;
@@ -1838,8 +1991,31 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
BBox3d b3Temp ;
pGeomDB->GetGlobalBBox( nId, b3Temp) ;
if ( b3Temp.OverlapsXY( b3CutM)) {
int nGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ;
ICurveLine* pLine = GetCurveLine( pGeomDB->GetGeoObj( nGeom)) ;
int nGeom = GDB_ID_NULL ;
INTVECTOR vnGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ;
ICurveLine* pLine = nullptr ;
// se ho un solo taglio, allora è quello
if ( ssize( vnGeom) == 1) {
pLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[0])) ;
nGeom = vnGeom[0] ;
}
// se ho più tagli, cerco quello più vicino alla linea corrente
else {
double dMinSqDist = INFINITO ;
for ( int i = 0 ; i < ssize( vnGeom) ; ++ i) {
Frame3d frCurrGeo ;
ICurveLine* pCurrLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[i])) ;
if ( pCurrLine == nullptr || ! pGeomDB->GetGlobFrame( vnGeom[i], frCurrGeo))
return false ;
double dCurrSqDist ;
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeo), *pCurrLine).GetSqDist( dCurrSqDist) ;
if ( dCurrSqDist < dMinSqDist) {
dMinSqDist = dCurrSqDist ;
pLine = pCurrLine ;
nGeom = vnGeom[i] ;
}
}
}
if ( nGeom == GDB_ID_NULL || pLine == nullptr || ! pGeomDB->GetGlobFrame( nGeom, frGeoF))
continue ;
ptStartF = pLine->GetStart() ;
@@ -1872,8 +2048,31 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
BBox3d b3Temp ;
pGeomDB->GetGlobalBBox( nId, b3Temp) ;
if ( b3Temp.OverlapsXY( b3CutF)) {
int nGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ;
ICurveLine* pLine = GetCurveLine( pGeomDB->GetGeoObj( nGeom)) ;
int nGeom = GDB_ID_NULL ;
INTVECTOR vnGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ;
ICurveLine* pLine = nullptr ;
// se ho un solo taglio, allora è quello
if ( ssize( vnGeom) == 1) {
pLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[0])) ;
nGeom = vnGeom[0] ;
}
// se ho più tagli, cerco quello più vicino alla linea corrente
else {
double dMinSqDist = INFINITO ;
for ( int i = 0 ; i < ssize( vnGeom) ; ++ i) {
Frame3d frCurrGeo ;
ICurveLine* pCurrLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[0])) ;
if ( pCurrLine == nullptr || ! pGeomDB->GetGlobFrame( vnGeom[i], frCurrGeo))
return false ;
double dCurrSqDist ;
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeo), *pCurrLine).GetSqDist( dCurrSqDist) ;
if ( dCurrSqDist < dMinSqDist) {
dMinSqDist = dCurrSqDist ;
pLine = pCurrLine ;
nGeom = vnGeom[i] ;
}
}
}
if ( nGeom == GDB_ID_NULL || pLine == nullptr || ! pGeomDB->GetGlobFrame( nGeom, frGeoM))
continue ;
ptStartM = pLine->GetStart() ;
@@ -1950,9 +2149,9 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
dMoveMn = CrossXY( ptStartF - ptEndM, vtDirFp) / dDenom ;
}
}
// pareggio la parte più vicina, se almeno una sotto soglia
// pareggio la parte più vicina, se almeno una sotto soglia
if ( abs( dMoveMp) < dMaxMove || abs( dMoveMn) < dMaxMove) {
// calcolo movimento necessario, se nullo già a posto
// calcolo movimento necessario, se nullo già a posto
Vector3d vtMove = (( abs( dMoveMp) < abs( dMoveMn)) ? dMoveMp : dMoveMn) * vtDirF ;
if ( vtMove.IsSmall()) {
bMoved = false ;
@@ -1977,7 +2176,7 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
pGeomDB->GetRefBBox( nCutM, frCutF, b3CutM) ;
double dStartDelta = b3CutF.GetMin().x - b3CutM.GetMin().x ;
double dEndDelta = b3CutF.GetMax().x - b3CutM.GetMax().x ;
// pareggio la parte più vicina, se sotto soglia
// pareggio la parte più vicina, se sotto soglia
if ( abs( dStartDelta) > dMaxMove && abs( dEndDelta) > dMaxMove)
return false ;
Vector3d vtMove = (( abs( dStartDelta) < abs( dEndDelta)) ? dStartDelta : dEndDelta) * vtDirF ;
@@ -2079,7 +2278,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
// Avvio nesting automatico
ExeAutoNestStart() ;
// Modalità ghigliottina incompatibile con tagli completi
// Modalità ghigliottina incompatibile con tagli completi
if ( ! bReducedCut)
bGuillotineMode = false ;
@@ -2102,11 +2301,11 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
nDamId = pGeomDB->GetNextName( nDamId, NST_DAMAGED_REG) ;
}
// Modalità ghigliottina incompatibile con pannelli non rettangolari
// Modalità ghigliottina incompatibile con pannelli non rettangolari
if ( ! bIsRect)
bGuillotineMode = false ;
// Assegno le aree occupate dai pezzi già nestati
// Assegno le aree occupate dai pezzi già nestati
bool bPartAlreadyNested = false ;
BBox3d b3Sheet ;
pGeomDB->GetGlobalBBox( nRefReg, b3Sheet) ;
@@ -2132,18 +2331,18 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
GetFlatPartDownCutRegions( pGeomDB, nId, bReducedCut, vCutReg) ;
for ( int nRegId : vCutReg)
ExeAutoNestAddDefectToSheet( nSheetId, nRegId) ;
// dichiaro ci sono pezzi già nestati
// dichiaro ci sono pezzi già nestati
bPartAlreadyNested = true ;
}
}
nId = ( bInRoot ? ExeGetNextPart( nId, true) : ExeGetNextGroup( nId)) ;
}
// Pezzi già nestati incompatibili con ghigliottina
// Pezzi già nestati incompatibili con ghigliottina
if ( bPartAlreadyNested)
bGuillotineMode = false ;
// Se richiesta modalità ghigliottina
// Se richiesta modalità ghigliottina
if ( bGuillotineMode) {
// cerco il gap necessario tra le parti
double dGap = 0 ;
@@ -2153,7 +2352,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
if ( GetFlatPartInterpartGap( pGeomDB, nPartId, dCurrGap) && dCurrGap > dGap)
dGap = dCurrGap ;
}
// se non trovato disabilito richiesta modalità ghigliottina
// se non trovato disabilito richiesta modalità ghigliottina
if ( dGap < EPS_SMALL)
bGuillotineMode = false ;
// altrimenti lo imposto
@@ -2161,7 +2360,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
ExeAutoNestSetInterpartGap( dGap) ;
}
// Se richiesto e abilitato, imposto modalità ghigliottina
// Se richiesto e abilitato, imposto modalità ghigliottina
if ( bGuillotineMode)
ExeAutoNestSetGuillotineMode() ;
@@ -2177,7 +2376,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nPartId) ;
if ( nDwnRegId != GDB_ID_NULL)
ExeAutoNestAddAnotherOutlineToPart( nPartId, nDwnRegId) ;
// se non è ghigliottina imposto le regioni dei tagli (con ghigliottina si usa il gap)
// se non è ghigliottina imposto le regioni dei tagli (con ghigliottina si usa il gap)
if ( ! bGuillotineMode) {
// recupero regioni dei tagli del pezzo
INTVECTOR vCutReg ;
BIN
View File
Binary file not shown.
+41 -8
View File
@@ -3832,11 +3832,38 @@ LuaGetCalcAngles( lua_State* L)
}
}
//-------------------------------------------------------------------------------
static int
LuaGetCalcAnglesEx( lua_State* L)
{
// 1 o 2 parametri : vtDirT, vtDirA
Vector3d vtDirT ;
LuaCheckParam( L, 1, vtDirT)
Vector3d vtDirA ;
LuaGetParam( L, 2, vtDirA) ;
LuaClearStack( L) ;
// calcolo gli angoli macchina dalle direzioni fresa e ausiliaria
int nStat ; DBLVECTOR vAng1, vAng2 ;
bool bOk = ExeGetCalcAngles( vtDirT, vtDirA, nStat, vAng1, vAng2) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, bOk) ;
LuaSetParam( L, nStat) ;
LuaSetParam( L, vAng1) ;
LuaSetParam( L, vAng2) ;
return 4 ;
}
else {
LuaSetParam( L, bOk) ;
return 1 ;
}
}
//-------------------------------------------------------------------------------
static int
LuaGetCalcPositions( lua_State* L)
{
// da 2 a 5 parametri : ptP, dAngA [, dAngB] [, dAngC] [, dAngD]
// da 1 a 5 parametri : ptP [, dAngR1] [, dAngR2] [, dAngR3] [, dAngR4]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
DBLVECTOR vAng ;
@@ -3854,7 +3881,7 @@ LuaGetCalcPositions( lua_State* L)
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, bOk) ;
LuaSetParam( L, 0) ; // assegnato per compatibilit
LuaSetParam( L, 0) ; // assegnato per compatibilità
LuaSetParam( L, dX) ;
LuaSetParam( L, dY) ;
LuaSetParam( L, dZ) ;
@@ -3982,21 +4009,26 @@ LuaGetCalcAuxDirFromAngles( lua_State* L)
static int
LuaVerifyOutstroke( lua_State* L)
{
// 5 parametri : dX, dY, dZ, dAngA, dAngB
// 3 o 4 o 5 o 6 o 7 parametri : dX, dY, dZ [, dAngR1] [, dAngR2] [, dAngR3] [, dAngR4]
double dX ;
LuaCheckParam( L, 1, dX)
double dY ;
LuaCheckParam( L, 2, dY)
double dZ ;
LuaCheckParam( L, 3, dZ)
double dAngA ;
LuaCheckParam( L, 4, dAngA)
double dAngB ;
LuaCheckParam( L, 5, dAngB)
DBLVECTOR vAng ;
int i ;
for ( i = 4 ; i <= 7 ; ++ i) {
double dAng ;
if ( LuaGetParam( L, i, dAng))
vAng.emplace_back( dAng) ;
else
break ;
}
LuaClearStack( L) ;
// imposto la tavola corrente per il calcolo
int nStat ;
bool bOk = ExeVerifyOutstroke( dX, dY, dZ, dAngA, dAngB, nStat) ;
bool bOk = ExeVerifyOutstroke( dX, dY, dZ, vAng, nStat) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, ( nStat == 0)) ;
@@ -4754,6 +4786,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllCurrAxesNames", LuaGetAllCurrAxesNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRotAxisBlocked", LuaGetRotAxisBlocked) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAngles", LuaGetCalcAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAnglesEx", LuaGetCalcAnglesEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcPositions", LuaGetCalcPositions) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRobotAngles", LuaGetRobotAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTipFromPositions", LuaGetCalcTipFromPositions) ;