DiscussionsIssue archiveOther usage issues

Archived discussion

How to transforme a TopoDS_Shape into a TopoDS_Edge

Other usage issuesThu, 03/25/2004 - 11:234 replies

Browse this forum
QuestionAuthor

Hello,

I want to convert a TopoDS_Shape into a TopoDS_Edge. So I use the following instructions :

Handle (TopoDS_TEdge) newEdge= Handle (TopoDS_TEdge) :: DownCast (oldShape);
or
Handle (PTopoDS_TEdge) newEdge= Handle (PTopoDS_TEdge) :: DownCast (oldShape);
or
Handle (PTopoDS_TEdge1) newEdge= Handle (PTopoDS_TEdge1) :: DownCast (oldShape);

And I have include the following librairie :
#include "Handle_TopoDS_TEdge.hxx"
#include "Handle_PTopoDS_TEdge.hxx"
#include "Handle_PTopoDS_TEdge1.hxx"

But none of those commands work.

Do you have an Idea ?
Thanks for your attention

Jean-Sébastien Klein Meyer

Discussion

4 archived replies

Posts are displayed in their archived order.

01Commenter-1

Hi
Try this.
TopoDS_Edge newEdge;
if (oldShape.ShapeType()==TopAbs_EDGE)
newEdge=TopoDS::Edge(oldShape);

Commenter-1

02Author

hey,

thanks for your idea, unfortunately it doesn't work :
if (oldShape.ShapeType()==TopAbs_EDGE))
--> this expression is always "false
Jean-Sébastien Klein Meyer

03Commenter-2

see if this works:

TopoDS_Shape myShape = ...;
.
.
.
for (TopExp_Explorer exp (myShape,TopAbs_Edge);exp.More();exp.Next())
{
TopoDS_Edge aCurrentEdge = TopoDS::Edge(exp.Current());
// do whatever with this edge
}

-vivek

04Commenter-3

Hi, Author! It's been a long time since you post your question.
Have you put the "#include <TopoDS.hxx>" header file at the beginning?
This is my code segment and it works:
TopExp_Explorer edgeExp1(topoNURBSSurface1, TopAbs_EDGE);
TopoDS_Edge surface1_edge1 = TopoDS::Edge(edgeExp1.Current());
Best Regards!