shape handles when using explorer

this is probably a dumb question but here goes:

Look at this ...

TopExp_Explorer Ex;
for ( Ex.Init(aSolid,TopAbs_FACE) ; Ex.More() ; Ex.Next ) {
How do I get a handle to the Ex.Current() shape so that I can have a pointer to the face shape for later immediate access [i really don't want to go through the aSolid and a possible index to get to the shape if i have an handle that gives me immediate access]
}

To me, this is a huge issue because I may want to call a routine to project a point on a face shape and that routine could be called a lot from outside occ. But without a handle to the face shape, i pretty much have to rely on occ to give me the shape given the aSolid and an index using a map (not efficient at all).

Ugo Capeto's picture

Do I need to do a:
new TopoDS_Shape(Ex.Current()) to get an handle to the face?
or
new TopoDS_HShape(Ex.Current())

confused.

Evgeny Lodyzhehsky's picture

Dear Ugo Capeto.

To get a handle:
...
for ( Ex.Init(aSolid,TopAbs_FACE) ; Ex.More() ; Ex.Next ) {
const TopoDS_Shape&aS=Ex.Current();
const Handle(TopoDS_TShape)&aTS=aS.TShape();
...
}
...

aTS here is just the handle.
But have in mind that a shape aS also has its own location and orientation. These attributes are not shared between shapes having equal handles.