--- /dev/null
+## Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+model.do()
+# a wire selection: container of intersections (edges are intesection of faces)
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "[[Box_1_1/Left][Box_1_1/Bottom]][[Box_1_1/Front][Box_1_1/Left]][[Box_1_1/Left][Box_1_1/Top]][[Box_1_1/Back][Box_1_1/Left]]")])
+model.end()
+
+assert(model.checkPythonDump())
for(size_t aStart = 0; aStart != std::string::npos; aStart = theName.find('[', aStart + 1)) {
size_t anEndPos = theName.find(']', aStart + 1);
if (anEndPos != std::string::npos) {
+ // there could be sub-intersections, so, [[...]] case; searching for other open-bracket
+ size_t aNextStart = theName.find('[', aStart + 1);
+ while(aNextStart != std::string::npos && aNextStart < anEndPos) {
+ anEndPos = theName.find(']', anEndPos + 1);
+ if (anEndPos == std::string::npos) {
+ return TDF_Label(); // invalid parentheses
+ }
+ aNextStart = theName.find('[', aNextStart + 1);
+ }
+ if (anEndPos == std::string::npos)
+ return TDF_Label(); // invalid parentheses
std::string aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
TopAbs_ShapeEnum aSubShapeType = TopAbs_FACE;
switch (myShapeType) {
}
} else
return TDF_Label(); // invalid parentheses
+ aStart = anEndPos; // for recursive parenthesis set start on the current end
}
return aContext;
}