space curve display

Hello everybody, I'd like to display part of the set of edges (or edges or faces) of TopoDS_Shape. The following code works well for vertices cases and faces case.

TopoDS_Compound aCompound;//common faces
BRep_Builder aBuilder;

for(int i=1;i {
if(m_FaceLabel[i]==k1||m_FaceLabel[i]==k2)
{
TopoDS_Face F=TopoDS::Face(m_FaceMap(i));
aBuilder.Add(aCompound,F);
}
}
m_AISFacesPart=new AIS_Shape(aCompound);

for(int i=1;im_VertexMap.Extent();i++)
{
TopoDS_Shape S=m_VertexMap(m_CPMap[k]->m_VertexMap(i));
TopoDS_Vertex V=TopoDS::Vertex(S);
aBuilder.Add(aCompound,V);
}
m_AISVertexPart=new AIS_Shape(aCompound);

But for edges cases, nothing is displayed when using the following code:

for(int i=1;im_EdgeMap.Extent();i++)
{
TopoDS_Shape S=m_EdgeMap(m_CPMap[k]->m_EdgeMap(i));
TopoDS_Edge E=TopoDS::Edge(S);
aBuilder.Add(aCompound,E);
}
m_AISVertexPart=new AIS_Shape(aCompound);

Why? Would someboby give me some suggestions?
btw. If I have a Handle(Geom_Curve), how to convert it into a Handle(AIS_Shape) to display it?

Many thanks!

Ming_39674's picture

Sorry, I found the edge case also work well. Would somebody help me to solve the second problem?

If I have a Handle(Geom_Curve), how to convert it into a Handle(AIS_Shape) to display it?

Thanks!

Hugues's picture

You can build a TopoDS_Edge object from a Geom_Curve one thanks to procedure BRep_Builder::MakeEdge.
Then construct an AIS_Shape object with the built topological edge.

That's not the best solution, because it need to create an intermediate object, but it should work.

If you want a better solution you could create a class like AIS_Curve that directly accepts geometric curves. For that purpose, i think you can rely on the implementation of classes AIS_Line and AIS_Circle.

Ming_39674's picture

Hugues,
Thank you for your suggestions.
I tried the first method and it works well. But, just as you said, it doesn't seem to be a very solution.