From: gzy Date: Mon, 24 Sep 2018 13:10:37 +0000 (+0300) Subject: pipe and measurement X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3b792f1403d42022260097c1982553a4093eea2d;p=modules%2Fshaper.git pipe and measurement --- diff --git a/src/FeaturesPlugin/doc/TUI_pipebinormalFeature.rst b/src/FeaturesPlugin/doc/TUI_pipebinormalFeature.rst new file mode 100644 index 000000000..5b2f289a9 --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_pipebinormalFeature.rst @@ -0,0 +1,11 @@ + + .. _tui_binormal_pipe: + +Pipe by object, path and Bi-normal +================================== + +.. literalinclude:: examples/pipe_binormal.py + :linenos: + :language: python + +:download:`Download this script ` \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/TUI_pipelocationsFeature.rst b/src/FeaturesPlugin/doc/TUI_pipelocationsFeature.rst new file mode 100644 index 000000000..611de087d --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_pipelocationsFeature.rst @@ -0,0 +1,11 @@ + + .. _tui_locations_pipe: + +Pipe by object, path and locations +================================== + +.. literalinclude:: examples/pipe_locations.py + :linenos: + :language: python + +:download:`Download this script ` \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/TUI_pipesimpleFeature.rst b/src/FeaturesPlugin/doc/TUI_pipesimpleFeature.rst new file mode 100644 index 000000000..b65adf293 --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_pipesimpleFeature.rst @@ -0,0 +1,11 @@ + + .. _tui_simple_pipe: + +Pipe by object and path +======================= + +.. literalinclude:: examples/pipe_simple.py + :linenos: + :language: python + +:download:`Download this script ` \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/examples/pipe_binormal.py b/src/FeaturesPlugin/doc/examples/pipe_binormal.py new file mode 100644 index 000000000..68fc2bca4 --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/pipe_binormal.py @@ -0,0 +1,34 @@ +# -*- 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("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()) +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() +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")) +model.do() +model.end() diff --git a/src/FeaturesPlugin/doc/examples/pipe_locations.py b/src/FeaturesPlugin/doc/examples/pipe_locations.py new file mode 100644 index 000000000..a059ece20 --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/pipe_locations.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 100, False) +Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), 120, False) +Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) +SketchCircle_1 = Sketch_1.addCircle(-17.96171526586622, -340.274716981132, 71.31826129521251) +SketchCircle_1.result().setColor(225, 0, 0) +SketchCircle_1.results()[1].setColor(225, 0, 0) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) +SketchCircle_2 = Sketch_2.addCircle(46.42844892447576, -229.9982953588847, 114.4484521366094) +SketchCircle_2.result().setColor(225, 0, 0) +SketchCircle_2.results()[1].setColor(225, 0, 0) +model.do() +Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) +SketchCircle_3 = Sketch_3.addCircle(121.2811188302094, -19.85285601110755, 120.5601403551194) +SketchCircle_3.result().setColor(225, 0, 0) +SketchCircle_3.results()[1].setColor(225, 0, 0) +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 = model.addInterpolation(Part_1_doc, Interpolation_1_objects, False, False) +Edge_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_3/Edge-SketchCircle_3_2")] +Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) +Pipe_1_objects_1 = [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_3")] +Pipe_1 = model.addPipe(Part_1_doc, Pipe_1_objects_1, model.selection("EDGE", "Interpolation_1_1"), []) +model.do() +model.end() diff --git a/src/FeaturesPlugin/doc/examples/pipe_simple.py b/src/FeaturesPlugin/doc/examples/pipe_simple.py new file mode 100644 index 000000000..5deb47e2c --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/pipe_simple.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- + +from SketchAPI import * + +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() +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")]) +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")) +model.do() +model.end() diff --git a/src/FeaturesPlugin/doc/images/meas_angle3p_32x32.png b/src/FeaturesPlugin/doc/images/meas_angle3p_32x32.png new file mode 100644 index 000000000..bc40b7a93 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/meas_angle3p_32x32.png differ diff --git a/src/FeaturesPlugin/doc/images/meas_angle_32x32.png b/src/FeaturesPlugin/doc/images/meas_angle_32x32.png new file mode 100644 index 000000000..800536f41 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/meas_angle_32x32.png differ diff --git a/src/FeaturesPlugin/doc/images/meas_distance_32x32.png b/src/FeaturesPlugin/doc/images/meas_distance_32x32.png new file mode 100644 index 000000000..d9a6d5b4a Binary files /dev/null and b/src/FeaturesPlugin/doc/images/meas_distance_32x32.png differ diff --git a/src/FeaturesPlugin/doc/images/meas_length_32x32.png b/src/FeaturesPlugin/doc/images/meas_length_32x32.png new file mode 100644 index 000000000..37ebd09f4 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/meas_length_32x32.png differ diff --git a/src/FeaturesPlugin/doc/images/meas_radius_32x32.png b/src/FeaturesPlugin/doc/images/meas_radius_32x32.png new file mode 100644 index 000000000..a3c70fca4 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/meas_radius_32x32.png differ diff --git a/src/FeaturesPlugin/doc/images/measurement.png b/src/FeaturesPlugin/doc/images/measurement.png new file mode 100644 index 000000000..c93fa62b2 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/measurement.png differ diff --git a/src/FeaturesPlugin/doc/images/pipe.png b/src/FeaturesPlugin/doc/images/pipe.png new file mode 100644 index 000000000..3ce55e8f6 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/pipe.png differ diff --git a/src/FeaturesPlugin/doc/images/pipe_binormal_32x32.png b/src/FeaturesPlugin/doc/images/pipe_binormal_32x32.png new file mode 100644 index 000000000..560183f15 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/pipe_binormal_32x32.png differ diff --git a/src/FeaturesPlugin/doc/images/pipe_locations_32x32.png b/src/FeaturesPlugin/doc/images/pipe_locations_32x32.png new file mode 100644 index 000000000..35e409309 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/pipe_locations_32x32.png differ diff --git a/src/FeaturesPlugin/doc/images/pipe_simple_32x32.png b/src/FeaturesPlugin/doc/images/pipe_simple_32x32.png new file mode 100644 index 000000000..b746e6c74 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/pipe_simple_32x32.png differ diff --git a/src/FeaturesPlugin/doc/measurementFeature.rst b/src/FeaturesPlugin/doc/measurementFeature.rst index 9f999a097..7fc7b9667 100644 --- a/src/FeaturesPlugin/doc/measurementFeature.rst +++ b/src/FeaturesPlugin/doc/measurementFeature.rst @@ -2,6 +2,51 @@ Measurement =========== +The feature **Measurement** calculates dimensions of sub-elements of a geometrical object (shape). + +The measured dimension is displayed in the property panel and shown in 3D OCC viewer. + +The properties of dimension text and line, such as font, color, arrow size, etc. can be defined in the Preferences :ref:`visualization_preferences`. + +**Apply** button does not generate any result and has the same effect as **Cancel** for this feature. + +To start Measurement in the active part: + +#. select in the Main Menu *Part - > Measurement* item or +#. click **Measurement** button in the toolbar + +.. image:: images/measurement.png + :align: center + +.. centered:: + **Measurement** button + +The following dimensions can be calculated: + + .. image:: images/meas_length_32x32.png + :align: left + edge length + + .. image:: images/meas_distance_32x32.png + :align: left + distance between objects + + .. image:: images/meas_radius_32x32.png + :align: left + radius + + .. image:: images/meas_angle_32x32.png + :align: left + angle between edges + + .. image:: images/meas_angle3p_32x32.png + :align: left + angle by 3 points + +Edge length +----------- + +The length can be measured for straight or curved edge built on two points. .. image:: images/Measurement1.png :align: center @@ -9,15 +54,40 @@ Measurement .. centered:: Edge length +Input fields: + +- **Edge** contains edge to be measured selected in 3D OCC viewer or object browser. +Note, that for curved edges length is displayed only in the property panel. -.. image:: images/Measurement2.png +**TUI Command**: *length =model.measureLength(Part_doc, edge)* + +**Arguments**: part + edge in format *model.selection("EDGE", edge)*. + + +Distance between objects +------------------------ + +**Distance between objects** calculates minimal distance for any pair of shapes: vertex, edge, face, solid. + + .. image:: images/Measurement2.png :align: center .. centered:: Distance between objects +Input fields: + +- **From**, **To** contain shapes between which distance is measured. Shapes are selected in 3D OCC viewer or object browser. +**TUI Command**: *length =model.measureDistance(Part_doc, shape1, shape2)* + +**Arguments**: part + 2 shapes in format *model.selection("TYPE", shape)*. + +Radius +------ + +**Radius** calculates radius for circular edge or cylindrical face. .. image:: images/Measurement3.png :align: center @@ -25,7 +95,19 @@ Measurement .. centered:: Radius +Input fields: + +- **Object** contains shape to be measured selected in 3D OCC viewer or object browser. + +**TUI Command**: *radius = model.measureRadius(Part_doc, shape)* + +**Arguments**: part + shape in format *model.selection("TYPE", shape)*. + +Angle between edges +------------------- + +**Angle between edges** calculates angle between the selected pair of edges in the point of intersection. If there are several points of intersection, then angles are calculated in all points. .. image:: images/Measurement4.png :align: center @@ -33,10 +115,30 @@ Measurement .. centered:: Angle between edges +Input fields: + +- **First Edge**, **Second edge** contain edges between which angle is measured. Edges are selected in 3D OCC viewer or object browser. + +**TUI Command**: *angle = model.measureAngle(Part_doc, edge1, edge2)* + +**Arguments**: part + 2 edges in format *model.selection("EDGE", edge)*. +Angle by 3 points +----------------- + +**Angle by 3 points** calculates angle between the selected three points. The second point is in the corner of the angle. .. image:: images/Measurement5.png :align: center .. centered:: Angle by 3 points + +Input fields: + +- **First point**, **Second point**, **Third point** contain point between which angle is measured. Points are selected in 3D OCC viewer or object browser. + +**TUI Command**: *angle = model.measureAngle(Part_doc, vertex1, vertex2, vertex3)* + +**Arguments**: part + 3 vertices in format *model.selection("VERTEX", vertex)*. + \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/pipeFeature.rst b/src/FeaturesPlugin/doc/pipeFeature.rst index 0ec31da4d..383eca0bb 100644 --- a/src/FeaturesPlugin/doc/pipeFeature.rst +++ b/src/FeaturesPlugin/doc/pipeFeature.rst @@ -2,23 +2,130 @@ Pipe ==== +The feature **Pipe** makes an extruded Pipe shape. + +To create Pipe in the active part: + +#. select in the Main Menu *Features - > Pipe* item or +#. click **Pipe** button in the toolbar + +.. image:: images/pipe.png + :align: center + +.. centered:: + **Pipe** button + +Pipe can be created in three different ways: + + .. image:: images/pipe_simple_32x32.png + :align: left + by object and path + + .. image:: images/pipe_binormal_32x32.png + :align: left + by object, path and Bi-normal + + .. image:: images/pipe_locations_32x32.png + :align: left + by object, path and locations + +Pipe by object and path +----------------------- + +Base Objects are extruded along the Path Object so that the angle between the normal vector to the base shape and the tangent to the path remain constant at any point of the given path. .. image:: images/Pipe1.png :align: center .. centered:: - Pipe by object and path + Pipe by object and path property panel + +Input fields: + +- **Base objects** panel contains shapes to be extruded. Several Base Objects generate several pipes. Shapes (edges, faces, shells) are selected in 3D OCC viewer or object browser; +- **Path object** defines path along which the Base Object will be extruded. **Path object** (edge or wire) is selected in 3D OCC viewer or object browser; + +**TUI Command**: *model.addPipe(Part_doc, [shape], path)* + +**Arguments**: part + list of shapes in format *model.selection(TYPE, shape)* + path in format *model.selection(TYPE, shape)*. + +Result +"""""" + +Result of extrusion of arc along another arc. + +.. image:: images/simplePipe.png + :align: center + +.. centered:: + Pipe by object and path + +**See Also** a sample TUI Script of a :ref:`tui_simple_pipe` operation. +Pipe by object, path and Bi-normal +---------------------------------- + +The pipe is generated to preserve the constant angle between the normal vector to the base shape and the BiNormal vector at any point of the given path. .. image:: images/Pipe2.png :align: center .. centered:: - Pipe by object, path and Bi-normal + Pipe by object, path and Bi-normal property panel + +Input fields: + +- **Base objects** panel contains shapes to be extruded. Several Base Objects generate several pipes. Shapes (edges, faces, shells) are selected in 3D OCC viewer or object browser; +- **Path object** defines path along which the Base Object will be extruded. **Path object** (edge or wire) is selected in 3D OCC viewer or object browser; +- **Bi-Normal** defines the BiNormal Vector. **Bi-Normal** (edge or wire) is selected in 3D OCC viewer or object browser. + +**TUI Command**: *model.addPipe(Part_doc, [shape], path, binormal)* + +**Arguments**: part + list of shapes in format *model.selection(TYPE, shape)* + path in format *model.selection(TYPE, shape)* + binormal in format *model.selection(TYPE, shape)*. + +Result +"""""" + +Result of extrusion of rectangular face along arc. + +.. image:: images/binormalPipe.png + :align: center + +.. centered:: + Pipe by object and path + +**See Also** a sample TUI Script of a :ref:`tui_binormal_pipe` operation. +Pipe by object, path and locations +---------------------------------- + +The pipe is generated to preserve selected profiles at the specified locations along path. .. image:: images/Pipe3.png :align: center .. centered:: - Pipe by object, path and locations + Pipe by object, path and locations property panel + +Input fields: + +- **Base objects** panel contains shapes to be extruded. Shapes (edges, faces, shells) are selected in 3D OCC viewer or object browser; +- **Path object** defines path along which the Base Object will be extruded. **Path object** (edge or wire) is selected in 3D OCC viewer or object browser; +- **Locations** define list of vertices that specify the locations of extruded Base Objects on the resulting Path Object. The number of Base Objects should be equal to the number of Locations. + +**TUI Command**: *model.addPipe(Part_doc, [shape], path, locations)* + +**Arguments**: part + list of shapes in format *model.selection(TYPE, shape)* + path in format *model.selection(TYPE, shape)* + list of locations in format *model.selection(TYPE, shape)*. + +Result +"""""" + +Result of extrusion of 3 circles along arc with specified locations. + +.. image:: images/locationPipe.png + :align: center + +.. centered:: + Pipe by object, path and locations + +**See Also** a sample TUI Script of a :ref:`tui_locations_pipe` operation. \ No newline at end of file