EgtMachKernel :
- aggiunta funzione KeepFixture - estesa funzione KeepRawPart.
This commit is contained in:
+50
-5
@@ -185,6 +185,18 @@ MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color
|
||||
nRawId = AddRawPart( nCrvSrfId, cCol) ;
|
||||
// annullo il sovra-materiale
|
||||
dOverMat = 0 ;
|
||||
// calcolo il punto di inserimento nel grezzo
|
||||
// determino l'ingombro del pezzo
|
||||
BBox3d b3Part ;
|
||||
if ( ! m_pGeomDB->GetGlobalBBox( nPartId, b3Part))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il box del solido del grezzo in globale
|
||||
int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
|
||||
BBox3d b3RawSolid ;
|
||||
if ( ! m_pGeomDB->GetGlobalBBox( nRawSolidId, b3RawSolid))
|
||||
return false ;
|
||||
// calcolo il punto di inserimento (come differenza tra i punti minimi)
|
||||
ptRef = b3Part.GetMin() + ( ORIG - b3RawSolid.GetMin()) ;
|
||||
}
|
||||
// se altrimenti grezzo da contorno
|
||||
else if ( ( nGtype & GEO_CURVE) != 0) {
|
||||
@@ -229,9 +241,12 @@ MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color
|
||||
// se definita tavola, aggiusto posizione del grezzo
|
||||
Point3d ptTabRef ;
|
||||
if ( GetTableRef( 1, ptTabRef)) {
|
||||
BBox3d b3Raw ;
|
||||
m_pGeomDB->GetGlobalBBox( nRawId, b3Raw) ;
|
||||
m_pGeomDB->TranslateGlob( nRawId, ptTabRef - b3Raw.GetMin()) ;
|
||||
// recupero box del solido
|
||||
int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
|
||||
BBox3d b3RawSolid ;
|
||||
// lo porto nell'angolo in basso a sinistra della tavola
|
||||
if ( m_pGeomDB->GetGlobalBBox( nRawSolidId, b3RawSolid))
|
||||
m_pGeomDB->TranslateGlob( nRawId, ptTabRef - b3RawSolid.GetMin()) ;
|
||||
}
|
||||
// inserisco il pezzo nel grezzo
|
||||
if ( ! AddPartToRawPart( nPartId, ptRef, nRawId)) {
|
||||
@@ -534,7 +549,7 @@ MachMgr::GetRawPartPhases( int nRawId, INTVECTOR& vPhase) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::KeepRawPart( int nRawId)
|
||||
MachMgr::KeepRawPart( int nRawId, int nSouPhase)
|
||||
{
|
||||
// verifico validità e recupero fasi in cui è presente
|
||||
INTVECTOR vPhase ;
|
||||
@@ -550,7 +565,37 @@ MachMgr::KeepRawPart( int nRawId)
|
||||
// visualizzo il grezzo e ne attivo i pezzi
|
||||
if ( ! m_pGeomDB->SetStatus( nRawId, GDB_ST_ON))
|
||||
return false ;
|
||||
return SwapRawPartParts( nRawId, true) ;
|
||||
if ( ! SwapRawPartParts( nRawId, true))
|
||||
return false ;
|
||||
// se fase di origine non definita, esco con successo
|
||||
if ( nSouPhase == 0)
|
||||
return true ;
|
||||
// copio il posizionamento
|
||||
Disposition* pSouDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nSouPhase))) ;
|
||||
Disposition* pDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( m_nCurrPhase))) ;
|
||||
if ( pSouDisp == nullptr || pDisp == nullptr)
|
||||
return false ;
|
||||
for ( int i = 0 ; ; ++ i) {
|
||||
int nId ; int nType ; Point3d ptPos ; int nFlag ;
|
||||
if ( pSouDisp->GetMoveRawData( i, nId, nType, ptPos, nFlag)) {
|
||||
if ( nId == nRawId) {
|
||||
switch ( nType) {
|
||||
case MoveRawData::COR :
|
||||
pDisp->MoveToCornerRawPart( nRawId, ptPos, nFlag) ;
|
||||
break ;
|
||||
case MoveRawData::CEN :
|
||||
pDisp->MoveToCenterRawPart( nRawId, ptPos, nFlag) ;
|
||||
break ;
|
||||
case MoveRawData::ROT :
|
||||
pDisp->ApplyRotationToRawPart( nRawId, ptPos.x, ptPos.y, ptPos.z) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
break ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user