BRepOffsetAPI_MakeOffset : Perform function giving weird results

Hi All,
I am working on offsetting a wire. My code for offset is
const GeomAbs_JoinType Join=GeomAbs_Arc;
BRepOffsetAPI_MakeOffset off(W1,GeomAbs_Arc); //W1 is a wire on which the offset is performed
Standard_Real dist=-0.3;
off.Perform(dist); //offset the wire to a distance 'dist'
TopoDS_Shape S1= off.Shape();

The result given by the function for a wire is as below

The function takes the distance and Performs offset until the distance is within the range. I used a loop where the function offsets the wire by incrementing the "dist" by 0.3. The loop checks if the number of wires obtained at each level are greater than 1. The function "off.Shape()" returns a TopoDS_Compound even if the offset distance has reached the limit. So, the TopoDS_Compound when converted to wire and perform Shape analysis to find number of wires it returns zero number of wires. Example: for the wire above the offset wire is displayed until the "dist=-1.97". In the fig below the small purple color wires are the offset wires obtained for the distance -1.97.

If the "dist > -1.97" then the "offset.Shape()" returns a TopoDS_Compound which is having zero wires.

When the same function is tried on different wires some of them work properly and some wires work properly until some distance and some are not at all accepted by the function 'Perform'.

For example here in the fig below

On this wire offset is performed until "dist=1.82" it works properly. It gives the purple line as output. When I tried on a distance 1.83 and above the function breaks at "off.Perform(dist);" statement.

Another example

The wire given in the figure is sent to the above function to perform offset. This wire is not at all accepted by the off.Perform. It breaks for the 1st iteration itself. It is a closed wire with 21 edges. I am confused why the function is not accepting some wires which are complex.

It gives correct results for simple wires but when it comes to complex wires the function gives weird results.

Can anyone please help me out from this confusion. Why is the function "off.Perform(dist)' is not giving consistent results? All suggestions are welcome.

Thanks a lot for your help

SINDHU's picture

Sorry please ignore this the link are not working ....