X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Fsalome%2Fgui%2FGEOM%2Finput%2Ftui_complex_objs.doc;h=7dcf151c177d518e3b08630001047186926f2784;hb=a9bf8c585f1924c1dc4097e442d53eef05338f16;hp=29813a9a6d86e336dba8a07b31571117b7d9dd9d;hpb=239f8109c64fa0c5a2e1d87a420bad5529b57f48;p=modules%2Fgeom.git
diff --git a/doc/salome/gui/GEOM/input/tui_complex_objs.doc b/doc/salome/gui/GEOM/input/tui_complex_objs.doc
index 29813a9a6..7dcf151c1 100644
--- a/doc/salome/gui/GEOM/input/tui_complex_objs.doc
+++ b/doc/salome/gui/GEOM/input/tui_complex_objs.doc
@@ -45,12 +45,14 @@ face2 = geompy.MakeFace(wire2, isPlanarWanted)
# create prisms
prism1 = geompy.MakePrism(face2, p1, p5)
prism2 = geompy.MakePrismVecH(face1, vector, 50)
+prism3 = geompy.MakePrismVecH2Ways(face1, vector, 50)
# add objects in the study
id_face1 = geompy.addToStudy(face1,"Face1")
id_face2 = geompy.addToStudy(face2,"Face2")
id_prism1 = geompy.addToStudy(prism1,"Prism1")
id_prism2 = geompy.addToStudy(prism2,"Prism2")
+id_prism3 = geompy.addToStudy(prism3,"Prism3")
# display cylinders
gg.createAndDisplayGO(id_face1)
@@ -61,6 +63,8 @@ gg.createAndDisplayGO(id_prism1)
gg.setDisplayMode(id_prism1,1)
gg.createAndDisplayGO(id_prism2)
gg.setDisplayMode(id_prism2,1)
+gg.createAndDisplayGO(id_prism3)
+gg.setDisplayMode(id_prism3,1)
\endcode
\anchor tui_creation_revolution
@@ -186,4 +190,464 @@ gg.createAndDisplayGO(id_pipe)
gg.setDisplayMode(id_pipe,1)
\endcode
-*/
\ No newline at end of file
+\anchor tui_creation_pipe_with_diff_sec
+
Creation of a PipeWithDifferentSections
+
+\code
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+Wire_1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 100 0:R 0:C 100 90:T 0 200", [0, 0, 0, 0, 0, 1, 1, 0, -0])
+edges = geompy.SubShapeAll(Wire_1, geompy.ShapeType["EDGE"])
+vertices = geompy.SubShapeAll(Wire_1, geompy.ShapeType["VERTEX"])
+
+# create sections
+circles=[]
+circles.append(geompy.MakeCircle(vertices[0], edges[0], 20))
+circles.append(geompy.MakeCircle(vertices[1], edges[0], 40))
+circles.append(geompy.MakeCircle(vertices[2], edges[2], 30))
+circles.append(geompy.MakeCircle(vertices[3], edges[2], 20))
+
+# create pipe
+Pipe = geompy.MakePipeWithDifferentSections(circles, vertices, Wire_1, 0, 0)
+
+# add objects in the study
+geompy.addToStudy(circles[0], "circles1")
+geompy.addToStudy(circles[1], "circles2")
+geompy.addToStudy(circles[2], "circles3")
+geompy.addToStudy(circles[3], "circles4")
+id_wire = geompy.addToStudy(Wire_1, "Path")
+id_pipe = geompy.addToStudy(Pipe, "Pipe")
+
+# display the wire(path) and the pipe
+gg.createAndDisplayGO(id_wire)
+gg.createAndDisplayGO(id_pipe)
+gg.setDisplayMode(id_pipe,1)
+\endcode
+
+\anchor tui_creation_pipe_with_shell_sec
+
Creation of a PipeWithShellSections
+
+\code
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create path
+WirePath = geompy.MakeSketcher("Sketcher:F 0 0:TT 100 0:R 0:C 100 90:T 0 200", [0, 0, 0, 0, 0, 1, 1, 0, -0])
+
+#=======================================================
+# Create shell sections
+#=======================================================
+ps = [Vertex_1,Vertex_2,Vertex_3,Vertex_4]
+theLocations = [Vertex_1, Vertex_2, Vertex_3, Vertex_4]
+VC = geompy.MakeCompound(theLocations)
+geompy.addToStudy(VC,"VC")
+vs = [Edge_1,Edge_1,Edge_3,Edge_3]
+hs = [20,40,30,20]
+shells = []
+subbases = []
+
+# 1 section
+c0 = geompy.PointCoordinates(ps[0])
+c1 = geompy.PointCoordinates(ps[1])
+nx = c1[0] - c0[0]
+ny = c1[1] - c0[1]
+nz = c1[2] - c0[2]
+
+faces = []
+f1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:TT 20 20:TT 0 20:WF",
+ [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
+f2 = geompy.MakeSketcher("Sketcher:F 0 0:TT 0 20:TT -20 20:TT -20 0:WF",
+ [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
+f3 = geompy.MakeSketcher("Sketcher:F 0 0:TT -20 0:TT -20 -20:TT 0 -20:WF",
+ [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
+f4 = geompy.MakeSketcher("Sketcher:F 0 0:TT 0 -20:TT 20 -20:TT 20 0:WF",
+ [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
+faces.append(f1)
+faces.append(f2)
+faces.append(f3)
+faces.append(f4)
+shell = geompy.MakeSewing(faces,1.e-6)
+shells.append(shell)
+faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
+subbases.append(faces[0])
+
+# 2 section
+faces = []
+
+w = geompy.MakeSketcher("Sketcher:F 20 20:TT 0 20:TT 0 0:TT 20 0",
+ [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,-1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f1 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F -20 0:TT 0 0:TT 0 20:TT -20 20",
+ [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,-1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f2 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F 20 0:TT 0 0:TT 0 -20:TT 20 -20",
+ [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,-1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f3 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F -20 -20:TT 0 -20:TT 0 0:TT -20 0",
+ [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,-1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f4 = geompy.MakeFace(w,1)
+
+faces.append(f1)
+faces.append(f2)
+faces.append(f3)
+faces.append(f4)
+shell = geompy.MakeSewing(faces,1.e-6)
+shells.append(shell)
+faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
+subbases.append(faces[0])
+
+# 3 section
+faces = []
+c2 = geompy.PointCoordinates(ps[2])
+c3 = geompy.PointCoordinates(ps[3])
+nx = c3[0] - c2[0]
+ny = c3[1] - c2[1]
+nz = c3[2] - c2[2]
+
+w = geompy.MakeSketcher("Sketcher:F 20 20:TT 0 20:TT 0 0:TT 20 0",
+ [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f1 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F -20 0:TT 0 0:TT 0 20:TT -20 20",
+ [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f2 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F 20 0:TT 0 0:TT 0 -20:TT 20 -20",
+ [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f3 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F -20 -20:TT 0 -20:TT 0 0:TT -20 0",
+ [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f4 = geompy.MakeFace(w,1)
+
+faces.append(f1)
+faces.append(f2)
+faces.append(f3)
+faces.append(f4)
+shell = geompy.MakeSewing(faces,1.e-6)
+shells.append(shell)
+faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
+subbases.append(faces[2])
+
+# 4 section
+faces = []
+
+kk = 4
+dx = c3[0] - nx/kk
+dy = c3[1] - ny/kk
+dz = c3[2] - nz/kk
+rad = math.sqrt(nx*nx+ny*ny+nz*nz)
+vc = geompy.MakeVertex(dx,dy,dz)
+sph = geompy.MakeSpherePntR(vc,rad/kk)
+shellsph = geompy.SubShapeAll(sph, geompy.ShapeType["SHELL"])
+
+fs = []
+vec = geompy.MakeVectorDXDYDZ(0,0,1)
+ff = geompy.MakePlane(ps[3],vec,40)
+fs.append(ff)
+vp = geompy.MakeVertex(c3[0],c3[1],c3[2]+20)
+ff = geompy.MakePlane(vp,vec,40)
+fs.append(ff)
+vp = geompy.MakeVertex(c3[0],c3[1],c3[2]-20)
+ff = geompy.MakePlane(vp,vec,40)
+fs.append(ff)
+vec = geompy.MakeVectorDXDYDZ(1,0,0)
+ff = geompy.MakePlane(ps[3],vec,40)
+fs.append(ff)
+vp = geompy.MakeVertex(c3[0]+20,c3[1],c3[2])
+ff = geompy.MakePlane(vp,vec,40)
+fs.append(ff)
+vp = geompy.MakeVertex(c3[0]-20,c3[1],c3[2])
+ff = geompy.MakePlane(vp,vec,40)
+fs.append(ff)
+aPartition = geompy.MakePartition(shellsph,fs)
+fs = geompy.SubShapeAllSortedCentres(aPartition, geompy.ShapeType["FACE"])
+
+faces.append(fs[0])
+faces.append(fs[1])
+faces.append(fs[2])
+faces.append(fs[3])
+shell = geompy.MakeSewing(faces,1.e-6)
+shells.append(shell)
+faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
+
+
+#===========================================================
+# Create Pipe
+#===========================================================
+subbases = []
+Pipe = geompy.MakePipeWithShellSections(shells, subbases, theLocations, WirePath,
+ theWithContact=0, theWithCorrection=0)
+
+# add objects in the study
+resc = geompy.MakeCompound(shells)
+id_sec = geompy.addToStudy(resc,"sections")
+id_wire = geompy.addToStudy(WirePath,"WirePath")
+id_pipe = geompy.addToStudy(Pipe, "Pipe")
+
+# display the wire(path), sections and the pipe
+gg.createAndDisplayGO(id_wire)
+gg.createAndDisplayGO(id_sec)
+gg.createAndDisplayGO(id_pipe)
+gg.setDisplayMode(id_pipe,1)
+\endcode
+
+
+\anchor tui_creation_pipe_without_path
+
Creation of a PipeShellsWithoutPath
+
+\code
+import geompy
+import math
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# Add a section based on quadrangles
+# ----------------------------------
+def section(s, p1, p2=None, p3=None, p4=None):
+ if p2==None:
+ q = p1
+ else:
+ q = geompy.MakeQuad4Vertices(p1, p2, p3, p4)
+ pass
+ s.append(q)
+ publish(q, "section")
+ return q
+
+
+# find distance between two points
+# -------------------------------
+def Dist(p1,p2):
+ c1 = geompy.PointCoordinates(p1)
+ c2 = geompy.PointCoordinates(p2)
+ return math.sqrt( (c2[0]-c1[0])*(c2[0]-c1[0]) +
+ (c2[1]-c1[1])*(c2[1]-c1[1]) +
+ (c2[2]-c1[2])*(c2[2]-c1[2]) )
+
+
+# return middle point
+# -------------------------------
+def MiddleVert(p1,p2):
+ c1 = geompy.PointCoordinates(p1)
+ c2 = geompy.PointCoordinates(p2)
+ return geompy.MakeVertex( (c2[0]+c1[0])/2, (c2[1]+c1[1])/2, (c2[2]+c1[2])/2 )
+
+
+# Complex section
+# result - 16 quads from lines
+# pnt - point from path
+# vec - direction from path
+def MakeComplexSect(pnt,vec,rmax,rmin,nb):
+ dang = 1.0/nb/2
+ cmax = geompy.MakeCircle(pnt,vec,rmax)
+ cmin = geompy.MakeCircle(pnt,vec,rmin)
+ faces = []
+ for i in range(0,2*nb,2):
+ p1 = geompy.MakeVertexOnCurve(cmin,dang*i)
+ p2 = geompy.MakeVertexOnCurve(cmax,dang*(i+1))
+ p3 = geompy.MakeVertexOnCurve(cmin,dang*(i+2))
+ f = geompy.MakeQuad4Vertices(pnt,p1,p2,p3)
+ faces.append(f)
+ pass
+ shell = geompy.MakeSewing(faces,1.e-6)
+ return shell
+
+
+#=======================================================
+# Create simple path and recieve points
+# for section creation
+#=======================================================
+WirePath = geompy.MakeSketcher("Sketcher:F 0 0:T 60 0:T 40 0:R 0:C 100 90:",
+ [0, 0, 0, 0, 0, 1, 1, 0, 0])
+vs = geompy.SubShapeAll(WirePath, geompy.ShapeType["VERTEX"])
+
+#=======================================================
+# Create shell sections
+#=======================================================
+shells = []
+subbases = []
+locs = []
+
+# 1 section
+shell = MakeComplexSect(vs[0], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16)
+shells.append(shell)
+vs1 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
+locs.append(vs1[17])
+
+# 2 section
+shell = MakeComplexSect(vs[1], geompy.MakeVectorDXDYDZ(1,0,0), 80, 30, 16)
+shells.append(shell)
+vs2 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
+locs.append(vs2[17])
+
+# 3 section
+shell = MakeComplexSect(vs[2], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16)
+shells.append(shell)
+vs3 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
+locs.append(vs3[17])
+
+# 4 section
+shell = MakeComplexSect(vs[3], geompy.MakeVectorDXDYDZ(0,1,0), 40, 35, 16)
+shells.append(shell)
+vs4 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
+locs.append(vs4[17])
+
+
+#===========================================================
+# Create Pipe
+#===========================================================
+
+Pipe = geompy.MakePipeShellsWithoutPath(shells,locs)
+
+# add objects in the study
+resc = geompy.MakeCompound(shells)
+id_sec = geompy.addToStudy(resc,"sections")
+resl = geompy.MakeCompound(locs)
+id_loc = geompy.addToStudy(resl,"locations")
+id_pipe = geompy.addToStudy(Pipe, "Pipe")
+
+# display the sections, locations and pipe
+gg.createAndDisplayGO(id_sec)
+gg.createAndDisplayGO(id_loc)
+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
+
+
Creation of Tangent Plane On Face
+\code
+import salome
+import geompy
+
+ # Create Vertexes for curve
+ Vertex_1 = geompy.MakeVertex(0, 0, 0)
+ Vertex_2 = geompy.MakeVertex(0, 90, 30)
+ Vertex_3 = geompy.MakeVertex(100, 90, 0)
+ Vertex_4 = geompy.MakeVertex(-100, 90, 0)
+ # Create curve
+ Curve_1 = geompy.MakeInterpol([Vertex_4, Vertex_2, Vertex_3, Vertex_1])
+ # Create Face by Extrusion of the Curve
+ Extrusion_1 = geompy.MakePrismDXDYDZ(Curve_1, 0, 30, -60)
+ # Make Tangent on this Extrusion (Face)
+ Tangent_1 = geompy.MakeTangentPlaneOnFace(Extrusion_1, 0.7, 0.5, 150)
+ # Publish in the study
+ geompy.addToStudy( Vertex_1, "Vertex_1" )
+ geompy.addToStudy( Vertex_2, "Vertex_2" )
+ geompy.addToStudy( Vertex_3, "Vertex_3" )
+ geompy.addToStudy( Vertex_4, "Vertex_4" )
+ geompy.addToStudy( Curve_1, "Curve_1" )
+ geompy.addToStudy( Extrusion_1, "Extrusion_1" )
+ geompy.addToStudy( Tangent_1, "Tangent_1" )
+\endcode
+
+
+*/