siyamalan_64721 Tue, 01/27/2009 - 10:30 Forums: Other usage issuesHi! I want to find the intersection between a set of WIREs and a Plane. How can I do that? Thanks in advancs... siyamalan Tue, 01/27/2009 - 13:04 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); } Log in to post comments Dmitry Khabi Wed, 02/18/2009 - 13:08 Don#t you get the Points which not belong to the edges ? Log in to post comments zhangzhigang824 Fri, 05/08/2009 - 06:23 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? Log in to post comments zhangzhigang824 Fri, 05/08/2009 - 06:26 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! Log in to post comments zhangzhigang824 Fri, 05/08/2009 - 07:06 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! Log in to post comments
Tue, 01/27/2009 - 13:04
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);
}
Wed, 02/18/2009 - 13:08
Don#t you get the Points which not belong to the edges ?
Fri, 05/08/2009 - 06:23
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?
Fri, 05/08/2009 - 06:26
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!
Fri, 05/08/2009 - 07:06
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!