std::shared_ptr<GeomAPI_Shape> Model_AttributeSelection::value()
{
+ GeomShapePtr aResult;
if (myTmpContext.get() || myTmpSubShape.get()) {
- return myTmpSubShape;
+ ResultConstructionPtr aResulConstruction = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(myTmpContext);
+ if(aResulConstruction.get()) {
+ // it is just reference to construction.
+ return myTmpSubShape;
+ }
+ return myTmpSubShape.get() ? myTmpSubShape : myTmpContext->shape();
}
- std::shared_ptr<GeomAPI_Shape> aResult;
TDF_Label aSelLab = selectionLabel();
if (aSelLab.IsAttribute(kINVALID_SELECTION))
return aResult;
if (aSelLab.IsAttribute(kPART_REF_ID)) { // it is reference to the part object
std::shared_ptr<GeomAPI_Shape> aNoSelection;
- return setInvalidIfFalse(aSelLab, selectPart(aContext, aNoSelection, true));
+ bool aResult = selectPart(aContext, aNoSelection, true);
+ if (aResult) {
+ owner()->data()->sendAttributeUpdated(this);
+ }
+ return setInvalidIfFalse(aSelLab, aResult);
}
if (aContext->groupName() == ModelAPI_ResultBody::group()) {
return setInvalidIfFalse(aSelLab, false);
}
- if (aShapeType == TopAbs_FACE) { // compound is for the whole sketch selection
- // If this is a wire with plane defined thin it is a sketch-like object
+ if (aShapeType == TopAbs_FACE || aShapeType == TopAbs_WIRE) { // compound is for the whole sketch selection
+ // If this is a wire with plane defined then it is a sketch-like object
if (!aConstructionContext->facesNum()) // no faces, update can not work correctly
return setInvalidIfFalse(aSelLab, false);
// if there is no edges indexes, any face can be used: take the first
}
}
if (aNewSelected) { // store this new selection
+ if (aShapeType == TopAbs_WIRE) { // just get a wire from face to have wire
+ TopExp_Explorer aWireExp(aNewSelected->impl<TopoDS_Shape>(), TopAbs_WIRE);
+ if (aWireExp.More()) {
+ aNewSelected.reset(new GeomAPI_Shape);
+ aNewSelected->setImpl<TopoDS_Shape>(new TopoDS_Shape(aWireExp.Current()));
+ }
+ }
selectConstruction(aContext, aNewSelected);
owner()->data()->sendAttributeUpdated(this);
return setInvalidIfFalse(aSelLab, true);
if (!theAdditionalName.empty())
aName<<theAdditionalName<<"/";
if (theShape.ShapeType() == TopAbs_FACE) aName<<"Face";
+ else if (theShape.ShapeType() == TopAbs_WIRE) aName<<"Wire";
else if (theShape.ShapeType() == TopAbs_EDGE) aName<<"Edge";
else if (theShape.ShapeType() == TopAbs_VERTEX) aName<<"Vertex";