For all issues regarding the Forums use, please, refer to the Forum Rules.

### Our Solutions

Need professional assistance?
Consider our:

Need to speed up your development?
Have a look at our:

Need some functionality extending standard OCCT capabilities?
Check out our:

# (Correct Post) ::: BRepOffsetAPI_MakeOffset : Perform function giving weird results

Forums:

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. The offset for this wire can further be done. As we can find come space in the middle which has not been offset.

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

I am extremely sorry to confuse all of you. Is there any way that we can delete a wrong post. The links are not working even in this post. I am very Sorry to post again and again.

Hi All,

This is the correct post.

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. The offset for this wire can further be done. As we can find come space in the middle which has not been offset.

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 and sorry for the confusion
Sindhu

I haven't used the offset methods myself, but one reason it could be failing is because the wires get way too close together somewhere, causing an overlapping/crossing.

Just a thought.

HI Paul

You were right!It is because of offset wire crossing itself.How do we solve such a case?

Once again, I have no experience using offset operations, but, from what they do, I see little you can do about it. You could probably offset further by using a smaller precision value (got to wonder which one and where to set it), yet you would have problems once again at different offsetting values.

I performed the CUT operation on two wires by making them into faces. The resultant shape obtained is again converted to wire. Now, I tried to perform the offset on the resultant wire. I didn't understand why the resultant wire cannot be offset. I used ShapeAnalysis_ShapeContents in order to check if the resultant is a wire. It is a wire and also a closed wire. But, the BRepOffset_MakeOffset is not able to offset this wire.

Can anyone please give me some suggestions why the wire cannot be offset?

Thanks & Regards,
Sindhu

Can anyone please help me in explaining about the class ShapeAnalysis_Wire. I used this class in order to check if the wire I have is a closed one or not using the functions "CheckClosed" and "CheckConnected". My code for this is ::
TopoDS_Wire Wire=....;
ShapeAnalysis_Wire SW;
if(SW.CheckClosed(0.0))
cout if(SW.CheckConnected(0.0))
cout

The "Wire" I loaded to the function is a "CLOSED WIRE" according to the function "Wire.Closed()".
But, the above code does not return the output "CLOSED WIRE". I am confused why the CheckClosed() and CheckConnected() functions does not return true.

Can you please explain me the objective of these 2 functions?

Sindhu

### DIGITAL 3D SOLUTIONS

A Capgemini Group Company