Primitives

Creation of a Box

import geompy

import salome

gg = salome.ImportComponentGUI("GEOM")

 

# create vertices

p0 = geompy.MakeVertex(15, 25, 35)

p70 = geompy.MakeVertex(70, 70, 70)

 

# create boxes

box1 = geompy.MakeBoxDXDYDZ(10, 20, 30)

box2 = geompy.MakeBox(10,20,30, 15,25,35)

box3 = geompy.MakeBoxTwoPnt(p0, p70)

 

# add objects in the study

id_box1 = geompy.addToStudy(box1,"Box1")

id_box2 = geompy.addToStudy(box2,"Box2")

id_box3 = geompy.addToStudy(box3,"Box3")

 

# display the boxes

gg.createAndDisplayGO(id_box1)

gg.setDisplayMode(id_box1,1)

gg.createAndDisplayGO(id_box2)

gg.setDisplayMode(id_box2,1)

gg.createAndDisplayGO(id_box3)

gg.setDisplayMode(id_box3,1)

 

Creation of a Cylinder

import geompy

import salome

gg = salome.ImportComponentGUI("GEOM")

 

# create a vertex and a vector

p1 = geompy.MakeVertex(35, 35, 0)

p2 = geompy.MakeVertex(35, 35, 70)

v = geompy.MakeVector(p1, p2)

 

# create cones

cone1 = geompy.MakeCone(p1, v, 17, 1, 20)

cone2 = geompy.MakeConeR1R2H(30, 10, 30)

 

# add objects in the study

id_cone1 = geompy.addToStudy(cone1,"Cone1")

id_cone2 = geompy.addToStudy(cone2,"Cone2")

 

# display cones

gg.createAndDisplayGO(id_cone1)

gg.setDisplayMode(id_cone1,1)

gg.createAndDisplayGO(id_cone2)

gg.setDisplayMode(id_cone2,1)

 

Creation of a Sphere

import geompy

import salome

gg = salome.ImportComponentGUI("GEOM")

 

# create a vertex

p = geompy.MakeVertex(55, 45, 25)

 

# create spheres

radius1 = 20

sphere1 = geompy.MakeSpherePntR(p, radius1)

radius2 = 15

sphere2 = geompy.MakeSphere(0, 0, 45, radius2)

radius3 = 30

sphere3 = geompy.MakeSphereR(radius3)

 

# add objects in the study

id_sphere1 = geompy.addToStudy(sphere1,"Sphere1")

id_sphere2 = geompy.addToStudy(sphere2,"Sphere2")

id_sphere3 = geompy.addToStudy(sphere3,"Sphere3")

 

# display spheres

gg.createAndDisplayGO(id_sphere1)

gg.setDisplayMode(id_sphere1,1)

gg.createAndDisplayGO(id_sphere2)

gg.setDisplayMode(id_sphere2,1)

gg.createAndDisplayGO(id_sphere3)

gg.setDisplayMode(id_sphere3,1)

 

Creation of a Torus

import geompy

import salome

gg = salome.ImportComponentGUI("GEOM")

 

# create a vertex and a vector

p1 = geompy.MakeVertex(35, 40, 45)

p2 = geompy.MakeVertex(35, 45, 70)

v = geompy.MakeVector(p1, p2)

 

# create toruses

torus1 = geompy.MakeTorus(p1, v, 20, 10)

torus2 = geompy.MakeTorusRR(30, 15)

 

# add objects in the study

id_torus1 = geompy.addToStudy(torus1,"Torus1")

id_torus2 = geompy.addToStudy(torus2,"Torus2")

 

# display toruses

gg.createAndDisplayGO(id_torus1)

gg.setDisplayMode(id_torus1,1)

gg.createAndDisplayGO(id_torus2)

gg.setDisplayMode(id_torus2,1)

Creation of a Cone

import geompy

import salome

gg = salome.ImportComponentGUI("GEOM")

 

# create a vertex and a vector

p1 = geompy.MakeVertex(35, 35, 0)

p2 = geompy.MakeVertex(35, 35, 70)

v = geompy.MakeVector(p1, p2)

 

# create cones

cone1 = geompy.MakeCone(p1, v, 17, 1, 20)

cone2 = geompy.MakeConeR1R2H(30, 10, 30)

 

# add objects in the study

id_cone1 = geompy.addToStudy(cone1,"Cone1")

id_cone2 = geompy.addToStudy(cone2,"Cone2")

 

# display cones

gg.createAndDisplayGO(id_cone1)

gg.setDisplayMode(id_cone1,1)

gg.createAndDisplayGO(id_cone2)

gg.setDisplayMode(id_cone2,1)