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 import salome
00028 import geompy
00029 import smesh
00030
00031
00032
00033 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
00034 idbox = geompy.addToStudy(box, "box")
00035
00036
00037
00038 subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
00039 face = subShapeList[0]
00040 name = geompy.SubShapeName(face, box)
00041 print name
00042 idface = geompy.addToStudyInFather(box, face, name)
00043
00044
00045
00046 subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
00047 shell = subShellList[0]
00048 name = geompy.SubShapeName(shell, box)
00049 print name
00050 idshell = geompy.addToStudyInFather(box, shell, name)
00051
00052
00053
00054 edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
00055 edge = edgeList[0]
00056 name = geompy.SubShapeName(edge, face)
00057 print name
00058 idedge = geompy.addToStudyInFather(face, edge, name)
00059
00060
00061
00062
00063 smesh.SetCurrentStudy(salome.myStudy)
00064
00065
00066
00067 mesh = smesh.Mesh(box, "Meshbox")
00068
00069 print "-------------------------- add hypothesis to box"
00070 algoReg1 = mesh.Segment()
00071 hypNbSeg1 = algoReg1.NumberOfSegments(7)
00072 print hypNbSeg1.GetName()
00073 print hypNbSeg1.GetId()
00074 print hypNbSeg1.GetNumberOfSegments()
00075 smesh.SetName(hypNbSeg1, "NumberOfSegments_7")
00076
00077 algoMef1 = mesh.Triangle()
00078 hypArea1 = algoMef1.MaxElementArea(2500)
00079 print hypArea1.GetName()
00080 print hypArea1.GetId()
00081 print hypArea1.GetMaxElementArea()
00082 smesh.SetName(hypArea1, "MaxElementArea_2500")
00083
00084
00085 print "-------------------------- add hypothesis to edge"
00086 edge = salome.IDToObject(idedge)
00087
00088 algoReg2 = mesh.Segment(edge)
00089 hypLen1 = algoReg2.LocalLength(100)
00090 smesh.SetName(algoReg2.GetSubMesh(), "SubMeshEdge")
00091 print hypLen1.GetName()
00092 print hypLen1.GetId()
00093 print hypLen1.GetLength()
00094 smesh.SetName(hypLen1, "Local_Length_100")
00095
00096
00097 print "-------------------------- add hypothesis to face"
00098 face = salome.IDToObject(idface)
00099
00100 algoMef2 = mesh.Triangle(face)
00101 hypArea2 = algoMef2.MaxElementArea(500)
00102 smesh.SetName(algoMef2.GetSubMesh(), "SubMeshFace")
00103 print hypArea2.GetName()
00104 print hypArea2.GetId()
00105 print hypArea2.GetMaxElementArea()
00106 smesh.SetName(hypArea2, "MaxElementArea_500")
00107
00108
00109 salome.sg.updateObjBrowser(1);