Intersection between EDGE and a plane

Hi!
I want to find the intersection between a set of WIREs and a Plane. How can I do that?
Thanks in advancs...

siyamalan's picture

I have found.......
void CImportExportDoc::test(const TopoDS_Shape &S)
{
BRepBuilderAPI_MakePolygon polygon;
Handle(Geom_Plane) aplane = new Geom_Plane(1.,0.,0.,0.);
TopoDS_Shape planeShape = BRepBuilderAPI_MakeFace(aplane).Face();

TopExp_Explorer Ex;
for (Ex.Init(S,TopAbs_EDGE); Ex.More(); Ex.Next())
{
Handle(Geom_Surface) sFirst = BRep_Tool::Surface(TopoDS::Face(planeShape));
Standard_Real First=0,Last=180.0;
Handle(Geom_Curve) myCurve = BRep_Tool::Curve(TopoDS::Edge(Ex.Current()),First,Last);

GeomAPI_IntCS Intersector(myCurve, sFirst);
Standard_Integer nb = Intersector.NbPoints();
if(nb>0)
{
gp_Pnt P = Intersector.Point(1);
polygon.Add(P);
}
}
polygon.Close();
TopoDS_Wire wire = polygon.Wire();
TopoDS_Face face = BRepBuilderAPI_MakeFace(wire);
myAISContext->Display(new AIS_Shape(wire), Standard_False);
}

Dmitry Khabi's picture

Don#t you get the Points which not belong to the edges ?

zhangzhigang824's picture

Hi,

I agree with Dmitry.

Handle(Geom_Curve) myCurve = BRep_Tool::Curve(TopoDS::Edge(Ex.Current()),First,Last);
It makes a infinite curve from a Edge, so you can get points which not belong to the edges.
We need make a bounded curve from a edge, but how can I do that?

zhangzhigang824's picture

Hi Dmitry,

How can I make a bounded curve form a TopoDS_Edge and how can I make a bounded furface form a TopoDS_Face?

thanks in advance!

zhangzhigang824's picture

Hi,
With the help of the forum, I find the answer of this problem. For example:

faceShape是一个TopoDS_Face
BRepAdaptor_Surface surface(faceShape);
GeomAdaptor_Surface adaptorSurface = surface.Surface();
Handle(Geom_RectangularTrimmedSurface) trimmedSurface = new Geom_RectangularTrimmedSurface(
adaptorSurface.Surface(),adaptorSurface.FirstUParameter(),adaptorSurface.LastUParameter(),
adaptorSurface.FirstVParameter(),adaptorSurface.LastVParameter());

trimmedSurface is a bounded surface which we need.

thanks!