EgtNesting 2.3l1 :
- ricompilazione con libreria Optalog 2021 - aggiunte funzioni AddRestrictedZoneToSheet e SetRestrictedZoneToPart (incompatibili con taglio ghigliottina).
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "/EgtDev/Include/EGkPolyArc.h"
|
||||
#include "/EgtDev/Extern/Optalog/Include/cns.h"
|
||||
#include "/EgtDev/Extern/Optalog/Include/cns_tooling.h"
|
||||
#include "/EgtDev/Extern/Optalog/Include/cns_restricted_zone.h"
|
||||
#include "/EgtDev/Extern/Optalog/Include/cns_egaltech.h"
|
||||
#include "/EgtDev/Include/SELkLockId.h"
|
||||
|
||||
@@ -82,6 +83,7 @@ AutoNester::Clear( void)
|
||||
m_pComp = nullptr ;
|
||||
}
|
||||
m_IdSheetInfo.clear() ;
|
||||
m_IdRzCstrPtr.clear() ;
|
||||
m_IdPartPtr.clear() ;
|
||||
m_dInterpartGap = 0 ;
|
||||
return true ;
|
||||
@@ -199,6 +201,57 @@ AutoNester::AddDefectToSheet( int nSheetId, const PolyArc& Outline)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
AutoNester::AddRestrictedZoneToSheet( int nRzConstrId, int nSheetId, const PolyArc& Outline)
|
||||
{
|
||||
if ( m_pOrder == nullptr)
|
||||
return false ;
|
||||
// verifico outline
|
||||
if ( Outline.GetArcNbr() == 0 || ! Outline.IsClosed())
|
||||
return false ;
|
||||
// cerco lo sheet
|
||||
const auto IterS = m_IdSheetInfo.find( nSheetId) ;
|
||||
if ( IterS == m_IdSheetInfo.end())
|
||||
return false ;
|
||||
CNS_SheetPtr pSheet = IterS->second.pSheet ;
|
||||
double dOffsX = IterS->second.dOffsX ;
|
||||
double dOffsY = IterS->second.dOffsY ;
|
||||
// cerco il vincolo
|
||||
CNS_RestrictedZoneConstraintPtr pRzCstr = nullptr ;
|
||||
const auto IterC = m_IdRzCstrPtr.find( nRzConstrId) ;
|
||||
if ( IterC == m_IdRzCstrPtr.end()) {
|
||||
// creo vincolo per zona ristretta
|
||||
pRzCstr = CNS_CreateRestrictedZoneConstraint( m_pOrder) ;
|
||||
if ( pRzCstr == nullptr)
|
||||
return false ;
|
||||
m_IdRzCstrPtr.emplace( nRzConstrId, pRzCstr) ;
|
||||
}
|
||||
else
|
||||
pRzCstr = IterC->second ;
|
||||
// aggiungo zona ristretta tramite suo contorno
|
||||
BBox3d b3Rect ;
|
||||
if ( Outline.IsRectangleXY( b3Rect)) {
|
||||
// imposto il rettangolo
|
||||
Point3d ptMin, ptMax ;
|
||||
b3Rect.GetMinMax( ptMin, ptMax) ;
|
||||
CNS_Point CNSPT_Min, CNSPT_Max ;
|
||||
CNSPT_Min.x = ptMin.x - dOffsX ;
|
||||
CNSPT_Min.y = ptMin.y - dOffsY ;
|
||||
CNSPT_Max.x = ptMax.x - dOffsX ;
|
||||
CNSPT_Max.y = ptMax.y - dOffsY ;
|
||||
ptMin += Vector3d( -dOffsX, -dOffsY, 0) ;
|
||||
ptMax += Vector3d( -dOffsX, -dOffsY, 0) ;
|
||||
CNS_SheetAddBoxRestrictedZone( pRzCstr, pSheet, CNSPT_Min, CNSPT_Max) ;
|
||||
}
|
||||
else {
|
||||
vector<CNS_Element> vElem ;
|
||||
GetCNSPath( Outline, -dOffsX, -dOffsY, vElem) ;
|
||||
CNS_SheetAddRestrictedZone( pRzCstr, pSheet, int( vElem.size()), vElem.data()) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
AutoNester::AddPart( int nPartId, const PolyArc& Outline, bool bCanFlip, bool bCanRotate, double dRotStep, int nPriority, int nCount)
|
||||
@@ -286,6 +339,27 @@ AutoNester::AddToolOutlineToPart( int nPartId, const PolyArc& ToolOutline)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
AutoNester::SetRestrictedZoneToPart( int nPartId, int nRzConstrId)
|
||||
{
|
||||
if ( m_pOrder == nullptr)
|
||||
return false ;
|
||||
// cerco il pezzo
|
||||
const auto Iter = m_IdPartPtr.find( nPartId) ;
|
||||
if ( Iter == m_IdPartPtr.end())
|
||||
return false ;
|
||||
CNS_PartPtr pPart = Iter->second ;
|
||||
// recupero il vincolo
|
||||
const auto IterC = m_IdRzCstrPtr.find( nRzConstrId) ;
|
||||
if ( IterC == m_IdRzCstrPtr.end())
|
||||
return false ;
|
||||
CNS_RestrictedZoneConstraintPtr pRzCstr = IterC->second ;
|
||||
// imposto il vincolo
|
||||
CNS_SetZoneRestrictedPart( pRzCstr, pPart) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
AutoNester::SetInterpartGap( double dGap)
|
||||
|
||||
Reference in New Issue
Block a user