Fri, 08/26/2016 - 04:08
Hello,
I'm very new to OCC,
I want to store pointers to every element of a cube (a topods_shape called aShape) in a vector of pointers so after that I can call them to apply an operation (fillet for example).
So I use this code:
std::vector<TopoDS_Shape*> shapesVector;
TopoDS_Iterator anIterator;
anIterator.Initialize(aShape);
while (anIterator.More())
{
TopoDS_Shape *shp = anIterator.Value();
edgeVector.push_back(shp);
anIterator.Next();
}
the problem is that the iterator method value() does not returns the "real" topods_shape, but a temporary "copy" wich I can't point to.
I've also tried with top_explorer, and the current() also has this problem.
Is there a way to achieve this? or do you have a better way?
regards.
Fri, 08/26/2016 - 08:58
Hi Amine,
You should use vector of TopoDS_Shape, not pointers thereto.
std::vector<TopoDS_Shape> shapesVector;
for (TopoDS_Iterator anIterator (aShape); anIterator.More(); anIterator.next()) {
shapesVector.push_back (anIterator.Value());
}
You should store TopoDS_Shape's in container whenever possible. These are not deep copies, the real sharing takes place via sharing TShape and location fields.
Best regards,
Roman