Use of BRepOffsetAPI_MakeOffset

Hi All,

Please guide me...
Can I use BRepOffsetAPI_MakeOffset function to offset a wire?
If yes can you please give me a sameple code of how to offset a wire using this function...
I tried using it but I couldnot clearly understand the parameters passed to this function...

BRepOffsetAPI_MakeOffset (const TopoDS_Wire &Spine, const GeomAbs_JoinType Join=GeomAbs_Arc)
what does the spine mean( Is it any TopoDS_Wire or only a special kind of it)?
what is the GeomAbs_JoinType mean?

I have a TopoDS_Wire W, I want to offset it to a distance 'dist=1.0'. How can I use this function to offset the give wire W to a distance 'dist'?

Thanks a lot,
Sindhu

arkoala's picture

You have to be sure your wire is plane (not matter orientation)

double compensation = 1.0;
BRepOffsetAPI_MakeOffset myOffsetAlgo(theWire, GeomAbs_Tangent);
myOffsetAlgo.Perform(compensation);
return (myOffsetAlgo.IsDone() == Standard_True);

There are different possibilities for GeomAbs_JoinType. Go to definition and you will see:
enum GeomAbs_JoinType {
GeomAbs_Arc,
GeomAbs_Tangent,
GeomAbs_Intersection
};

Try with them, :)

SINDHU's picture

Thank you very much Arkoala...:)

SINDHU's picture

Hi Arkoala,

By using the above code once we offset the wire W then how can I display the resultant offset wire obtained. My code :
TopoDS_Wire W = BRepBuilderAPI_MakePolygon(gp_Pnt(-4,0,-4),gp_Pnt(-4,0,4),gp_Pnt(4,0,4),gp_Pnt(4,0,-4),Standard_True);
TopoDS_Shape res1=TopoDS::Wire(W); //To display the wire
Handle(AIS_Shape) ais1=new AIS_Shape(res1); aDoc->GetAISContext()->Display(ais1,Standard_True);
const GeomAbs_JoinType Join=GeomAbs_Tangent; //Offsetting the wire W to a distance 'dist'
Standard_Real dist = 1.0;
BRepOffsetAPI_MakeOffset off(W,GeomAbs_Tangent);
off.Perform(dist);

Now I want to display the obtained offset wire.
What is the return type of the function BRepOffsetAPI_MakeOffset ?
Can you please give me a sample code or the related function?

Thanks a lot,
SINDHU

SINDHU's picture

I was able to solve the problem using the Shape() function.

Thank you
SINDHU