AttributeSelectionPtr aSelection = aSelectionList->value(anIndex);
GeomShapePtr aShape = aSelection->value();
if(!aShape.get()) {
+ if (!aSelection->context()) {
+ theError = "Objects are not selected.";
+ return false;
+ }
aShape = aSelection->context()->shape();
}
for(GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
}
if(anEdges.empty()) {
- theError = "Objects not selected.";
+ theError = "Objects are not selected.";
return false;
}
for(int i = 0; i < aCurSelList->size() && aValid; i++) {
std::shared_ptr<ModelAPI_AttributeSelection> aSelAttribute = aCurSelList->value(i);
ResultPtr aResult = aSelAttribute->context();
- if (isPartSetDocument) // PartSet document: Result Part is valid
+ if (!aResult) {
+ theError = "Invalid selection.";
+ return false;
+ } if (isPartSetDocument) // PartSet document: Result Part is valid
aValid = aResult->groupName() == ModelAPI_ResultPart::group();
else { // Part document: Result CompSolid is valid
aValid = aResult->groupName() == ModelAPI_ResultBody::group();
Events_Loop::loop()->send(aFinishMsg);
}
+ // for open of document with primitive box inside (finish transaction in initAttributes)
+ bool aWasActivatedFlushes = aLoop->activateFlushes(true);
while(aLoop->hasGrouppedEvent(kCreatedEvent) || aLoop->hasGrouppedEvent(kUpdatedEvent) ||
aLoop->hasGrouppedEvent(kRedispEvent) || aLoop->hasGrouppedEvent(kDeletedEvent)) {
aLoop->flush(kCreatedEvent);
aLoop->flush(kRedispEvent);
aLoop->flush(kDeletedEvent);
}
+ aLoop->activateFlushes(aWasActivatedFlushes);
// to avoid "updated" message appearance by updater
//aLoop->clear(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
aSession->startOperation();
}
+void updateFeatures()
+{
+ Events_Loop* aLoop = Events_Loop::loop();
+ aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
+ aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
+}
+
//--------------------------------------------------------------------------------------
void undo()
{
MODELHIGHAPI_EXPORT
void apply();
+/** Executes features, created or updated before.
+ *
+ * This method flushes creation and update events in order to make all
+ * features up to date.
+ */
+MODELHIGHAPI_EXPORT
+void updateFeatures();
+
/// Roll-back the data structure to the previous control point.
MODELHIGHAPI_EXPORT
void undo();
from ModelHighAPI import defaultPlane, standardPlane
from ModelHighAPI import begin, end
from ModelHighAPI import apply as do
+from ModelHighAPI import updateFeatures
from ModelHighAPI import undo, redo
from ModelHighAPI import reset
from ModelHighAPI import ModelHighAPI_Selection as selection
self.base.setPerpendicular(line[0], line[3])
# execute sketch
- model.do()
+ mypart.setCurrentFeature(self.base.feature(), False)
+ model.updateFeatures()
# Creating the extrusion (the box) at default size
# A box result