How to get the cross section of a shape?

Hi Bros! It's not the first time I meet the problem.

I try to get the cross section of a shape, assume the shape is a cylinder.

I can get the location and direction of the cylinder, then can get a plane with this.

I try to get the cross section through BRepAlgoAPI_Cut. However, it doesn't work.

Now I will try to use GeomAPI_IntSS.

yekong yekong's picture
    BRepAlgoAPI_Section tool(shape1, shape2);
    tool.SetFuzzyValue(dPrecisionBoolean);
    tool.SetNonDestructive(true);
    tool.SetRunParallel(true);
    tool.Build();

    if (tool.HasErrors()) 
    {
        return false;
    }
    else if (tool.HasWarnings()) 
    {
        return false;
    }
    else
    {
        data = tool.Shape();
        if (data.IsNull())
        {
            return false;
        }
    }

shape1 is a cylinder, shape2 is a face, result shape is a wire you can use get TopoDS_Edge and TopoDS_Vertex

linbei jianbaoxia's picture

Thanks very much, it works.