#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //======================================================================= //function : ShapeFix_SplitCommonVertex //purpose : //======================================================================= ShapeFix_SplitCommonVertex::ShapeFix_SplitCommonVertex() { myStatus = ShapeExtend::EncodeStatus ( ShapeExtend_OK ); SetPrecision(Precision::Confusion()); } //======================================================================= //function : Init //purpose : //======================================================================= void ShapeFix_SplitCommonVertex::Init(const TopoDS_Shape& S) { myShape = S; if ( Context().IsNull() ) SetContext ( new ShapeBuild_ReShape ); myResult = myShape; Context()->Apply(myShape); } //======================================================================= //function : Perform //purpose : //======================================================================= void ShapeFix_SplitCommonVertex::Perform() { TopAbs_ShapeEnum st = myShape.ShapeType(); if(st>TopAbs_FACE) return; for(TopExp_Explorer itf(myShape,TopAbs_FACE); itf.More(); itf.Next()) { TopoDS_Shape tmpFace = Context()->Apply(itf.Current()); TopoDS_Face F = TopoDS::Face(tmpFace); if(F.IsNull()) continue; // analys face and split if necessary TopTools_SequenceOfShape wires; for(TopoDS_Iterator itw(F,Standard_False); itw.More(); itw.Next()) { if(itw.Value().ShapeType() != TopAbs_WIRE) continue; wires.Append(itw.Value()); } if(wires.Length()<2) continue; TopTools_DataMapOfShapeShape MapVV; MapVV.Clear(); for(Standard_Integer nw1=1; nw1NbEdges(); ne2++) { TopoDS_Edge E = sewd2->Edge(ne2); TopoDS_Vertex FV = sae.FirstVertex(E); TopoDS_Vertex LV = sae.LastVertex(E); Standard_Boolean IsCoinc = Standard_False; if(FV==V2) { FV=Vnew; IsCoinc = Standard_True; } if(LV==V2) { LV=Vnew; IsCoinc = Standard_True; } if(IsCoinc) { TopoDS_Edge NewE = sbe.CopyReplaceVertices(E,FV,LV); Context()->Replace(E,NewE); } } } } } } } } myShape = Context()->Apply(myShape); } //======================================================================= //function : Shape //purpose : //======================================================================= TopoDS_Shape ShapeFix_SplitCommonVertex::Shape() { return myShape; }