geom/doc/salome/examples/repairing_operations_ex03.py

34 lines
883 B
Python
Raw Permalink Normal View History

2013-02-12 17:35:16 +06:00
# Close Contour
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
2013-02-12 17:35:16 +06:00
gg = salome.ImportComponentGUI("GEOM")
# create vertices and vectors
p0 = geompy.MakeVertex( 0., 0., 0.)
px = geompy.MakeVertex(100., 0., 0.)
py = geompy.MakeVertex( 0., 100., 0.)
py1 = geompy.MakeVertex( 0., 140., 0.)
pz = geompy.MakeVertex( 0., 0., 100.)
vxy = geompy.MakeVector(px, py)
# create an arc
arc = geompy.MakeArc(py1, pz, px)
# create a wire
wire = geompy.MakeWire([vxy, arc])
# close an open wire by creation of an edge between ends
wire_close = geompy.CloseContour(wire, [1], 0)
# add objects in the study
id_wire = geompy.addToStudy(wire, "Wire")
id_wire_close = geompy.addToStudy(wire_close, "Wire close")
# display the results
gg.createAndDisplayGO(id_wire)
gg.createAndDisplayGO(id_wire_close)