From: vsv Date: Mon, 14 Jan 2019 15:46:25 +0000 (+0300) Subject: Issue #2833: Update example scripts X-Git-Tag: Jan2019~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ae8ad4bb8ad8dbad63b72814a40064f74588e690;p=modules%2Fshaper.git Issue #2833: Update example scripts --- diff --git a/src/BuildPlugin/doc/examples/compound.py b/src/BuildPlugin/doc/examples/compound.py index 0394678d5..ef01e11f3 100644 --- a/src/BuildPlugin/doc/examples/compound.py +++ b/src/BuildPlugin/doc/examples/compound.py @@ -7,10 +7,7 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Compound_1_objects = [model.selection("FACE", "Box_1_1/Front"), - model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top"), - model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top"), - model.selection("EDGE", "Box_1_1/Back&Box_1_1/Top")] +Compound_1_objects = [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/edge.py b/src/BuildPlugin/doc/examples/edge.py index 38f025468..24dccbb20 100644 --- a/src/BuildPlugin/doc/examples/edge.py +++ b/src/BuildPlugin/doc/examples/edge.py @@ -7,9 +7,6 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Edge_1_objects = [model.selection("EDGE", "Box_1_1/Front&Box_1_1/Top"), - model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top"), - model.selection("EDGE", "Box_1_1/Front&Box_1_1/Left")] -Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) +Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")]) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/filling.py b/src/BuildPlugin/doc/examples/filling.py index d912bd387..b95a1ec1d 100644 --- a/src/BuildPlugin/doc/examples/filling.py +++ b/src/BuildPlugin/doc/examples/filling.py @@ -7,8 +7,6 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Edges = [model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top"), - model.selection("EDGE", "Box_1_1/Front&Box_1_1/Top")] -Filling_1 = model.addFilling(Part_1_doc, Edges) +Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]")]) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/interpolation.py b/src/BuildPlugin/doc/examples/interpolation.py index be911ea94..9001d465f 100644 --- a/src/BuildPlugin/doc/examples/interpolation.py +++ b/src/BuildPlugin/doc/examples/interpolation.py @@ -7,10 +7,7 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Interpolation_1_objects = [model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top"), - model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top"), - model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top"), - model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top")] +Interpolation_1_objects = [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]")] Interpolation_1 = model.addInterpolation(Part_1_doc, Interpolation_1_objects, True, False) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/polyline.py b/src/BuildPlugin/doc/examples/polyline.py index 9596db811..4f54f0123 100644 --- a/src/BuildPlugin/doc/examples/polyline.py +++ b/src/BuildPlugin/doc/examples/polyline.py @@ -9,7 +9,7 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Point_2 = model.addPoint(Part_1_doc, -10, -5, -7) Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")]) -Polyline_1_objects = [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Bottom"), model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top"), model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top"), model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Right&Box_1_1/Bottom")] +Polyline_1_objects = [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]")] Polyline_1 = model.addPolyline3D(Part_1_doc, Polyline_1_objects, False) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/vertex.py b/src/BuildPlugin/doc/examples/vertex.py index ea2979b7f..2b0c5ce65 100644 --- a/src/BuildPlugin/doc/examples/vertex.py +++ b/src/BuildPlugin/doc/examples/vertex.py @@ -7,11 +7,7 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Vertex_1_objects = [model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top"), - model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top"), - model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top"), - model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Bottom"), - model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Bottom")] +Vertex_1_objects = [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]")] Vertex_1 = model.addVertex(Part_1_doc, Vertex_1_objects) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/wire.py b/src/BuildPlugin/doc/examples/wire.py index 36497d8ff..47925a3e1 100644 --- a/src/BuildPlugin/doc/examples/wire.py +++ b/src/BuildPlugin/doc/examples/wire.py @@ -7,10 +7,7 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Wire_1_objects = [model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top"), - model.selection("EDGE", "Box_1_1/Front&Box_1_1/Top"), - model.selection("EDGE", "Box_1_1/Right&Box_1_1/Top"), - model.selection("EDGE", "Box_1_1/Back&Box_1_1/Top")] +Wire_1_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]")] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects) model.do() model.end() diff --git a/src/CollectionPlugin/doc/examoles/field.py b/src/CollectionPlugin/doc/examoles/field.py deleted file mode 100644 index f0d917ae7..000000000 --- a/src/CollectionPlugin/doc/examoles/field.py +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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) -Field_1 = model.addField(Part_1_doc, 2, "DOUBLE", 2, ["DX", "DY"], [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Top")]) -Field_1.addStep(0, 0, [[0.1, 0.2], [2.1, 1.7], [3.7, 1.95]]) -Field_1.addStep(1, 31, [[0.1, 0.2], [1.1, 2.1], [0.75, 3.1]]) -model.do() -model.end() diff --git a/src/CollectionPlugin/doc/examoles/group.py b/src/CollectionPlugin/doc/examoles/group.py deleted file mode 100644 index 5c42ca401..000000000 --- a/src/CollectionPlugin/doc/examoles/group.py +++ /dev/null @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- - -from salome.shaper import model - -model.begin() -partSet = model.moduleDocument() -Part_1 = model.addPart(partSet) -Part_1_doc = Part_1.document() -Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) -Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Cone_1_1/Face_1&Cone_1_1/Face_2"), model.selection("EDGE", "Cone_1_1/Face_1")]) -Group_1.setName("edges_cone") -Group_1.result().setName("edges_cone") -model.do() -model.end() diff --git a/src/CollectionPlugin/doc/examples/field.py b/src/CollectionPlugin/doc/examples/field.py new file mode 100644 index 000000000..6ba1b0a32 --- /dev/null +++ b/src/CollectionPlugin/doc/examples/field.py @@ -0,0 +1,15 @@ +# -*- 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) +Field_1_objects = [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Front")] +Field_1 = model.addField(Part_1_doc, 2, "DOUBLE", 2, ["Comp 1", "Comp 2"], Field_1_objects) +Field_1.addStep(0, 0, [[0, 0], [0.1, 0.2], [2.1, 1.7], [3.7, 1.95]]) +Field_1.addStep(1, 0, [[0, 0], [0.1, 0.2], [1.1, 2.1], [0.75, 3.1]]) +model.do() +model.end() diff --git a/src/CollectionPlugin/doc/examples/group.py b/src/CollectionPlugin/doc/examples/group.py new file mode 100644 index 000000000..c66c5b179 --- /dev/null +++ b/src/CollectionPlugin/doc/examples/group.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) +Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Cone_1_1/Face_1][Cone_1_1/Face_2]"), model.selection("EDGE", "[Cone_1_1/Face_1][Cone_1_1/Face_3]")]) +Group_1.result().setName("edges_cone") +model.do() +model.end() diff --git a/src/ConstructionPlugin/doc/examples/plane1.py b/src/ConstructionPlugin/doc/examples/plane1.py index 576189911..416292fdd 100644 --- a/src/ConstructionPlugin/doc/examples/plane1.py +++ b/src/ConstructionPlugin/doc/examples/plane1.py @@ -7,6 +7,6 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top"), model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top"), model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Bottom")) +Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]")) model.do() model.end() diff --git a/src/ConstructionPlugin/doc/examples/plane2.py b/src/ConstructionPlugin/doc/examples/plane2.py index fe351d87e..6e5475625 100644 --- a/src/ConstructionPlugin/doc/examples/plane2.py +++ b/src/ConstructionPlugin/doc/examples/plane2.py @@ -7,6 +7,6 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Box_1_1/Front&Box_1_1/Top"), model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top"), False) +Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]"), False) model.do() model.end() diff --git a/src/ConstructionPlugin/doc/examples/point2.py b/src/ConstructionPlugin/doc/examples/point2.py index 41fa8768c..f73127ca5 100644 --- a/src/ConstructionPlugin/doc/examples/point2.py +++ b/src/ConstructionPlugin/doc/examples/point2.py @@ -7,6 +7,6 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Box_1_1/Front&Box_1_1/Left"), 0.4, True, False) +Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), 0.4, True, False) model.do() model.end() diff --git a/src/ConstructionPlugin/doc/examples/point4.py b/src/ConstructionPlugin/doc/examples/point4.py index 0d2819227..88e2cc32a 100644 --- a/src/ConstructionPlugin/doc/examples/point4.py +++ b/src/ConstructionPlugin/doc/examples/point4.py @@ -7,8 +7,8 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Bottom"), model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top")) -Axis_5 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom"), model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top")) +Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]")) +Axis_5 = model.addAxis(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]")) Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("EDGE", "Axis_2")) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/fillet1.py b/src/FeaturesPlugin/doc/examples/fillet1.py index 67299d876..80cce185b 100644 --- a/src/FeaturesPlugin/doc/examples/fillet1.py +++ b/src/FeaturesPlugin/doc/examples/fillet1.py @@ -7,6 +7,7 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("FACE", "Box_1_1/Front"), model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top")], 2) +Fillet_1_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]")] +Fillet_1 = model.addFillet(Part_1_doc, Fillet_1_objects, 2) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/fillet2.py b/src/FeaturesPlugin/doc/examples/fillet2.py index a72a7ec78..465fbcd9d 100644 --- a/src/FeaturesPlugin/doc/examples/fillet2.py +++ b/src/FeaturesPlugin/doc/examples/fillet2.py @@ -7,6 +7,6 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top")], 1, 3) +Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")], 1, 3) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/fuse_faces.py b/src/FeaturesPlugin/doc/examples/fuse_faces.py index 888480992..ed41166ea 100644 --- a/src/FeaturesPlugin/doc/examples/fuse_faces.py +++ b/src/FeaturesPlugin/doc/examples/fuse_faces.py @@ -33,10 +33,9 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_7r-SketchLine_8f")], model.selection(), 0, 50) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")]) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_8f-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r_wire")], model.selection(), 50, 0) +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 0, 50) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")]) FusionFaces_1 = model.addFusionFaces(Part_1_doc, model.selection("SOLID", "Fuse_1_1")) -Export_1 = model.exportToXAO(Part_1_doc, '/tmp/shaper_gjzkis0q.xao', 'automatic_shaper_export_to_XAO') model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/pipe_binormal.py b/src/FeaturesPlugin/doc/examples/pipe_binormal.py index 68fc2bca4..93bb0ce86 100644 --- a/src/FeaturesPlugin/doc/examples/pipe_binormal.py +++ b/src/FeaturesPlugin/doc/examples/pipe_binormal.py @@ -8,13 +8,9 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(72.2418524871355, 29.96679215537161, -69.82505995666611, 29.96679215537161) -SketchLine_1.result().setColor(225, 0, 0) SketchLine_2 = Sketch_1.addLine(-69.82505995666611, 29.96679215537161, -69.82505995666611, -40.02291624943114) -SketchLine_2.result().setColor(225, 0, 0) SketchLine_3 = Sketch_1.addLine(-69.82505995666611, -40.02291624943114, 72.2418524871355, -40.02291624943114) -SketchLine_3.result().setColor(225, 0, 0) SketchLine_4 = Sketch_1.addLine(72.2418524871355, -40.02291624943114, 72.2418524871355, 29.96679215537161) -SketchLine_4.result().setColor(225, 0, 0) 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()) @@ -28,7 +24,6 @@ Point_2 = model.addPoint(Part_1_doc, 0, 100, 40) Point_3 = model.addPoint(Part_1_doc, 0, 260, 60) Interpolation_1_objects = [model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")] Interpolation_1 = model.addInterpolation(Part_1_doc, Interpolation_1_objects, False, False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")]) -Pipe_1 = model.addPipe(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection("EDGE", "Interpolation_1_1"), model.selection("EDGE", "PartSet/OX")) +Pipe_1 = model.addPipe(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection("EDGE", "Interpolation_1_1"), model.selection("EDGE", "PartSet/OX")) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/pipe_locations.py b/src/FeaturesPlugin/doc/examples/pipe_locations.py index 52386bd1b..331513136 100644 --- a/src/FeaturesPlugin/doc/examples/pipe_locations.py +++ b/src/FeaturesPlugin/doc/examples/pipe_locations.py @@ -20,13 +20,13 @@ model.do() Sketch_3 = model.addSketch(Part_2_doc, model.selection("FACE", "Plane_2")) SketchCircle_3 = Sketch_3.addCircle(121.2811188302094, -19.85285601110755, 120.5601403551194) model.do() -Interpolation_1_objects = [model.selection("VERTEX", "Sketch_1/Vertex-SketchCircle_1"), model.selection("VERTEX", "Sketch_2/Vertex-SketchCircle_2"), model.selection("VERTEX", "Sketch_3/Vertex-SketchCircle_3")] +Interpolation_1_objects = [model.selection("VERTEX", "Sketch_1/SketchCircle_1"), model.selection("VERTEX", "Sketch_2/SketchCircle_2"), model.selection("VERTEX", "Sketch_3/SketchCircle_3")] Interpolation_1 = model.addInterpolation(Part_2_doc, Interpolation_1_objects, False, False) -Vertex_1 = model.addVertex(Part_2_doc, [model.selection("VERTEX", "Sketch_2/Vertex-SketchCircle_2")]) +Vertex_1 = model.addVertex(Part_2_doc, [model.selection("VERTEX", "Sketch_2/SketchCircle_2")]) Partition_1 = model.addPartition(Part_2_doc, [model.selection("EDGE", "Interpolation_1_1"), model.selection("VERTEX", "Vertex_1_1")]) Wire_1 = model.addWire(Part_2_doc, [model.selection("EDGE", "Partition_1_1_1"), model.selection("EDGE", "Partition_1_1_2")]) -Pipe_1_objects_2 = [model.selection("VERTEX", "Interpolation_1_1/Vertex_1"), model.selection("VERTEX", "Vertex_1_1/Vertex_1_1_1"), model.selection("VERTEX", "Interpolation_1_1/Vertex_2")] -Pipe_1_objects_1 = [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f"), model.selection("FACE", "Sketch_3/Face-SketchCircle_3_2f")] +Pipe_1_objects_2 = [model.selection("VERTEX", "Interpolation_1_1/Vertex_1_2"), model.selection("VERTEX", "Interpolation_1_1/Vertex_1_1"), model.selection("VERTEX", "Vertex_1_1/Vertex_1_1&Sketch_2/SketchCircle_2")] +Pipe_1_objects_1 = [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_2_2r_wire"), model.selection("FACE", "Sketch_3/Face-SketchCircle_3_2r")] Pipe_1 = model.addPipe(Part_2_doc, Pipe_1_objects_1, model.selection("WIRE", "Wire_1_1"), Pipe_1_objects_2) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/pipe_simple.py b/src/FeaturesPlugin/doc/examples/pipe_simple.py index 5deb47e2c..05be8a283 100644 --- a/src/FeaturesPlugin/doc/examples/pipe_simple.py +++ b/src/FeaturesPlugin/doc/examples/pipe_simple.py @@ -11,25 +11,19 @@ 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() -SketchPoint_1.result().setColor(170, 0, 225) SketchCircle_1 = Sketch_1.addCircle(0, 0, 40) -SketchCircle_1.result().setColor(225, 0, 0) -SketchCircle_1.results()[1].setColor(225, 0, 0) SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 40) model.do() -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")]) +Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")]) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) SketchLine_1 = SketchProjection_2.createdFeature() -SketchLine_1.result().setColor(170, 0, 225) SketchArc_1 = Sketch_2.addArc(30, 0, 0, 0, 40.50885209855912, 28.09918197333542, True) -SketchArc_1.result().setColor(225, 0, 0) -SketchArc_1.results()[1].setColor(225, 0, 0) SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.result(), SketchArc_1.center()) SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchArc_1.startPoint()) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_1.results()[1], 30) model.do() -Pipe_1 = model.addPipe(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "Sketch_2/Edge-SketchArc_1_2")) +Pipe_1 = model.addPipe(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "Sketch_2/SketchArc_1_2")) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/placement.py b/src/FeaturesPlugin/doc/examples/placement.py index d74ab4d23..433d523da 100644 --- a/src/FeaturesPlugin/doc/examples/placement.py +++ b/src/FeaturesPlugin/doc/examples/placement.py @@ -10,12 +10,7 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front")) SketchCircle_1 = Sketch_1.addCircle(20, 6, 3) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, - [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], - model.selection(), -10, 0) -Placement_1 = model.addPlacement(Part_1_doc, - [model.selection("SOLID", "Extrusion_1_1")], - model.selection("FACE", "Extrusion_1_1/From_Face_1"), - model.selection("FACE", "Box_1_1/Front"), False, True) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), -10, 0) +Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("FACE", "Extrusion_1_1/From_Face"), model.selection("FACE", "Box_1_1/Front"), False, True) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/revolution_cut_by_angles.py b/src/FeaturesPlugin/doc/examples/revolution_cut_by_angles.py index 295a9493c..213b5501d 100644 --- a/src/FeaturesPlugin/doc/examples/revolution_cut_by_angles.py +++ b/src/FeaturesPlugin/doc/examples/revolution_cut_by_angles.py @@ -10,11 +10,6 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) SketchCircle_1 = Sketch_1.addCircle(5, 5, 2.5) model.do() -RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, - [model.selection("COMPOUND", "Sketch_1")], - model.selection("EDGE", "Box_1_1/Front&Box_1_1/Top"), - 0, - 90, - [model.selection("SOLID", "Box_1_1")]) +RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), 0, 90, [model.selection("SOLID", "Box_1_1")]) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/revolution_cut_by_bounding_planes.py b/src/FeaturesPlugin/doc/examples/revolution_cut_by_bounding_planes.py index fba7ef081..bf0c00f2a 100644 --- a/src/FeaturesPlugin/doc/examples/revolution_cut_by_bounding_planes.py +++ b/src/FeaturesPlugin/doc/examples/revolution_cut_by_bounding_planes.py @@ -10,13 +10,6 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) SketchCircle_1 = Sketch_1.addCircle(5, 5, 2.5) model.do() -RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, - [model.selection("COMPOUND", "Sketch_1")], - model.selection("EDGE", "Box_1_1/Front&Box_1_1/Top"), - model.selection(), - 0, - model.selection("FACE", "Box_1_1/Front"), - 0, - [model.selection("SOLID", "Box_1_1")]) +RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection(), 0, model.selection("FACE", "Box_1_1/Front"), 0, [model.selection("SOLID", "Box_1_1")]) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/revolution_fuse_by_angles.py b/src/FeaturesPlugin/doc/examples/revolution_fuse_by_angles.py index 145a9a0fb..5aafe07fb 100644 --- a/src/FeaturesPlugin/doc/examples/revolution_fuse_by_angles.py +++ b/src/FeaturesPlugin/doc/examples/revolution_fuse_by_angles.py @@ -10,11 +10,6 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) SketchCircle_1 = Sketch_1.addCircle(5, 5, 2.5) model.do() -RevolutionCut_1 = model.addRevolutionFuse(Part_1_doc, - [model.selection("COMPOUND", "Sketch_1")], - model.selection("EDGE", "Box_1_1/Front&Box_1_1/Top"), - 90, - 0, - [model.selection("SOLID", "Box_1_1")]) +RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), 90, 0, [model.selection("SOLID", "Box_1_1")]) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/revolution_fuse_by_bounding_planes.py b/src/FeaturesPlugin/doc/examples/revolution_fuse_by_bounding_planes.py index 3e2c2e0ec..65ee5cd7a 100644 --- a/src/FeaturesPlugin/doc/examples/revolution_fuse_by_bounding_planes.py +++ b/src/FeaturesPlugin/doc/examples/revolution_fuse_by_bounding_planes.py @@ -10,13 +10,6 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) SketchCircle_1 = Sketch_1.addCircle(5, 5, 2.5) model.do() -RevolutionCut_1 = model.addRevolutionFuse(Part_1_doc, - [model.selection("COMPOUND", "Sketch_1")], - model.selection("EDGE", "Box_1_1/Front&Box_1_1/Top"), - model.selection("FACE", "Box_1_1/Front"), - 0, - model.selection(), - 0, - [model.selection("SOLID", "Box_1_1")]) +RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("FACE", "Box_1_1/Front"), 0, model.selection(), 0, [model.selection("SOLID", "Box_1_1")]) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/rotation2.py b/src/FeaturesPlugin/doc/examples/rotation2.py index 489541f93..68f242c6a 100644 --- a/src/FeaturesPlugin/doc/examples/rotation2.py +++ b/src/FeaturesPlugin/doc/examples/rotation2.py @@ -7,6 +7,6 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Cone_1_1/Face_1&Cone_1_1/Face_3"), model.selection("VERTEX", "Cone_1_1/Face_1&Cone_1_1/Face_2")) +Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "[Cone_1_1/Face_1][Cone_1_1/Face_3]"), model.selection("VERTEX", "[Cone_1_1/Face_1][Cone_1_1/Face_2]")) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/symmetryaxis.py b/src/FeaturesPlugin/doc/examples/symmetryaxis.py index 3ceb146fe..ac042b770 100644 --- a/src/FeaturesPlugin/doc/examples/symmetryaxis.py +++ b/src/FeaturesPlugin/doc/examples/symmetryaxis.py @@ -7,6 +7,6 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "Cylinder_1_1/Face_1"), False) +Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "([Cylinder_1_1/Face_1][Cylinder_1_1/Face_2])([Cylinder_1_1/Face_1][Cylinder_1_1/Face_3])"), False) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/translation2points.py b/src/FeaturesPlugin/doc/examples/translation2points.py index d06a7ecad..955e212de 100644 --- a/src/FeaturesPlugin/doc/examples/translation2points.py +++ b/src/FeaturesPlugin/doc/examples/translation2points.py @@ -7,6 +7,6 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Cone_1_1/Face_1&Cone_1_1/Face_2")) +Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "[Cone_1_1/Face_1][Cone_1_1/Face_2]")) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/translationvector.py b/src/FeaturesPlugin/doc/examples/translationvector.py index 5ebee45fa..19a488772 100644 --- a/src/FeaturesPlugin/doc/examples/translationvector.py +++ b/src/FeaturesPlugin/doc/examples/translationvector.py @@ -7,6 +7,6 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("EDGE", "Cone_1_1/Face_1"), 40) +Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("EDGE", "([Cone_1_1/Face_1][Cone_1_1/Face_2])([Cone_1_1/Face_1][Cone_1_1/Face_3])"), 40) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/union.py b/src/FeaturesPlugin/doc/examples/union.py index f5ce125b4..d4336f5ab 100644 --- a/src/FeaturesPlugin/doc/examples/union.py +++ b/src/FeaturesPlugin/doc/examples/union.py @@ -23,12 +23,7 @@ SketchLine_5 = Sketch_1.addLine(3, -15, 36, -56) SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, - [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_5r"), - model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f")], - model.selection(), 10, 0) -Union_1 = model.addUnion(Part_1_doc, - [model.selection("SOLID", "Extrusion_1_1_1"), - model.selection("SOLID", "Extrusion_1_1_2")]) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_5f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 0) +Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")]) model.do() model.end() diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index afe020112..4d31da36c 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -948,6 +948,8 @@ bool ModuleBase_WidgetMultiSelector::findInSelection(const ObjectPtr& theObject, const std::map >& theGeomSelection, ModuleBase_IWorkshop* theWorkshop) { + if (!theObject.get()) + return false; // issue #2154: we should not remove from list objects hidden in the viewer if selection // was done with SHIFT button if (theWorkshop->hasSHIFTPressed() && !theObject->isDisplayed())