TestGroupMove23.py
TestGroupMove24.py
TestGroupMove25.py
+ TestGroupMove26.py
TestGroupShareTopology.py
TestGroupAddition.py
TestGroupAddition_Error.py
--- /dev/null
+# Copyright (C) 2014-2019 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
+#
+
+# Check that if particular result of group is concealed, other results are not concealed
+# and don't treated like that by the move to the history algorithm
+
+from salome.shaper import model
+from ModelAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(10.07512315270936, 19.52832512315271, 5.646825151450413)
+SketchCircle_2 = Sketch_1.addCircle(-17.04064039408868, -4.229064039408867, 10.0065552781921)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
+Group_1 = model.addGroup(Part_1_doc, "Solids", [model.selection("SOLID", "Extrusion_1_1")])
+RemoveResults_1 = model.addRemoveResults(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2")])
+model.do()
+Part_1_doc.moveFeature(Group_1.feature(), RemoveResults_1.feature())
+model.end()
+
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(Group_1.feature()))
+selectionList = Group_1.feature().selectionList("group_list")
+assert(selectionList.size() == 1)
+
+assert(model.checkPythonDump())
data()->addAttribute(METHOD(), ModelAPI_AttributeString::typeId());
if (!string(METHOD())->isInitialized()) {
myClearListOnTypeChange = false;
+ data()->blockSendAttributeUpdated(true, false);
string(METHOD())->setValue(METHOD_DEFAULT());
+ data()->blockSendAttributeUpdated(false, false);
myClearListOnTypeChange = true;
}
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), METHOD());
void Model_AttributeSelection::concealedFeature(
- const FeaturePtr theFeature, const FeaturePtr theStop, std::list<FeaturePtr>& theConcealers)
+ const FeaturePtr theFeature, const FeaturePtr theStop, std::list<FeaturePtr>& theConcealers,
+ const ResultPtr theResultOfFeature)
{
std::set<FeaturePtr> alreadyProcessed;
alreadyProcessed.insert(theFeature);
if (theStop.get())
alreadyProcessed.insert(theStop);
/// iterate all results to find the concealment-attribute
- const std::list<ResultPtr>& aRootRes = theFeature->results();
+ std::list<ResultPtr> aRootRes;
+ if (theResultOfFeature.get()) {
+ ResultPtr aRoot = ModelAPI_Tools::bodyOwner(theResultOfFeature, true);
+ aRootRes.push_back(aRoot ? aRoot : theResultOfFeature);
+ } else { // all results of a feature
+ aRootRes = theFeature->results();
+ }
std::list<ResultPtr>::const_iterator aRootIter = aRootRes.cbegin();
for(; aRootIter != aRootRes.cend(); aRootIter++) {
std::list<ResultPtr> allRes;
FeaturePtr aThisFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
FeaturePtr aContextOwner = theDoc->feature(theContext);
std::list<FeaturePtr> aConcealers;
- concealedFeature(aContextOwner, aThisFeature, aConcealers);
+ concealedFeature(aContextOwner, aThisFeature, aConcealers, theContext);
std::list<FeaturePtr>::iterator aConcealer = aConcealers.begin();
for(; aConcealer != aConcealers.end(); aConcealer++) {
std::list<ResultPtr> aRefResults;
if (aFeature.get()) {
FeaturePtr aThisFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
std::list<FeaturePtr> aConcealers;
- concealedFeature(aFeature, aThisFeature, aConcealers);
+ concealedFeature(aFeature, aThisFeature, aConcealers, ResultPtr());
if (aConcealers.empty())
return;
bool aChanged = false;
TDF_Label baseDocumentLab();
/// Returns features that conceals theFeature and located in history before theStop
+ /// theResultOfFeature if not null defines exact referenced result of a feature
void concealedFeature(
- const FeaturePtr theFeature, const FeaturePtr theStop, std::list<FeaturePtr>& theConcealers);
+ const FeaturePtr theFeature, const FeaturePtr theStop, std::list<FeaturePtr>& theConcealers,
+ const ResultPtr theResultOfFeature);
friend class Model_Data;
friend class Model_AttributeSelectionList;
Author: Nathalie Gore
"""
-from qtsalome import QMessageBox
from salome.shaper import model
from salome.shaper import geom
import ModelAPI
for line in file:
coord = line.split(self.separator)
if len(coord) != 3:
- #QMessageBox.warning( self, 'Error!', '3D coords waited!' )
return
x = float(coord[0]); y = float(coord[1]); z = float(coord[2]);
point = model.addPoint(part, x,y,z); point.execute(True); self.lfeatures.append(point)
if (!(hasResult || hasFeature || hasParameter || hasFolder))
return;
- // Remove from the list non-deletable objects: infinite constuctions which are not in history
+ // Remove from the list non-deletable objects: infinite constructions which are not in history
bool notDelete = true;
QObjectPtrList::iterator aIt;
for (aIt = anObjects.begin(); aIt != anObjects.end(); aIt++) {
ObjectPtr aObj = (*aIt);
ResultConstructionPtr aConstr = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
- notDelete = (!aFeature->isInHistory()) && aConstr->isInfinite();
- if (notDelete) {
- anObjects.removeAll(aObj);
- aIt--;
+ if (aFeature) {
+ notDelete = (!aFeature->isInHistory()) && aConstr->isInfinite();
+ if (notDelete) {
+ anObjects.removeAll(aObj);
+ aIt--;
+ }
}
}
// delete objects