mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-24 08:20:35 +05:00
PAL8375 improvement solving.
This commit is contained in:
parent
bc6b9bec11
commit
a0aa2f09b2
@ -67,7 +67,12 @@ EXPORT_PYSCRIPTS = \
|
||||
GEOM_tube_geom.py \
|
||||
GEOM_tube_geom_gg2.py \
|
||||
GEOM_Nut.py \
|
||||
GEOM_Sketcher.py
|
||||
GEOM_Sketcher.py \
|
||||
PAL-MESH-019-020_geometry.py \
|
||||
PAL-MESH-028_geometry.py \
|
||||
PAL-MESH-030_geometry.py \
|
||||
PAL-MESH-033_geometry.py \
|
||||
PAL-MESH-035_geometry.py
|
||||
|
||||
LIB_CLIENT_IDL = SALOMEDS.idl \
|
||||
SALOMEDS_Attributes.idl \
|
||||
|
34
src/GEOM_SWIG/PAL-MESH-019-020_geometry.py
Executable file
34
src/GEOM_SWIG/PAL-MESH-019-020_geometry.py
Executable file
@ -0,0 +1,34 @@
|
||||
#####################################################################################
|
||||
#Created :17/02/2005
|
||||
#Auhtor :KOVALTCHUK Alexey
|
||||
#GUI test scenario :PAL-MESH-019 (geometry part), PAL-MESH-020 (geometry part)
|
||||
#####################################################################################
|
||||
|
||||
import geompy
|
||||
import salome
|
||||
|
||||
#Points creation (2.2)
|
||||
Vertex_1 = geompy.MakeVertex(0, 0, 0)
|
||||
geompy.addToStudy(Vertex_1, "Vertex_1")
|
||||
|
||||
Vertex_2 = geompy.MakeVertex(20, 0, 0)
|
||||
geompy.addToStudy(Vertex_2, "Vertex_2")
|
||||
|
||||
Vertex_3 = geompy.MakeVertex(10, 10, 0)
|
||||
geompy.addToStudy(Vertex_3, "Vertex_3")
|
||||
|
||||
Vertex_4 = geompy.MakeVertex(0, 100, 0)
|
||||
geompy.addToStudy(Vertex_4, "Vertex_4")
|
||||
|
||||
Vertex_5 = geompy.MakeVertex(0, 80, 20)
|
||||
geompy.addToStudy(Vertex_5, "Vertex_5")
|
||||
|
||||
#Curve creation (2.21)
|
||||
Curve_1 = geompy.MakeInterpol([Vertex_1, Vertex_3, Vertex_2])
|
||||
geompy.addToStudy(Curve_1, "Curve_1")
|
||||
|
||||
#Line creation (2.29)
|
||||
Line_1 = geompy.MakeLineTwoPnt(Vertex_4, Vertex_5)
|
||||
geompy.addToStudy(Line_1, "Line_1")
|
||||
|
||||
salome.sg.updateObjBrowser(1)
|
64
src/GEOM_SWIG/PAL-MESH-028_geometry.py
Executable file
64
src/GEOM_SWIG/PAL-MESH-028_geometry.py
Executable file
@ -0,0 +1,64 @@
|
||||
#####################################################################
|
||||
#Created :17/02/2005
|
||||
#Auhtor :KOVALTCHUK Alexey
|
||||
#GUI test scenario :PAL-MESH-028 (geometry part)
|
||||
#####################################################################
|
||||
|
||||
import geompy
|
||||
import salome
|
||||
import os
|
||||
|
||||
#Initialization
|
||||
salome.salome_init(1)
|
||||
|
||||
#Points construction (2.1)
|
||||
Vertices = [geompy.MakeVertex(0, 0, 0), geompy.MakeVertex(200, 0, 0), geompy.MakeVertex(200, 200, 0), geompy.MakeVertex(0, 200, 0), geompy.MakeVertex(50, 50, 200), geompy.MakeVertex(150, 50, 200), geompy.MakeVertex(150, 150, 200), geompy.MakeVertex(50, 150, 200)]
|
||||
for i in range(0, len(Vertices)):
|
||||
name = "Vertex_" + str(i+1)
|
||||
geompy.addToStudy(Vertices[i], name)
|
||||
|
||||
#Edges construction (3.1)
|
||||
Edges = [geompy.MakeEdge(Vertices[0], Vertices[1]), geompy.MakeEdge(Vertices[1], Vertices[5]), geompy.MakeEdge(Vertices[5], Vertices[4]), geompy.MakeEdge(Vertices[4], Vertices[0]), geompy.MakeEdge(Vertices[1], Vertices[2]), geompy.MakeEdge(Vertices[2], Vertices[6]), geompy.MakeEdge(Vertices[6], Vertices[5]), geompy.MakeEdge(Vertices[2], Vertices[3]), geompy.MakeEdge(Vertices[3], Vertices[7]), geompy.MakeEdge(Vertices[7], Vertices[6]), geompy.MakeEdge(Vertices[3], Vertices[0]), geompy.MakeEdge(Vertices[4], Vertices[7])]
|
||||
for i in range(0, len(Edges)):
|
||||
name = "Edge_" + str(i+1)
|
||||
geompy.addToStudy(Edges[i], name)
|
||||
|
||||
#Wires construction (4.1)
|
||||
Wires = [geompy.MakeWire([Edges[0], Edges[1], Edges[2], Edges[3]]), geompy.MakeWire([Edges[1], Edges[4], Edges[5], Edges[6]]), geompy.MakeWire([Edges[5], Edges[7], Edges[8], Edges[9]]), geompy.MakeWire([Edges[3], Edges[10], Edges[8], Edges[11]]), geompy.MakeWire([Edges[2], Edges[6], Edges[9], Edges[11]]), geompy.MakeWire([Edges[0], Edges[4], Edges[7], Edges[10]])]
|
||||
for i in range(0, len(Wires)):
|
||||
name = "Wire_" + str(i+1)
|
||||
geompy.addToStudy(Wires[i], name)
|
||||
|
||||
#Faces construction (5.1)
|
||||
Faces = [geompy.MakeFace(Wires[0], 1), geompy.MakeFace(Wires[1], 1), geompy.MakeFace(Wires[2], 1), geompy.MakeFace(Wires[3], 1), geompy.MakeFace(Wires[4], 1), geompy.MakeFace(Wires[5], 1)]
|
||||
for i in range(0, len(Faces)):
|
||||
name = "Face_" + str(i+1)
|
||||
geompy.addToStudy(Faces[i], name)
|
||||
|
||||
#Shell construction (6.1)
|
||||
Shell_1 = geompy.MakeShell(Faces)
|
||||
geompy.addToStudy(Shell_1, "Shell_1")
|
||||
Shells = [Shell_1]
|
||||
|
||||
#Solid construction (7.1)
|
||||
Solid_1 = geompy.MakeSolid(Shells)
|
||||
geompy.addToStudy(Solid_1, "Solid_1")
|
||||
|
||||
#Prism construction (8.1)
|
||||
Prism_1 = geompy.MakePrismVecH(Faces[4], Edges[1], 100)
|
||||
geompy.addToStudy(Prism_1, "Prism_1")
|
||||
|
||||
#Save Study (9.1)
|
||||
theHomePath = os.getenv("HOME")
|
||||
theFilenameToSave = theHomePath + "/Pyramid.hdf"
|
||||
if os.access(theFilenameToSave, os.F_OK):
|
||||
if os.access(theFilenameToSave, os.W_OK):
|
||||
os.remove(theFilenameToSave)
|
||||
salome.myStudyManager.SaveAs(theFilenameToSave, salome.myStudy, 0)
|
||||
else:
|
||||
print "You have no enough permissions to overwrite HDF file: ",theFilenameToSave
|
||||
else:
|
||||
salome.myStudyManager.SaveAs(theFilenameToSave, salome.myStudy, 0)
|
||||
|
||||
|
||||
salome.sg.updateObjBrowser(1)
|
57
src/GEOM_SWIG/PAL-MESH-030_geometry.py
Executable file
57
src/GEOM_SWIG/PAL-MESH-030_geometry.py
Executable file
@ -0,0 +1,57 @@
|
||||
#==============================================================================
|
||||
# Created : 17/02/2005
|
||||
# Author : Alexander KOVALEV
|
||||
# GUI test scenario : PAL-MESH-030_geometry
|
||||
#==============================================================================
|
||||
|
||||
import salome
|
||||
import geompy
|
||||
|
||||
# Stage 2: "Creation of geometry"
|
||||
|
||||
# (2.1) Creating a box
|
||||
Box_1 = geompy.MakeBoxDXDYDZ(200, 400, 300)
|
||||
# (2.8) Exploding Box_1 to vertices and faces
|
||||
Box_1_vertices = geompy.SubShapeAll(Box_1, geompy.ShapeType["VERTEX"])
|
||||
Box_1_faces = geompy.SubShapeAll(Box_1, geompy.ShapeType["FACE"])
|
||||
# (2.17) Creating a new points
|
||||
Vertex_9 = geompy.MakeVertex(200, 200, 50)
|
||||
Vertex_10 = geompy.MakeVertex(150, 300, 80)
|
||||
# (2.26) Translation of the faces
|
||||
Face_translated = []
|
||||
Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[2], Box_1_vertices[5], Vertex_9))
|
||||
Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[5], Vertex_9, Vertex_10))
|
||||
Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[2], Vertex_10, Vertex_9))
|
||||
Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[3], Box_1_vertices[5], Vertex_9))
|
||||
Face_translated.append(geompy.MakeTranslationTwoPoints(Face_translated[1], Vertex_9, Vertex_10))
|
||||
# (2.49) Building a Compound_1
|
||||
ShapeListCompound_1 = []
|
||||
i = 0
|
||||
while i < 5 :
|
||||
ShapeListCompound_1.append(Face_translated[i])
|
||||
i = i + 1
|
||||
Compound_1 = geompy.MakeCompound(ShapeListCompound_1)
|
||||
# (2.54) Exploding of Compound_1 to faces
|
||||
Compound_1_faces = geompy.SubShapeAll(Compound_1, geompy.ShapeType["FACE"])
|
||||
# (2.54) Exploding of Face_translated_2 to vertices
|
||||
Face_translated_2_vertices = geompy.SubShapeAll(Face_translated[1], geompy.ShapeType["VERTEX"])
|
||||
# (2.62) Creating two boxes
|
||||
Box_1 = geompy.MakeBoxTwoPnt(Vertex_9, Face_translated_2_vertices[1])
|
||||
Box_2 = geompy.MakeBoxTwoPnt(Vertex_10, Face_translated_2_vertices[0])
|
||||
# (2.70) Building Compound_2
|
||||
ShapeListCompound_2 = []
|
||||
ShapeListCompound_2.append(Box_1)
|
||||
ShapeListCompound_2.append(Box_2)
|
||||
Compound_2 = geompy.MakeCompound(ShapeListCompound_2)
|
||||
# (2.75) Exploding of Compound_2 to solids
|
||||
Compound_2_solids = geompy.SubShapeAll(Compound_2, geompy.ShapeType["SOLID"])
|
||||
|
||||
# Adding to study of geometrical objects
|
||||
id_Compound_1 = geompy.addToStudy(Compound_1, "Compound_1")
|
||||
id_Face_1 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[0], "Face_1")
|
||||
id_Face_5 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[4], "Face_5")
|
||||
id_Face_4 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[3], "Face_4")
|
||||
id_Compound_2 = geompy.addToStudy(Compound_2, "Compound_2")
|
||||
id_Solid_2 = geompy.addToStudyInFather(Compound_2,Compound_2_solids[1], "Solid_2")
|
||||
|
||||
salome.sg.updateObjBrowser(1)
|
40
src/GEOM_SWIG/PAL-MESH-033_geometry.py
Executable file
40
src/GEOM_SWIG/PAL-MESH-033_geometry.py
Executable file
@ -0,0 +1,40 @@
|
||||
#####################################################################
|
||||
#Created :17/02/2005
|
||||
#Auhtor :KOVALTCHUK Alexey
|
||||
#GUI test scenario :PAL-MESH-033 (geometry part)
|
||||
#####################################################################
|
||||
|
||||
import geompy
|
||||
import salome
|
||||
|
||||
#Points creation (2.2)
|
||||
Vertex_1 = geompy.MakeVertex(0, 0, 0)
|
||||
geompy.addToStudy(Vertex_1, "Vertex_1")
|
||||
|
||||
Vertex_2 = geompy.MakeVertex(0, 100, 0)
|
||||
geompy.addToStudy(Vertex_2, "Vertex_2")
|
||||
|
||||
Vertex_3 = geompy.MakeVertex(100, 100, 0)
|
||||
geompy.addToStudy(Vertex_3, "Vertex_3")
|
||||
|
||||
Vertex_4 = geompy.MakeVertex(100, 0, 0)
|
||||
geompy.addToStudy(Vertex_4, "Vertex_4")
|
||||
|
||||
#Edges creation (2.18)
|
||||
Edge_1 = geompy.MakeEdge(Vertex_1, Vertex_2)
|
||||
geompy.addToStudy(Edge_1, "Edge_1")
|
||||
|
||||
Edge_2 = geompy.MakeEdge(Vertex_2, Vertex_3)
|
||||
geompy.addToStudy(Edge_2, "Edge_2")
|
||||
|
||||
Edge_3 = geompy.MakeEdge(Vertex_3, Vertex_4)
|
||||
geompy.addToStudy(Edge_3, "Edge_3")
|
||||
|
||||
Edge_4 = geompy.MakeEdge(Vertex_4, Vertex_1)
|
||||
geompy.addToStudy(Edge_4, "Edge_4")
|
||||
|
||||
#Wire creation (2.33)
|
||||
Wire_1 = geompy.MakeWire([Edge_1, Edge_2, Edge_3, Edge_4])
|
||||
geompy.addToStudy(Wire_1, "Wire_1")
|
||||
|
||||
salome.sg.updateObjBrowser(1)
|
88
src/GEOM_SWIG/PAL-MESH-035_geometry.py
Executable file
88
src/GEOM_SWIG/PAL-MESH-035_geometry.py
Executable file
@ -0,0 +1,88 @@
|
||||
#####################################################################
|
||||
#Created :15/02/2005
|
||||
#Auhtor :KOVALTCHUK Alexey
|
||||
#GUI test scenario :PAL-MESH-035 (geometry part)
|
||||
#####################################################################
|
||||
|
||||
import geompy
|
||||
import salome
|
||||
|
||||
#Box creation (2.2)
|
||||
Box_1 = geompy.MakeBoxDXDYDZ(200, 400, 300)
|
||||
geompy.addToStudy(Box_1, "Box_1")
|
||||
|
||||
#Cylinder creation (2.8)
|
||||
Cylinder_1 = geompy.MakeCylinderRH(100, 300)
|
||||
geompy.addToStudy(Cylinder_1, "Cylinder_1")
|
||||
|
||||
#Cone creation (2.13)
|
||||
Cone_1 = geompy.MakeConeR1R2H(100, 50, 200)
|
||||
geompy.addToStudy(Cone_1, "Cone_1")
|
||||
|
||||
#Explode box, cone and cylinder on faces and vertices(2.18)
|
||||
ListOfFaces_Box_1 = geompy.SubShapeAll(Box_1, geompy.ShapeType["FACE"])
|
||||
NbExplodedFaces_Box_1 = len(ListOfFaces_Box_1)
|
||||
for i in range (0, NbExplodedFaces_Box_1):
|
||||
name = "Face_" + str(i+1)
|
||||
geompy.addToStudyInFather(Box_1, ListOfFaces_Box_1[i], name)
|
||||
|
||||
ListOfVertices_Box_1 = geompy.SubShapeAll(Box_1, geompy.ShapeType["VERTEX"])
|
||||
NbExplodedVertices_Box_1 = len(ListOfVertices_Box_1)
|
||||
for i in range (0, NbExplodedVertices_Box_1):
|
||||
name = "Vertex_" + str(i+1)
|
||||
geompy.addToStudyInFather(Box_1, ListOfVertices_Box_1[i], name)
|
||||
|
||||
ListOfFaces_Cylinder_1 = geompy.SubShapeAll(Cylinder_1, geompy.ShapeType["FACE"])
|
||||
NbExplodedFaces_Cylinder_1 = len(ListOfFaces_Cylinder_1)
|
||||
for i in range (0, NbExplodedFaces_Cylinder_1):
|
||||
name = "Face_" + str(NbExplodedFaces_Box_1+i+1)
|
||||
geompy.addToStudyInFather(Cylinder_1, ListOfFaces_Cylinder_1[i], name)
|
||||
|
||||
ListOfFaces_Cone_1 = geompy.SubShapeAll(Cone_1, geompy.ShapeType["FACE"])
|
||||
NbExplodedFaces_Cone_1 = len(ListOfFaces_Cone_1)
|
||||
for i in range (0, NbExplodedFaces_Cone_1):
|
||||
name = "Face_" + str(NbExplodedFaces_Box_1+NbExplodedFaces_Cylinder_1+i+1)
|
||||
geompy.addToStudyInFather(Cone_1, ListOfFaces_Cone_1[i], name)
|
||||
|
||||
#Plane creation (2.32)
|
||||
Plane_1 = geompy.MakePlaneThreePnt(ListOfVertices_Box_1[0], ListOfVertices_Box_1[1], ListOfVertices_Box_1[3], 600)
|
||||
geompy.addToStudy(Plane_1, "Plane_1")
|
||||
|
||||
#Partition (2.32)
|
||||
compound = geompy.MakeCompound([ListOfFaces_Cylinder_1[0], ListOfFaces_Cone_1[0]])
|
||||
Partition_1 = geompy.MakeHalfPartition(compound, Plane_1)
|
||||
geompy.addToStudy(Partition_1, "Partition_1")
|
||||
|
||||
#Explode partition on faces and vertices(2.38)
|
||||
ListOfFaces_Partition_1 = geompy.SubShapeAll(Partition_1, geompy.ShapeType["FACE"])
|
||||
NbExplodedFaces_Partition_1 = len(ListOfFaces_Partition_1)
|
||||
for i in range (0, NbExplodedFaces_Partition_1):
|
||||
name = "Face_" + str(NbExplodedFaces_Box_1+NbExplodedFaces_Cylinder_1+NbExplodedFaces_Cone_1+i+1)
|
||||
geompy.addToStudyInFather(Partition_1, ListOfFaces_Partition_1[i], name)
|
||||
|
||||
#Explode faces on vertices(2.43)
|
||||
ListOfVertices_Face_7 = geompy.SubShapeAll(ListOfFaces_Cylinder_1[0], geompy.ShapeType["VERTEX"])
|
||||
NbExplodedVertices_Face_7 = len(ListOfVertices_Face_7)
|
||||
for i in range (0, NbExplodedVertices_Face_7):
|
||||
name = "Vertex_" + str(NbExplodedVertices_Box_1+i+1)
|
||||
geompy.addToStudyInFather(ListOfFaces_Cylinder_1[0], ListOfVertices_Face_7[i], name)
|
||||
|
||||
ListOfVertices_Face_10 = geompy.SubShapeAll(ListOfFaces_Cone_1[0], geompy.ShapeType["VERTEX"])
|
||||
NbExplodedVertices_Face_10 = len(ListOfVertices_Face_10)
|
||||
for i in range (0, NbExplodedVertices_Face_10):
|
||||
name = "Vertex_" + str(NbExplodedVertices_Box_1+NbExplodedVertices_Face_7+i+1)
|
||||
geompy.addToStudyInFather(ListOfFaces_Cone_1[0], ListOfVertices_Face_10[i], name)
|
||||
|
||||
ListOfVertices_Face_15 = geompy.SubShapeAll(ListOfFaces_Partition_1[2], geompy.ShapeType["VERTEX"])
|
||||
NbExplodedVertices_Face_15 = len(ListOfVertices_Face_15)
|
||||
for i in range (0, NbExplodedVertices_Face_15):
|
||||
name = "Vertex_" + str(NbExplodedVertices_Box_1+NbExplodedVertices_Face_7+NbExplodedVertices_Face_10+i+1)
|
||||
geompy.addToStudyInFather(ListOfFaces_Partition_1[2], ListOfVertices_Face_15[i], name)
|
||||
|
||||
ListOfVertices_Face_18 = geompy.SubShapeAll(ListOfFaces_Partition_1[NbExplodedFaces_Partition_1-1], geompy.ShapeType["VERTEX"])
|
||||
NbExplodedVertices_Face_18 = len(ListOfVertices_Face_18)
|
||||
for i in range (0, NbExplodedVertices_Face_18):
|
||||
name = "Vertex_" + str(NbExplodedVertices_Box_1+NbExplodedVertices_Face_7+NbExplodedVertices_Face_10+NbExplodedVertices_Face_15+i+1)
|
||||
geompy.addToStudyInFather(ListOfFaces_Partition_1[NbExplodedFaces_Partition_1-1], ListOfVertices_Face_18[i], name)
|
||||
|
||||
salome.sg.updateObjBrowser(1)
|
Loading…
Reference in New Issue
Block a user