Hello
I try to make face with hole.
But sometimes it miscalculated.
http://www.fisco21.com/img/OCC/20090213-1.jpg
The orientation of wire might have the cause of miscalculation,
so I tried to reverse the orientation of a hole and that lead to get the desired results.
But sometimes it still miscalculated in another data.
So, I program a simple code to examine the condition of the miscalculation. (OCC 6.3.0 VS6 WinXp)
The code is to create wire of square with a hole.
The squre with hole is rotated with 15 degrees each and call makeFaceWidthHole function.
void OnDebug_test2(Handle_AIS_InteractiveContext myAISContext)
{
static double xx[] = { -1, 1, 1, -1, -1};
static double yy[] = { -1, -1, 1, 1, -1};
TopoDS_Wire aOuter;
{
BRepBuilderAPI_MakePolygon MP;
for ( int i=0; i
gp_Pnt aPnt( xx[i]*50, yy[i]*50+50, 0 );
MP.Add( aPnt );
}
MP.Close();
aOuter = MP;
}
TopoDS_Wire aInner;
{
BRepBuilderAPI_MakePolygon MP;
for ( int i=0; i
gp_Pnt aPnt( xx[i]*25, yy[i]*25+50, 0 );
MP.Add( aPnt );
}
MP.Close();
aInner = MP;
}
for ( double th=0.0; th
TopoDS_Shape aRotatedOuter, aRotatedInner;
{
gp_Trsf aTrsf;
aTrsf.SetRotation( gp::OX(), th * Standard_PI/180.0 );
aRotatedOuter = BRepBuilderAPI_Transform( aOuter, aTrsf, Standard_True );
aRotatedInner = BRepBuilderAPI_Transform( aInner, aTrsf, Standard_True );
}
makeFaceWithHole( myAISContext, TopoDS::Wire(aRotatedOuter), TopoDS::Wire(aRotatedInner) );
}
}
static makeFaceWithHole( Handle_AIS_InteractiveContext myAISContext, TopoDS_Wire tFrame, TopoDS_Wire tHole )
{
TopoDS_Face tFace = BRepBuilderAPI_MakeFace( tFrame );
BRepBuilderAPI_MakeFace MF( tFace );
MF.Add( tHole );
if ( MF.IsDone()) {
Handle(AIS_Shape) aShape = new AIS_Shape(MF.Shape());
myAISContext->SetDisplayMode(aShape,1);
myAISContext->Display(aShape);
}
}
I paint the miscalculated plane with red.
http://www.fisco21.com/img/OCC/20090213-2.jpg
I am at a loss as it seems to randomly miscalculated.
Surprisingly the execution of this sample program at Vista c2d machine, has different results( miscalculated at different angles ).
It also goes different between debug and release occ dlls.
Any help will welcome.