本文整理汇总了C++中TopoDS_Face::IsSame方法的典型用法代码示例。如果您正苦于以下问题:C++ TopoDS_Face::IsSame方法的具体用法?C++ TopoDS_Face::IsSame怎么用?C++ TopoDS_Face::IsSame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TopoDS_Face
的用法示例。
在下文中一共展示了TopoDS_Face::IsSame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: replaceFacesInternal
void OCCRegion::replaceFacesInternal(std::list<GFace*> &new_faces)
{
// we simply replace old faces by new faces in the structure
TopExp_Explorer aExpS, aExpF;
BRep_Builder aBB;
TopoDS_Compound aCmp;
aBB.MakeCompound(aCmp);
TopoDS_Solid _s_replacement;
aBB.MakeSolid(_s_replacement);
_s_replacement.Orientation(s.Orientation());
aExpS.Init(s, TopAbs_SHELL);
for (; aExpS.More(); aExpS.Next()) {
const TopoDS_Shell& _shell=TopoDS::Shell(aExpS.Current());
TopoDS_Shell _shell_replacement;
aBB.MakeShell(_shell_replacement);
_shell_replacement.Orientation(_shell.Orientation());
aExpF.Init(_shell, TopAbs_FACE);
for (; aExpF.More(); aExpF.Next()) {
const TopoDS_Face& _face=TopoDS::Face(aExpF.Current());
TopoDS_Face _face_replacement;
std::list<GFace*>::iterator it = l_faces.begin();
std::list<GFace*>::iterator it2 = new_faces.begin();
for ( ; it != l_faces.end() ; ++it,++it2){
OCCFace *occF = dynamic_cast<OCCFace*>(*it);
if (occF){
TopoDS_Face oldf = occF->getTopoDS_Face();
if (oldf.IsSame(_face)){
_face_replacement = *((TopoDS_Face*)(*it2)->getNativePtr());
}
else {
oldf = occF->getTopoDS_FaceOld();
if (oldf.IsSame(_face)){
_face_replacement = *((TopoDS_Face*)(*it2)->getNativePtr());
}
}
}
}
if (_face_replacement.IsNull()){
Msg::Error("cannot find an face for gluing a region");
}
if (_face_replacement.IsSame(_face)) {
aBB.Add(_shell_replacement, _face);
}
else {
if(FaceHaveDifferentOrientations(_face, _face_replacement))
_face_replacement.Reverse();
aBB.Add(_shell_replacement, _face_replacement);
}
}
aBB.Add(_s_replacement, _shell_replacement);
}
s = _s_replacement;
setup();
}
示例2: update_OCC_entity
//----------------------------------------------------------------
// Function: TopoDS_Shape level function to update the core Surface
// for any movement or Boolean operation of the body.
// Author: Jane Hu
//----------------------------------------------------------------
CubitStatus OCCSurface::update_OCC_entity(TopoDS_Face& old_surface,
TopoDS_Shape& new_surface,
BRepBuilderAPI_MakeShape *op,
TopoDS_Vertex* removed_vertex,
LocOpe_SplitShape* sp)
{
//set the Wires
TopTools_IndexedMapOfShape M, M2;
TopoDS_Shape shape, shape2, shape_edge, shape_vertex;
TopExp::MapShapes(old_surface, TopAbs_WIRE, M);
TopTools_ListOfShape shapes;
BRepFilletAPI_MakeFillet2d* test_op = NULL;
for (int ii=1; ii<=M.Extent(); ii++)
{
TopoDS_Wire wire = TopoDS::Wire(M(ii));
TopTools_ListOfShape shapes;
if(op)
{
test_op = dynamic_cast<BRepFilletAPI_MakeFillet2d*>(op);
if(!test_op)
shapes.Assign(op->Modified(wire));
if(shapes.Extent() == 0)
shapes.Assign(op->Generated(wire));
if(!new_surface.IsNull())
TopExp::MapShapes(new_surface,TopAbs_WIRE, M2);
}
else if(sp)
shapes.Assign(sp->DescendantShapes(wire));
if (shapes.Extent() == 1)
{
shape = shapes.First();
if(M2.Extent() == 1)
{
shape2 = TopoDS::Wire(M2(1));
if(!shape.IsSame(shape2))
shape = shape2;
}
else if(M2.Extent() > 1)
shape.Nullify();
}
else if(shapes.Extent() > 1)
shape.Nullify();
else if(op->IsDeleted(wire) || shapes.Extent() == 0)
{
TopTools_IndexedMapOfShape M_new;
TopExp::MapShapes(new_surface, TopAbs_WIRE, M_new);
if (M_new.Extent()== 1)
shape = M_new(1);
else
shape.Nullify();
}
else
{
shape = wire;
continue;
}
//set curves
BRepTools_WireExplorer Ex;
for(Ex.Init(wire); Ex.More();Ex.Next())
{
TopoDS_Edge edge = Ex.Current();
if(op && !test_op)
{
shapes.Assign(op->Modified(edge));
if(shapes.Extent() == 0)
shapes.Assign(op->Generated(edge));
}
else if(sp)
shapes.Assign(sp->DescendantShapes(edge));
if (shapes.Extent() == 1)
{
//in fillet creating mothod, one edge could generated a face, so check
//it here.
TopAbs_ShapeEnum type = shapes.First().TShape()->ShapeType();
if(type != TopAbs_EDGE)
shape_edge.Nullify();
else
shape_edge = shapes.First();
}
else if (shapes.Extent() > 1)
{
//update all attributes first.
TopTools_ListIteratorOfListOfShape it;
it.Initialize(shapes);
for(; it.More(); it.Next())
{
shape_edge = it.Value();
OCCQueryEngine::instance()->copy_attributes(edge, shape_edge);
//.........这里部分代码省略.........