TopExp_Explorer problem

Hi!!.

Todays, I check the object count and type to make a vector because of normal to edge segment. so i use the TopoExp_Explorer.

TopoExp_Explorer ex;

for(ex.Init(selectedshape,TopAbs_VERTEX) ; ex.More(); ex.Next())
{
/// to my job
}

But It's problem that VERTEX counts are not equal to input data. input data have a number of 180 point(x-y plane), but In my procedure, perfectly check 2 times numbers(360).

SelectedShape is face type object. i make a face object as below.

void GeomSources::OnShapeFill(CmyobjectDoc* aDoc)
{

// For saving the shape, make a list data structure object
TopTools_ListOfShape ListOfShape;

// Find the selected object from initiating selected object
// to last selected object Step by Step.
for(aDoc->myAISContext->InitSelected();
aDoc->myAISContext->MoreSelected();
aDoc->myAISContext->NextSelected())
{

// If selected shape is Edge, excute this line
if(aDoc->myAISContext->SelectedShape().ShapeType() == TopAbs_EDGE)
{

// Append the shape at List data structure
ListOfShape.Append(aDoc->myAISContext->SelectedShape());

// Erase the selected object which type is AIS_InteractiveObject
// If you don't excute this line, you don't get the face object in monitor
// because two object is overlapped
aDoc->myAISContext->Erase(aDoc->myAISContext->SelectedInteractive());

}
}

// Initiate the selected object
aDoc->myAISContext->InitSelected();

if(aDoc->myAISContext->SelectedShape().ShapeType() == TopAbs_EDGE)
{

BRepBuilderAPI_MakeWire BRepMakeWire;
BRepMakeWire.Add(ListOfShape);
TopoDS_Face TopoDSFace = BRepBuilderAPI_MakeFace(BRepMakeWire.Wire());
Handle(AIS_Shape) AISCurrentShape = new AIS_Shape(TopoDSFace);

aDoc->myAISContext->SetCurrentObject(AISCurrentShape);
}
else if(aDoc->myAISContext->SelectedShape().ShapeType() == TopAbs_WIRE)
{

aDoc->myAISContext->Erase(aDoc->myAISContext->SelectedInteractive());
TopoDS_Shape SelectedShape = aDoc->myAISContext->SelectedShape();
TopoDS_Wire SelectedWire = TopoDS::Wire(SelectedShape);
TopoDS_Face TopoDSFace = BRepBuilderAPI_MakeFace(SelectedWire);

Handle(AIS_Shape) AISCurrentShape = new AIS_Shape(TopoDSFace);
aDoc->myAISContext->SetCurrentObject(AISCurrentShape);
}
}

What's wrong my code? do you help me??

eXav's picture

Hello!
I have the same problem.
If I map the vertices of face "Face" to IndexedMapOfShape, I have size of map 4.
Bur TopExp_Explorer ( Face, TopAbs_FACE ) give me 8 vertices.
Have you solved your problem?
Or anybody meet with this hack?

mything's picture

Mr Kang.

Read Moeling Data menual.
Then You can understand way it have 2 time more.
you shoud check figure 10 in this menual.

and to solve the problem (it's not any bug!!)
You may use TopTools_Map.

Regards

Mything