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

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

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

Samples & Tools

 

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

Adv. Components

Related pages

Combining two tangent continuous edges into one single edge

Sushrut Pavanaskar's picture
Forums: 

Hi, I am in need of an API that will combine two edges that are tangent continuous and exactly have one point in common. Something like api_combine_edges in ACIS. I tried fuse but it creates a thing called compound and not really an TopoDS_Edge. Is there any way to do this? Creating a wire out of them also is not helpful because the shared vertex still remains. First post, new to OCC, please be kind :)

Benjamin Bihler's picture

Most probably creating a wire out of two edges is EXACTLY what you would like to do. If the visualization displays something like a vertex at the fuse position, this shouldn't bother you.

Still if you insist to make one edge out of two, you could perhaps try the following:

- Create an Adaptor3d_HCurve for your edges (look at its child classes and check BRepAdaptor_Curve).

- Approximate the edges by splines using class GeomConvert_ApproxCurve.

- Concatenate the splines using Add() method of class GeomConvert_CompCurveToBSplineCurve.

- Create an edge out of your concatenated splines with BRepLib_MakeEdge.

I cannot think of any useful application of this recipe. ;)

Benjamin

Sushrut Pavanaskar's picture

Hi Benjamin,

Thanks a bunch for your detailed reply. I'm quite new to OCC so implementing that took me some time but here is how I did it and I think it works well.

GeomAdaptor_HCurve hcurveadapt1(BRepAdaptor_Curve(e1).Curve());

const Handle(GeomAdaptor_HCurve)& aHC1 = new GeomAdaptor_HCurve(hcurveadapt1);

GeomConvert_ApproxCurve c1 = GeomConvert_ApproxCurve(aHC1, 0.001, GeomAbs_C1, 1, 10);

    GeomAdaptor_HCurve hcurveadapt2(BRepAdaptor_Curve(e2).Curve());

    const Handle(GeomAdaptor_HCurve)& aHC2 = new GeomAdaptor_HCurve(hcurveadapt2);

    GeomConvert_ApproxCurve c2 = GeomConvert_ApproxCurve(aHC2, 0.001, GeomAbs_C1, 1, 10);

    GeomConvert_CompCurveToBSplineCurve res;

    res.Add(c1.Curve(), 0.001);

    res.Add(c2.Curve(), 0.001);

    BRepLib_MakeEdge mEdge;

    mEdge.Init(res.BSplineCurve());

    mEdge.Build();

    return TopoDS::Edge(mEdge.Shape()); //This is the result

As to why on earth would I do that: I have a set of edges - some are tangent continuous to the next in the sequence, some are not and instead are oriented to form a sharp corner. I want to fillet these corners out. The filletting routine works on two edges at a time (I am using ChFi2d_FilletAPI). If I dont combine all edges that can be combined being tangent continuous, sometimes the filletting routine gets a small edge before a sharp corner and thus I cant fillet it with a reasonable radius. After combining, now the entire combined edge goes as an input to the filletting routine giving it much more radius to work with.

Anyway, thanks for the help again.

Sushrut