This works as long as face.Orientation() is TopAbs_FORWARD.
If face.Orientation() is TopAbs_REVERSED, newface.Orientation() correctly returns TopAbs_FORWARD,
but if you Diplay newshape and check the orientation of the replaced face, it still is TopAbs_REVERSED.
Does anyone know why this is so? How can this be fixed?
Oops, I didn't mean to leave the class name in the code. The rest of the code does this:
A shape and a face that belongs to the shape are passed to ReverseFaceOrientation. Then the representation of the old shape is deleted and a representation of the new shape
returned by ReverseFaceOrientation is displayed.
I think there is no problem with this.
Here is the solution to my problem. I just overlooked that the function
BRepTools_ReShape::ModeConsiderOrientation()
can also be used to SET the private myConsiderOrientation.
Here is the working code:
Wed, 06/20/2007 - 15:23
It should work like this:
TopoDS_Shape QtOCCViewerContext::ReverseFaceOrientation( const TopoDS_Shape& shape, const TopoDS_Face& face)
{
Handle(BRepTools_ReShape) rebuild = new BRepTools_ReShape;
TopoDS_Shape newface = face.Complemented();
rebuild->Replace(face, newface, Standard_True );
TopoDS_Shape newshape = rebuild->Apply(shape, TopAbs_FACE );
return newshape;
}
This works as long as face.Orientation() is TopAbs_FORWARD.
If face.Orientation() is TopAbs_REVERSED, newface.Orientation() correctly returns TopAbs_FORWARD,
but if you Diplay newshape and check the orientation of the replaced face, it still is TopAbs_REVERSED.
Does anyone know why this is so? How can this be fixed?
Dirk
Thu, 06/21/2007 - 03:17
I wonder what the rest of your QtOCCViewerContext looks like!
Pete
Thu, 06/21/2007 - 17:42
Oops, I didn't mean to leave the class name in the code. The rest of the code does this:
A shape and a face that belongs to the shape are passed to ReverseFaceOrientation. Then the representation of the old shape is deleted and a representation of the new shape
returned by ReverseFaceOrientation is displayed.
I think there is no problem with this.
Here is the solution to my problem. I just overlooked that the function
BRepTools_ReShape::ModeConsiderOrientation()
can also be used to SET the private myConsiderOrientation.
Here is the working code:
TopoDS_Shape ReverseFaceOrientation( const TopoDS_Shape& shape, const TopoDS_Face& face)
{
Handle(BRepTools_ReShape) rebuild = new BRepTools_ReShape();
rebuild->ModeConsiderOrientation() = Standard_True;
TopoDS_Shape newface = face.Complemented();
rebuild->Replace(face, newface, Standard_True );
TopoDS_Shape newshape = rebuild->Apply(shape, TopAbs_FACE );
return newshape;
}
Thu, 06/21/2007 - 18:01
There's no problem with me advertising the class name - it is GPL'd.
Pete