+ std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(partDoc());
+ if (aDoc.get()) {
+ AttributeSelectionListPtr aSelAttr = aDoc->selectionInPartFeature();
+ AttributeSelectionPtr aThisAttr = aSelAttr->value(theIndex - 1);
+ if (aThisAttr.get()) {
+ aThisAttr->combineGeometrical();
+ if (aThisAttr->value().get()) {
+ int anIndex;
+ theNewName = nameInPart(aThisAttr->value(), anIndex);
+ return true;
+ }
+ }
+ }
+ return false; // something is wrong
+}
+
+std::shared_ptr<GeomAPI_Shape> Model_ResultPart::shapeInPart(
+ const std::wstring& theName, const std::string& theType, int& theIndex)
+{
+ theIndex = 0; // not found yet
+ std::shared_ptr<GeomAPI_Shape> aResult;
+ std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(partDoc());
+ if (!aDoc.get()) // the part document is not presented for the moment
+ return aResult;
+
+ AttributeSelectionListPtr aSelAttr = aDoc->selectionInPartFeature();
+ // check this selection is already there: reuse it
+ int aSize = aSelAttr->size();
+ for(int a = 0; a < aSize; a++) {
+ if (aSelAttr->value(a)->namingName() == theName) {
+ theIndex = a;
+ return aSelAttr->value(a)->value();
+ }
+ }
+
+ aSelAttr->append(theName, theType);
+ theIndex = aSelAttr->size();
+ aResult = aSelAttr->value(theIndex - 1)->value();
+ if (myTrsf.get() && aResult.get() && !aResult->isNull()) {
+ gp_Trsf aSumTrsf = sumTrsf();
+#if OCC_VERSION_LARGE < 0x07070000
+ TopoDS_Shape anOrigMoved = aResult->impl<TopoDS_Shape>().Moved(aSumTrsf);
+#else
+ TopoDS_Shape anOrigMoved = aResult->impl<TopoDS_Shape>().Moved(aSumTrsf, Standard_False);
+#endif
+ aResult->setImpl(new TopoDS_Shape(anOrigMoved));
+ }
+ return aResult;