+ theIndex = 0; // not initialized
+
+ if (myTrsf.get()) { // if this is moved copy of part => return the name of original shape
+ ResultPartPtr anOrigResult = baseRef();
+ // searching in the origin the shape equal to the given but with myTrsf
+ TopoDS_Shape aSelection = theShape->impl<TopoDS_Shape>();
+ gp_Trsf aSelTrsf = aSelection.Location().Transformation();
+ TopoDS_Shape anOrigMain = anOrigResult->shape()->impl<TopoDS_Shape>();
+ if (!aSelection.IsNull() && !anOrigMain.IsNull()) {
+ TopExp_Explorer anExp(anOrigMain, aSelection.ShapeType());
+ for(; anExp.More(); anExp.Next()) {
+ if (anExp.Current().IsPartner(aSelection)) {
+ TopoDS_Shape anOrigMoved = anExp.Current().Moved(*(myTrsf.get()));
+ //if (anOrigMoved.IsSame(aSelection)) {
+ if (IsEqualTrsf(aSelTrsf, anOrigMoved.Location().Transformation())) {
+ std::shared_ptr<GeomAPI_Shape> anOrigSel(new GeomAPI_Shape);
+ anOrigSel->setImpl(new TopoDS_Shape(anExp.Current()));
+ return anOrigResult->nameInPart(anOrigSel, theIndex);
+ }
+ }
+ }
+ }
+ // something is not right
+ return "";
+ }
+