Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 import salome
00033 import geompy
00034 import smesh
00035
00036 import math
00037
00038
00039
00040 geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
00041 myBuilder = salome.myStudy.NewBuilder()
00042 gg = salome.ImportComponentGUI("GEOM")
00043
00044 ShapeTypeCompSolid = 1
00045 ShapeTypeSolid = 2
00046 ShapeTypeShell = 3
00047 ShapeTypeFace = 4
00048 ShapeTypeWire = 5
00049 ShapeTypeEdge = 6
00050 ShapeTypeVertex = 7
00051
00052 Boolop_common = 1
00053 Boolop_cut = 2
00054 Boolop_fuse = 3
00055 Boolop_section = 4
00056
00057 p0 = geompy.MakeVertex(0., 0., 0.)
00058 px = geompy.MakeVertex(100., 0., 0.)
00059 py = geompy.MakeVertex(0., 100., 0.)
00060 pz = geompy.MakeVertex(0., 0., 100.)
00061 vx = geompy.MakeVector(p0, px)
00062 vy = geompy.MakeVector(p0, py)
00063 vz = geompy.MakeVector(p0, pz)
00064
00065 sphereExt = geompy.MakeSphere( 0., 0., 0., 400.)
00066 sphereInt = geompy.MakeSphere( 0.,-50., 0., 350.)
00067 sphereA = geompy.MakeSphere( -400., 50., 50., 400.)
00068 sphereB = geompy.MakeSphere( 350.,-50.,-50., 350.)
00069 ptcyle = geompy.MakeVertex(0., -300., -450.)
00070 cylindre = geompy.MakeCylinder(ptcyle,vz,500.,900.)
00071
00072 vol1=geompy.MakeCut(sphereExt,sphereA)
00073 vol2=geompy.MakeCut(vol1,sphereB)
00074 vol3=geompy.MakeCut(vol2,cylindre)
00075 blob=geompy.MakeCut(vol3,sphereInt)
00076
00077 idblob = geompy.addToStudy(blob,"blob")
00078
00079 aretes = []
00080 aretes = geompy.SubShapeAllSorted(blob, ShapeTypeEdge)
00081 eid=0
00082
00083
00084
00085
00086
00087
00088
00089
00090 salome.sg.updateObjBrowser(1)
00091
00092
00093
00094
00095
00096
00097
00098 print "-------------------------- mesh"
00099 smesh.SetCurrentStudy(salome.myStudy)
00100
00101
00102 shape_mesh = blob
00103 mesh=smesh.Mesh(shape_mesh, "MeshBlob")
00104
00105
00106 print "-------------------------- add hypothesis to mesh"
00107 algo1 = mesh.Segment()
00108 algo2 = mesh.Quadrangle()
00109 algo3 = mesh.Hexahedron()
00110
00111 numberOfSegmentsA = 4
00112
00113 algo = mesh.Segment(aretes[0])
00114 algo.NumberOfSegments(numberOfSegmentsA)
00115 algo = mesh.Segment(aretes[2])
00116 algo.NumberOfSegments(numberOfSegmentsA)
00117 algo = mesh.Segment(aretes[8])
00118 algo.NumberOfSegments(numberOfSegmentsA)
00119 algo = mesh.Segment(aretes[10])
00120 algo.NumberOfSegments(numberOfSegmentsA)
00121
00122
00123 numberOfSegmentsC = 15
00124
00125 algo = mesh.Segment(aretes[1])
00126 algo.NumberOfSegments(numberOfSegmentsC)
00127 algo = mesh.Segment(aretes[3])
00128 algo.NumberOfSegments(numberOfSegmentsC)
00129 algo = mesh.Segment(aretes[9])
00130 algo.NumberOfSegments(numberOfSegmentsC)
00131 algo = mesh.Segment(aretes[11])
00132 algo.NumberOfSegments(numberOfSegmentsC)
00133
00134
00135 numberOfSegmentsB = 10
00136 algo = mesh.Segment(aretes[4])
00137 algo.NumberOfSegments(numberOfSegmentsB)
00138 algo = mesh.Segment(aretes[5])
00139 algo.NumberOfSegments(numberOfSegmentsB)
00140 algo = mesh.Segment(aretes[6])
00141 algo.NumberOfSegments(numberOfSegmentsB)
00142 algo = mesh.Segment(aretes[7])
00143 algo.NumberOfSegments(numberOfSegmentsB)
00144
00145
00146
00147
00148 print "-------------------------- compute mesh"
00149 ret=mesh.Compute()
00150 print ret
00151 if ret != 0:
00152
00153
00154
00155 print "Information about the Mesh:"
00156 print "Number of nodes : ", mesh.NbNodes()
00157 print "Number of edges : ", mesh.NbEdges()
00158 print "Number of faces : ", mesh.NbFaces()
00159 print "Number of quadrangles : ", mesh.NbQuadrangles()
00160 print "Number of volumes : ", mesh.NbVolumes()
00161 print "Number of hexahedrons : ", mesh.NbHexas()
00162 else:
00163 print "problem when Computing the mesh"
00164
00165 salome.sg.updateObjBrowser(1)