Add attribute "number of copies" for creating plane by rotating and by distance from other plane.
Added a corresponding field in the creation window.
Change documentation to reference about copies when creating a planes.
Change "dump to script" to set number of copies(or without it).
Add Python test.
Add translate to French.
ConstructionAPI_Plane::ConstructionAPI_Plane(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const ModelHighAPI_Selection& theFace,
const ModelHighAPI_Double& theDistance,
- const bool theIsReverse)
+ const bool theIsReverse,
+ const ModelHighAPI_Integer& theNbCopy)
: ModelHighAPI_Interface(theFeature)
{
if(initialize()) {
- setByFaceAndDistance(theFace, theDistance, theIsReverse);
+ setByFaceAndDistance(theFace, theDistance, theIsReverse, theNbCopy);
}
}
ConstructionAPI_Plane::ConstructionAPI_Plane(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const ModelHighAPI_Selection& thePlane,
const ModelHighAPI_Selection& theAxis,
- const ModelHighAPI_Double& theAngle)
+ const ModelHighAPI_Double& theAngle,
+ const ModelHighAPI_Integer& theNbCopy)
: ModelHighAPI_Interface(theFeature)
{
if(initialize()) {
- setByRotation(thePlane, theAxis, theAngle);
+ setByRotation(thePlane, theAxis, theAngle, theNbCopy);
}
}
//==================================================================================================
void ConstructionAPI_Plane::setByFaceAndDistance(const ModelHighAPI_Selection& theFace,
const ModelHighAPI_Double& theDistance,
- const bool theIsReverse)
+ const bool theIsReverse,
+ const ModelHighAPI_Integer& theNbCopy)
{
fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE(), mycreationMethod);
fillAttribute(theFace, myplane);
mycreationMethodByOtherPlane);
fillAttribute(theDistance, mydistance);
fillAttribute(theIsReverse, myreverse);
+ fillAttribute(theNbCopy, mynbcopy);
execute();
}
//==================================================================================================
void ConstructionAPI_Plane::setByRotation(const ModelHighAPI_Selection& thePlane,
const ModelHighAPI_Selection& theAxis,
- const ModelHighAPI_Double& theAngle)
+ const ModelHighAPI_Double& theAngle,
+ const ModelHighAPI_Integer& theNbCopy)
{
fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE(), mycreationMethod);
fillAttribute(thePlane, myplane);
mycreationMethodByOtherPlane);
fillAttribute(theAxis, myaxis);
fillAttribute(theAngle, myangle);
+ fillAttribute(theNbCopy, mynbcopy);
execute();
}
ConstructionPlugin_Plane::CREATION_METHOD_BY_DISTANCE_FROM_OTHER()) {
AttributeDoublePtr anAttrDistance = aBase->real(ConstructionPlugin_Plane::DISTANCE());
AttributeBooleanPtr anAttrReverse = aBase->boolean(ConstructionPlugin_Plane::REVERSE());
+ AttributeIntegerPtr anAttrNbCopy = aBase->integer(ConstructionPlugin_Plane::NB_COPIES());
theDumper << ", " << anAttrPlane << ", " << anAttrDistance << ", " << anAttrReverse;
+ if(anAttrNbCopy.get() && anAttrNbCopy->value() > 1)
+ theDumper << ", " << anAttrNbCopy;
} else if(aCreationMethodOption ==
ConstructionPlugin_Plane::CREATION_METHOD_BY_COINCIDENT_TO_POINT()) {
AttributeSelectionPtr anAttrPoint =
} else if(aCreationMethodOption == ConstructionPlugin_Plane::CREATION_METHOD_BY_ROTATION()) {
AttributeSelectionPtr anAttrAxis = aBase->selection(ConstructionPlugin_Plane::AXIS());
AttributeDoublePtr anAttrAngle = aBase->real(ConstructionPlugin_Plane::ANGLE());
+ AttributeIntegerPtr anAttrNbCopy = aBase->integer(ConstructionPlugin_Plane::NB_COPIES());
theDumper << ", " << anAttrPlane << ", " << anAttrAxis << ", " << anAttrAngle;
+ if (anAttrNbCopy.get() && anAttrNbCopy->value() > 1)
+ theDumper << ", " << anAttrNbCopy;
}
} else if(aCreationMethod ==
ConstructionPlugin_Plane::CREATION_METHOD_BY_TWO_PARALLEL_PLANES()) {
PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document>& thePart,
const ModelHighAPI_Selection& theFace,
const ModelHighAPI_Double& theDistance,
- const bool theIsReverse)
+ const bool theIsReverse,
+ const ModelHighAPI_Integer& theNbCopies)
{
// TODO(spo): check that thePart is not empty
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Plane::ID());
- return PlanePtr(new ConstructionAPI_Plane(aFeature, theFace, theDistance, theIsReverse));
+ return PlanePtr(new ConstructionAPI_Plane(aFeature, theFace, theDistance, theIsReverse, theNbCopies));
}
//==================================================================================================
PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document>& thePart,
const ModelHighAPI_Selection& thePlane,
const ModelHighAPI_Selection& theAxis,
- const ModelHighAPI_Double& theAngle)
+ const ModelHighAPI_Double& theAngle,
+ const ModelHighAPI_Integer& theNbCopies)
{
// TODO(spo): check that thePart is not empty
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Plane::ID());
- return PlanePtr(new ConstructionAPI_Plane(aFeature, thePlane, theAxis, theAngle));
+ return PlanePtr(new ConstructionAPI_Plane(aFeature, thePlane, theAxis, theAngle, theNbCopies));
}
#include <ModelHighAPI_Interface.h>
#include <ModelHighAPI_Macro.h>
+#include <ModelHighAPI_Integer.h>
class ModelHighAPI_Double;
class ModelHighAPI_Selection;
ConstructionAPI_Plane(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const ModelHighAPI_Selection& theFace,
const ModelHighAPI_Double& theDistance,
- const bool theIsReverse);
+ const bool theIsReverse,
+ const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1));
/// Constructor with values
CONSTRUCTIONAPI_EXPORT
ConstructionAPI_Plane(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const ModelHighAPI_Selection& thePlane,
const ModelHighAPI_Selection& theAxis,
- const ModelHighAPI_Double& theAngle);
+ const ModelHighAPI_Double& theAngle,
+ const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1));
/// Destructor
CONSTRUCTIONAPI_EXPORT
virtual ~ConstructionAPI_Plane();
- INTERFACE_20(ConstructionPlugin_Plane::ID(),
+ INTERFACE_21(ConstructionPlugin_Plane::ID(),
creationMethod, ConstructionPlugin_Plane::CREATION_METHOD(),
ModelAPI_AttributeString, /** Creation method */,
A, ConstructionPlugin_Plane::A(),
plane1, ConstructionPlugin_Plane::PLANE1(),
ModelAPI_AttributeSelection, /** Plane 1 */,
plane2, ConstructionPlugin_Plane::PLANE2(),
- ModelAPI_AttributeSelection, /** Plane 2 */)
+ ModelAPI_AttributeSelection, /** Plane 2 */,
+ nbcopy, ConstructionPlugin_Plane::NB_COPIES(),
+ ModelAPI_AttributeInteger, /** Number of copies */)
/// Set face and distance
CONSTRUCTIONAPI_EXPORT
void setByFaceAndDistance(const ModelHighAPI_Selection& theFace,
const ModelHighAPI_Double& theDistance,
- const bool theIsReverse);
+ const bool theIsReverse,
+ const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1));
/// Set GeneralEquation parameters of the feature
CONSTRUCTIONAPI_EXPORT
CONSTRUCTIONAPI_EXPORT
void setByRotation(const ModelHighAPI_Selection& thePlane,
const ModelHighAPI_Selection& theAxis,
- const ModelHighAPI_Double& theAngle);
+ const ModelHighAPI_Double& theAngle,
+ const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1));
/// Dump wrapped feature
CONSTRUCTIONAPI_EXPORT
PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document>& thePart,
const ModelHighAPI_Selection& theFace,
const ModelHighAPI_Double& theDistance,
- const bool theIsReverse);
+ const bool theIsReverse,
+ const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1));
/// \ingroup CPPHighAPI
/// \brief Create Plane feature
PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document>& thePart,
const ModelHighAPI_Selection& thePlane,
const ModelHighAPI_Selection& theAxis,
- const ModelHighAPI_Double& theAngle);
+ const ModelHighAPI_Double& theAngle,
+ const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1));
#endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_PLANE_H_ */
#include <ModelAPI_AttributeSelection.h>
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeInteger.h>
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
// By two parallel planes.
data()->addAttribute(PLANE1(), ModelAPI_AttributeSelection::typeId());
data()->addAttribute(PLANE2(), ModelAPI_AttributeSelection::typeId());
+
+ // By other plane.
+ AttributeIntegerPtr aNbCopies = std::dynamic_pointer_cast<ModelAPI_AttributeInteger>(
+ data()->addAttribute(NB_COPIES(), ModelAPI_AttributeInteger::typeId()));
+
+ if (!aNbCopies->isInitialized())
+ aNbCopies->setValue(1);
}
//==================================================================================================
void ConstructionPlugin_Plane::execute()
{
- GeomShapePtr aShape;
+ ListOfShape aShapes;
std::string aCreationMethod = string(CREATION_METHOD())->value();
if(aCreationMethod == CREATION_METHOD_BY_GENERAL_EQUATION() ||
aCreationMethod == "PlaneByGeneralEquation") {
- aShape = createByGeneralEquation();
+ aShapes.push_back(createByGeneralEquation());
} else if(aCreationMethod == CREATION_METHOD_BY_THREE_POINTS()) {
- aShape = createByThreePoints();
+ aShapes.push_back(createByThreePoints());
} else if(aCreationMethod == CREATION_METHOD_BY_LINE_AND_POINT()) {
- aShape = createByLineAndPoint();
+ aShapes.push_back(createByLineAndPoint());
} else if(aCreationMethod == CREATION_METHOD_BY_OTHER_PLANE()) {
std::string aCreationMethodOption = string(CREATION_METHOD_BY_OTHER_PLANE_OPTION())->value();
if(aCreationMethodOption == CREATION_METHOD_BY_DISTANCE_FROM_OTHER()) {
- aShape = createByDistanceFromOther();
+ createByDistanceFromOther(aShapes);
} else if(aCreationMethodOption == CREATION_METHOD_BY_COINCIDENT_TO_POINT()) {
- aShape = createByCoincidentPoint();
+ aShapes.push_back(createByCoincidentPoint());
} else if(aCreationMethodOption == CREATION_METHOD_BY_ROTATION()) {
- aShape = createByRotation();
+ createByRotation(aShapes);
}
} else if(aCreationMethod == CREATION_METHOD_BY_TWO_PARALLEL_PLANES()) {
- aShape = createByTwoParallelPlanes();
+ aShapes.push_back(createByTwoParallelPlanes());
} else {
setError("Error: Plane creation method \"" + aCreationMethod + "\" not supported.");
return;
}
- if(!aShape.get()) {
+ if(aShapes.size() == 0) {
setError("Error: Could not create a plane.");
return;
}
- ResultConstructionPtr aConstr = document()->createConstruction(data());
- aConstr->setInfinite(true);
- aConstr->setShape(aShape);
- setResult(aConstr);
+ int anIndex = 0;
+ for (auto aShapeIter = aShapes.begin(); aShapeIter != aShapes.end(); ++aShapeIter, ++anIndex)
+ {
+ if (!aShapeIter->get())
+ {
+ setError("Error: Could not create a plane.");
+ continue;
+ }
+ ResultConstructionPtr aConstr = document()->createConstruction(data(), anIndex);
+ aConstr->setInfinite(true);
+ aConstr->setShape(*aShapeIter);
+ setResult(aConstr, anIndex);
+ }
+ removeResults(anIndex);
}
//==================================================================================================
}
return aPlaneFace;
}
-
//==================================================================================================
std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByThreePoints()
{
}
//==================================================================================================
-std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByDistanceFromOther()
+void ConstructionPlugin_Plane::createByDistanceFromOther(ListOfShape& theShapes)
{
AttributeSelectionPtr aFaceAttr = data()->selection(ConstructionPlugin_Plane::PLANE());
AttributeDoublePtr aDistAttr = data()->real(ConstructionPlugin_Plane::DISTANCE());
- std::shared_ptr<GeomAPI_Shape> aPlane;
+ AttributeIntegerPtr aNbCopyAttr = data()->integer(ConstructionPlugin_Plane::NB_COPIES());
if ((aFaceAttr.get() != NULL) &&
- (aDistAttr.get() != NULL) &&
+ (aDistAttr.get() != NULL) && (aNbCopyAttr.get() != NULL) &&
aFaceAttr->isInitialized() && aDistAttr->isInitialized()) {
double aDist = aDistAttr->value();
bool anIsReverse = boolean(REVERSE())->value();
+ int aNumOfCopies = aNbCopyAttr->value();
if(anIsReverse) aDist = -aDist;
GeomShapePtr aShape = aFaceAttr->value();
if (!aShape.get() && aFaceAttr->context()) {
}
if(!aShape.get()) {
- return aPlane;
+ return;
}
std::shared_ptr<GeomAPI_Face> aFace;
aFace = anIt.current()->face();
}
if (!aFace)
- return GeomShapePtr();
+ return;
std::shared_ptr<GeomAPI_Pln> aPln = aFace->getPlane();
std::shared_ptr<GeomAPI_Pnt> aOrig = aPln->location();
std::shared_ptr<GeomAPI_Dir> aDir = aPln->direction();
- aOrig->translate(aDir, aDist);
- std::shared_ptr<GeomAPI_Pln> aNewPln(new GeomAPI_Pln(aOrig, aDir));
+ for (int aNbCopy = 0; aNbCopy < aNumOfCopies; ++aNbCopy)
+ {
+ std::shared_ptr<GeomAPI_Shape> aPlane;
+ aOrig->translate(aDir, aDist);
+ std::shared_ptr<GeomAPI_Pln> aNewPln(new GeomAPI_Pln(aOrig, aDir));
- aPlane = makeRectangularFace(aFace, aNewPln);
+ aPlane = makeRectangularFace(aFace, aNewPln);
+ theShapes.push_back(aPlane);
+ }
}
- return aPlane;
}
//==================================================================================================
}
//==================================================================================================
-std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByRotation()
+void ConstructionPlugin_Plane::createByRotation(ListOfShape& theShapes)
{
// Get face.
AttributeSelectionPtr aFaceSelection = selection(PLANE());
aFace = anIt.current()->face();
}
if (!aFace)
- return GeomShapePtr();
+ return;
aFace = makeRectangularFace(aFace, aFace->getPlane());
// Get axis.
anEdge = anIt.current()->edge();
}
if (!anEdge)
- return GeomShapePtr();
+ return;
+
+ AttributeIntegerPtr aNbCopyAttr = data()->integer(ConstructionPlugin_Plane::NB_COPIES());
+ int aNBCopy;
+ if (!aNbCopyAttr.get())
+ return;
+
+ aNBCopy = aNbCopyAttr->value();
std::shared_ptr<GeomAPI_Ax1> anAxis =
std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
// Getting angle.
double anAngle = real(ANGLE())->value();
- std::shared_ptr<GeomAlgoAPI_Rotation> aRotationAlgo(
- new GeomAlgoAPI_Rotation(aFace, anAxis, anAngle));
- // Checking that the algorithm worked properly.
- std::string anError;
- if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationAlgo, getKind(), anError)) {
- setError("Error: Failed to rotate plane");
- return GeomShapePtr();
- }
+ for (int anIndex = 1; anIndex <= aNBCopy; ++anIndex)
+ {
+ std::shared_ptr<GeomAlgoAPI_Rotation> aRotationAlgo(
+ new GeomAlgoAPI_Rotation(aFace, anAxis, anAngle * anIndex));
+ // Checking that the algorithm worked properly.
+ std::string anError;
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationAlgo, getKind(), anError)) {
+ setError("Error: Failed to rotate plane");
+ return;
+ }
- std::shared_ptr<GeomAPI_Face> aRes(new GeomAPI_Face(aRotationAlgo->shape()));
- return aRes;
+ std::shared_ptr<GeomAPI_Face> aRes(new GeomAPI_Face(aRotationAlgo->shape()));
+ theShapes.push_back(aRes);
+ }
}
//==================================================================================================
#include <ModelAPI_Feature.h>
#include <ModelAPI_Result.h>
#include <GeomAPI_ICustomPrs.h>
+#include <GeomAPI_Shape.h>
/// \class ConstructionPlugin_Plane
/// \ingroup Plugins
return ATTR_ID;
}
+ inline static const std::string& NB_COPIES()
+ {
+ static const std::string ATTR_ID("nb_copies");
+ return ATTR_ID;
+ }
/// Attribute name for a parameter for the general equation of a plane (ax+by+cz+d=0)
inline static const std::string& A()
std::shared_ptr<GeomAPI_Shape> createByThreePoints();
std::shared_ptr<GeomAPI_Shape> createByLineAndPoint();
std::shared_ptr<GeomAPI_Shape> createByCoincidentPoint();
- std::shared_ptr<GeomAPI_Shape> createByRotation();
+ void createByRotation(ListOfShape& theShapes);
std::shared_ptr<GeomAPI_Shape> createByTwoParallelPlanes();
/// Creates a new plane by copy of face plane with translation along the normal
/// to the specified distance.
- std::shared_ptr<GeomAPI_Shape> createByDistanceFromOther();
+ void createByDistanceFromOther(ListOfShape& theShapes);
};
#endif
<translation>Select the third point.</translation>
</message>
</context>
+ <context>
+ <name>Plane:nb_copies</name>
+ <message>
+ <source>Attribute "%1" is not initialized.</source>
+ <translation>Select the number of copies.</translation>
+ </message>
+ </context>
<context>
<name>Point:edge</name>
<translation>Sens inverse</translation>
</message>
</context>
-
+ <context>
+ <name>Plane:nb_copies</name>
+ <message>
+ <source>Nb copies</source>
+ <translation>Nb d'exemplaires</translation>
+ </message>
+ <message>
+ <source>Number of copies of the plane</source>
+ <translation>Nombre de plans</translation>
+ </message>
+ <message>
+ <source>Attribute "%1" is not initialized.</source>
+ <translation>Sélectionnez le nombre d'exemplaires.</translation>
+ </message>
+ </context>
<context>
<name>Point</name>
<message>
--- /dev/null
+# Copyright (C) 2014-2021 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+"""
+Test case for Construction Plane feature. Written on High API.
+"""
+from ModelAPI import *
+from GeomAPI import *
+
+from salome.shaper import model
+
+# Get session
+aSession = ModelAPI_Session.get()
+
+# Create a part
+aDocument = aSession.activeDocument()
+aSession.startOperation()
+model.addPart(aDocument)
+aDocument = aSession.activeDocument()
+aSession.finishOperation()
+
+# Test a plane by general equation
+aSession.startOperation()
+aPlane = model.addPlane(aDocument, 1, 1, 1, 0)
+aSession.finishOperation()
+assert (len(aPlane.results()) > 0)
+
+# Create an axis
+aSession.startOperation()
+anAxis = model.addAxis(aDocument, 100, 0, 0)
+aSession.finishOperation()
+
+# Test a plane by rotation
+aSession.startOperation()
+aRotatedPlane = model.addPlane(aDocument, aPlane.result(), anAxis.result(), 45)
+aRotatedPlanes = model.addPlane(aDocument, aPlane.result(), anAxis.result(), 45, 5)
+aSession.finishOperation()
+assert (len(aRotatedPlane.results()) > 0)
+assert (len(aRotatedPlanes.results()) == 5)
+
+# Test a plane by distance from other
+aSession.startOperation()
+anOnlyPlane = model.addPlane(aDocument, aPlane.result(), 50, False)
+assert (len(anOnlyPlane.results()) > 0)
+aPlane = model.addPlane(aDocument, aPlane.result(), 50, False, 10)
+aSession.finishOperation()
+assert (len(aPlane.results()) == 10)
+
+assert(model.checkPythonDump())
:align: left
:height: 24px
-**By other plane** creates a plane parallel to another plane.
+**By other plane** creates a plane or planes(if the number of copies is more than one) parallel to another plane.
.. figure:: images/plane_by_two_parallel_planes_32x32.png
:align: left
**TUI Commands**:
-.. py:function:: model.addPlane(Part_doc, model.selection("FACE", "Box_1_1/Front"), 10, False)
+.. py:function:: model.addPlane(Part_doc, model.selection("FACE", "Box_1_1/Front"), 10, False, 1)
:param part: The current part object.
:param object: A plane.
:param real: An offset.
:param boolean: Is reverse.
+ :param integer: Number of copies
:return: Result object.
Result
""""""
-The Result of the operation will be a plane parallel to already existing one:
+The Result of the operation will be a plane (or planes at equal distance from each other, if the number of copies is more than one) parallel to already existing one:
.. figure:: images/CreatedPlane3.png
:align: center
min="0"
default="10">
</doublevalue>
+ <integervalue id="nb_copies"
+ label="Nb copies"
+ tooltip="Number of copies of the plane"
+ min="1"
+ default="1">
+ </integervalue>
<boolvalue id="reverse"
label="Reverse"
tooltip="Checked means on the other side of the selected plane."
default="45">
<validator id="GeomValidators_Positive"/>
</doublevalue>
+ <integervalue id="nb_copies"
+ label="Nb copies"
+ tooltip="Number of copies of the plane "
+ min="1"
+ default="1">
+ </integervalue>
</box>
</toolbox>
</box>
TestPlane.py
TestPlane_ErrorMsg.py
TestPlane_FaceValidator.py
+ TestPlane_Copies.py
Test19207.py
Test19471.py
)
}
} else if (aGroup->Get() == ModelAPI_ResultConstruction::group().c_str()) {
ResultConstructionPtr aConstr = createConstruction(theFeature->data(), aResIndex);
- if (!aConstr->updateShape())
- theFeature->execute(); // not stored shape in the data structure, execute to have it
- else
- theFeature->setResult(aConstr, aResIndex); // result is ready without execution
+ if (!aConstr->data()->isDeleted()) {
+ if (!aConstr->updateShape())
+ theFeature->execute(); // not stored shape in the data structure, execute to have it
+ else
+ theFeature->setResult(aConstr, aResIndex); // result is ready without execution
+ }
} else if (aGroup->Get() == ModelAPI_ResultGroup::group().c_str()) {
aNewBody = createGroup(theFeature->data(), aResIndex);
} else if (aGroup->Get() == ModelAPI_ResultField::group().c_str()) {
bool isObligatory = aFactory->isCase(theFeature, theFeature->data()->id(aSel));
if (isObligatory)
aState = ModelAPI_StateInvalidArgument;
- } else if (theFeature->getKind() == "Sketch" && aSel->id() == "External" &&
- aSel->isInitialized()) {
+ } else if (aSel->isInitialized()) {
// #19703 : if sketch plane was selected, but after context disappears, it must become invalid
aSel->update();
if (aSel->isInvalid()) {