Attachment 'lat_tibial_cartilage_Salome_HEX.py'

Download

   1 # -*- coding: utf-8 -*-
   2 
   3 ###
   4 ### This file is generated automatically by SALOME v7.5.1 with dump python functionality
   5 ###
   6 
   7 import sys
   8 import salome
   9 
  10 salome.salome_init()
  11 theStudy = salome.myStudy
  12 
  13 import salome_notebook
  14 notebook = salome_notebook.NoteBook(theStudy)
  15 sys.path.insert( 0, r'/home/bennetc2/Downloads/openknee_v1-0-1_IGES_surfaces')
  16 
  17 ###
  18 ### GEOM component
  19 ###
  20 
  21 import GEOM
  22 from salome.geom import geomBuilder
  23 import math
  24 import SALOMEDS
  25 
  26 
  27 geompy = geomBuilder.New(theStudy)
  28 
  29 O = geompy.MakeVertex(0, 0, 0)
  30 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
  31 OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
  32 OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
  33 lat_tibial_cartilage_igs_1 = geompy.ImportIGES("/home/bennetc2/Downloads/openknee_v1-0-1_IGES_surfaces/lat_tibial_cartilage.igs")
  34 Sewing_1 = geompy.Sew(lat_tibial_cartilage_igs_1, 1e-05)
  35 Solid_1 = geompy.MakeSolid([Sewing_1])
  36 NoExtraEdges_1 = geompy.RemoveExtraEdges(Solid_1, False)
  37 [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.ExtractShapes(NoExtraEdges_1, geompy.ShapeType["EDGE"], True)
  38 O_1 = geompy.MakeVertex(0, 0, 0)
  39 OX_1 = geompy.MakeVectorDXDYDZ(1, 0, 0)
  40 OY_1 = geompy.MakeVectorDXDYDZ(0, 1, 0)
  41 OZ_1 = geompy.MakeVectorDXDYDZ(0, 0, 1)
  42 Auto_group_for_SubMesh_1 = geompy.CreateGroup(NoExtraEdges_1, geompy.ShapeType["EDGE"])
  43 geompy.UnionList(Auto_group_for_SubMesh_1, [Edge_1, Edge_4, Edge_9, Edge_10])
  44 Auto_group_for_SubMesh_2 = geompy.CreateGroup(NoExtraEdges_1, geompy.ShapeType["EDGE"])
  45 geompy.UnionList(Auto_group_for_SubMesh_2, [Edge_5, Edge_6, Edge_7, Edge_8])
  46 Auto_group_for_SubMesh_3 = geompy.CreateGroup(NoExtraEdges_1, geompy.ShapeType["EDGE"])
  47 geompy.UnionList(Auto_group_for_SubMesh_3, [Edge_2, Edge_3, Edge_11, Edge_12])
  48 geompy.addToStudy( O, 'O' )
  49 geompy.addToStudy( OX, 'OX' )
  50 geompy.addToStudy( OY, 'OY' )
  51 geompy.addToStudy( OZ, 'OZ' )
  52 geompy.addToStudy( lat_tibial_cartilage_igs_1, 'lat_tibial_cartilage.igs_1' )
  53 geompy.addToStudy( Sewing_1, 'Sewing_1' )
  54 geompy.addToStudy( Solid_1, 'Solid_1' )
  55 geompy.addToStudy( NoExtraEdges_1, 'NoExtraEdges_1' )
  56 geompy.addToStudy( O_1, 'O' )
  57 geompy.addToStudy( OX_1, 'OX' )
  58 geompy.addToStudy( OY_1, 'OY' )
  59 geompy.addToStudy( OZ_1, 'OZ' )
  60 geompy.addToStudyInFather( NoExtraEdges_1, Edge_1, 'Edge_1' )
  61 geompy.addToStudyInFather( NoExtraEdges_1, Edge_2, 'Edge_2' )
  62 geompy.addToStudyInFather( NoExtraEdges_1, Edge_3, 'Edge_3' )
  63 geompy.addToStudyInFather( NoExtraEdges_1, Edge_4, 'Edge_4' )
  64 geompy.addToStudyInFather( NoExtraEdges_1, Edge_5, 'Edge_5' )
  65 geompy.addToStudyInFather( NoExtraEdges_1, Edge_6, 'Edge_6' )
  66 geompy.addToStudyInFather( NoExtraEdges_1, Edge_7, 'Edge_7' )
  67 geompy.addToStudyInFather( NoExtraEdges_1, Edge_8, 'Edge_8' )
  68 geompy.addToStudyInFather( NoExtraEdges_1, Edge_9, 'Edge_9' )
  69 geompy.addToStudyInFather( NoExtraEdges_1, Edge_10, 'Edge_10' )
  70 geompy.addToStudyInFather( NoExtraEdges_1, Edge_11, 'Edge_11' )
  71 geompy.addToStudyInFather( NoExtraEdges_1, Edge_12, 'Edge_12' )
  72 geompy.addToStudyInFather( NoExtraEdges_1, Auto_group_for_SubMesh_1, 'Auto_group_for_SubMesh_1' )
  73 geompy.addToStudyInFather( NoExtraEdges_1, Auto_group_for_SubMesh_2, 'Auto_group_for_SubMesh_2' )
  74 geompy.addToStudyInFather( NoExtraEdges_1, Auto_group_for_SubMesh_3, 'Auto_group_for_SubMesh_3' )
  75 
  76 ###
  77 ### SMESH component
  78 ###
  79 
  80 import  SMESH, SALOMEDS
  81 from salome.smesh import smeshBuilder
  82 
  83 from salome.StdMeshers import StdMeshersBuilder
  84 
  85 smesh = smeshBuilder.New(theStudy)
  86 Mesh_1 = smesh.Mesh(NoExtraEdges_1)
  87 Hexa_3D = Mesh_1.Hexahedron(algo=smeshBuilder.Hexa)
  88 Regular_1D = Mesh_1.Segment(geom=Auto_group_for_SubMesh_1)
  89 Nb_Segments_1 = Regular_1D.NumberOfSegments(3)
  90 Nb_Segments_1.SetDistrType( 0 )
  91 Nb_Segments_2 = smesh.CreateHypothesis('NumberOfSegments')
  92 Nb_Segments_2.SetNumberOfSegments( 50 )
  93 Nb_Segments_2.SetDistrType( 0 )
  94 status = Mesh_1.AddHypothesis(Regular_1D,Auto_group_for_SubMesh_2)
  95 status = Mesh_1.AddHypothesis(Nb_Segments_2,Auto_group_for_SubMesh_2)
  96 Nb_Segments_3 = smesh.CreateHypothesis('NumberOfSegments')
  97 Nb_Segments_3.SetNumberOfSegments( 50 )
  98 Nb_Segments_3.SetDistrType( 0 )
  99 status = Mesh_1.AddHypothesis(Regular_1D,Auto_group_for_SubMesh_3)
 100 status = Mesh_1.AddHypothesis(Nb_Segments_3,Auto_group_for_SubMesh_3)
 101 Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
 102 Quadrangle_Parameters_1 = Quadrangle_2D.QuadrangleParameters(StdMeshersBuilder.QUAD_STANDARD,-1,[],[])
 103 isDone = Mesh_1.Compute()
 104 [ SubMesh_1, SubMesh_2, SubMesh_3 ] = Mesh_1.GetMesh().GetSubMeshes()
 105 SubMesh_1 = Regular_1D.GetSubMesh()
 106 SubMesh_2 = Mesh_1.GetSubMesh( Auto_group_for_SubMesh_2, 'SubMesh_2' )
 107 SubMesh_3 = Mesh_1.GetSubMesh( Auto_group_for_SubMesh_3, 'SubMesh_3' )
 108 
 109 
 110 ## Set names of Mesh objects
 111 smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
 112 smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
 113 smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
 114 smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
 115 smesh.SetName(Nb_Segments_2, 'Nb. Segments_2')
 116 smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
 117 smesh.SetName(SubMesh_2, 'SubMesh_2')
 118 smesh.SetName(SubMesh_3, 'SubMesh_3')
 119 smesh.SetName(SubMesh_1, 'SubMesh_1')
 120 smesh.SetName(Quadrangle_Parameters_1, 'Quadrangle Parameters_1')
 121 smesh.SetName(Nb_Segments_3, 'Nb. Segments_3')
 122 
 123 
 124 if salome.sg.hasDesktop():
 125   salome.sg.updateObjBrowser(1)

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.