2013-02-12 17:35:16 +06:00
|
|
|
# Sewing
|
|
|
|
|
2014-10-09 20:34:57 +06:00
|
|
|
import salome, math
|
2013-04-04 13:06:43 +06:00
|
|
|
salome.salome_init()
|
|
|
|
from salome.geom import geomBuilder
|
2014-10-09 20:34:57 +06:00
|
|
|
|
2017-06-13 14:57:14 +05:00
|
|
|
geompy = geomBuilder.New()
|
2014-10-09 20:34:57 +06:00
|
|
|
gg = salome.ImportComponentGUI("GEOM")
|
2013-02-12 17:35:16 +06:00
|
|
|
|
|
|
|
# create base points
|
|
|
|
px = geompy.MakeVertex(100., 0., 0.)
|
|
|
|
py = geompy.MakeVertex(0., 100., 0.)
|
|
|
|
pz = geompy.MakeVertex(0., 0., 100.)
|
|
|
|
|
2014-10-09 20:34:57 +06:00
|
|
|
# create base geometry 2D
|
2013-02-12 17:35:16 +06:00
|
|
|
vector = geompy.MakeVector(px, py)
|
2014-10-09 20:34:57 +06:00
|
|
|
arc = geompy.MakeArc(py, pz, px)
|
2013-02-12 17:35:16 +06:00
|
|
|
|
|
|
|
# create base objects
|
|
|
|
angle = 45. * math.pi / 180
|
2014-10-09 20:34:57 +06:00
|
|
|
WantPlanarFace = True
|
|
|
|
wire = geompy.MakeWire([vector, arc])
|
|
|
|
face = geompy.MakeFace(wire, WantPlanarFace)
|
2013-02-12 17:35:16 +06:00
|
|
|
face_rot = geompy.MakeRotation(face, vector, angle)
|
|
|
|
|
|
|
|
# make sewing
|
|
|
|
precision = 0.00001
|
|
|
|
sewing = geompy.MakeSewing([face, face_rot], precision)
|
|
|
|
|
|
|
|
# add objects in the study
|
2014-10-09 20:34:57 +06:00
|
|
|
id_face = geompy.addToStudy(face, "Face")
|
2013-02-12 17:35:16 +06:00
|
|
|
id_face_rot = geompy.addToStudy(face_rot, "Face rotation")
|
2014-10-09 20:34:57 +06:00
|
|
|
id_sewing = geompy.addToStudy(sewing, "Sewing")
|
2013-02-12 17:35:16 +06:00
|
|
|
|
|
|
|
# display the results
|
|
|
|
gg.createAndDisplayGO(id_face)
|
|
|
|
gg.setDisplayMode(id_face,1)
|
|
|
|
gg.createAndDisplayGO(id_face_rot)
|
|
|
|
gg.setDisplayMode(id_face_rot,1)
|
|
|
|
gg.createAndDisplayGO(id_sewing)
|
|
|
|
gg.setDisplayMode(id_sewing,1)
|
2014-10-09 20:34:57 +06:00
|
|
|
|
|
|
|
|
|
|
|
# Example 2: make a shell of a multiply translated face
|
|
|
|
quad = geompy.MakeFaceHW( 10, 20, 1 )
|
|
|
|
quadCompound = geompy.MakeMultiTranslation1D( quad, geompy.MakeVectorDXDYDZ(1,0,0), 10, 3)
|
|
|
|
shell = geompy.Sew( quadCompound, 1e-6 )
|
|
|
|
|
|
|
|
id_shell = geompy.addToStudy( shell, "3 quads shell")
|
|
|
|
gg.createAndDisplayGO(id_shell)
|