+
+void PartSet_ResultSketchPrs::fillShapes(TopoDS_Shape& theResultShape,
+ TopoDS_Compound& theAuxiliaryCompound,
+ NCollection_List<TopoDS_Shape>& theFaceList)
+{
+ //if (!aResultShape.IsNull() || !anAuxiliaryCompound.IsNull())
+ std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(myResult);
+ if (!aShapePtr)
+ return;
+
+ theFaceList.Clear();
+ ResultConstructionPtr aConstruction =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(myResult);
+ if (aConstruction.get()) {
+ int aFacesNum = aConstruction->facesNum();
+ for(int aFaceIndex = 0; aFaceIndex < aFacesNum; aFaceIndex++) {
+ std::shared_ptr<GeomAPI_Face> aFaceShape = aConstruction->face(aFaceIndex);
+ if (aFaceShape.get()) {
+ TopoDS_Shape aFace = (aFaceShape)->impl<TopoDS_Shape>();
+ theFaceList.Append(aFace);
+ }
+ }
+ }
+ theResultShape = aShapePtr->impl<TopoDS_Shape>();
+
+ /// find auxiliary shapes
+ FeaturePtr aResultFeature = ModelAPI_Feature::feature(myResult);
+ CompositeFeaturePtr aSketchFeature = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>
+ (aResultFeature);
+ std::list<ResultPtr> anAuxiliaryResults;
+ for (int i = 0; i < aSketchFeature->numberOfSubs(); i++) {
+ FeaturePtr aFeature = aSketchFeature->subFeature(i);
+ if (PartSet_Tools::isAuxiliarySketchEntity(aFeature)) {
+ std::list<ResultPtr> aResults = aFeature->results();
+ std::list<ResultPtr>::const_iterator aIt;
+ for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) {
+ ResultPtr aResult = *aIt;
+ if (aResult.get() && aResult->shape().get())
+ anAuxiliaryResults.push_back(aResult);
+ }
+ }
+ else {
+ /// append not-edges shapes, e.g. center of a circle, an arc, a point feature
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aRes = aFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter = aRes.cbegin();
+ for (; aResIter != aRes.cend(); aResIter++) {
+ std::shared_ptr<ModelAPI_ResultConstruction> aConstr = std::dynamic_pointer_cast<
+ ModelAPI_ResultConstruction>(*aResIter);
+ if (aConstr) {
+ std::shared_ptr<GeomAPI_Shape> aGeomShape = aConstr->shape();
+ if (aGeomShape.get()) {
+ const TopoDS_Shape& aShape = aGeomShape->impl<TopoDS_Shape>();
+ if (aShape.ShapeType() != TopAbs_EDGE)
+ anAuxiliaryResults.push_back(aConstr);
+ }
+ }
+ }
+ }
+ }
+
+ if (anAuxiliaryResults.size() > 0) {
+ BRep_Builder aBuilder;
+ //TopoDS_Compound aComp;
+ aBuilder.MakeCompound(theAuxiliaryCompound);
+ std::list<ResultPtr>::const_iterator anIt = anAuxiliaryResults.begin(),
+ aLast = anAuxiliaryResults.end();
+ for (; anIt != aLast; anIt++) {
+ ResultPtr aResult = *anIt;
+ if (aResult.get()) {
+ GeomShapePtr aGeomShape = aResult->shape();
+ if (aGeomShape.get()) {
+ const TopoDS_Shape& aShape = aGeomShape->impl<TopoDS_Shape>();
+ if (!aShape.IsNull())
+ aBuilder.Add(theAuxiliaryCompound, aShape);
+ }
+ }
+ }
+ }
+}