From: akl Date: Mon, 29 Sep 2008 07:13:29 +0000 (+0000) Subject: To implement issue 0019962: MakePipeBiNormalAlongAxis implementation. X-Git-Tag: RELIQUAT_4x_25102008~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eb4c2e36a5d09392dfd7138bce47a6cdf47daa75;p=modules%2Fgeom.git To implement issue 0019962: MakePipeBiNormalAlongAxis implementation. --- diff --git a/doc/salome/gui/GEOM/images/pipebinormalsn.png b/doc/salome/gui/GEOM/images/pipebinormalsn.png new file mode 100644 index 000000000..d5add9f5d Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipebinormalsn.png differ diff --git a/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc b/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc index 77e453170..e0a629bb0 100644 --- a/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc +++ b/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc @@ -4,7 +4,7 @@ To generate a \b Pipe in the Main Menu select New Entity - > Generation - > Extrusion along a path -\n To create an extruded \b Pipe shape, you need to define the Base +\n Firstly, to create an extruded \b Pipe shape, you can define the Base Object (vertex, edge, planar wire, face or shell), which will be extruded and the Path Object (edge or wire) along which the Base Object will be extruded. @@ -18,12 +18,30 @@ definition of the path. \image html pipe.png +\n Secondly, you can define the Base +Object (edge, planar wire or face), which will be extruded, +the Path Object (edge or wire) along which the Base +Object will be extruded and the Vector (edge or wire) +to keep constant angular relations between the sections and this one. +\n The \b Result of the operation will be a GEOM_Object (edge, face, shell, +solid or compsolid). + +\n TUI Command: geompy.MakePipeBiNormalAlongVector(baseShape, pathShape, binormalShape) +\n Arguments: Name + 1 shape (edge, planar wire or face) +serving as base object + 1 shape (edge or wire) for +definition of the path + 1 shape (edge or wire) to set a fixed +BiNormal direction to perform the extrusion. + +\image html pipe2.png + Example: \image html pipe_wire_edgesn.png \image html pipesn.png +\image html pipebinormalsn.png + Our TUI Scripts provide you with useful examples of creation of \ref tui_creation_pipe "Complex Geometric Objects". diff --git a/doc/salome/gui/GEOM/input/tui_complex_objs.doc b/doc/salome/gui/GEOM/input/tui_complex_objs.doc index 2f4fa5076..254846e07 100644 --- a/doc/salome/gui/GEOM/input/tui_complex_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_complex_objs.doc @@ -543,4 +543,84 @@ gg.createAndDisplayGO(id_pipe) gg.setDisplayMode(id_pipe,1) \endcode +\anchor tui_creation_pipe_binormal_along_vector +

Creation of a PipeBiNormalAlongVector

+ +\code +def MakeHelix(radius, height, rotation, direction): + # - create a helix - + radius = 1.0 * radius + height = 1.0 * height + rotation = 1.0 * rotation + if direction > 0: + direction = +1 + else: + direction = -1 + pass + from math import sqrt + length_z = height + length_xy = radius*rotation + length = sqrt(length_z*length_z + length_xy*length_xy) + import geompy + nb_steps = 1 + epsilon = 1.0e-6 + while 1: + z_step = height / nb_steps + angle_step = rotation / nb_steps + z = 0.0 + angle = 0.0 + helix_points = [] + for n in range(nb_steps+1): + from math import cos, sin + x = radius * cos(angle) + y = radius * sin(angle) + p = geompy.MakeVertex(x, y, z) + helix_points.append( p ) + z += z_step + angle += direction * angle_step + pass + helix = geompy.MakeInterpol(helix_points) + length_test = geompy.BasicProperties(helix)[0] + prec = abs(length-length_test)/length + # print nb_steps, length_test, prec + if prec < epsilon: + break + nb_steps *= 2 + pass + return helix + +def MakeSpring(radius, height, rotation, direction, thread_radius, base_rotation=0.0): + # - create a pipe - + thread_radius = 1.0 * thread_radius + # create a helix + helix = MakeHelix(radius, height, rotation, direction) + # base in the (Ox, Oz) plane + import geompy + p0 = geompy.MakeVertex(radius-3*thread_radius, 0.0, -thread_radius) + p1 = geompy.MakeVertex(radius+3*thread_radius, 0.0, -thread_radius) + p2 = geompy.MakeVertex(radius+3*thread_radius, 0.0, +thread_radius) + p3 = geompy.MakeVertex(radius-3*thread_radius, 0.0, +thread_radius) + e0 = geompy.MakeEdge(p0, p1) + e1 = geompy.MakeEdge(p1, p2) + e2 = geompy.MakeEdge(p2, p3) + e3 = geompy.MakeEdge(p3, p0) + w = geompy.MakeWire([e0, e1, e2, e3]) + # create a base face + base = geompy.MakeFace(w, True) + # create a binormal vector + binormal = geompy.MakeVectorDXDYDZ(0.0, 0.0, 10.0) + # create a pipe + spring = geompy.MakePipeBiNormalAlongVector(base, helix, binormal) + # Publish in the study + geompy.addToStudy(base, "base") + geompy.addToStudy(helix, "helix") + geompy.addToStudy(binormal, "binormal") + geompy.addToStudy(spring, "spring") + return spring + +from math import pi + +spring = MakeSpring(50, 100, 2*pi, 1, 5, pi/2) +\endcode + */