From 9ba3503e67afb18e8f5f318a17d48990ed8dc5e9 Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 26 Sep 2018 09:39:39 +0300 Subject: [PATCH] Issue #2622 : weak naming implementation and related tests added to the unit tests base. --- src/Model/Model_AttributeSelection.cpp | 97 +++++++- src/Model/Model_AttributeSelection.h | 4 + src/ModelAPI/CMakeLists.txt | 13 ++ src/ModelAPI/ModelAPI_AttributeSelection.h | 4 + src/ModelAPI/Test/TestFeatureSelection_2.py | 10 - src/ModelAPI/Test/TestWeakNaming2125.py | 62 +++++ src/ModelAPI/Test/TestWeakNaming2222.py | 243 ++++++++++++++++++++ src/ModelAPI/Test/TestWeakNaming2245.py | 46 ++++ src/ModelAPI/Test/TestWeakNaming2247.py | 61 +++++ src/ModelAPI/Test/TestWeakNaming2248.py | 53 +++++ src/ModelAPI/Test/TestWeakNaming2261.py | 62 +++++ src/ModelAPI/Test/TestWeakNaming2291.py | 62 +++++ src/ModelAPI/Test/TestWeakNaming2335.py | 34 +++ src/ModelAPI/Test/TestWeakNaming2375.py | 213 +++++++++++++++++ src/ModelAPI/Test/TestWeakNaming2437.py | 192 ++++++++++++++++ src/ModelAPI/Test/TestWeakNaming2445.py | 168 ++++++++++++++ src/ModelAPI/Test/TestWeakNaming2446.py | 46 ++++ src/ModelAPI/Test/TestWeakNaming2452.py | 96 ++++++++ src/ModelHighAPI/ModelHighAPI_Dumper.cpp | 5 +- 19 files changed, 1457 insertions(+), 14 deletions(-) create mode 100644 src/ModelAPI/Test/TestWeakNaming2125.py create mode 100644 src/ModelAPI/Test/TestWeakNaming2222.py create mode 100644 src/ModelAPI/Test/TestWeakNaming2245.py create mode 100644 src/ModelAPI/Test/TestWeakNaming2247.py create mode 100644 src/ModelAPI/Test/TestWeakNaming2248.py create mode 100644 src/ModelAPI/Test/TestWeakNaming2261.py create mode 100644 src/ModelAPI/Test/TestWeakNaming2291.py create mode 100644 src/ModelAPI/Test/TestWeakNaming2335.py create mode 100644 src/ModelAPI/Test/TestWeakNaming2375.py create mode 100644 src/ModelAPI/Test/TestWeakNaming2437.py create mode 100644 src/ModelAPI/Test/TestWeakNaming2445.py create mode 100644 src/ModelAPI/Test/TestWeakNaming2446.py create mode 100644 src/ModelAPI/Test/TestWeakNaming2452.py diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index af1020ab5..96c947bf4 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -88,6 +88,10 @@ Standard_GUID kCIRCLE_CENTER("d0d0e0f1-217a-4b95-8fbb-0c4132f23718"); Standard_GUID kELLIPSE_CENTER1("f70df04c-3168-4dc9-87a4-f1f840c1275d"); // identifier of the selection of the second focus point of ellipse on edge Standard_GUID kELLIPSE_CENTER2("1395ae73-8e02-4cf8-b204-06ff35873a32"); +// identifier of the weak naming index +Standard_GUID kWEAK_NAMING("9dcdd9be-a3a9-46eb-9b16-1c957ab20142"); +// identifier of the weak naming sub-shape type +Standard_GUID kWEAK_NAMING_SHAPETYPE("6b9cc709-e320-4a1f-9c42-df5622369ea7"); // prefix for the whole feature context identification const static std::string kWHOLE_FEATURE = "all-in-"; @@ -134,6 +138,8 @@ bool Model_AttributeSelection::setValue(const ObjectPtr& theContext, aSelLab.ForgetAttribute(kCIRCLE_CENTER); aSelLab.ForgetAttribute(kELLIPSE_CENTER1); aSelLab.ForgetAttribute(kELLIPSE_CENTER2); + aSelLab.ForgetAttribute(kWEAK_NAMING); + aSelLab.ForgetAttribute(kWEAK_NAMING_SHAPETYPE); bool isDegeneratedEdge = false; // do not use the degenerated edge as a shape, a null context and shape is used in the case @@ -385,6 +391,29 @@ std::shared_ptr Model_AttributeSelection::internalValue(CenterTyp } } + if (aSelLab.IsAttribute(kWEAK_NAMING)) { // a weak naming is used + Handle(TDataStd_Integer) aWeakId; + aSelLab.FindAttribute(kWEAK_NAMING, aWeakId); + // get the context shape + GeomShapePtr aContextShape; + ResultBodyPtr aBody = std::dynamic_pointer_cast(context()); + if (aBody.get()) { + aContextShape = aBody->shape(); + } else { + ResultPtr aResult = std::dynamic_pointer_cast(myRef.value()); + if (aResult) { + aContextShape = aResult->shape(); + } + } + if (!aContextShape.get()) + return GeomShapePtr(); + Handle(TDataStd_Integer) aWeakShapeType; + aSelLab.FindAttribute(kWEAK_NAMING_SHAPETYPE, aWeakShapeType); + GeomAlgoAPI_NExplode aNExplode(aContextShape, GeomAPI_Shape::ShapeType(aWeakShapeType->Get())); + GeomShapePtr aValue = aNExplode.shape(aWeakId->Get()); + return aValue; + } + Handle(TNaming_NamedShape) aSelection; if (aSelLab.FindAttribute(TNaming_NamedShape::GetID(), aSelection)) { TopoDS_Shape aSelShape = aSelection->Get(); @@ -633,6 +662,28 @@ bool Model_AttributeSelection::update() } if (aContext->groupName() == ModelAPI_ResultBody::group()) { + if (aSelLab.IsAttribute(kWEAK_NAMING)) { // a weak naming is used + Handle(TDataStd_Integer) aWeakId; + aSelLab.FindAttribute(kWEAK_NAMING, aWeakId); + // get the context shape + GeomShapePtr aContextShape; + ResultBodyPtr aBody = std::dynamic_pointer_cast(aContext); + if (aBody.get()) { + aContextShape = aBody->shape(); + } else { + ResultPtr aResult = std::dynamic_pointer_cast(myRef.value()); + if (aResult) { + aContextShape = aResult->shape(); + } + } + if (!setInvalidIfFalse(aSelLab, aContextShape.get() != NULL)) // context shape not found + return false; + Handle(TDataStd_Integer) aWeakShapeType; + aSelLab.FindAttribute(kWEAK_NAMING_SHAPETYPE, aWeakShapeType); + GeomAlgoAPI_NExplode aNExplode(aContextShape, GeomAPI_Shape::ShapeType(aWeakShapeType->Get())); + GeomShapePtr aValue = aNExplode.shape(aWeakId->Get()); + return setInvalidIfFalse(aSelLab, aValue.get() != NULL); + } // body: just a named shape, use selection mechanism from OCCT TNaming_Selector aSelector(aSelLab); TopoDS_Shape anOldShape; @@ -774,10 +825,39 @@ void Model_AttributeSelection::selectBody( if (aEraseResults) // erase results without flash deleted and redisplay: do it after Select aFeatureOwner->removeResults(0, false, false); } - aSel.Select(aNewSub, aNewContext); + bool aSelectorOk = true; + try { + aSel.Select(aNewSub, aNewContext); + } catch(...) { + aSelectorOk = false; + } // face may become divided after the model update, so, new labels may be added to the scope myScope.Clear(); + // check that selection is correct, otherwise use weak naming solution + TDF_Label aSelLab = selectionLabel(); + aSelLab.ForgetAttribute(kWEAK_NAMING); + Handle(TNaming_NamedShape) aSelectorShape; + if (aSelectorOk && aSelLab.FindAttribute(TNaming_NamedShape::GetID(), aSelectorShape)) + { + TopoDS_Shape aShape = aSelectorShape->Get(); + if (aShape.IsNull() || aShape.ShapeType() != aNewSub.ShapeType()) + aSelectorOk = false; + } + if (!aSelectorOk) { // weak naming identifier instead + GeomShapePtr aContextShape(new GeomAPI_Shape); + aContextShape->setImpl(new TopoDS_Shape(aNewContext)); + GeomShapePtr aValueShape(new GeomAPI_Shape); + aValueShape->setImpl(new TopoDS_Shape(aNewSub)); + + GeomAlgoAPI_NExplode aNExplode(aContextShape, aValueShape->shapeType()); + int anId = aNExplode.index(aValueShape); + if (anId) { + TDataStd_Integer::Set(aSelLab, kWEAK_NAMING, anId); + TDataStd_Integer::Set(aSelLab, kWEAK_NAMING_SHAPETYPE, int(aValueShape->shapeType())); + } + } + if (aEraseResults) { // flash after Select : in Groups it makes selection with shift working static Events_Loop* aLoop = Events_Loop::loop(); static const Events_ID kDeletedEvent = aLoop->eventByName(EVENT_OBJECT_DELETED); @@ -864,7 +944,15 @@ std::string Model_AttributeSelection::namingName(const std::string& theDefaultNa return ""; } - Model_SelectionNaming aSelNaming(selectionLabel()); + TDF_Label aSelLab = selectionLabel(); + Handle(TDataStd_Integer) aWeakId; + if (aSelLab.FindAttribute(kWEAK_NAMING, aWeakId)) { // a weak naming is used + std::ostringstream aNameStream; + aNameStream<data()->name()<<"/weak_name_"<Get(); + return aNameStream.str(); + } + + Model_SelectionNaming aSelNaming(aSelLab); std::string aResult = aSelNaming.namingName( aCont, aSubSh, theDefaultName, owner()->document() != aCont->document()); if (aCenterType != NOT_CENTER) { @@ -1597,3 +1685,8 @@ void Model_AttributeSelection::setParent(Model_AttributeSelectionList* theParent { myParent = theParent; } + +bool Model_AttributeSelection::isWeakNaming() +{ + return selectionLabel().IsAttribute(kWEAK_NAMING); +} diff --git a/src/Model/Model_AttributeSelection.h b/src/Model/Model_AttributeSelection.h index cafa6ea37..66f628ebb 100644 --- a/src/Model/Model_AttributeSelection.h +++ b/src/Model/Model_AttributeSelection.h @@ -125,6 +125,10 @@ public: /// or reorder of features upper in the history line (issue #1757) MODEL_EXPORT virtual void updateInHistory(); + /// Returns true if the name was stored using weak naming principle + MODEL_EXPORT virtual bool isWeakNaming(); + + protected: /// Objects are created for features automatically MODEL_EXPORT Model_AttributeSelection(TDF_Label& theLabel); diff --git a/src/ModelAPI/CMakeLists.txt b/src/ModelAPI/CMakeLists.txt index 35d4b45d3..14148d046 100644 --- a/src/ModelAPI/CMakeLists.txt +++ b/src/ModelAPI/CMakeLists.txt @@ -210,4 +210,17 @@ ADD_UNIT_TESTS(TestConstants.py Test2607.py TestBlockRecalculation.py TestSelectionScope.py + TestWeakNaming2125.py + TestWeakNaming2222.py + TestWeakNaming2245.py + TestWeakNaming2247.py + TestWeakNaming2248.py + TestWeakNaming2261.py + TestWeakNaming2291.py + TestWeakNaming2335.py + TestWeakNaming2375.py + TestWeakNaming2437.py + TestWeakNaming2445.py + TestWeakNaming2446.py + TestWeakNaming2452.py ) diff --git a/src/ModelAPI/ModelAPI_AttributeSelection.h b/src/ModelAPI/ModelAPI_AttributeSelection.h index 53e0151b8..212e83be9 100644 --- a/src/ModelAPI/ModelAPI_AttributeSelection.h +++ b/src/ModelAPI/ModelAPI_AttributeSelection.h @@ -115,9 +115,13 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute /// Returns true if recompute of selection become impossible virtual bool isInvalid() = 0; + /// Returns true if the name was stored using weak naming principle + MODELAPI_EXPORT virtual bool isWeakNaming() = 0; + /// To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelection(); + protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeSelection(); diff --git a/src/ModelAPI/Test/TestFeatureSelection_2.py b/src/ModelAPI/Test/TestFeatureSelection_2.py index c4ba30ff8..3e8b58b4e 100644 --- a/src/ModelAPI/Test/TestFeatureSelection_2.py +++ b/src/ModelAPI/Test/TestFeatureSelection_2.py @@ -34,29 +34,19 @@ Param_N = model.addParameter(Part_1_doc, "n", "3") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) SketchLine_1 = SketchProjection_1.createdFeature() -SketchLine_1.result().setColor(170, 0, 225) SketchCircle_1 = Sketch_1.addCircle(30, 0, 15) -SketchCircle_1.result().setColor(225, 0, 0) -SketchCircle_1.results()[1].setColor(225, 0, 0) SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center()) SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center(), 30, True) SketchMultiRotation_1 = Sketch_1.addRotation([SketchCircle_1.results()[1]], SketchAPI_Line(SketchLine_1).startPoint(), 360, "n=", True) [SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() -SketchCircle_3.result().setColor(225, 0, 0) -SketchCircle_3.results()[1].setColor(225, 0, 0) -SketchCircle_2.result().setColor(225, 0, 0) -SketchCircle_2.results()[1].setColor(225, 0, 0) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 15) model.do() Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) SketchCircle_4 = Sketch_2.addCircle(25, 5, 4) -SketchCircle_4.result().setColor(225, 0, 0) -SketchCircle_4.results()[1].setColor(225, 0, 0) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_4.results()[1], 4) SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) SketchLine_2 = SketchProjection_2.createdFeature() -SketchLine_2.result().setColor(170, 0, 225) SketchConstraintDistance_2 = Sketch_2.setDistance(SketchLine_2.result(), SketchCircle_4.center(), 5, True) SketchConstraintDistanceHorizontal_1 = Sketch_2.setHorizontalDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchCircle_4.center(), 25) model.do() diff --git a/src/ModelAPI/Test/TestWeakNaming2125.py b/src/ModelAPI/Test/TestWeakNaming2125.py new file mode 100644 index 000000000..e9ec85ba5 --- /dev/null +++ b/src/ModelAPI/Test/TestWeakNaming2125.py @@ -0,0 +1,62 @@ +## 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 +## + +# -*- coding: utf-8 -*- + +from salome.shaper import model + +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("YOZ")) +SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) +SketchCircle_1 = Sketch_1.addCircle(0, 0, 207.1440202435477) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchCircle_2 = Sketch_1.addCircle(0, 0, 103.3027146966417) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchCircle_2.center()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_2_2r")], model.selection(), 410, 0) +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1")) +SketchCircle_3 = Sketch_2.addCircle(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1")) +SketchCircle_4 = Sketch_2.addCircle(model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1")) +SketchArc_1 = Sketch_2.addArc(-76.31943784014528, 69.61892179185162, 22.73963059863011, 100.7688447087372, -98.26117835861398, -31.87776170424145, False) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchCircle_3.results()[1], SketchArc_1.startPoint()) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchCircle_3.results()[1], SketchArc_1.endPoint()) +SketchConstraintTangent_1 = Sketch_2.setTangent(SketchCircle_4.results()[1], SketchArc_1.results()[1]) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchArc_1.center(), SketchCircle_3.results()[1]) +SketchArc_2 = Sketch_2.addArc(0, 0, 22.73963059863011, 100.7688447087372, -98.26117835861152, -31.87776170424295, False) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchCircle_3.result(), SketchArc_2.center()) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchArc_2.startPoint()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchArc_1.results()[1], SketchArc_2.endPoint()) +model.do() +ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_1_2f-SketchArc_2_2r")], model.selection(), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_2_2r"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")]) +Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_1")) +SketchLine_1 = Sketch_3.addLine(72.49453964599654, -117.643151959956, 76.08424302289386, 111.5797586569786) +SketchArc_3 = Sketch_3.addArc(23.82028040531734, -147.9761102212422, 72.49453964599654, -117.643151959956, 29.20403695178628, -205.0750334594096, False) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_1.startPoint(), SketchArc_3.startPoint()) +SketchProjection_1 = Sketch_3.addProjection(model.selection("EDGE", "ExtrusionCut_1_1", 13), False) +SketchArc_4 = SketchProjection_1.createdFeature() +SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchArc_3.endPoint(), SketchArc_4.results()[1]) +model.end() + +from ModelAPI import * +aFactory = ModelAPI_Session.get().validators() +assert(aFactory.validate(Sketch_3.feature())) diff --git a/src/ModelAPI/Test/TestWeakNaming2222.py b/src/ModelAPI/Test/TestWeakNaming2222.py new file mode 100644 index 000000000..1aa708b3f --- /dev/null +++ b/src/ModelAPI/Test/TestWeakNaming2222.py @@ -0,0 +1,243 @@ +## 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 +## + +# -*- coding: utf-8 -*- + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +model.addParameter(Part_1_doc, "ep_base", "0.65") +model.addParameter(Part_1_doc, "ep_voiles", "0.1") +model.addParameter(Part_1_doc, "ep_poteau", "0.15") +model.addParameter(Part_1_doc, "h_ouverture", "0.95") +model.addParameter(Part_1_doc, "h_apres_ouverture", "0.6") +model.addParameter(Part_1_doc, "ep_dalles", "0.12") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_1 = Sketch_1.addLine(0.275, 3.325, -0.375, 3.325) +SketchLine_2 = Sketch_1.addLine(-0.375, 3.325, -0.375, -0.325) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_3 = Sketch_1.addLine(-0.375, -0.325, 4.275, -0.325) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_4 = Sketch_1.addLine(4.275, -0.325, 4.275, 1.325) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_5 = Sketch_1.addLine(4.275, 1.325, 3.625, 1.325) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchLine_6 = Sketch_1.addLine(3.625, 1.325, 3.625, 0.325) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchLine_7 = Sketch_1.addLine(3.625, 0.325, 0.275, 0.3250000000000001) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_8 = Sketch_1.addLine(0.275, 0.3250000000000001, 0.275, 3.325) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) +SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_8.result()) +SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) +SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_4.result()) +SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "ep_base") +SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 3.65) +SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_3.result(), 4.65) +SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_4.result(), 1.65) +SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_3.result(), "ep_base") +SketchLine_9 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) +SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_9.result(), "0.275+ep_voiles/2") +SketchLine_10 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY")) +SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_10.result(), "0.325+ep_voiles/2") +SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_1.result()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 0, 0.3) +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face_1")) +SketchLine_11 = Sketch_2.addLine(2.26, -2.31, 1.64, -2.31) +SketchLine_12 = Sketch_2.addLine(1.64, -2.31, 1.64, -1.69) +SketchLine_13 = Sketch_2.addLine(1.64, -1.69, 2.26, -1.69) +SketchLine_14 = Sketch_2.addLine(2.26, -1.69, 2.26, -2.31) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result()) +SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_12.result()) +SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_13.result()) +SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_14.result()) +SketchPoint_1 = Sketch_2.addPoint(1.925, -1.875) +SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_11.result(), 0.62) +SketchConstraintLength_5.setName("SketchConstraintLength_10") +SketchConstraintEqual_2 = Sketch_2.setEqual(SketchLine_11.result(), SketchLine_12.result()) +SketchConstraintDistance_4 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_13.result(), "0.11+ep_poteau/2") +SketchConstraintDistance_4.setName("SketchConstraintDistance_6") +SketchConstraintDistance_5 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_12.result(), "0.21+ep_poteau/2") +SketchConstraintDistance_5.setName("SketchConstraintDistance_7") +SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX")) +SketchLine_15 = SketchProjection_1.createdFeature() +SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY")) +SketchLine_16 = SketchProjection_2.createdFeature() +SketchConstraintDistance_6 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_15.result(), "1.75+ep_poteau/2+ep_voiles/2") +SketchConstraintDistance_6.setName("SketchConstraintDistance_8") +SketchConstraintDistance_7 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_16.result(), "1.8+ep_poteau/2+ep_voiles/2") +SketchConstraintDistance_7.setName("SketchConstraintDistance_9") +model.do() +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_14r")], model.selection(), 0, 0.02) +Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")) +SketchLine_17 = Sketch_3.addLine(0, 2.950000000000001, 0, 1.700000000000001) +SketchLine_17.setName("SketchLine_15") +SketchLine_17.result().setName("SketchLine_15") +SketchLine_18 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OY")) +SketchLine_18.setName("SketchLine_16") +SketchLine_18.result().setName("SketchLine_16") +SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_17.startPoint(), SketchLine_18.result()) +SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_18.result()) +SketchLine_19 = Sketch_3.addLine(0, 1.2, 0, 0) +SketchLine_19.setName("SketchLine_17") +SketchLine_19.result().setName("SketchLine_17") +SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_19.startPoint(), SketchLine_18.result()) +SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_18.result()) +SketchLine_20 = Sketch_3.addLine(0, 0, 0.95, 0) +SketchLine_20.setName("SketchLine_18") +SketchLine_20.result().setName("SketchLine_18") +SketchLine_21 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OX")) +SketchLine_21.setName("SketchLine_19") +SketchLine_21.result().setName("SketchLine_19") +#SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_21.result()) +#SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_21.result()) +SketchLine_22 = Sketch_3.addLine(2.525000000000001, 0, 3.975000000000001, 0) +SketchLine_22.setName("SketchLine_20") +SketchLine_22.result().setName("SketchLine_20") +SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_21.result()) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_21.result()) +SketchLine_23 = Sketch_3.addLine(3.975000000000001, 0, 3.975000000000001, 0.95) +SketchLine_23.setName("SketchLine_21") +SketchLine_23.result().setName("SketchLine_21") +SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) +SketchLine_24 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1")) +SketchLine_24.setName("SketchLine_22") +SketchLine_24.result().setName("SketchLine_22") +SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_17.result(), 1.25) +SketchConstraintLength_6.setName("SketchConstraintLength_5") +SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_19.endPoint()) +SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_19.result(), "1.25-ep_voiles/2") +SketchConstraintLength_7.setName("SketchConstraintLength_6") +SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_20.result(), "1-ep_voiles/2") +SketchConstraintLength_8.setName("SketchConstraintLength_7") +SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_22.result(), "1.5-ep_voiles/2") +SketchConstraintLength_9.setName("SketchConstraintLength_8") +SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_23.result()) +SketchLine_25 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")) +SketchLine_25.setName("SketchLine_23") +SketchLine_25.result().setName("SketchLine_23") +SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_22.endPoint(), SketchLine_25.result(), "0.25+ep_voiles/2") +SketchConstraintDistance_8.setName("SketchConstraintDistance_5") +SketchConstraintLength_10 = Sketch_3.setLength(SketchLine_23.result(), "1-ep_voiles/2") +SketchConstraintLength_10.setName("SketchConstraintLength_9") +SketchLine_26 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/To_Face_1")) +SketchLine_26.setName("SketchLine_35") +SketchLine_26.result().setName("SketchLine_35") +SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_17.startPoint(), SketchLine_26.result(), 0.375) +SketchConstraintDistance_9.setName("SketchConstraintDistance_12") +model.do() +Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_15"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_17"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_18"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_20"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_21")]) +Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_3"), model.selection("EDGE", "Edge_1_4"), model.selection("EDGE", "Edge_1_5")], model.selection("EDGE", "PartSet/OZ"), "h_ouverture", 0) +Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_3_1/Generated_Edge_2&Extrusion_3_1/To_Edge_1"), model.selection("VERTEX", "Extrusion_3_3/Generated_Edge_2&Extrusion_3_3/To_Edge_1"), model.selection("VERTEX", "Extrusion_3_4/Generated_Edge_1&Extrusion_3_4/To_Edge_1")) +Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) +SketchLine_27 = Sketch_4.addLine(0, 2.950000000000001, 0, 0) +SketchLine_27.setName("SketchLine_26") +SketchLine_27.result().setName("SketchLine_26") +SketchPoint_2 = Sketch_4.addPoint(model.selection("VERTEX", "Extrusion_3_1/Generated_Edge_2&Extrusion_3_1/To_Edge_1")) +SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchLine_27.startPoint(), SketchPoint_2.result()) +SketchPoint_3 = Sketch_4.addPoint(model.selection("VERTEX", "Extrusion_3_3/Generated_Edge_2&Extrusion_3_3/To_Edge_1")) +SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchPoint_3.result()) +SketchLine_28 = Sketch_4.addLine(0, 0, 3.975000000000001, 0) +SketchLine_28.setName("SketchLine_27") +SketchLine_28.result().setName("SketchLine_27") +SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint()) +SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "Extrusion_3_4/Generated_Edge_1&Extrusion_3_4/To_Edge_1")) +SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchPoint_4.result()) +SketchLine_29 = Sketch_4.addLine(3.975000000000001, 0, 3.975000000000001, 0.95) +SketchLine_29.setName("SketchLine_28") +SketchLine_29.result().setName("SketchLine_28") +SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint()) +SketchPoint_5 = Sketch_4.addPoint(model.selection("VERTEX", "Extrusion_3_5/Generated_Edge_1&Extrusion_3_5/To_Edge_1")) +SketchConstraintCoincidence_29 = Sketch_4.setCoincident(SketchLine_29.endPoint(), SketchPoint_5.result()) +model.do() +Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/Edge-SketchLine_26"), model.selection("EDGE", "Sketch_4/Edge-SketchLine_27"), model.selection("EDGE", "Sketch_4/Edge-SketchLine_28")]) +Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2"), model.selection("EDGE", "Edge_2_3")], model.selection("EDGE", "PartSet/OZ"), "h_apres_ouverture-ep_dalles/2", 0) +Plane_5 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_4_1/Generated_Edge_2&Extrusion_4_1/To_Edge_1"), model.selection("VERTEX", "Extrusion_4_1/Generated_Edge_1&Extrusion_4_1/To_Edge_1"), model.selection("VERTEX", "Extrusion_4_2/Generated_Edge_1&Extrusion_4_2/To_Edge_1")) +Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) +SketchLine_30 = Sketch_5.addLine(0, 2.950000000000001, 0, 0) +SketchLine_30.setName("SketchLine_29") +SketchLine_30.result().setName("SketchLine_29") +SketchPoint_6 = Sketch_5.addPoint(model.selection("VERTEX", "Extrusion_4_1/Generated_Edge_2&Extrusion_4_1/To_Edge_1")) +SketchConstraintCoincidence_30 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchPoint_6.result()) +SketchPoint_7 = Sketch_5.addPoint(model.selection("VERTEX", "Extrusion_4_1/Generated_Edge_1&Extrusion_4_1/To_Edge_1")) +SketchConstraintCoincidence_31 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchPoint_7.result()) +SketchLine_31 = Sketch_5.addLine(0, 0, 3.975000000000001, 0) +SketchLine_31.setName("SketchLine_30") +SketchLine_31.result().setName("SketchLine_30") +SketchConstraintCoincidence_32 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) +SketchPoint_8 = Sketch_5.addPoint(model.selection("VERTEX", "Extrusion_4_2/Generated_Edge_1&Extrusion_4_2/To_Edge_1")) +SketchConstraintCoincidence_33 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchPoint_8.result()) +SketchLine_32 = Sketch_5.addLine(3.975000000000001, 0, 3.975000000000001, 0.95) +SketchLine_32.setName("SketchLine_31") +SketchLine_32.result().setName("SketchLine_31") +SketchConstraintCoincidence_34 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) +SketchPoint_9 = Sketch_5.addPoint(model.selection("VERTEX", "Extrusion_4_3/Generated_Edge_1&Extrusion_4_3/To_Edge_1")) +SketchConstraintCoincidence_35 = Sketch_5.setCoincident(SketchLine_32.endPoint(), SketchPoint_9.result()) +SketchLine_33 = Sketch_5.addLine(3.975000000000001, 0.95, 0, 2.950000000000001) +SketchLine_33.setName("SketchLine_32") +SketchLine_33.result().setName("SketchLine_32") +SketchConstraintCoincidence_36 = Sketch_5.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_37 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchLine_33.endPoint()) +SketchConstraintCoincidence_38 = Sketch_5.setCoincident(SketchPoint_6.coordinates(), SketchLine_33.endPoint()) +SketchLine_34 = Sketch_5.addLine(1.85, 2.019182389937107, 1.85, 0) +SketchLine_34.setName("SketchLine_33") +SketchLine_34.result().setName("SketchLine_33") +SketchConstraintCoincidence_39 = Sketch_5.setCoincident(SketchLine_34.startPoint(), SketchLine_33.result()) +SketchLine_35 = Sketch_5.addLine(2.075000000000001, 1.905974842767296, 2.075000000000001, 0) +SketchLine_35.setName("SketchLine_34") +SketchLine_35.result().setName("SketchLine_34") +SketchConstraintCoincidence_40 = Sketch_5.setCoincident(SketchLine_35.startPoint(), SketchLine_33.result()) +SketchConstraintCoincidence_41 = Sketch_5.setCoincident(SketchLine_35.endPoint(), SketchLine_31.result()) +SketchConstraintCoincidence_42 = Sketch_5.setCoincident(SketchLine_34.endPoint(), SketchLine_31.result()) +SketchConstraintVertical_8 = Sketch_5.setVertical(SketchLine_34.result()) +SketchConstraintVertical_9 = Sketch_5.setVertical(SketchLine_35.result()) +SketchConstraintDistance_10 = Sketch_5.setDistance(SketchLine_34.startPoint(), SketchLine_30.result(), "1.8+ep_voiles/2") +SketchConstraintDistance_11 = Sketch_5.setDistance(SketchLine_35.startPoint(), SketchLine_32.result(), "1.85+ep_voiles/2") +model.do() +Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_29f-SketchLine_30f-SketchLine_32f-SketchLine_33r")]) +Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_30f-SketchLine_31f-SketchLine_32f-SketchLine_34f")]) +Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_30f-SketchLine_32f-SketchLine_33f-SketchLine_34r")]) +Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Extrusion_4_3"), model.selection("FACE", "Extrusion_3_3"), model.selection("FACE", "Extrusion_4_2"), model.selection("FACE", "Extrusion_3_5"), model.selection("FACE", "Extrusion_3_4"), model.selection("FACE", "Extrusion_3_2"), model.selection("FACE", "Extrusion_4_1"), model.selection("FACE", "Extrusion_3_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OZ"), "h_ouverture+h_apres_ouverture-ep_dalles/2") +Recover_1_objects = [Face_2.result(), Face_3.result(), Face_1.result(), Extrusion_3.result(), Extrusion_4.result(), Extrusion_3.results()[1], Extrusion_3.results()[3], Extrusion_3.results()[4], Extrusion_4.results()[1], Extrusion_3.results()[2], Extrusion_4.results()[2]] +Recover_1 = model.addRecover(Part_1_doc, Translation_1, Recover_1_objects) +Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_2"), model.selection("FACE", "Recover_1_5"), model.selection("FACE", "Recover_1_3"), model.selection("FACE", "Recover_1_4"), model.selection("FACE", "Recover_1_1"), model.selection("FACE", "Recover_1_6"), model.selection("FACE", "Recover_1_8"), model.selection("FACE", "Recover_1_7"), model.selection("FACE", "Recover_1_11"), model.selection("FACE", "Recover_1_10"), model.selection("FACE", "Recover_1_9")], model.selection("EDGE", "PartSet/OZ"), "2*(h_ouverture+h_apres_ouverture-ep_dalles/2)") +Recover_2_objects = [Recover_1.results()[8], Recover_1.results()[9], Recover_1.results()[10], Recover_1.results()[6], Recover_1.results()[7], Recover_1.results()[5], Recover_1.result(), Recover_1.results()[3], Recover_1.results()[2], Recover_1.results()[4], Recover_1.results()[1]] +Recover_2 = model.addRecover(Part_1_doc, Translation_2, Recover_2_objects) +Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/Vertex-SketchPoint_1")]) +Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OZ"), model.selection("FACE", "Translation_2_11"), 0, model.selection(), 0) +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("FACE", "Translation_1_1"), model.selection("FACE", "Translation_1_2"), model.selection("FACE", "Translation_1_3"), model.selection("FACE", "Translation_1_4"), model.selection("FACE", "Translation_1_5"), model.selection("FACE", "Translation_1_6"), model.selection("FACE", "Translation_1_7"), model.selection("FACE", "Translation_1_8"), model.selection("FACE", "Translation_1_9"), model.selection("FACE", "Translation_1_10"), model.selection("FACE", "Translation_1_11"), model.selection("FACE", "Translation_2_1"), model.selection("FACE", "Translation_2_2"), model.selection("FACE", "Translation_2_3"), model.selection("FACE", "Translation_2_4"), model.selection("FACE", "Translation_2_5"), model.selection("FACE", "Translation_2_6"), model.selection("FACE", "Translation_2_7"), model.selection("FACE", "Translation_2_8"), model.selection("FACE", "Translation_2_9"), model.selection("FACE", "Translation_2_10"), model.selection("FACE", "Translation_2_11"), model.selection("FACE", "Recover_2_1"), model.selection("FACE", "Recover_2_2"), model.selection("FACE", "Recover_2_3"), model.selection("FACE", "Recover_2_4"), model.selection("FACE", "Recover_2_5"), model.selection("FACE", "Recover_2_6"), model.selection("FACE", "Recover_2_7"), model.selection("FACE", "Recover_2_8"), model.selection("FACE", "Recover_2_9"), model.selection("FACE", "Recover_2_10"), model.selection("FACE", "Recover_2_11"), model.selection("EDGE", "Extrusion_5_1")]) +model.do() +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) +model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2245.py b/src/ModelAPI/Test/TestWeakNaming2245.py new file mode 100644 index 000000000..65cf0e0f3 --- /dev/null +++ b/src/ModelAPI/Test/TestWeakNaming2245.py @@ -0,0 +1,46 @@ +## 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 +## + +# -*- coding: utf-8 -*- + +from salome.shaper import model + +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("YOZ")) +SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchPoint_1 = SketchProjection_1.createdFeature() +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_1 = SketchProjection_2.createdFeature() +SketchArc_1 = Sketch_1.addArc(0, 0, 0, 39.7470266529203, 0, -39.7470266529203, False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result()) +SketchLine_2 = Sketch_1.addLine(0, -39.7470266529203, 0, 39.7470266529203) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.endPoint()) +model.do() +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Revolution_1_1"), model.selection("FACE", "PartSet/XOY")]) +model.do() +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) +model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2247.py b/src/ModelAPI/Test/TestWeakNaming2247.py new file mode 100644 index 000000000..9b1b195c4 --- /dev/null +++ b/src/ModelAPI/Test/TestWeakNaming2247.py @@ -0,0 +1,61 @@ +## 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 +## + +# -*- coding: utf-8 -*- + +from salome.shaper import model + +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("YOZ")) +SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchPoint_1 = SketchProjection_1.createdFeature() +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_1 = SketchProjection_2.createdFeature() +SketchArc_1 = Sketch_1.addArc(0, 0, 0, 85.6495043418947, 0, -85.6495043418947, False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result()) +SketchLine_2 = Sketch_1.addLine(0, -85.6495043418947, 0, 85.6495043418947) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.endPoint()) +model.do() +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) +SketchLine_3 = Sketch_2.addLine(42.96245524296674, 29.66455242966749, -38.35933503836317, 29.66455242966749) +SketchLine_4 = Sketch_2.addLine(-38.35933503836317, 29.66455242966749, -38.35933503836317, -29.66455242966754) +SketchLine_5 = Sketch_2.addLine(-38.35933503836317, -29.66455242966754, 42.96245524296674, -29.66455242966754) +SketchLine_6 = Sketch_2.addLine(42.96245524296674, -29.66455242966754, 42.96245524296674, 29.66455242966749) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_4.result()) +SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_5.result()) +SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 100, 100) +Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")]) +model.do() +model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc) +model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2248.py b/src/ModelAPI/Test/TestWeakNaming2248.py new file mode 100644 index 000000000..a5e571790 --- /dev/null +++ b/src/ModelAPI/Test/TestWeakNaming2248.py @@ -0,0 +1,53 @@ +## 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 +## + +# -*- coding: utf-8 -*- + +from salome.shaper import model + +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")) +SketchLine_1 = Sketch_1.addLine(162.2066367177775, 151.0353807454788, -151.0353807454788, 151.0353807454788) +SketchLine_2 = Sketch_1.addLine(-151.0353807454788, 151.0353807454788, -151.0353807454788, -54.96257938370976) +SketchLine_3 = Sketch_1.addLine(-151.0353807454788, -54.96257938370976, 162.2066367177775, -54.96257938370976) +SketchLine_4 = Sketch_1.addLine(162.2066367177775, -54.96257938370976, 162.2066367177775, 151.0353807454788) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchArc_1 = Sketch_1.addArc(-6.962011033302339, 151.0353807454788, -151.0353807454788, 151.0353807454788, 38.42912054470763, 14.29920764454234, False) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_1.startPoint()) +SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_2.result(), SketchArc_1.results()[1]) +SketchArc_2 = Sketch_1.addArc(162.2066367177775, 234.3997613131608, 162.2066367177775, -54.96257938370976, -46.91927508365465, 34.40746839468006, True) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_2.startPoint()) +SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_2.results()[1]) +SketchCircle_1 = Sketch_1.addCircle(-8.043304300055087, 108.5846080507436, 59.51166177475501) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) +model.do() +model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) +model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2261.py b/src/ModelAPI/Test/TestWeakNaming2261.py new file mode 100644 index 000000000..672fe4cc7 --- /dev/null +++ b/src/ModelAPI/Test/TestWeakNaming2261.py @@ -0,0 +1,62 @@ +## 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 +## + +# -*- coding: utf-8 -*- + +from salome.shaper import model + +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")) +SketchLine_1 = Sketch_1.addLine(500.0000311770457, 317.8294573643411, -308.1395348837211, 317.8294573643411) +SketchLine_2 = Sketch_1.addLine(-308.1395348837211, 317.8294573643411, -308.1395348837211, -263.9724263224183) +SketchLine_3 = Sketch_1.addLine(-308.1395348837211, -263.9724263224183, 500.0000311770457, -263.9724263224183) +SketchLine_4 = Sketch_1.addLine(500.0000311770457, -263.9724263224183, 500.0000311770457, 317.8294573643411) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchCircle_1 = Sketch_1.addCircle(-118.2170542635659, 222.8682170542636, 141.685090902591) +SketchCircle_2 = Sketch_1.addCircle(294.5736434108529, -40.69767441860468, 113.2187726277406) +SketchArc_1 = Sketch_1.addArc(500.0000311770867, -335287.7996679137, 500.0000311770457, -263.9724263224183, -639.534183538502, -265.9104108427558, True) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint()) +SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_1.results()[1]) +SketchArc_2 = Sketch_1.addArc(-638.1195022375863, -681.8252609710054, -639.534183538502, -265.9104108427558, -316.014851248167, -418.6983758160058, True) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint()) +SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1]) +SketchArc_3 = Sketch_1.addArc(-167.5780303038277, -297.4405230733651, -316.014851248167, -418.6983758160058, -17.4411870157839, -178.2940378070349, False) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) +SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) +SketchArc_4 = Sketch_1.addArc(-301.8048538198685, -403.9610406236078, -17.4411870157839, -178.2940378070349, -637.5573748460384, -265.908384788777, False) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchArc_4.startPoint()) +SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchArc_4.results()[1]) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.results()[1], SketchArc_4.endPoint()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 0) +Translation_1 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OX"), 400) +model.do() +model.testHaveNamingSubshapes(Translation_1, model, Part_1_doc) +model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2291.py b/src/ModelAPI/Test/TestWeakNaming2291.py new file mode 100644 index 000000000..10c00199a --- /dev/null +++ b/src/ModelAPI/Test/TestWeakNaming2291.py @@ -0,0 +1,62 @@ +## 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 +## + +# -*- coding: utf-8 -*- + +from salome.shaper import model + +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")) +SketchLine_1 = Sketch_1.addLine(36.44136828644502, 18.79607416879796, -16.36664961636829, 18.79607416879796) +SketchLine_2 = Sketch_1.addLine(-16.36664961636829, 18.79607416879796, -16.36664961636829, -16.62237851662404) +SketchLine_3 = Sketch_1.addLine(-16.36664961636829, -16.62237851662404, 36.44136828644502, -16.62237851662404) +SketchLine_4 = Sketch_1.addLine(36.44136828644502, -16.62237851662404, 36.44136828644502, 18.79607416879796) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 0) +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")) +SketchLine_5 = Sketch_2.addLine(-3.660618520812283, -7.666051414039341, -9.927240775274454, -7.666051414039341) +SketchLine_6 = Sketch_2.addLine(-9.927240775274454, -7.666051414039341, -9.927240775274454, 7.885614342469023) +SketchLine_7 = Sketch_2.addLine(-9.927240775274454, 7.885614342469023, -3.660618520812283, 7.885614342469023) +SketchLine_8 = Sketch_2.addLine(-3.660618520812283, 7.885614342469023, -3.660618520812283, -7.666051414039341) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_5.result()) +SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result()) +SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result()) +SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result()) +model.do() +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r")], model.selection(), 10, 0) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")]) +model.do() +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2335.py b/src/ModelAPI/Test/TestWeakNaming2335.py new file mode 100644 index 000000000..fd17dbebb --- /dev/null +++ b/src/ModelAPI/Test/TestWeakNaming2335.py @@ -0,0 +1,34 @@ +## 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 +## + +# -*- coding: utf-8 -*- + +from salome.shaper import model + +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) +Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Cylinder_1_1")]) +model.do() +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2375.py b/src/ModelAPI/Test/TestWeakNaming2375.py new file mode 100644 index 000000000..0113da48a --- /dev/null +++ b/src/ModelAPI/Test/TestWeakNaming2375.py @@ -0,0 +1,213 @@ +## 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 +## + +from SketchAPI import * + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +model.addParameter(Part_1_doc, "angle", "27.5") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) +SketchLine_1 = Sketch_1.addLine(0, 4, 6.2, 4) +SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_2 = SketchProjection_1.createdFeature() +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) +SketchLine_3 = Sketch_1.addLine(6.2, 4, 6.2, 2.5) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchLine_4 = Sketch_1.addLine(6.2, 2.5, 3.5, 2) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_5 = Sketch_1.addLine(3.5, 2, 3.5, 0) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_6 = SketchProjection_2.createdFeature() +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result()) +SketchLine_7 = Sketch_1.addLine(3.5, 0, 0, 0) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_7.endPoint()) +SketchLine_8 = Sketch_1.addLine(0, 4, 0, 0) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_8.endPoint()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 6.2) +SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_7.result(), 3.5) +SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_5.result(), 2) +SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_3.result(), 1.5) +SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_8.result(), 4) +model.do() +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_7r-SketchLine_8f")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_1")) +SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Revolution_1_1/Generated_Face_1__cc"), False) +SketchPoint_1 = SketchProjection_3.createdFeature() +SketchCircle_1 = Sketch_2.addCircle(0, 0, 4.75) +SketchCircle_1.setAuxiliary(True) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchCircle_2 = Sketch_2.addCircle(4.113620667976081, 2.375000000000003, 1.1) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_2.center()) +SketchCircle_3 = Sketch_2.addCircle(-4.113620667974014, 2.375000000003604, 1.1) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_3.center()) +SketchCircle_4 = Sketch_2.addCircle(4.163806340121522e-012, -4.75000000000001, 1.1) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_4.center()) +SketchConstraintEqual_1 = Sketch_2.setEqual(SketchCircle_2.results()[1], SketchCircle_3.results()[1]) +SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_3.results()[1], SketchCircle_4.results()[1]) +SketchLine_9 = Sketch_2.addLine(0, 0, 4.113620667976081, 2.375000000000003) +SketchLine_9.setAuxiliary(True) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchLine_9.endPoint()) +SketchLine_10 = Sketch_2.addLine(-4.113620667974014, 2.375000000003604, 0, 0) +SketchLine_10.setAuxiliary(True) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_10.endPoint()) +SketchLine_11 = Sketch_2.addLine(4.163806340121522e-012, -4.75000000000001, 0, 0) +SketchLine_11.setAuxiliary(True) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchCircle_4.center(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_11.endPoint()) +SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_2.results()[1], 1.1) +SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False) +SketchLine_12 = SketchProjection_4.createdFeature() +SketchConstraintAngle_1 = Sketch_2.setAngleBackward(SketchLine_9.result(), SketchLine_12.result(), 30.00000000000006) +SketchConstraintAngle_2 = Sketch_2.setAngle(SketchLine_9.result(), SketchLine_10.result(), 119.9999999999498) +SketchConstraintAngle_3 = Sketch_2.setAngle(SketchLine_10.result(), SketchLine_11.result(), 120.0000000001004) +SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_9.result(), 4.75) +SketchCircle_5 = Sketch_2.addCircle(2.552173139647412, 4.006109367611208, 0.65) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_5.center()) +SketchCircle_6 = Sketch_2.addCircle(2.552173139647412, 4.006109367611208, 0.8) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_6.center()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchCircle_6.center()) +SketchCircle_7 = Sketch_2.addCircle(4.745479052513824, 0.20719208998535, 0.65) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_7.center()) +SketchCircle_8 = Sketch_2.addCircle(4.745479052513824, 0.20719208998535, 0.8) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_8.center()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchCircle_8.center()) +SketchLine_13 = Sketch_2.addLine(0, 0, 2.552173139647412, 4.006109367611208) +SketchLine_13.setAuxiliary(True) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchLine_13.endPoint()) +SketchLine_14 = Sketch_2.addLine(0, 0, 4.745479052513824, 0.20719208998535) +SketchLine_14.setAuxiliary(True) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchLine_14.endPoint()) +SketchConstraintEqual_3 = Sketch_2.setEqual(SketchCircle_7.results()[1], SketchCircle_5.results()[1]) +SketchConstraintEqual_4 = Sketch_2.setEqual(SketchCircle_8.results()[1], SketchCircle_6.results()[1]) +SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_7.results()[1], 0.65) +SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_8.results()[1], 0.8) +SketchCircle_9 = Sketch_2.addCircle(-2.552173139482203, 4.006109367717388, 0.65) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_9.center()) +SketchCircle_10 = Sketch_2.addCircle(-4.745479052513825, 0.2071920899853395, 0.65) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_10.center()) +SketchCircle_11 = Sketch_2.addCircle(-2.552173139482203, 4.006109367717388, 0.8) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_11.center()) +SketchCircle_12 = Sketch_2.addCircle(-4.745479052513825, 0.2071920899853395, 0.8) +SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchCircle_10.center(), SketchCircle_12.center()) +SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchCircle_9.center(), SketchCircle_11.center()) +SketchConstraintEqual_5 = Sketch_2.setEqual(SketchCircle_6.results()[1], SketchCircle_11.results()[1]) +SketchConstraintEqual_6 = Sketch_2.setEqual(SketchCircle_5.results()[1], SketchCircle_9.results()[1]) +SketchConstraintEqual_7 = Sketch_2.setEqual(SketchCircle_9.results()[1], SketchCircle_10.results()[1]) +SketchConstraintEqual_8 = Sketch_2.setEqual(SketchCircle_11.results()[1], SketchCircle_12.results()[1]) +SketchLine_15 = Sketch_2.addLine(-2.552173139482203, 4.006109367717388, 0, 0) +SketchLine_15.setAuxiliary(True) +SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchCircle_9.center(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_15.endPoint()) +SketchLine_16 = Sketch_2.addLine(-4.745479052513825, 0.2071920899853395, 0, 0) +SketchLine_16.setAuxiliary(True) +SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchCircle_10.center(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_16.endPoint()) +SketchCircle_13 = Sketch_2.addCircle(-2.193305912870557, -4.213301457594897, 0.8) +SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_13.center()) +SketchCircle_14 = Sketch_2.addCircle(2.193305912973027, -4.213301457541542, 0.8) +SketchConstraintCoincidence_40 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_14.center()) +SketchConstraintEqual_9 = Sketch_2.setEqual(SketchCircle_14.results()[1], SketchCircle_13.results()[1]) +SketchConstraintEqual_10 = Sketch_2.setEqual(SketchCircle_12.results()[1], SketchCircle_13.results()[1]) +SketchLine_17 = Sketch_2.addLine(0, 0, -2.193305912870557, -4.213301457594897) +SketchLine_17.setAuxiliary(True) +SketchConstraintCoincidence_41 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_42 = Sketch_2.setCoincident(SketchCircle_13.center(), SketchLine_17.endPoint()) +SketchLine_18 = Sketch_2.addLine(0, 0, 2.193305912973027, -4.213301457541542) +SketchLine_18.setAuxiliary(True) +SketchConstraintCoincidence_43 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_44 = Sketch_2.setCoincident(SketchCircle_14.center(), SketchLine_18.endPoint()) +SketchConstraintAngle_4 = Sketch_2.setAngleBackward(SketchLine_9.result(), SketchLine_14.result(), "angle") +SketchConstraintAngle_5 = Sketch_2.setAngle(SketchLine_9.result(), SketchLine_13.result(), "angle") +SketchConstraintAngle_6 = Sketch_2.setAngleBackward(SketchLine_10.result(), SketchLine_15.result(), "angle") +SketchConstraintAngle_7 = Sketch_2.setAngleBackward(SketchLine_16.result(), SketchLine_10.result(), "angle") +SketchConstraintAngle_8 = Sketch_2.setAngle(SketchLine_17.result(), SketchLine_11.result(), "angle") +SketchConstraintAngle_9 = Sketch_2.setAngle(SketchLine_11.result(), SketchLine_18.result(), "angle") +SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchLine_19 = SketchProjection_5.createdFeature() +SketchCircle_15 = Sketch_2.addCircle(0, 5, 0.45) +SketchConstraintCoincidence_45 = Sketch_2.setCoincident(SketchLine_19.result(), SketchCircle_15.center()) +SketchConstraintRadius_4 = Sketch_2.setRadius(SketchCircle_15.results()[1], 0.45) +SketchLine_20 = Sketch_2.addLine(0, 0, 4.385635518227006, -2.793957963403483) +SketchLine_20.setAuxiliary(True) +SketchConstraintCoincidence_46 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_20.startPoint()) +SketchCircle_16 = Sketch_2.addCircle(3.373565783251674, -2.149198433387089, 0.3) +SketchConstraintCoincidence_47 = Sketch_2.setCoincident(SketchLine_20.result(), SketchCircle_16.center()) +SketchCircle_17 = Sketch_2.addCircle(4.385635518227006, -2.793957963403483, 0.5) +SketchConstraintCoincidence_48 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchCircle_17.center()) +SketchConstraintRadius_5 = Sketch_2.setRadius(SketchCircle_16.results()[1], 0.3) +SketchConstraintRadius_6 = Sketch_2.setRadius(SketchCircle_17.results()[1], 0.5) +SketchConstraintAngle_10 = Sketch_2.setAngleBackward(SketchLine_14.result(), SketchLine_20.result(), 35.00000000000006) +SketchConstraintDistance_1 = Sketch_2.setDistance(SketchCircle_15.center(), SketchLine_12.result(), 5, True) +SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_16.center(), SketchAPI_Line(SketchLine_19).startPoint(), 4, True) +SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_19).startPoint(), SketchCircle_17.center(), 5.2, True) +model.do() +ExtrusionCut_1_objects_1 = [model.selection("FACE", "Sketch_2/Face-SketchCircle_9_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_10_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_5_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_7_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_17_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_16_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")] +ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")]) +ExtrusionCut_2_objects_1 = [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_11_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_12_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_6_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_8_2f")] +ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_2_objects_1, model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_1_1")]) +Axis_4 = model.addAxis(Part_1_doc, 0, -1, -10) +ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_15_2f")], model.selection("EDGE", "Axis_1"), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")]) +ExtrusionCut_3.result().setDeflection(1e-005) +Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) +SketchLine_21 = Sketch_3.addLine(3.5, 2.508501119175777, 3.5, 4.934853156880259) +SketchLine_22 = Sketch_3.addLine(3.5, 4.934853156880259, 6.2, 4.934853156880259) +SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint()) +SketchLine_23 = Sketch_3.addLine(6.2, 4.934853156880259, 6.2, 3.008501119175777) +SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) +SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), False) +SketchLine_24 = SketchProjection_6.createdFeature() +SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_24.result()) +SketchLine_25 = Sketch_3.addLine(6.2, 3.008501119175777, 3.5, 2.508501119175777) +SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_25.endPoint()) +SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), False) +SketchLine_26 = SketchProjection_7.createdFeature() +SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_26.result()) +SketchConstraintCoincidence_55 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_26.result()) +SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_22.result()) +SketchConstraintCoincidence_56 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_24.result()) +SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), False) +SketchLine_27 = SketchProjection_8.createdFeature() +SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_25.result(), SketchLine_27.result()) +SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), False) +SketchLine_28 = SketchProjection_9.createdFeature() +SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_21.startPoint(), SketchLine_28.result(), 0.5, True) +model.do() +Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_13_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_14_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0) +Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_2_1")]) +Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_3_1")], [model.selection("SOLID", "Common_1_1"), model.selection("SOLID", "Common_1_2")]) +model.do() +model.testHaveNamingEdges(Cut_1, model, Part_1_doc) +model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2437.py b/src/ModelAPI/Test/TestWeakNaming2437.py new file mode 100644 index 000000000..6656fbe9d --- /dev/null +++ b/src/ModelAPI/Test/TestWeakNaming2437.py @@ -0,0 +1,192 @@ +## 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 +## + +# -*- coding: utf-8 -*- + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +model.addParameter(Part_1_doc, "BHD", "8", "Base Hole Diameter") +model.addParameter(Part_1_doc, "BHPD", "14", "Base Hole Plate Diameter") +model.addParameter(Part_1_doc, "BHPS", "2", "Base Hole Plate Thickness") +model.addParameter(Part_1_doc, "BHPFR", "BHPS/4*3", "Base Hole Plate Fillet Radius") +model.addParameter(Part_1_doc, "BPS", "6", "Base Plate Thickness") +model.addParameter(Part_1_doc, "Draft", "100", "Bracket Draft") +model.addParameter(Part_1_doc, "TDI", "14", "Tube Internal Diameter") +model.addParameter(Part_1_doc, "TDE", "TDI+8", "Tube External Diameter") +model.addParameter(Part_1_doc, "TL", "86", "Tube Length") +model.addParameter(Part_1_doc, "Width", "112", "Full Width of Base") +model.addParameter(Part_1_doc, "LegThick", "5") +model.addParameter(Part_1_doc, "BaseLegFillet", "3") +model.addParameter(Part_1_doc, "LegTopFillet", "2") +model.addParameter(Part_1_doc, "BottomCutFillet", "2") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) +SketchLine_1 = Sketch_1.addLine(0, 84.99999999999999, 11, 85) +SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_2 = SketchProjection_1.createdFeature() +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) +SketchLine_3 = Sketch_1.addLine(11, 85, 24.4927071104659, 8.479055466987994) +SketchLine_4 = Sketch_1.addLine(27.44713036948842, 6, 56, 6) +SketchLine_5 = Sketch_1.addLine(56, 6, 56, 0) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4") +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchLine_6 = SketchProjection_2.createdFeature() +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5") +SketchLine_7 = Sketch_1.addLine(56, 0, 20.91066030079079, 0) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6") +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_7") +SketchLine_8 = Sketch_1.addLine(20.91066030079079, 0, 17.67553693029129, 18.34729635533419) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_8") +SketchLine_9 = Sketch_1.addLine(15.70592142426623, 20, 0, 20) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_10") +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result()) +SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_4.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_4.endPoint(), SketchLine_6.result(), 6, True) +SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_9.endPoint(), SketchLine_6.result(), 20, True) +SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_2.result(), "Width/2", True) +SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_4.result(), SketchLine_3.result(), "Draft") +SketchArc_1 = Sketch_1.addArc(15.70592142426623, 18, 17.67553693029129, 18.34729635533419, 15.70592142426623, 20, False) +SketchPoint_1 = Sketch_1.addPoint(17.3841206866215, 20) +SketchPoint_1.setAuxiliary(True) +SketchConstraintDistance_4 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_3.result(), "LegThick", True) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_8.result()) +SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_11") +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.result()) +SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_12") +SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_13") +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_14") +SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_8.result()) +SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_9.result()) +SketchPoint_2 = Sketch_1.addPoint(11, 85) +SketchPoint_2.setAuxiliary(True) +SketchConstraintDistance_5 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_7.result(), 85, True) +SketchConstraintDistance_6 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_2.result(), "TDE/2", True) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.result()) +SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_15") +SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_3.result()) +SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_16") +SketchArc_2 = Sketch_1.addArc(27.44713036950173, 9.00000000000146, 24.4927071104659, 8.479055466987994, 27.44713036948842, 6, False) +SketchArc_2.setName("SketchArc_3") +SketchArc_2.result().setName("SketchArc_3") +SketchArc_2.results()[1].setName("SketchArc_3_2") +SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_19") +SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_20") +SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_3.result()) +SketchConstraintTangent_3.setName("SketchConstraintTangent_5") +SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_4.result()) +SketchConstraintTangent_4.setName("SketchConstraintTangent_6") +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], "BaseLegFillet") +SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], "LegTopFillet") +SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_8.result()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchPoint_2.coordinates()) +SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_17") +SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_18") +SketchConstraintMirror_1_objects = [SketchLine_3.result(), SketchLine_1.result(), SketchLine_4.result(), SketchLine_7.result(), SketchArc_2.results()[1], SketchLine_5.result(), SketchLine_8.result(), SketchLine_9.result(), SketchArc_1.results()[1]] +SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_2.result(), SketchConstraintMirror_1_objects) +[SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchArc_3, SketchLine_14, SketchLine_15, SketchLine_16, SketchArc_4] = SketchConstraintMirror_1.mirrored() +SketchArc_4.setName("SketchArc_5") +SketchArc_4.result().setName("SketchArc_5") +SketchArc_4.results()[1].setName("SketchArc_5_2") +SketchArc_3.setName("SketchArc_4") +SketchArc_3.result().setName("SketchArc_4") +SketchArc_3.results()[1].setName("SketchArc_4_2") +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) +SketchLine_17 = Sketch_2.addLine(-18, 39.99999999999999, 18, 39.99999999999999) +SketchLine_18 = Sketch_2.addLine(20, 37.99999999999999, 20, -5) +SketchLine_19 = Sketch_2.addLine(20, -5, -20, -5) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_22") +SketchLine_20 = Sketch_2.addLine(-20, -5, -20, 37.99999999999999) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_23") +SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_18.result()) +SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_20.result()) +SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_17.result()) +SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_19.result()) +SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_21 = SketchProjection_3.createdFeature() +SketchArc_5 = Sketch_2.addArc(18, 37.99999999999999, 20, 37.99999999999999, 18, 39.99999999999999, False) +SketchArc_5.setName("SketchArc_6") +SketchArc_5.result().setName("SketchArc_6") +SketchArc_5.results()[1].setName("SketchArc_6_2") +SketchPoint_3 = Sketch_2.addPoint(20, 40) +SketchPoint_3.setAuxiliary(True) +SketchConstraintDistance_7 = Sketch_2.setDistance(SketchPoint_3.coordinates(), SketchLine_21.result(), 40, True) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_17.result()) +SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_25") +SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_18.result()) +SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_26") +SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchArc_5.startPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_27") +SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_17.endPoint()) +SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_28") +SketchConstraintTangent_5 = Sketch_2.setTangent(SketchArc_5.results()[1], SketchLine_17.result()) +SketchConstraintTangent_5.setName("SketchConstraintTangent_7") +SketchConstraintTangent_6 = Sketch_2.setTangent(SketchArc_5.results()[1], SketchLine_18.result()) +SketchConstraintTangent_6.setName("SketchConstraintTangent_8") +SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_5.results()[1], "BottomCutFillet") +SketchArc_6 = Sketch_2.addArc(-18, 37.99999999999999, -18, 39.99999999999999, -20, 37.99999999999999, False) +SketchArc_6.setName("SketchArc_7") +SketchArc_6.result().setName("SketchArc_7") +SketchArc_6.results()[1].setName("SketchArc_7_2") +SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchArc_6.startPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_24") +SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchArc_6.endPoint(), SketchLine_20.endPoint()) +SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_29") +SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchLine_17.result()) +SketchConstraintTangent_7.setName("SketchConstraintTangent_9") +SketchConstraintTangent_8 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchLine_20.result()) +SketchConstraintTangent_8.setName("SketchConstraintTangent_10") +SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_6.results()[1], "BottomCutFillet") +SketchConstraintDistance_8 = Sketch_2.setDistance(SketchLine_19.startPoint(), SketchLine_21.result(), 5, True) +SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_22 = SketchProjection_4.createdFeature() +SketchConstraintDistance_9 = Sketch_2.setDistance(SketchLine_19.startPoint(), SketchLine_22.result(), "(TL/2-3)-20", True) +SketchConstraintDistance_10 = Sketch_2.setDistance(SketchLine_19.endPoint(), SketchLine_22.result(), "(TL/2-3)-20", True) +model.do() +Wire_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_11"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_10"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_4_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_12"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_14"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_13"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_15"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_5_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_16"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_3_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")] +Wire_1 = model.addWire(Part_1_doc, Wire_1_objects) +Wire_2_objects = [model.selection("EDGE", "Sketch_2/Edge-SketchLine_17"), model.selection("EDGE", "Sketch_2/Edge-SketchArc_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_20"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_19"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_18"), model.selection("EDGE", "Sketch_2/Edge-SketchArc_6_2")] +Wire_2 = model.addWire(Part_1_doc, Wire_2_objects) +Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_1_1")]) +Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_2_1")]) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection(), 10, 0) +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection(), 10, 0) +Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], [model.selection("SOLID", "Extrusion_1_1")]) +model.do() +model.testHaveNamingSubshapes(Smash_1, model, Part_1_doc) +model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2445.py b/src/ModelAPI/Test/TestWeakNaming2445.py new file mode 100644 index 000000000..b9145a046 --- /dev/null +++ b/src/ModelAPI/Test/TestWeakNaming2445.py @@ -0,0 +1,168 @@ +## 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 +## + +# -*- coding: utf-8 -*- + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +model.addParameter(Part_1_doc, "R1", "50") +model.addParameter(Part_1_doc, "L1", "100") +model.addParameter(Part_1_doc, "R2", "40") +model.addParameter(Part_1_doc, "L2", "50") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) +SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchPoint_1 = SketchProjection_1.createdFeature() +SketchCircle_1 = Sketch_1.addCircle(0, 0, 50) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "R1") +SketchLine_1 = Sketch_1.addLine(0, 49.99999999999999, 0, 31.81980515339405) +SketchLine_2 = Sketch_1.addLine(-1.202451477893311e-021, -31.81980515339534, 0, -50) +SketchLine_2.setName("SketchLine_3") +SketchLine_2.result().setName("SketchLine_3") +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4") +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_3 = SketchProjection_2.createdFeature() +SketchLine_3.setName("SketchLine_4") +SketchLine_3.result().setName("SketchLine_4") +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchLine_1.startPoint()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_1.result(), SketchLine_2.result()) +SketchLine_4 = Sketch_1.addLine(0, 31.81980515339405, 31.81980515339462, -6.650124210799604e-013) +SketchLine_4.setName("SketchLine_5") +SketchLine_4.result().setName("SketchLine_5") +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5") +SketchLine_5 = Sketch_1.addLine(31.81980515339462, -6.650124210799604e-013, -1.202451477893311e-021, -31.81980515339534) +SketchLine_5.setName("SketchLine_6") +SketchLine_5.result().setName("SketchLine_6") +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6") +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7") +SketchLine_6 = Sketch_1.addLine(-1.202451477893311e-021, -31.81980515339534, -31.8198051533955, -6.650124202329274e-013) +SketchLine_6.setName("SketchLine_7") +SketchLine_6.result().setName("SketchLine_7") +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8") +SketchLine_7 = Sketch_1.addLine(-31.8198051533955, -6.650124202329274e-013, -8.789247626282909e-013, 31.81980515339405) +SketchLine_7.setName("SketchLine_8") +SketchLine_7.result().setName("SketchLine_8") +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9") +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_7.result(), SketchLine_4.result()) +SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_5.result()) +SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result()) +SketchLine_8 = Sketch_1.addLine(-31.8198051533955, -6.650124202329274e-013, -50, -8.919190713816664e-015) +SketchLine_8.setName("SketchLine_9") +SketchLine_8.result().setName("SketchLine_9") +SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11") +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_12") +SketchLine_9 = Sketch_1.addLine(31.81980515339462, -6.650124210799604e-013, 50, -8.919190733668999e-015) +SketchLine_9.setName("SketchLine_10") +SketchLine_9.result().setName("SketchLine_10") +SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_13") +SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_14") +SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_6.result()) +SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_7.result(), SketchLine_5.result()) +SketchConstraintCollinear_2 = Sketch_1.setCollinear(SketchLine_8.result(), SketchLine_9.result()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_8.result()) +SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_8.result(), SketchLine_1.result()) +SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result()) +SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "R1*0.9") +SketchConstraintLength_1.setName("SketchConstraintLength_2") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "L1", "L1") +Extrusion_1.result().setName("tuyau_principal") +Extrusion_1.result().subResult(0).setName("Extrusion_1_1_1") +Extrusion_1.result().subResult(1).setName("Extrusion_1_1_2") +Extrusion_1.result().subResult(2).setName("Extrusion_1_1_3") +Extrusion_1.result().subResult(3).setName("Extrusion_1_1_4") +Extrusion_1.result().subResult(4).setName("Extrusion_1_1_5") +Rotation_1 = model.addRotation(Part_1_doc, [model.selection("COMPSOLID", "tuyau_principal")], model.selection("EDGE", "PartSet/OX"), 45) +Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) +SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchPoint_2 = SketchProjection_3.createdFeature() +SketchCircle_2 = Sketch_2.addCircle(0, 0, 40) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_15") +SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], "R2") +model.do() +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 0, "R1+L2") +Extrusion_2.result().setName("piquage") +Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "piquage")], [model.selection("COMPSOLID", "tuyau_principal")]) +Smash_1.result().setName("té") +Smash_1.result().setColor(153, 76, 153) +Smash_1.result().subResult(0).setName("Smash_1_1_1") +Smash_1.result().subResult(0).setColor(51, 102, 51) +Smash_1.result().subResult(1).setName("Smash_1_1_2") +Smash_1.result().subResult(1).setColor(0, 204, 0) +Smash_1.result().subResult(2).setName("Smash_1_1_3") +Smash_1.result().subResult(2).setColor(204, 102, 204) +Smash_1.result().subResult(3).setName("Smash_1_1_4") +Smash_1.result().subResult(3).setColor(204, 102, 204) +Smash_1.result().subResult(4).setName("Smash_1_1_5") +Smash_1.result().subResult(4).setColor(204, 0, 204) +Smash_1.result().subResult(5).setName("Smash_1_1_6") +Smash_1.result().subResult(5).setColor(76, 76, 153) +Recover_1 = model.addRecover(Part_1_doc, Smash_1, [Extrusion_2.result(), Rotation_1.result()]) +Recover_1.result().setName("tuyau_principal") +Recover_1.result().subResult(0).setName("Recover_1_1_1") +Recover_1.result().subResult(1).setName("Recover_1_1_2") +Recover_1.result().subResult(2).setName("Recover_1_1_3") +Recover_1.result().subResult(3).setName("Recover_1_1_4") +Recover_1.result().subResult(4).setName("Recover_1_1_5") +Recover_1.results()[1].setName("piquage") +Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("COMPSOLID", "tuyau_principal"), model.selection("SOLID", "piquage")]) +Intersection_1.result().setName("intersection") +Intersection_1.result().subResult(0).setName("Intersection_1_1_1") +Intersection_1.result().subResult(1).setName("Intersection_1_1_2") +Intersection_1.result().subResult(2).setName("Intersection_1_1_3") +Intersection_1.result().subResult(3).setName("Intersection_1_1_4") +Intersection_1.result().subResult(4).setName("Intersection_1_1_5") +Intersection_1.result().subResult(5).setName("Intersection_1_1_6") +Intersection_1.result().subResult(6).setName("Intersection_1_1_7") +Intersection_1.result().subResult(7).setName("Intersection_1_1_8") +Intersection_1.result().subResult(8).setName("Intersection_1_1_9") +Intersection_1.result().subResult(9).setName("Intersection_1_1_10") +Intersection_1.result().subResult(10).setName("Intersection_1_1_11") +Intersection_1.result().subResult(11).setName("Intersection_1_1_12") +Intersection_1.result().subResult(12).setName("Intersection_1_1_13") +Intersection_1.result().subResult(13).setName("Intersection_1_1_14") +Intersection_1.result().subResult(14).setName("Intersection_1_1_15") +Intersection_1.result().subResult(15).setName("Intersection_1_1_16") +Intersection_1.result().subResult(16).setName("Intersection_1_1_17") +Edge_1_objects = [model.selection("EDGE", "Intersection_1_1_3"), model.selection("EDGE", "Intersection_1_1_12"), model.selection("EDGE", "Intersection_1_1_14"), model.selection("EDGE", "Intersection_1_1_5"), model.selection("EDGE", "Intersection_1_1_1")] +Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) +Edge_1.results()[1].setName("intersection_1") +Edge_1.results()[2].setName("intersection_2") +Edge_1.results()[3].setName("intersection_3") +Edge_1.results()[4].setName("intersection_4") +model.do() +model.testHaveNamingSubshapes(Edge_1, model, Part_1_doc) +model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2446.py b/src/ModelAPI/Test/TestWeakNaming2446.py new file mode 100644 index 000000000..331d753c0 --- /dev/null +++ b/src/ModelAPI/Test/TestWeakNaming2446.py @@ -0,0 +1,46 @@ +## 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 +## + +from salome.shaper import model + +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")) +SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchPoint_1 = SketchProjection_1.createdFeature() +SketchCircle_1 = Sketch_1.addCircle(0, 0, 40) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 40) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) +SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchPoint_2 = SketchProjection_2.createdFeature() +SketchCircle_2 = Sketch_2.addCircle(0, 0, 40) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchCircle_2.center()) +SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], 40) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 10, 10) +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 10) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], [model.selection("SOLID", "Extrusion_1_1")]) +model.do() +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2452.py b/src/ModelAPI/Test/TestWeakNaming2452.py new file mode 100644 index 000000000..21caaa1da --- /dev/null +++ b/src/ModelAPI/Test/TestWeakNaming2452.py @@ -0,0 +1,96 @@ +## 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 +## + +from salome.shaper import model + +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")) +SketchLine_1 = Sketch_1.addLine(-20.13803680981595, 73.73619631901842, -73.42638036809818, 73.73619631901842) +SketchLine_2 = Sketch_1.addLine(-73.42638036809818, 73.73619631901842, -73.42638036809818, 32.22085889570552) +SketchLine_3 = Sketch_1.addLine(-73.42638036809818, 32.22085889570552, -20.13803680981595, 32.22085889570552) +SketchLine_4 = Sketch_1.addLine(-20.13803680981595, 32.22085889570552, -20.13803680981595, 73.73619631901842) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchLine_5 = Sketch_1.addLine(82.41104294478531, 71.56748466257669, 24.47546012269937, 71.56748466257669) +SketchLine_6 = Sketch_1.addLine(24.47546012269937, 71.56748466257669, 24.47546012269937, 17.96932515337424) +SketchLine_7 = Sketch_1.addLine(24.47546012269937, 17.96932515337424, 82.41104294478531, 17.96932515337424) +SketchLine_8 = Sketch_1.addLine(82.41104294478531, 17.96932515337424, 82.41104294478531, 71.56748466257669) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) +SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) +SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) +SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result()) +SketchLine_9 = Sketch_1.addLine(-0.3098159509202501, -18.89877300613497, -69.70858895705524, -18.89877300613497) +SketchLine_10 = Sketch_1.addLine(-69.70858895705524, -18.89877300613497, -69.70858895705524, -72.80674846625769) +SketchLine_11 = Sketch_1.addLine(-69.70858895705524, -72.80674846625769, -0.3098159509202501, -72.80674846625769) +SketchLine_12 = Sketch_1.addLine(-0.3098159509202501, -72.80674846625769, -0.3098159509202501, -18.89877300613497) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_9.result()) +SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_10.result()) +SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_11.result()) +SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_12.result()) +SketchLine_13 = Sketch_1.addLine(74.04601226993866, -25.09509202453988, 29.74233128834356, -25.09509202453988) +SketchLine_14 = Sketch_1.addLine(29.74233128834356, -25.09509202453988, 29.74233128834356, -77.45398773006136) +SketchLine_15 = Sketch_1.addLine(29.74233128834356, -77.45398773006136, 74.04601226993866, -77.45398773006136) +SketchLine_16 = Sketch_1.addLine(74.04601226993866, -77.45398773006136, 74.04601226993866, -25.09509202453988) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_13.result()) +SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_14.result()) +SketchConstraintHorizontal_8 = Sketch_1.setHorizontal(SketchLine_15.result()) +SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_16.result()) +SketchLine_17 = Sketch_1.addLine(52.66871165644174, 52.66871165644174, -42.75460122699386, 52.66871165644174) +SketchLine_18 = Sketch_1.addLine(-42.75460122699386, 52.66871165644174, -42.75460122699386, -41.51533742331289) +SketchLine_19 = Sketch_1.addLine(-42.75460122699386, -41.51533742331289, 52.66871165644174, -41.51533742331289) +SketchLine_20 = Sketch_1.addLine(52.66871165644174, -41.51533742331289, 52.66871165644174, 52.66871165644174) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintHorizontal_9 = Sketch_1.setHorizontal(SketchLine_17.result()) +SketchConstraintVertical_9 = Sketch_1.setVertical(SketchLine_18.result()) +SketchConstraintHorizontal_10 = Sketch_1.setHorizontal(SketchLine_19.result()) +SketchConstraintVertical_10 = Sketch_1.setVertical(SketchLine_20.result()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 100) +Translation_1 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1")], model.selection("EDGE", "Extrusion_1_1/Generated_Face_24&Extrusion_1_1/To_Face_2"), 200) +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 50) +Translation_2 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_2_1")], model.selection("EDGE", "Extrusion_2_1/Generated_Face_24&Extrusion_2_1/To_Face_2"), 150) +Boolean_1 = model.addCut(Part_1_doc, [model.selection("COMPSOLID", "Translation_1_1")], [model.selection("COMPSOLID", "Translation_2_1")]) +model.do() +model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc) +model.end() diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp index 92eaa64f2..e7b03dd00 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp @@ -1094,8 +1094,9 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( myDumpBuffer << anIndex << "\", "; *this << aMiddlePoint; aStandardDump = false; - } if (myWeakNamingSelection && aShape.get() && theAttrSelect->context().get() && - aShape != theAttrSelect->context()->shape()) { // weak naming for local selection only + } if (theAttrSelect->isWeakNaming() || + (myWeakNamingSelection && aShape.get() && theAttrSelect->context().get() && + aShape != theAttrSelect->context()->shape())) { // weak naming for local selection only GeomAlgoAPI_NExplode aNExplode(theAttrSelect->context()->shape(), aShape->shapeType()); int anIndex = aNExplode.index(aShape); if (anIndex != 0) { // found a week-naming index, so, export it -- 2.39.2