+
+ /// Issue 431: for the current moment create planes only in the module document,
+ /// Later if it is needed we may create special initial planes in Parts (may be different)
+ if (aDoc != ModelAPI_Session::get()->moduleDocument())
+ return;
+
+ std::list<FeaturePtr> aFeatures;
+
+ // the viewer update should be blocked in order to avoid the features blinking before they are
+ // hidden
+ std::shared_ptr<Events_Message> aMsg = std::shared_ptr<Events_Message>(
+ new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)));
+ Events_Loop::loop()->send(aMsg);
+
+ FeaturePtr aOrigin = createPoint(aDoc, "Origin", 0., 0., 0.);
+ aFeatures.push_back(aOrigin);
+ aFeatures.push_back(createAxis(aDoc, aOrigin, 100., 0., 0.));
+ aFeatures.push_back(createAxis(aDoc, aOrigin, 0., 100., 0.));
+ aFeatures.push_back(createAxis(aDoc, aOrigin, 0., 0., 100.));
+ aFeatures.push_back(createPlane(aDoc, 1., 0., 0.));
+ aFeatures.push_back(createPlane(aDoc, 0., -1., 0.));
+ aFeatures.push_back(createPlane(aDoc, 0., 0., 1.));
+ // for PartSet it is done outside of the transaction, so explicitly flush this creation
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
+
+ // hides the created features, the precondition is that the feature's results have been
+ // already built, so the createPlane/Points method calls the execute function for the planes
+ std::list<FeaturePtr >::const_iterator aFIter = aFeatures.begin();
+ for (; aFIter != aFeatures.cend(); aFIter++) {
+ FeaturePtr aPlane = *aFIter;
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aPlane->results();
+ std::list<ResultPtr >::const_iterator aRIter = aResults.begin();
+ for (; aRIter != aResults.cend(); aRIter++) {
+ (*aRIter)->setDisplayed(false);
+ }
+ }
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
+
+ // the viewer update should be unblocked in order to avoid the features blinking before they are
+ // hidden
+ aMsg = std::shared_ptr<Events_Message>(
+ new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED)));
+
+ Events_Loop::loop()->send(aMsg);
+