2013-02-12 17:35:16 +06:00
|
|
|
# Projection
|
|
|
|
|
|
|
|
import salome
|
2013-04-04 13:06:43 +06:00
|
|
|
salome.salome_init()
|
|
|
|
from salome.geom import geomBuilder
|
|
|
|
geompy = geomBuilder.New(salome.myStudy)
|
2013-02-12 17:35:16 +06:00
|
|
|
|
|
|
|
# create a cylindric face and a curve(edge)
|
|
|
|
cylinder = geompy.MakeCylinderRH(100, 300)
|
|
|
|
[face_cyl] = geompy.SubShapes(cylinder, [3])
|
|
|
|
|
|
|
|
p1 = geompy.MakeVertex(200, 0, 100)
|
|
|
|
p2 = geompy.MakeVertex(200, 80, 100)
|
|
|
|
p3 = geompy.MakeVertex(200, 80, 180)
|
|
|
|
p4 = geompy.MakeVertex(130, 80, 180)
|
|
|
|
p5 = geompy.MakeVertex(90, 80, 240)
|
|
|
|
|
|
|
|
curve = geompy.MakeInterpol([p1, p2, p3, p4, p5], False, False)
|
|
|
|
|
|
|
|
# create a new object as projection of the
|
|
|
|
# given curve on the given cylindric face
|
|
|
|
projection = geompy.MakeProjection(curve, face_cyl)
|
|
|
|
|
|
|
|
# add objects in the study
|
|
|
|
geompy.addToStudy(cylinder, "cylinder")
|
|
|
|
geompy.addToStudyInFather(cylinder, face_cyl, "face_cyl")
|
|
|
|
geompy.addToStudy(curve, "curve")
|
|
|
|
geompy.addToStudy(projection, "projection")
|
2013-10-21 15:02:19 +06:00
|
|
|
|
2014-11-21 22:25:48 +05:00
|
|
|
#projection of point on wire
|
2013-10-21 15:02:19 +06:00
|
|
|
e1 = geompy.MakeLineTwoPnt(p1, p2)
|
|
|
|
e2 = geompy.MakeLineTwoPnt(p2, p3)
|
|
|
|
|
|
|
|
w1 = geompy.MakeWire([e1, e2], 1.e-7)
|
|
|
|
v1 = geompy.MakeVertex(300, 40, 100)
|
|
|
|
|
2014-11-21 22:25:48 +05:00
|
|
|
prj = geompy.MakeProjection(v1, w1)
|
2013-10-21 15:02:19 +06:00
|
|
|
geompy.addToStudy(w1, "w1")
|
|
|
|
geompy.addToStudy(v1, "v1")
|
2014-11-21 22:25:48 +05:00
|
|
|
geompy.addToStudy(prj, "projOnWire")
|