MPV: Merge V1_2d

This commit is contained in:
smh 2004-01-28 14:08:37 +00:00
parent 2d1018ed21
commit 8bc9b430c5
16 changed files with 117 additions and 64 deletions

View File

@ -440,6 +440,7 @@ void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO
} }
Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value()); Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value());
aSh->SetShadingColor(myDisplayGUI->myGeomBase->myShadingColor); aSh->SetShadingColor(myDisplayGUI->myGeomBase->myShadingColor);
aSh->SetInfiniteState(Shape.Infinite());
Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myDisplayGUI->myGeomGUI->GetFatherior(), "GEOM"); Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myDisplayGUI->myGeomGUI->GetFatherior(), "GEOM");
IO->setEntry(obj->GetID()); IO->setEntry(obj->GetID());
aSh->setIO(IO); aSh->setIO(IO);

View File

@ -198,7 +198,7 @@ void EntityGUI_SubShapeDlg::ClickOnApply()
QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
/* Reset all arguments and local context to allow user a new selection ...*/ /* Reset all arguments and local context to allow user a new selection ...*/
this->ResetStateOfDialog(); //this->ResetStateOfDialog();
return; return;
} }

View File

@ -452,7 +452,9 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames; SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
aSeq->length(1); aSeq->length(1);
// Prepare a file name to open // Prepare a file name to open
TCollection_AsciiString aNameWithExt(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL())); TCollection_AsciiString aNameWithExt("");
if (isMultiFile)
aNameWithExt = TCollection_AsciiString(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL()));
aNameWithExt += TCollection_AsciiString("_GEOM.sgd"); aNameWithExt += TCollection_AsciiString("_GEOM.sgd");
aSeq[0] = CORBA::string_dup(aNameWithExt.ToCString()); aSeq[0] = CORBA::string_dup(aNameWithExt.ToCString());
// Build a full file name of temporary file // Build a full file name of temporary file
@ -493,7 +495,10 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
isMultiFile); isMultiFile);
// Prepare a file name to open // Prepare a file name to open
TCollection_AsciiString aNameWithExt(aSeq[0]); TCollection_AsciiString aNameWithExt("");
if (isMultiFile)
aNameWithExt = TCollection_AsciiString(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL()));
aNameWithExt += TCollection_AsciiString("_GEOM.sgd");
TCollection_AsciiString aFullName = aTmpDir + aNameWithExt; TCollection_AsciiString aFullName = aTmpDir + aNameWithExt;
// Open document // Open document

View File

@ -490,13 +490,13 @@ bool GEOMBase::Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name)
anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixmap->SetPixMap("ICON_OBJBROWSER_Geometry"); aPixmap->SetPixMap("ICON_OBJBROWSER_Geometry");
aStudyBuilder->DefineComponentInstance(father, myGeom);
QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
if(aLocked) if(aLocked)
aStudy->GetProperties()->SetLocked(true); aStudy->GetProperties()->SetLocked(true);
op->finish(); op->finish();
} }
aStudyBuilder->DefineComponentInstance(father, myGeom);
father->ComponentIOR(myGeomGUI->GetFatherior()); father->ComponentIOR(myGeomGUI->GetFatherior());
TCollection_AsciiString nameG(""); TCollection_AsciiString nameG("");
@ -540,6 +540,7 @@ bool GEOMBase::Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name)
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
Handle(GEOM_AISShape) theResult = new GEOM_AISShape(shape, nameG.ToCString()); Handle(GEOM_AISShape) theResult = new GEOM_AISShape(shape, nameG.ToCString());
theResult->SetInfiniteState(shape.Infinite());
theResult->SetShadingColor(myShadingColor); theResult->SetShadingColor(myShadingColor);
IO = new GEOM_InteractiveObject(aShape->Name(), myGeomGUI->GetFatherior(), "GEOM"); IO = new GEOM_InteractiveObject(aShape->Name(), myGeomGUI->GetFatherior(), "GEOM");
theResult->setIO(IO); theResult->setIO(IO);
@ -595,12 +596,12 @@ bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject)
anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixmap->SetPixMap("ICON_OBJBROWSER_Geometry"); aPixmap->SetPixMap("ICON_OBJBROWSER_Geometry");
aStudyBuilder->DefineComponentInstance(father, myGeom);
if (aLocked) if (aLocked)
aStudy->GetProperties()->SetLocked(true); aStudy->GetProperties()->SetLocked(true);
op->finish(); op->finish();
} }
aStudyBuilder->DefineComponentInstance(father, myGeom);
father->ComponentIOR(myGeomGUI->GetFatherior()); father->ComponentIOR(myGeomGUI->GetFatherior());
SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry());

View File

@ -313,7 +313,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
{ {
QAD_PyEditor* PyEditor = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getPyEditor(); QAD_PyEditor* PyEditor = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getPyEditor();
PyEditor->setText("from GEOM_usinggeom import *\n"); PyEditor->setText("from GEOM_usinggeom import *\n");
PyEditor->setText(">>> "); //PyEditor->setText(">>> ");
PyEditor->handleReturn(); PyEditor->handleReturn();
break; break;
} }
@ -533,6 +533,9 @@ void GEOMToolsGUI::OnEditDelete()
SALOMEDS::AttributeIOR_var anIOR; SALOMEDS::AttributeIOR_var anIOR;
SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
QAD_Operation* op = new SALOMEGUI_ImportOperation( QAD_Application::getDesktop()->getActiveStudy() );
op->start();
Standard_Boolean deleted = false;
for(;It.More();It.Next()) { for(;It.More();It.Next()) {
Handle(SALOME_InteractiveObject) IObject = It.Value(); Handle(SALOME_InteractiveObject) IObject = It.Value();
if(IObject->hasEntry()) { if(IObject->hasEntry()) {
@ -598,15 +601,16 @@ void GEOMToolsGUI::OnEditDelete()
/* Erase objects in Study */ /* Erase objects in Study */
SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry()); SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry());
if(!obj->_is_nil()) { if(!obj->_is_nil()) {
QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy());
op->start();
aStudyBuilder->RemoveObject(obj); aStudyBuilder->RemoveObject(obj);
op->finish(); deleted = true;
} }
} /* IObject->hasEntry() */ } /* IObject->hasEntry() */
} /* more/next */ } /* more/next */
if (deleted) op->finish();
else op->abort();
/* Clear any previous selection */ /* Clear any previous selection */
Sel->ClearIObjects(); Sel->ClearIObjects();
QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
@ -742,11 +746,11 @@ bool GEOMToolsGUI::Import(int aState)
anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixmap->SetPixMap( "ICON_OBJBROWSER_Geometry" ); aPixmap->SetPixMap( "ICON_OBJBROWSER_Geometry" );
aStudyBuilder->DefineComponentInstance( father, myGeom );
if (aLocked) aStudy->GetProperties()->SetLocked(true); if (aLocked) aStudy->GetProperties()->SetLocked(true);
op->finish(); op->finish();
} }
// if (aLocked) return false; // if (aLocked) return false;
aStudyBuilder->DefineComponentInstance( father, myGeom );
father->ComponentIOR(myGeomGUI->GetFatherior()); father->ComponentIOR(myGeomGUI->GetFatherior());
QString nameShape = QAD_Tools::getFileNameFromPath(file,false) + QString("_%1").arg(myGeomGUI->GetNbGeom()++); QString nameShape = QAD_Tools::getFileNameFromPath(file,false) + QString("_%1").arg(myGeomGUI->GetNbGeom()++);

View File

@ -115,7 +115,7 @@ def addToStudy(aShape, aName):
#NRI : BugID 1682 : sg = SALOMEGUI_Swig() #NRI : BugID 1682 : sg = SALOMEGUI_Swig()
#NRI : BugID 1682 : sg.updateObjBrowser(0) #NRI : BugID 1682 : sg.updateObjBrowser(0)
salome.sg.updateObjBrowser(0) # salome.sg.updateObjBrowser(0)
return id return id
def addToStudyInFather(aFather, aShape, aName): def addToStudyInFather(aFather, aShape, aName):
@ -141,7 +141,7 @@ def addToStudyInFather(aFather, aShape, aName):
addArguments( aShape ) addArguments( aShape )
#NRI : BugID 1682 : sg.updateObjBrowser(0) #NRI : BugID 1682 : sg.updateObjBrowser(0)
salome.sg.updateObjBrowser(0) # salome.sg.updateObjBrowser(0)
return id return id
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

View File

@ -103,11 +103,11 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn(); myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn();
Graphic3d_MaterialAspect aMatAspect; Graphic3d_MaterialAspect aMatAspect;
aMatAspect.SetAmbient( 1 ); aMatAspect.SetAmbient( 0.5 );
aMatAspect.SetDiffuse( 0 ); aMatAspect.SetDiffuse( 0.5 );
aMatAspect.SetEmissive( 0 ); aMatAspect.SetEmissive( 0.5 );
aMatAspect.SetShininess(1 ); aMatAspect.SetShininess(0.5 );
aMatAspect.SetSpecular( 0 ); aMatAspect.SetSpecular( 0.5 );
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect); myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(Graphic3d_NOM_JADE); myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(Graphic3d_NOM_JADE);

View File

@ -76,6 +76,7 @@ GEOM_Actor::GEOM_Actor()
this->ishighlighted = false; this->ishighlighted = false;
this->subshape = false; this->subshape = false;
this->myIsInfinite = false;
} }
GEOM_Actor::~GEOM_Actor() GEOM_Actor::~GEOM_Actor()
@ -171,6 +172,7 @@ void GEOM_Actor::SetShadingProperty(vtkProperty* Prop) {
// Mapper creating function // Mapper creating function
//------------------------------------------------------------- //-------------------------------------------------------------
void GEOM_Actor::CreateMapper(int theMode) { void GEOM_Actor::CreateMapper(int theMode) {
this->myIsInfinite = myShape.Infinite();
if(myShape.ShapeType() == TopAbs_VERTEX) { if(myShape.ShapeType() == TopAbs_VERTEX) {
gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(myShape)); gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(myShape));
this->SetPosition(aPnt.X(),aPnt.Y(),aPnt.Z()); this->SetPosition(aPnt.X(),aPnt.Y(),aPnt.Z());
@ -220,7 +222,9 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *Mapper)
} }
if(!ishighlighted) { if(!ishighlighted) {
if(myDisplayMode >= 1) { if ( ispreselected )
this->Property = PreviewProperty;
else if(myDisplayMode >= 1) {
// SHADING // SHADING
this->Property = ShadingProperty; this->Property = ShadingProperty;
} }
@ -228,8 +232,6 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *Mapper)
this->Property = WireframeProperty; this->Property = WireframeProperty;
} }
if ( ispreselected )
this->Property = PreviewProperty;
} }
this->Property->Render(this, ren); this->Property->Render(this, ren);

View File

@ -94,6 +94,7 @@ class VTKOCC_EXPORT GEOM_Actor : public SALOME_Actor {
void SetColor(float r,float g,float b); void SetColor(float r,float g,float b);
void GetColor(float& r,float& g,float& b); void GetColor(float& r,float& g,float& b);
virtual bool IsInfinite() {return myIsInfinite;}
protected: protected:
GEOM_Actor(); GEOM_Actor();
@ -110,6 +111,7 @@ class VTKOCC_EXPORT GEOM_Actor : public SALOME_Actor {
private: private:
bool subshape; bool subshape;
bool myIsInfinite;
TopoDS_Shape myShape; TopoDS_Shape myShape;
double deflection; double deflection;

View File

@ -69,7 +69,7 @@ void GEOM_AssemblyBuilder::InitProperties(vtkProperty* IsoProp,
{ {
// Shading like default OCC material // Shading like default OCC material
FaceProp->SetRepresentationToSurface(); FaceProp->SetRepresentationToSurface();
FaceProp->SetInterpolation(1); FaceProp->SetInterpolationToGouraud();
FaceProp->SetAmbient(1.0); FaceProp->SetAmbient(1.0);
FaceProp->SetDiffuse(1.0); FaceProp->SetDiffuse(1.0);
FaceProp->SetSpecular(0.4); FaceProp->SetSpecular(0.4);
@ -109,9 +109,9 @@ void GEOM_AssemblyBuilder::InitProperties(vtkProperty* IsoProp,
// Wireframe for Preview edge // Wireframe for Preview edge
EdgePVProp->SetRepresentationToWireframe(); EdgePVProp->SetRepresentationToWireframe();
EdgePVProp->SetAmbientColor(0, 1, 1); EdgePVProp->SetAmbientColor(1, 1, 0);
EdgePVProp->SetDiffuseColor(0, 1, 1); EdgePVProp->SetDiffuseColor(1, 1, 0);
EdgePVProp->SetSpecularColor(0, 1, 1); EdgePVProp->SetSpecularColor(1, 1, 0);
// Wireframe for vertex // Wireframe for vertex
VertexProp->SetRepresentationToWireframe(); VertexProp->SetRepresentationToWireframe();

View File

@ -205,14 +205,19 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel < 1) { if(nbSel < 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1) if(myEditCurrentArgument == GroupPoints->LineEdit1) {
myListShapes.length(0);
myOkListShapes = false; myOkListShapes = false;
else if(myEditCurrentArgument == GroupPoints->LineEdit2) } else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
myListTools.length(0);
myOkListTools = false; myOkListTools = false;
else if(myEditCurrentArgument == GroupPoints->LineEdit3) } else if(myEditCurrentArgument == GroupPoints->LineEdit3) {
myListRemoveInside.length(0);
myOkKeepShape = false; myOkKeepShape = false;
else if(myEditCurrentArgument == GroupPoints->LineEdit4) } else if(myEditCurrentArgument == GroupPoints->LineEdit4) {
myListKeepInside.length(0);
myOkRemoveShape = false; myOkRemoveShape = false;
}
return; return;
} }

View File

@ -241,11 +241,14 @@ TopoDS_Vertex Partition_Inter2d::AddVonE(const TopoDS_Vertex& theV,
if (!OnE1 && !OnE2 && !theF.IsNull()) if (!OnE1 && !OnE2 && !theF.IsNull())
{ {
// analitically find vertices E1 and E2 must pass trough // if 3 faces intersects each others, 3 new edges on them must pass
// through one vertex but real intersection points of each
// pair of edges are sometimes more far than a tolerance.
// Try to analitically find vertices that E1 and E2 must pass trough
TopoDS_Shape F1 = getOtherShape( theF, AsDes->Ascendant( E1 )); TopoDS_Shape F1 = getOtherShape( theF, AsDes->Ascendant( E1 ));
TopoDS_Shape F2 = getOtherShape( theF, AsDes->Ascendant( E2 )); TopoDS_Shape F2 = getOtherShape( theF, AsDes->Ascendant( E2 ));
if (!F1.IsNull() && !F2.IsNull()) if (!F1.IsNull() && !F2.IsNull() && !F1.IsSame( F2 ))
{ {
OnE1 = findVOnE ( theV, E1, E2, F1, F2, AsDes, V1 ); OnE1 = findVOnE ( theV, E1, E2, F1, F2, AsDes, V1 );
OnE2 = findVOnE ( theV, E2, E1, F1, F2, AsDes, V2 ); OnE2 = findVOnE ( theV, E2, E1, F1, F2, AsDes, V2 );

View File

@ -67,7 +67,6 @@ using namespace std;
#include <Geom_RectangularTrimmedSurface.hxx> #include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_SphericalSurface.hxx> #include <Geom_SphericalSurface.hxx>
#include <Geom_Surface.hxx> #include <Geom_Surface.hxx>
#include <Geom_ToroidalSurface.hxx>
#include <Geom_TrimmedCurve.hxx> #include <Geom_TrimmedCurve.hxx>
#include <Precision.hxx> #include <Precision.hxx>
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
@ -136,10 +135,10 @@ void Partition_Inter3d::CompletPart3d(const TopTools_ListOfShape& SetOfFaces1,
// avoid intersecting faces of one shape // avoid intersecting faces of one shape
TopoDS_Shape S1; TopoDS_Shape S1;
if (FaceShapeMap.IsBound(F1)) S1 = FaceShapeMap.Find(F1); if (FaceShapeMap.IsBound(F1)) S1 = FaceShapeMap.Find(F1);
// avoid intersecting faces sharing vertices, suppose they belong to
// shapes sharing same faces // to filter faces sharing an edge
TopTools_IndexedMapOfShape VM; TopTools_IndexedMapOfShape EM;
TopExp::MapShapes( F1, TopAbs_VERTEX, VM); TopExp::MapShapes( F1, TopAbs_EDGE, EM);
TColStd_ListIteratorOfListOfInteger itLI = BOS.Compare(F1); TColStd_ListIteratorOfListOfInteger itLI = BOS.Compare(F1);
for (; itLI.More(); itLI.Next()) { for (; itLI.More(); itLI.Next()) {
@ -152,12 +151,21 @@ void Partition_Inter3d::CompletPart3d(const TopTools_ListOfShape& SetOfFaces1,
if (!S1.IsNull() && S1.IsSame(S2)) if (!S1.IsNull() && S1.IsSame(S2))
continue; // descendants of one shape continue; // descendants of one shape
TopExp_Explorer expV (F2, TopAbs_VERTEX); TopExp_Explorer expE (F2, TopAbs_EDGE);
for ( ; expV.More(); expV.Next()) for ( ; expE.More(); expE.Next())
if (VM.Contains( expV.Current() )) if (EM.Contains( expE.Current() ))
break; break;
if (expV.More()) if (expE.More())
continue; // faces have a common edge {
// faces have a common edge, check if they are a tool and a face
// generated by the tool in another shape; in that case they are
// to be intersected
TopLoc_Location L1, L2;
Handle(Geom_Surface) S1 = BRep_Tool::Surface( F1, L1 );
Handle(Geom_Surface) S2 = BRep_Tool::Surface( F2, L2 );
if ( S1 != S2 || L1 != L2 )
continue;
}
F1.Orientation(TopAbs_FORWARD); F1.Orientation(TopAbs_FORWARD);
F2.Orientation(TopAbs_FORWARD); F2.Orientation(TopAbs_FORWARD);
@ -210,8 +218,7 @@ static void PutInBounds (const TopoDS_Face& F,
// UPeriodic, sometimes it is in domain but nontheless it has // UPeriodic, sometimes it is in domain but nontheless it has
// wrong position. // wrong position.
// Check pcurve position by 3D point // Check pcurve position by 3D point
if (S->IsKind(STANDARD_TYPE( Geom_SphericalSurface )) || if (S->IsKind(STANDARD_TYPE( Geom_SphericalSurface )))
S->IsKind(STANDARD_TYPE( Geom_ToroidalSurface )))
{ {
// get point on the surface // get point on the surface
gp_Pnt Ps = S->Value( Pm.X(), Pm.Y() ); gp_Pnt Ps = S->Value( Pm.X(), Pm.Y() );
@ -472,11 +479,17 @@ void Partition_Inter3d::Inter3D(const TopoDS_Face& F1,
TopoDS_Edge se = TopoDS::Edge( itLSE.Value() ); TopoDS_Edge se = TopoDS::Edge( itLSE.Value() );
// move itLSE to the next se
Standard_Integer ancRank = DS.AncestorRank(se); Standard_Integer ancRank = DS.AncestorRank(se);
if (ME[ancRank-1].Contains( se )) if (ME[ancRank-1].Contains( se ))
{
LSE.Remove( itLSE ); // se is an edge of face it intersects LSE.Remove( itLSE ); // se is an edge of face it intersects
continue;
}
else else
{
itLSE.Next(); itLSE.Next();
}
const TopoDS_Face& F = (ancRank == 1) ? F2 : F1; const TopoDS_Face& F = (ancRank == 1) ? F2 : F1;

View File

@ -163,6 +163,7 @@ fields
myEqualEdges : MapOfShape from TopTools; -- equal splits myEqualEdges : MapOfShape from TopTools; -- equal splits
myNewSection : MapOfShape from TopTools; -- new secton edges myNewSection : MapOfShape from TopTools; -- new secton edges
myClosedShapes : MapOfShape from TopTools; myClosedShapes : MapOfShape from TopTools;
mySharedFaces : MapOfShape from TopTools; -- faces shared by several shapes
myWrappingSolid: MapOfShape from TopTools; -- solids having other shapes inside myWrappingSolid: MapOfShape from TopTools; -- solids having other shapes inside
myFaceShapeMap : DataMapOfShapeShape from TopTools; -- to find a shape by face myFaceShapeMap : DataMapOfShapeShape from TopTools; -- to find a shape by face

View File

@ -208,9 +208,10 @@ void Partition_Spliter::Clear()
myListShapes.Clear(); myListShapes.Clear();
myMapFaces.Clear(); myMapFaces.Clear();
myMapTools.Clear(); myMapTools.Clear();
myClosedShapes.Clear();
myEqualEdges.Clear(); myEqualEdges.Clear();
myNewSection.Clear(); myNewSection.Clear();
myClosedShapes.Clear();
mySharedFaces.Clear();
myWrappingSolid.Clear(); myWrappingSolid.Clear();
myFaceShapeMap.Clear(); myFaceShapeMap.Clear();
@ -521,6 +522,7 @@ void Partition_Spliter::Compute(const TopAbs_ShapeEnum Limit)
if (makeSolids && S.ShapeType() == TopAbs_SOLID ) if (makeSolids && S.ShapeType() == TopAbs_SOLID )
MakeSolids( S, NSL ); MakeSolids( S, NSL );
// store new shells or solids
TopTools_ListIteratorOfListOfShape itNSL (NSL); TopTools_ListIteratorOfListOfShape itNSL (NSL);
for ( ; itNSL.More(); itNSL.Next()) for ( ; itNSL.More(); itNSL.Next())
myBuilder.Add (myShape, itNSL.Value()); myBuilder.Add (myShape, itNSL.Value());
@ -593,7 +595,7 @@ void Partition_Spliter::MakeSolids(const TopoDS_Shape & theSolid,
} }
} }
// find outer a shell most close to each hole shell // find an outer shell most close to each hole shell
TopTools_DataMapOfShapeShape aInOutMap; TopTools_DataMapOfShapeShape aInOutMap;
for (aShellIt.Initialize( aHoleShells ); aShellIt.More(); aShellIt.Next()) for (aShellIt.Initialize( aHoleShells ); aShellIt.More(); aShellIt.Next())
{ {
@ -913,42 +915,46 @@ TopoDS_Shape Partition_Spliter::FindFacesInside(const TopoDS_Shape& theShape,
Standard_Boolean isSolid = (theShape.ShapeType() == TopAbs_SOLID); Standard_Boolean isSolid = (theShape.ShapeType() == TopAbs_SOLID);
if (All || isSolid) // All is for sub-result removal if (All || isSolid) // All is for sub-result removal
{ {
// loop on not used faces; checked faces will be removed from MFP
// during the loop
for ( itm.Initialize( MFP ); itm.More(); itm.Next() ) { for ( itm.Initialize( MFP ); itm.More(); itm.Next() ) {
TopoDS_Shape aFace = itm.Key(); const TopoDS_Shape & aFace = itm.Key();
// find a shape aFace originates from // a shape which aFace originates from
TopoDS_Shape anOrigShape = GetOriginalShape( aFace ); TopoDS_Shape anOrigShape = GetOriginalShape( aFace );
// find out if all faces of anOrigShape are not in MFP // find out if all split faces of anOrigShape are not in MFP
// and by the way remove them from MFP // and by the way remove them from MFP
Standard_Boolean isAllOut = Standard_True; Standard_Boolean isAllOut = Standard_True;
TopoDS_Shape aSplitFaces = anOrigShape; TopoDS_Shape aSplitFaces = anOrigShape;
if (myImageShape.HasImage(anOrigShape)) if (myImageShape.HasImage(anOrigShape))
aSplitFaces = myImageShape.Image(anOrigShape).First(); aSplitFaces = myImageShape.Image(anOrigShape).First();
TopTools_ListOfShape aSplitFaceL; TopTools_ListOfShape aSplitFaceL; // faces candidate to be kept
for (expl.Init( aSplitFaces, TopAbs_FACE ); expl.More(); expl.Next()) for (expl.Init( aSplitFaces, TopAbs_FACE ); expl.More(); expl.Next())
{ {
const TopoDS_Shape & aSpFace = expl.Current(); const TopoDS_Shape & aSpFace = expl.Current();
// a tool face which become object has image but the whole tool shape has not // a tool face which became object has image but the whole tool shape has not
if (myImageShape.HasImage( aSpFace )) if (myImageShape.HasImage( aSpFace ))
{ {
TopExp_Explorer exF (myImageShape.Image( aSpFace ).First(), TopAbs_FACE ); TopExp_Explorer exF (myImageShape.Image( aSpFace ).First(), TopAbs_FACE );
for ( ; exF.More(); exF.Next() ) for ( ; exF.More(); exF.Next() )
{ {
aSplitFaceL.Append( exF.Current() ); aSplitFaceL.Append( exF.Current() );
if ( ! MFP.Remove( exF.Current() )) if ( ! MFP.Remove( exF.Current() ) && isAllOut )
isAllOut = Standard_False; // a shared face might be removed from MFP during a prev loop
isAllOut = mySharedFaces.Contains( exF.Current() );
} }
} }
else else
{ {
aSplitFaceL.Append( aSpFace ); aSplitFaceL.Append( aSpFace );
if ( ! MFP.Remove( aSpFace )) if ( ! MFP.Remove( aSpFace ) && isAllOut)
isAllOut = Standard_False; // a shared face might be removed from MFP during a prev loop
isAllOut = mySharedFaces.Contains( aSpFace );
} }
} }
itm.Initialize( MFP ); itm.Initialize( MFP ); // iterate remaining faces
if ( !isAllOut ) if ( !isAllOut )
continue; continue;
@ -1301,15 +1307,17 @@ TopoDS_Shape Partition_Spliter::MakeFaces (const TopoDS_Shape& S)
myImagesFaces.Bind(F,LNF); myImagesFaces.Bind(F,LNF);
// replace the result faces that have already been built // replace the result faces that have already been built
// during same domain faces reconstruction // during same domain faces reconstruction done earlier
if (myInter3d.HasSameDomainF( F )) { if (myInter3d.HasSameDomainF( F ))
// build map edge to same domain faces {
// build map edge to same domain faces: EFM
TopTools_IndexedDataMapOfShapeListOfShape EFM; TopTools_IndexedDataMapOfShapeListOfShape EFM;
TopTools_MapOfShape SDFM; // avoid doubling TopTools_MapOfShape SDFM; // avoid doubling
itl.Initialize( myInter3d.SameDomain( F )); itl.Initialize( myInter3d.SameDomain( F ));
for (; itl.More(); itl.Next()) { for (; itl.More(); itl.Next()) {
if ( !myImagesFaces.HasImage( itl.Value() )) if ( !myImagesFaces.HasImage( itl.Value() ))
continue; continue;
// loop on splits of a SD face
TopTools_ListIteratorOfListOfShape itNF; TopTools_ListIteratorOfListOfShape itNF;
itNF.Initialize (myImagesFaces.Image( itl.Value() )); itNF.Initialize (myImagesFaces.Image( itl.Value() ));
for ( ; itNF.More(); itNF.Next()) { for ( ; itNF.More(); itNF.Next()) {
@ -1320,7 +1328,7 @@ TopoDS_Shape Partition_Spliter::MakeFaces (const TopoDS_Shape& S)
TopExp::MapShapesAndAncestors(SDF, TopAbs_EDGE, TopAbs_FACE, EFM); TopExp::MapShapesAndAncestors(SDF, TopAbs_EDGE, TopAbs_FACE, EFM);
} }
} }
// do replace // do replace faces in the LNF
TopTools_ListOfShape LOF; TopTools_ListOfShape LOF;
if ( !EFM.IsEmpty() ) if ( !EFM.IsEmpty() )
itl.Initialize( LNF ); itl.Initialize( LNF );
@ -1335,13 +1343,15 @@ TopoDS_Shape Partition_Spliter::MakeFaces (const TopoDS_Shape& S)
Standard_Real dot; Standard_Real dot;
Partition_Loop3d::IsInside (E, TopoDS::Face(NF), TopoDS::Face(SDF), Partition_Loop3d::IsInside (E, TopoDS::Face(NF), TopoDS::Face(SDF),
1, dot, GoodOri); 1, dot, GoodOri);
if (dot < 0) { if (dot < 0)
{
// NF and SDF are on different side of E
if (SDFL.Extent() == 1) { if (SDFL.Extent() == 1) {
itl.Next(); itl.Next();
continue; continue;
} }
else else
SDF = SDFL.Last(); SDF = SDFL.Last(); // next face must be on the same side
} }
gp_Vec V1 = Partition_Loop3d::Normal( E, TopoDS::Face( NF )); gp_Vec V1 = Partition_Loop3d::Normal( E, TopoDS::Face( NF ));
gp_Vec V2 = Partition_Loop3d::Normal( E, TopoDS::Face( SDF )); gp_Vec V2 = Partition_Loop3d::Normal( E, TopoDS::Face( SDF ));
@ -1351,6 +1361,9 @@ TopoDS_Shape Partition_Spliter::MakeFaces (const TopoDS_Shape& S)
if (!myImagesFaces.HasImage( NF )) if (!myImagesFaces.HasImage( NF ))
myImagesFaces.Bind( NF, SDF ); myImagesFaces.Bind( NF, SDF );
// mySharedFaces is used in FindFacesInside()
mySharedFaces.Add( SDF );
LOF.Prepend ( SDF ); LOF.Prepend ( SDF );
LNF.Remove (itl); LNF.Remove (itl);
} }
@ -1368,8 +1381,10 @@ TopoDS_Shape Partition_Spliter::MakeFaces (const TopoDS_Shape& S)
} }
} // if (myImagesFaces.HasImage( F )) } // if (myImagesFaces.HasImage( F ))
// fill the resulting compound
for (itl.Initialize(LNF); itl.More(); itl.Next()) for (itl.Initialize(LNF); itl.More(); itl.Next())
myBuilder.Add ( C, itl.Value()); myBuilder.Add ( C, itl.Value());
} // loop on faces of S } // loop on faces of S
return C; return C;

View File

@ -124,6 +124,7 @@ TopTools_MapOfShape myMapTools;
TopTools_MapOfShape myEqualEdges; TopTools_MapOfShape myEqualEdges;
TopTools_MapOfShape myNewSection; TopTools_MapOfShape myNewSection;
TopTools_MapOfShape myClosedShapes; TopTools_MapOfShape myClosedShapes;
TopTools_MapOfShape mySharedFaces;
TopTools_MapOfShape myWrappingSolid; TopTools_MapOfShape myWrappingSolid;
TopTools_DataMapOfShapeShape myFaceShapeMap; TopTools_DataMapOfShapeShape myFaceShapeMap;
TopTools_DataMapOfShapeShape myInternalFaces; TopTools_DataMapOfShapeShape myInternalFaces;