]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Documentation for B-spline and Periodic B-spline features.
authorazv <azv@opencascade.com>
Wed, 29 Jan 2020 05:23:53 +0000 (08:23 +0300)
committerazv <azv@opencascade.com>
Wed, 29 Jan 2020 07:17:41 +0000 (10:17 +0300)
src/SketchPlugin/doc/SketchPlugin.rst
src/SketchPlugin/doc/TUI_bsplineFeature.rst [new file with mode: 0644]
src/SketchPlugin/doc/bsplineFeature.rst [new file with mode: 0644]
src/SketchPlugin/doc/examples/bspline.py [new file with mode: 0644]
src/SketchPlugin/doc/images/bspline.png [new file with mode: 0644]
src/SketchPlugin/doc/images/bspline_add_pole.png [new file with mode: 0644]
src/SketchPlugin/doc/images/bspline_creation_panel.png [new file with mode: 0644]
src/SketchPlugin/doc/images/bspline_modification_panel.png [new file with mode: 0644]
src/SketchPlugin/doc/images/bspline_p.png [new file with mode: 0644]
src/SketchPlugin/doc/images/bspline_periodic_result.png [new file with mode: 0644]
src/SketchPlugin/doc/images/bspline_result.png [new file with mode: 0644]

index c8e4b9b7df9ac66f4aed804f1a4146f731a1da51..6d2a5af6cdfc2b135adbb6e6e0c5ca79c503dad1 100644 (file)
@@ -92,6 +92,7 @@ The plug-in includes the following features for creation of 2D objects:
    arcFeature.rst
    ellipseFeature.rst
    arcEllipseFeature.rst
+   bsplineFeature.rst
 
 .. _sketch_constraints:
 
diff --git a/src/SketchPlugin/doc/TUI_bsplineFeature.rst b/src/SketchPlugin/doc/TUI_bsplineFeature.rst
new file mode 100644 (file)
index 0000000..962c33f
--- /dev/null
@@ -0,0 +1,11 @@
+
+  .. _tui_create_bspline:
+
+Create Sketch B-spline
+======================
+
+.. literalinclude:: examples/bspline.py
+    :linenos:
+    :language: python
+
+:download:`Download this script <examples/bspline.py>`
diff --git a/src/SketchPlugin/doc/bsplineFeature.rst b/src/SketchPlugin/doc/bsplineFeature.rst
new file mode 100644 (file)
index 0000000..5d8cde2
--- /dev/null
@@ -0,0 +1,81 @@
+.. |bspline.icon|    image:: images/bspline.png
+.. |bspline_p.icon|  image:: images/bspline_p.png
+.. |add_pole.icon|   image:: images/bspline_add_pole.png
+
+B-spline and periodic B-spline
+==============================
+
+The feature creates a free form spline curve in the current Sketch.
+
+To add a new B-spline to the Sketch:
+
+#. select in the Main Menu *Sketch - > B-spline* item  or
+#. click |bspline.icon| **B-spline** button in the Sketch toolbar.
+
+To add a periodic B-spline to the Sketch:
+
+#. select in the Main Menu *Sketch - > Periodic B-spline* item  or
+#. click |bspline_p.icon| **Periodic B-spline** button in the Sketch toolbar.
+
+
+Creation of B-spline curve
+""""""""""""""""""""""""""
+
+.. image:: images/bspline_creation_panel.png
+   :align: center
+
+Click in the view to specify the control polygon of B-spline curve. The curve will be shown after the second point is initialized. To stop adding new poles, click **Esc** button or **Apply** the operation.
+
+
+**TUI Command**:
+
+.. py:function:: Sketch_1.addSpline(degree, poles, weights, knots, multiplicities, periodic)
+
+    :param integer: degree of B-spline.
+    :param array: list of poles [(x1, y1), (x2, y2), ...].
+    :param array: list of weights for corresponding poles.
+    :param array: parametric knots of B-spline curve.
+    :param array: multiplicity of each knot.
+    :param boolean: True mentions that the B-spline curve is periodic.
+    :return: Result object.
+
+Each parameter is optional.
+
+Result
+""""""
+
+Created B-spline curve appears in the view.
+
+.. image:: images/bspline_result.png
+          :align: center
+
+.. centered::
+   Non-periodic B-spline created
+
+
+.. image:: images/bspline_periodic_result.png
+          :align: center
+
+.. centered::
+   Periodic B-spline created
+
+**See Also** a sample TUI Script of :ref:`tui_create_bspline` operation.
+
+
+Modification of B-spline curve
+""""""""""""""""""""""""""""""
+
+.. image:: images/bspline_modification_panel.png
+   :align: center
+
+.. centered::
+   Modification panel for B-spline curve
+
+The following options are provided to modify the already created B-spline curve:
+
+#. Change weight of each pole.
+#. Add new pole.
+
+The new pole is added after the current by pressing on the corresponding |add_pole.icon| button. The default weight for the new pole is 1. 
+
+**Note:** adding the new pole after the last for non-periodic B-spline will not change the last point of the curve to avoid modification of full sketch.
diff --git a/src/SketchPlugin/doc/examples/bspline.py b/src/SketchPlugin/doc/examples/bspline.py
new file mode 100644 (file)
index 0000000..40f5bb3
--- /dev/null
@@ -0,0 +1,18 @@
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
+
+SketchBSpline_1_poles = [(-70, -5), (-50, 30), (-40, 3), (-20, 20), (-10, -5)]
+SketchBSpline_1 = Sketch_1.addSpline(poles = SketchBSpline_1_poles, weights = [1, 2, 2, 2, 1])
+[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5] = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3, 4])
+[SketchLine_1, SketchLine_2, SketchLine_3, SketchLine_4] = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2, 3])
+
+SketchBSplinePeriodic_1_poles = [(10, -5), (30, 30), (40, 3), (60, 20), (70, -5)]
+SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = SketchBSplinePeriodic_1_poles, weights = [3, 2, 1, 1, 1], periodic = True)
+[SketchPoint_6, SketchPoint_7, SketchPoint_8, SketchPoint_9, SketchPoint_10] = SketchBSplinePeriodic_1.controlPoles(auxiliary = [0, 1, 2, 3, 4])
+[SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8, SketchLine_9] = SketchBSplinePeriodic_1.controlPolygon(auxiliary = [0, 1, 2, 3, 4])
+
+model.do()
+model.end()
diff --git a/src/SketchPlugin/doc/images/bspline.png b/src/SketchPlugin/doc/images/bspline.png
new file mode 100644 (file)
index 0000000..149d19e
Binary files /dev/null and b/src/SketchPlugin/doc/images/bspline.png differ
diff --git a/src/SketchPlugin/doc/images/bspline_add_pole.png b/src/SketchPlugin/doc/images/bspline_add_pole.png
new file mode 100644 (file)
index 0000000..388f8ff
Binary files /dev/null and b/src/SketchPlugin/doc/images/bspline_add_pole.png differ
diff --git a/src/SketchPlugin/doc/images/bspline_creation_panel.png b/src/SketchPlugin/doc/images/bspline_creation_panel.png
new file mode 100644 (file)
index 0000000..88acb19
Binary files /dev/null and b/src/SketchPlugin/doc/images/bspline_creation_panel.png differ
diff --git a/src/SketchPlugin/doc/images/bspline_modification_panel.png b/src/SketchPlugin/doc/images/bspline_modification_panel.png
new file mode 100644 (file)
index 0000000..4bda345
Binary files /dev/null and b/src/SketchPlugin/doc/images/bspline_modification_panel.png differ
diff --git a/src/SketchPlugin/doc/images/bspline_p.png b/src/SketchPlugin/doc/images/bspline_p.png
new file mode 100644 (file)
index 0000000..a23ade1
Binary files /dev/null and b/src/SketchPlugin/doc/images/bspline_p.png differ
diff --git a/src/SketchPlugin/doc/images/bspline_periodic_result.png b/src/SketchPlugin/doc/images/bspline_periodic_result.png
new file mode 100644 (file)
index 0000000..b02a7cc
Binary files /dev/null and b/src/SketchPlugin/doc/images/bspline_periodic_result.png differ
diff --git a/src/SketchPlugin/doc/images/bspline_result.png b/src/SketchPlugin/doc/images/bspline_result.png
new file mode 100644 (file)
index 0000000..9b954c0
Binary files /dev/null and b/src/SketchPlugin/doc/images/bspline_result.png differ