6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI(
"GEOM")
11 p1 = geompy.MakeVertex(10, 40, 0)
12 p2 = geompy.MakeVertex( 0, 0, 50)
13 p3 = geompy.MakeVertex(50, 80, 0)
14 v = geompy.MakeVector(p1, p2)
15 vt = geompy.MakeVector(p1, p3)
20 cylinder = geompy.MakeCylinder(p1, v, radius1, height)
24 translation1 = geompy.MakeTranslationTwoPoints(cylinder, p1, p3)
25 translation2 = geompy.MakeTranslation(cylinder, 40, 40, 0)
26 translation3 = geompy.MakeTranslationVector(cylinder, vt)
27 translation4 = geompy.MakeTranslationVectorDistance(cylinder, vt, 200)
30 id_cylinder = geompy.addToStudy(cylinder,
"Cylinder")
31 id_translation1 = geompy.addToStudy(translation1,
"Translation1")
32 id_translation2 = geompy.addToStudy(translation2,
"Translation2")
33 id_translation3 = geompy.addToStudy(translation3,
"Translation3")
34 id_translation4 = geompy.addToStudy(translation4,
"Translation4")
37 gg.createAndDisplayGO(id_cylinder)
38 gg.setDisplayMode(id_cylinder,1)
39 gg.createAndDisplayGO(id_translation1)
40 gg.setDisplayMode(id_translation1,1)
41 gg.createAndDisplayGO(id_translation2)
42 gg.setDisplayMode(id_translation2,1)
43 gg.createAndDisplayGO(id_translation3)
44 gg.setDisplayMode(id_translation3,1)
45 gg.createAndDisplayGO(id_translation4)
46 gg.setDisplayMode(id_translation4,1)
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
9 gg = salome.ImportComponentGUI(
"GEOM")
12 p1 = geompy.MakeVertex(10, 40, 0)
13 p2 = geompy.MakeVertex( 0, 0, 50)
14 p3 = geompy.MakeVertex(10, 50,-20)
15 p4 = geompy.MakeVertex(10, 50, 60)
16 v = geompy.MakeVector(p1, p2)
17 vr = geompy.MakeVector(p3, p4)
22 cylinder = geompy.MakeCylinder(p1, v, radius1, height)
25 rotation1 = geompy.MakeRotation(cylinder, vr, math.pi)
26 rotation2 = geompy.MakeRotationThreePoints(cylinder, p4, p1, p2)
29 id_vr = geompy.addToStudy(vr,
"Rotation 1 axis")
30 id_p4 = geompy.addToStudy(p4,
"Rotation 2 center")
31 id_p1 = geompy.addToStudy(p1,
"Rotation 2 point 1")
32 id_p2 = geompy.addToStudy(p2,
"Rotation 2 point 2")
33 id_cylinder = geompy.addToStudy(cylinder,
"Cylinder")
34 id_rotation1 = geompy.addToStudy(rotation1,
"Rotation 1")
35 id_rotation2 = geompy.addToStudy(rotation2,
"Rotation 2")
38 gg.createAndDisplayGO(id_vr)
39 gg.createAndDisplayGO(id_p4)
40 gg.createAndDisplayGO(id_p1)
41 gg.createAndDisplayGO(id_p2)
42 gg.createAndDisplayGO(id_cylinder)
43 gg.setDisplayMode(id_cylinder,1)
44 gg.createAndDisplayGO(id_rotation1)
45 gg.createAndDisplayGO(id_rotation2)
46 gg.setDisplayMode(id_rotation1,1)
47 gg.setDisplayMode(id_rotation2,1)
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
9 gg = salome.ImportComponentGUI(
"GEOM")
12 p1 = geompy.MakeVertex(10, 40, 0)
13 p2 = geompy.MakeVertex( 0, 0, 50)
14 v = geompy.MakeVector(p1, p2)
19 cylinder = geompy.MakeCylinder(p1, v, radius1, height)
20 circle = geompy.MakeCircle(p2, v, radius1)
23 cs1 = geompy.MakeMarker( 0, 0, 0, 1,0,0, 0,1,0)
24 cs2 = geompy.MakeMarker(30,40,40, 1,0,0, 0,1,0)
27 position = geompy.MakePosition(cylinder, cs1, cs2)
28 position2 = geompy.PositionAlongPath(position, circle, 0.75, 1, 1)
31 id_cs1 = geompy.addToStudy(cs1,
"Coordinate system 1")
32 id_cs2 = geompy.addToStudy(cs2,
"Coordinate system 2")
33 id_cylinder = geompy.addToStudy(cylinder,
"Cylinder")
34 id_circle = geompy.addToStudy(circle,
"Circle")
35 id_position = geompy.addToStudy(position,
"Position")
36 id_position2 = geompy.addToStudy(position2,
"PositionAlongPath")
39 gg.createAndDisplayGO(id_cylinder)
40 gg.setDisplayMode(id_cylinder,1)
41 gg.createAndDisplayGO(id_position)
42 gg.setDisplayMode(id_position,1)
43 gg.createAndDisplayGO(id_circle)
44 gg.setDisplayMode(id_circle,1)
45 gg.createAndDisplayGO(id_position2)
46 gg.setDisplayMode(id_position2,1)
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI(
"GEOM")
11 box = geompy.MakeBoxDXDYDZ(200, 200, 200)
14 p1 = geompy.MakeVertex( 0, 25, 0)
15 p2 = geompy.MakeVertex( 5, 25, 0)
16 p3 = geompy.MakeVertex( 0,-30, 40)
17 plane = geompy.MakePlaneThreePnt(p1, p2, p3, 1000.)
18 mirror1 = geompy.MakeMirrorByPlane(box, plane)
21 p4 = geompy.MakeVertex( 210, 210, -20)
22 p5 = geompy.MakeVertex( 210, 210, 220)
23 axis = geompy.MakeVector(p4, p5)
24 mirror2 = geompy.MakeMirrorByAxis(box, axis)
27 mirror3 = geompy.MakeMirrorByPoint(box, p4)
30 id_box = geompy.addToStudy(box,
"Box")
31 id_plane = geompy.addToStudy(plane,
"Plane")
32 id_mirror1 = geompy.addToStudy(mirror1,
"Mirror plane")
33 id_axis = geompy.addToStudy(axis,
"Axis")
34 id_mirror2 = geompy.addToStudy(mirror2,
"Mirror axis")
35 id_p4 = geompy.addToStudy(p4,
"Point")
36 id_mirror3 = geompy.addToStudy(mirror3,
"Mirror point")
39 gg.createAndDisplayGO(id_box)
40 gg.setDisplayMode(id_box,1)
41 gg.createAndDisplayGO(id_plane)
42 gg.createAndDisplayGO(id_mirror1)
43 gg.setDisplayMode(id_mirror1,1)
44 gg.createAndDisplayGO(id_axis)
45 gg.createAndDisplayGO(id_mirror2)
46 gg.setDisplayMode(id_mirror2,1)
47 gg.createAndDisplayGO(id_p4)
48 gg.createAndDisplayGO(id_mirror3)
49 gg.setDisplayMode(id_mirror3,1)
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI(
"GEOM")
11 box = geompy.MakeBoxDXDYDZ(200, 200, 200)
14 p0 = geompy.MakeVertex(100, 100, 100)
16 scale = geompy.MakeScaleTransform(box, p0, factor)
19 id_box = geompy.addToStudy(box,
"Box")
20 id_scale = geompy.addToStudy(scale,
"Scale")
23 gg.createAndDisplayGO(id_box)
24 gg.setDisplayMode(id_box,1)
25 gg.setTransparency(id_box,0.5)
26 gg.createAndDisplayGO(id_scale)
27 gg.setDisplayMode(id_scale,1)
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI(
"GEOM")
11 box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
14 offset = geompy.MakeOffset(box, 70.)
17 id_box = geompy.addToStudy(box,
"Box")
18 id_offset = geompy.addToStudy(offset,
"Offset")
21 gg.createAndDisplayGO(id_box)
22 gg.setDisplayMode(id_box,1)
23 gg.createAndDisplayGO(id_offset)
5 from salome.geom
import geomBuilder
6 geompy = geomBuilder.New(salome.myStudy)
9 cylinder = geompy.MakeCylinderRH(100, 300)
10 [face_cyl] = geompy.SubShapes(cylinder, [3])
12 p1 = geompy.MakeVertex(200, 0, 100)
13 p2 = geompy.MakeVertex(200, 80, 100)
14 p3 = geompy.MakeVertex(200, 80, 180)
15 p4 = geompy.MakeVertex(130, 80, 180)
16 p5 = geompy.MakeVertex(90, 80, 240)
18 curve = geompy.MakeInterpol([p1, p2, p3, p4, p5],
False,
False)
22 projection = geompy.MakeProjection(curve, face_cyl)
25 geompy.addToStudy(cylinder,
"cylinder")
26 geompy.addToStudyInFather(cylinder, face_cyl,
"face_cyl")
27 geompy.addToStudy(curve,
"curve")
28 geompy.addToStudy(projection,
"projection")
31 e1 = geompy.MakeLineTwoPnt(p1, p2)
32 e2 = geompy.MakeLineTwoPnt(p2, p3)
34 w1 = geompy.MakeWire([e1, e2], 1.e-7)
35 v1 = geompy.MakeVertex(300, 40, 100)
37 prj = geompy.MakeProjection(v1, w1)
38 geompy.addToStudy(w1,
"w1")
39 geompy.addToStudy(v1,
"v1")
40 geompy.addToStudy(prj,
"projOnWire")
43 pp1 = geompy.MakeVertex(100, 200, 0)
44 pp2 = geompy.MakeVertex(100, 200, 80)
45 pp3 = geompy.MakeVertex(100, 220, 90)
46 pp4 = geompy.MakeVertex(100, 130, 80)
47 pp5 = geompy.MakeVertex(100, 90, 80)
48 cc1 = geompy.MakeInterpol([pp1, pp2, pp3, pp4, pp5],
True,
False)
49 ww1 = geompy.MakeWire([cc1], 1.e-7)
50 vx = geompy.MakeVectorDXDYDZ(100, 0, 0)
51 pln1 = geompy.MakePlane(pp1, vx, 200)
52 face1 = geompy.MakeFaceFromSurface(pln1, ww1)
53 prj_cyl = geompy.MakeProjectionOnCylinder(face1, 100)
55 geompy.addToStudy(face1,
"pln_face")
56 geompy.addToStudy(prj_cyl,
"projOnCylinder")
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI(
"GEOM")
11 p0 = geompy.MakeVertex( 0., 0., 0.)
12 px = geompy.MakeVertex(20., 0., 0.)
13 py = geompy.MakeVertex( 0., 20., 0.)
14 pz = geompy.MakeVertex( 0., 0., 20.)
15 pxy = geompy.MakeVertex( 50., 0., 0.)
16 pxyz = geompy.MakeVertex( 50., 50., 50.)
17 vz = geompy.MakeVector(p0, pz)
18 vxy = geompy.MakeVector(px, py)
19 vtr1d = geompy.MakeVector(p0, pxyz)
20 vtr2d = geompy.MakeVector(p0, pxy)
23 arc = geompy.MakeArc(py, pz, px)
26 wire = geompy.MakeWire([vxy, arc])
29 face = geompy.MakeFace(wire, 1)
32 prism = geompy.MakePrismVecH(face, vz, 20.0)
35 tr1d = geompy.MakeMultiTranslation1D(prism, vtr1d, 20, 4)
38 tr2d = geompy.MakeMultiTranslation2D(prism, vtr1d, 20, 4, vtr2d, 80, 3)
41 id_prism = geompy.addToStudy(prism,
"Prism")
42 id_tr1d = geompy.addToStudy(tr1d,
"Translation 1D")
43 id_tr2d = geompy.addToStudy(tr2d,
"Translation 2D")
46 gg.createAndDisplayGO(id_prism)
47 gg.setDisplayMode(id_prism,1)
48 gg.createAndDisplayGO(id_tr1d)
49 gg.setDisplayMode(id_tr1d,1)
50 gg.createAndDisplayGO(id_tr2d)
51 gg.setDisplayMode(id_tr2d,1)
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI(
"GEOM")
12 p0 = geompy.MakeVertex( 0., 0., 0.)
13 px = geompy.MakeVertex(20., 0., 0.)
14 py = geompy.MakeVertex( 0., 20., 0.)
15 pz = geompy.MakeVertex( 0., 0., 20.)
16 pxyz = geompy.MakeVertex( 50., 50., 10.)
17 vz = geompy.MakeVector(p0, pz)
18 vxy = geompy.MakeVector(px, py)
19 vrot = geompy.MakeVector(p0, pxyz)
22 arc = geompy.MakeArc(py, pz, px)
25 wire = geompy.MakeWire([vxy, arc])
28 face = geompy.MakeFace(wire, 1)
31 prism = geompy.MakePrismVecH(face, vz, 20.0)
36 rot1da = geompy.MultiRotate1DNbTimes(prism, vrot, 4)
39 rot1db = geompy.MultiRotate1DByStep(prism, vrot, math.pi/6., 4)
45 rot2da = geompy.MultiRotate2DNbTimes(prism, vrot, 4, 50, 5)
48 rot2db = geompy.MultiRotate2DByStep(prism, vrot, math.pi/3., 4, 50, 5)
51 id_prism = geompy.addToStudy(prism,
"Prism")
52 id_rot1da = geompy.addToStudy(rot1da,
"Rotation 1D Nb.Times")
53 id_rot1db = geompy.addToStudy(rot1db,
"Rotation 1D By Step")
54 id_rot2da = geompy.addToStudy(rot2da,
"Rotation 2D Nb.Times")
55 id_rot2db = geompy.addToStudy(rot2db,
"Rotation 2D By Step")
58 gg.createAndDisplayGO(id_prism)
59 gg.setDisplayMode(id_prism,1)
60 gg.createAndDisplayGO(id_rot1da)
61 gg.setDisplayMode(id_rot1da,1)
62 gg.createAndDisplayGO(id_rot1db)
63 gg.setDisplayMode(id_rot1db,1)
64 gg.createAndDisplayGO(id_rot2da)
65 gg.setDisplayMode(id_rot2da,1)
66 gg.createAndDisplayGO(id_rot2db)
67 gg.setDisplayMode(id_rot2db,1)
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI(
"GEOM")
11 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
13 [Edge_1,Edge_2,Edge_3,Edge_4,Edge_5,Edge_6,Edge_7,Edge_8,Edge_9,Edge_10,Edge_11,Edge_12] = geompy.SubShapeAllSortedCentres(Box_1, geompy.ShapeType[
"EDGE"])
15 Wire_1 = geompy.MakeWire([Edge_12, Edge_7, Edge_11, Edge_6, Edge_1,Edge_4])
17 Fillet_1D_1 = geompy.MakeFillet1D(Wire_1, 55, [3, 4, 6, 8, 10])
19 id_Wire_1 = geompy.addToStudy(Wire_1,
"Wire_1")
20 id_Fillet_1D_1= geompy.addToStudy(Fillet_1D_1,
"Fillet_1D_1")
23 gg.createAndDisplayGO(id_Wire_1)
24 gg.createAndDisplayGO(id_Fillet_1D_1)
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI(
"GEOM")
10 ShapeTypeEdge = geompy.ShapeType[
"EDGE"]
13 p0 = geompy.MakeVertex( 0., 0., 0.)
14 px = geompy.MakeVertex(100., 0., 0.)
15 py = geompy.MakeVertex( 0., 100., 0.)
16 pz = geompy.MakeVertex( 0., 0., 100.)
17 vz = geompy.MakeVector(p0, pz)
18 vxy = geompy.MakeVector(px, py)
21 arc = geompy.MakeArc(py, pz, px)
24 wire = geompy.MakeWire([vxy, arc])
27 face = geompy.MakeFace(wire, 1)
30 prism = geompy.MakePrismVecH(face, vz, 100.0)
33 prism_edges = geompy.SubShapeAllSortedCentres(prism, ShapeTypeEdge)
35 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0]))
36 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1]))
37 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[2]))
40 fillet = geompy.MakeFillet(prism, radius, ShapeTypeEdge, IDlist_e)
43 filletall = geompy.MakeFilletAll(prism, radius)
46 id_prism = geompy.addToStudy(prism,
"Prism")
47 id_fillet = geompy.addToStudy(fillet,
"Fillet")
48 id_filletall = geompy.addToStudy(filletall,
"Fillet all")
51 gg.createAndDisplayGO(id_prism)
52 gg.setDisplayMode(id_prism,1)
53 gg.createAndDisplayGO(id_fillet)
54 gg.setDisplayMode(id_fillet,1)
55 gg.createAndDisplayGO(id_filletall)
56 gg.setDisplayMode(id_filletall,1)
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI(
"GEOM")
11 ShapeTypeFace = geompy.ShapeType[
"FACE"]
14 p0 = geompy.MakeVertex( 0., 0., 0.)
15 px = geompy.MakeVertex(100., 0., 0.)
16 py = geompy.MakeVertex( 0., 100., 0.)
17 pz = geompy.MakeVertex( 0., 0., 100.)
18 vz = geompy.MakeVector(p0, pz)
19 vxy = geompy.MakeVector(px, py)
22 arc = geompy.MakeArc(py, pz, px)
25 wire = geompy.MakeWire([vxy, arc])
28 face = geompy.MakeFace(wire, 1)
31 prism = geompy.MakePrismVecH(face, vz, 100.0)
34 prism_faces = geompy.SubShapeAllSortedCentres(prism, ShapeTypeFace)
35 f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0])
36 f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1])
37 IDlist_f = [f_ind_1, f_ind_2]
40 chamfer_e = geompy.MakeChamferEdge(prism, d1, d2, f_ind_1, f_ind_2)
43 chamfer_f = geompy.MakeChamferFaces(prism, d1, d2, IDlist_f)
44 chamfer_f1 = geompy.MakeChamfer(prism, d1, d2, ShapeTypeFace, IDlist_f)
47 chamfer_all = geompy.MakeChamferAll(prism, d1)
50 id_prism = geompy.addToStudy(prism,
"Prism")
51 id_chamfer_e = geompy.addToStudy(chamfer_e,
"Chamfer edge")
52 id_chamfer_f = geompy.addToStudy(chamfer_f,
"Chamfer faces")
53 id_chamfer_f1 = geompy.addToStudy(chamfer_f1,
"Chamfer faces 1")
54 id_chamfer_all = geompy.addToStudy(chamfer_all,
"Chamfer all")
57 gg.createAndDisplayGO(id_prism)
58 gg.setDisplayMode(id_prism,1)
59 gg.createAndDisplayGO(id_chamfer_e)
60 gg.setDisplayMode(id_chamfer_e,1)
61 gg.createAndDisplayGO(id_chamfer_f)
62 gg.setDisplayMode(id_chamfer_f,1)
63 gg.createAndDisplayGO(id_chamfer_f1)
64 gg.setDisplayMode(id_chamfer_f1,1)
65 gg.createAndDisplayGO(id_chamfer_all)
66 gg.setDisplayMode(id_chamfer_all,1)
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI(
"GEOM")
11 p1 = geompy.MakeVertex( 0., 0., 0.)
12 p2 = geompy.MakeVertex(100., 100., 0.)
13 p3 = geompy.MakeVertex( 0., 100., 0.)
16 edge1 = geompy.MakeEdge(p1, p2)
17 edge2 = geompy.MakeCircleR(100)
20 face1 = geompy.MakePlaneThreePnt(p1, p2, p3, 200)
21 sphere1 = geompy.MakeSpherePntR(p1, 100)
22 faces2 = geompy.SubShapeAllSorted(sphere1, GEOM.FACE)
26 resEdge1 = geompy.ExtendEdge(edge1, 0.2, 0.8)
27 resEdge2 = geompy.ExtendEdge(edge1, -0.3, 1.3)
28 resEdge3 = geompy.ExtendEdge(edge2, 0.5, 1)
29 resEdge4 = geompy.ExtendEdge(edge2, 0.2, 0.5)
32 resFace1 = geompy.ExtendFace(face1, 0.2, 0.8, -0.3, 1.3)
33 resFace2 = geompy.ExtendFace(face1, 0, 0.5, 1, 2)
34 resFace3 = geompy.ExtendFace(face2, 0.2, 0.8, 0.3, 0.7)
35 resFace4 = geompy.ExtendFace(face2, 0.5, 1, 0.5, 1)
38 id_edge1 = geompy.addToStudy(edge1,
"Edge 1")
39 id_edge2 = geompy.addToStudy(edge2,
"Edge 2")
40 id_face1 = geompy.addToStudy(face1,
"Face 1")
41 id_face2 = geompy.addToStudy(face2,
"Face 2")
42 id_resEdge1 = geompy.addToStudy(resEdge1,
"Extended Edge 1")
43 id_resEdge2 = geompy.addToStudy(resEdge2,
"Extended Edge 1")
44 id_resEdge3 = geompy.addToStudy(resEdge3,
"Extended Edge 2")
45 id_resEdge4 = geompy.addToStudy(resEdge4,
"Extended Edge 3")
46 id_resFace1 = geompy.addToStudy(resFace1,
"Extended Face 1")
47 id_resFace2 = geompy.addToStudy(resFace2,
"Extended Face 2")
48 id_resFace3 = geompy.addToStudy(resFace3,
"Extended Face 3")
49 id_resFace4 = geompy.addToStudy(resFace4,
"Extended Face 4")
52 gg.createAndDisplayGO(id_edge1)
53 gg.setDisplayMode(id_edge1, 1)
54 gg.createAndDisplayGO(id_edge2)
55 gg.setDisplayMode(id_edge2, 1)
56 gg.createAndDisplayGO(id_face1)
57 gg.setDisplayMode(id_face1, 1)
58 gg.createAndDisplayGO(id_face2)
59 gg.setDisplayMode(id_face2, 1)
60 gg.createAndDisplayGO(id_resEdge1)
61 gg.setDisplayMode(id_resEdge1, 1)
62 gg.createAndDisplayGO(id_resEdge2)
63 gg.setDisplayMode(id_resEdge2, 1)
64 gg.createAndDisplayGO(id_resEdge3)
65 gg.setDisplayMode(id_resEdge3, 1)
66 gg.createAndDisplayGO(id_resEdge4)
67 gg.setDisplayMode(id_resEdge4, 1)
68 gg.createAndDisplayGO(id_resFace1)
69 gg.setDisplayMode(id_resFace1, 1)
70 gg.createAndDisplayGO(id_resFace2)
71 gg.setDisplayMode(id_resFace2, 1)
72 gg.createAndDisplayGO(id_resFace3)
73 gg.setDisplayMode(id_resFace3, 1)
74 gg.createAndDisplayGO(id_resFace4)
75 gg.setDisplayMode(id_resFace4, 1)