aFuseShape = HYDROData_Tool::RebuildCmp(aFuseShape);
- BRep_Builder BB;
- TopoDS_Face DF;
+ ShapeUpgrade_UnifySameDomain unif( aFuseShape, Standard_False, Standard_True, Standard_False );
if (!IE.IsEmpty())
{
- DEBTRACE("---!IE.IsEmpty() ");
- //add dummy face to existing shell
- //this face contains all internal edges
- //USD algo will skip such edges and will not perform unifying through them
- //(more than 2 faces are connected to one edge + non same domain surfaces)
- TopoDS_Wire DW;
- Handle(Geom_Plane) DPl = new Geom_Plane(gp_Pln (gp_Pnt(0,0,0), gp_Dir(0,1,0))); //non same domain with the main surf
- BB.MakeFace(DF, DPl, Precision::Confusion());
- BB.MakeWire(DW);
+ TopTools_MapOfShape IEM;
for (int i = 1; i <= IE.Extent(); i++)
- BB.Add(DW, IE(i));
- BB.Add(DF, DW);
- BB.Add(aFuseShape, DF);
+ IEM.Add(IE(i));
+ unif.KeepShapes(IEM);
}
- ShapeUpgrade_UnifySameDomain unif( aFuseShape, Standard_False, Standard_True, Standard_False );
unif.Build();
TopoDS_Shape anUnitedShape;
- const TopoDS_Shape& out = unif.Shape();
+ anUnitedShape = unif.Shape();
HYDROData_ShapesGroup::GroupDefinition::Update( &aSeqOfUsedGroups, &unif );
- if (!IE.IsEmpty())
- {
- //remove dummy face from shell; shell becomes valid
- const TopoDS_Shape& NDF = unif.History()->Modified(DF).First();
- BRepTools_ReShape ReShaper;
- ReShaper.Remove(NDF);
- anUnitedShape = ReShaper.Apply(out);
- HYDROData_ShapesGroup::GroupDefinition::Update( &aSeqOfUsedGroups, &ReShaper );
- }
- else
- anUnitedShape = out;
+ //cout << "inif: fuseshape: " << aFuseShape.TShape().get() << "unifS " << anUnitedShape.TShape().get() << endl;
+#ifdef DEB_GET_REGION_SHAPE
+ HYDROData_ShapesGroup::GroupDefinition::Dump( std::cout, aSeqOfUsedGroups );
+#endif
TopTools_SequenceOfShape aShapeFaces;
HYDROData_ShapesTool::ExploreShapeToShapes( anUnitedShape, TopAbs_FACE, aShapeFaces );
*theSeqOfGroups = aSeqOfGroups;
}
}
-
+
return aResShape;
}
return;
SeqOfGroupsDefs::Iterator anIter( *theGroupsDefs );
+ if (theAlgo->History().IsNull())
+ return;
+
for ( ; anIter.More(); anIter.Next() )
{
GroupDefinition& aGroupDef = anIter.ChangeValue();
{
TopoDS_Shape aShape = aGroupDef.Shapes.Value( i );
- TopoDS_Shape aGeneratedByAlgo = TopoDS_Shape();
- if ( !theAlgo->History().IsNull() && ! aShape.IsNull())
+ TopoDS_Shape aModifSh;
+ if ( !aShape.IsNull())
+ {
+ const TopTools_ListOfShape& listModified = theAlgo->History()->Modified(aShape);
+ if (listModified.Extent() > 0)
{
- const TopTools_ListOfShape& listModified = theAlgo->History()->Modified(aShape);
- if (listModified.Extent() > 0)
- aGeneratedByAlgo = listModified.First();
+ aModifSh = listModified.First();
+ // Edge has been modified
+ aShapesToAdd.Append( aModifSh );
+ aGroupDef.Shapes.Remove( i );
+ --i;
}
- if ( aGeneratedByAlgo.IsNull() )
- {
- // Edge has been removed
- aGroupDef.Shapes.Remove( i );
- --i;
- }
- else if ( !aShape.IsEqual( aGeneratedByAlgo ) )
- {
- // Edge has been modified
- aShapesToAdd.Append( aGeneratedByAlgo );
- aGroupDef.Shapes.Remove( i );
- --i;
+ else if ( theAlgo->History()->IsRemoved(aShape) )
+ {
+ // Edge has been removed
+ aGroupDef.Shapes.Remove( i );
+ --i;
+ }
+
}
- }
+ }
HYDROData_ShapesTool::AddShapes( aGroupDef.Shapes, aShapesToAdd );
}