Version: 6.3.1
Functions | Variables

Package batchmode_smesh

Functions

def Init
def AddNewMesh
def AddNewHypothesis
def AddNewAlgorithms
def SetShape
def SetHypothesis
def SetAlgorithms
def UnSetHypothesis
def AddSubMesh
def AddSubMeshOnShape
def SetName

Variables

tuple modulecatalog = naming_service.Resolve("/Kernel/ModulCatalog")
tuple smesh = lcc.FindOrLoadComponent("FactoryServer", "SMESH")
tuple myStudyBuilder = myStudy.NewBuilder()
tuple father = myStudy.FindComponent("SMESH")
tuple FName = myStudyBuilder.FindOrCreateAttribute(father, "AttributeName")
tuple Comp = modulecatalog.GetComponent("SMESH")
tuple aPixmap = myStudyBuilder.FindOrCreateAttribute(father, "AttributePixMap")
tuple mySComponentMesh = father._narrow(SALOMEDS.SComponent)
int Tag_HypothesisRoot = 1
int Tag_AlgorithmsRoot = 2
int Tag_RefOnShape = 1
int Tag_RefOnAppliedHypothesis = 2
int Tag_RefOnAppliedAlgorithms = 3
int Tag_SubMeshOnVertex = 4
int Tag_SubMeshOnEdge = 5
int Tag_SubMeshOnFace = 6
int Tag_SubMeshOnSolid = 7
int Tag_SubMeshOnCompound = 8
dictionary Tag = {"HypothesisRoot":1,"AlgorithmsRoot":2,"RefOnShape":1,"RefOnAppliedHypothesis":2,"RefOnAppliedAlgorithms":3,"SubMeshOnVertex":4,"SubMeshOnEdge":5,"SubMeshOnFace":6,"SubMeshOnSolid":7,"SubMeshOnCompound":8}

Function Documentation

def batchmode_smesh.AddNewAlgorithms (   IOR)

Definition at line 139 of file batchmode_smesh.py.

00140                          :
00141      # VSR: added temporarily - objects are published automatically by the engine
00142      aSO = myStudy.FindObjectIOR( IOR )
00143      if aSO is not None:
00144           return aSO.GetID()
00145      # VSR ######################################################################
00146 
00147      res, AlgorithmsRoot = mySComponentMesh.FindSubObject (Tag_AlgorithmsRoot)
00148      if  AlgorithmsRoot is None or res == 0:
00149           AlgorithmsRoot = myStudyBuilde.NewObjectToTag (mySComponentMesh, Tag_AlgorithmsRoot)
00150           aName = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributeName")
00151           aName.SetValue("Algorithms")
00152           aSelAttr = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributeSelectable")
00153           aSelAttr.SetSelectable(0)
00154           aPixmap = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributePixMap")
00155           aPixmap.SetPixMap( "mesh_tree_algo.png" )
00156 
00157   # Add New Algorithms
00158      newHypo = myStudyBuilder.NewObject(AlgorithmsRoot)
00159      aPixmap = myStudyBuilder.FindOrCreateAttribute(newHypo, "AttributePixMap")
00160      aPixmap = anAttr._narrow(SALOMEDS.AttributePixMap)
00161      H = orb.string_to_object(IOR)
00162      aType = H.GetName();     #QString in fact
00163      aPixmap.SetPixMap( "mesh_tree_algo.png_" + aType )
00164      anIOR = myStudyBuilder.FindOrCreateAttribute(newHypo, "AttributeIOR")
00165      anIOR.SetValue(IOR)
00166      return newHypo.GetID()
00167 
00168 
#------------------------------------------------------------
def batchmode_smesh.AddNewHypothesis (   IOR)

Definition at line 111 of file batchmode_smesh.py.

00112                          :
00113      # VSR: added temporarily - objects are published automatically by the engine
00114      aSO = myStudy.FindObjectIOR( IOR )
00115      if aSO is not None:
00116           return aSO.GetID()
00117      # VSR ######################################################################
00118 
00119      res, HypothesisRoot = mySComponentMesh.FindSubObject (Tag_HypothesisRoot)
00120      if HypothesisRoot is None or res == 0:
00121           HypothesisRoot = myStudyBuilder.NewObjectToTag (mySComponentMesh, Tag_HypothesisRoot)
00122           aName = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributeName")
00123           aName.SetValue("Hypotheses")
00124           aSelAttr = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributeSelectable")
00125           aSelAttr.SetSelectable(0)
00126           aPixmap = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributePixMap")
00127           aPixmap.SetPixMap( "mesh_tree_hypo.png" )
00128  
00129      # Add New Hypothesis
00130      newHypo = myStudyBuilder.NewObject(HypothesisRoot)
00131      aPixmap = myStudyBuilder.FindOrCreateAttribute(newHypo, "AttributePixMap")
00132      H = orb.string_to_object(IOR)
00133      aType = H.GetName()
00134      aPixmap.SetPixMap( "mesh_tree_hypo.png_" + aType )
00135      anIOR = myStudyBuilder.FindOrCreateAttribute(newHypo, "AttributeIOR")
00136      anIOR.SetValue(IOR)
00137      return newHypo.GetID()
00138 
#------------------------------------------------------------
def batchmode_smesh.AddNewMesh (   IOR)

Definition at line 75 of file batchmode_smesh.py.

00076                    :
00077      # VSR: added temporarily - objects are published automatically by the engine
00078      aSO = myStudy.FindObjectIOR( IOR )
00079      if aSO is not None:
00080           return aSO.GetID()
00081      # VSR ######################################################################
00082      
00083      res,HypothesisRoot = mySComponentMesh.FindSubObject ( Tag_HypothesisRoot )
00084      if HypothesisRoot is None or res == 0:
00085           HypothesisRoot = myStudyBuilder.NewObjectToTag(mySComponentMesh, Tag_HypothesisRoot)
00086           aName = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributeName")
00087           aName.SetValue("Hypotheses")
00088           aPixmap = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributePixMap")
00089           aPixmap.SetPixMap( "mesh_tree_hypo.png" )
00090           aSelAttr = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributeSelectable")
00091           aSelAttr.SetSelectable(0)
00092 
00093      res, AlgorithmsRoot = mySComponentMesh.FindSubObject (Tag_AlgorithmsRoot)
00094      if AlgorithmsRoot is None  or res == 0:
00095           AlgorithmsRoot = myStudyBuilder.NewObjectToTag (mySComponentMesh, Tag_AlgorithmsRoot)
00096           aName = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributeName")
00097           aName.SetValue("Algorithms")
00098           aPixmap = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributePixMap")
00099           aPixmap.SetPixMap( "mesh_tree_algo.png" )
00100           aSelAttr = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributeSelectable")
00101           aSelAttr.SetSelectable(0)
00102 
00103      HypothesisRoot = HypothesisRoot._narrow(SALOMEDS.SObject)
00104      newMesh = myStudyBuilder.NewObject(mySComponentMesh)
00105      aPixmap = myStudyBuilder.FindOrCreateAttribute(newMesh, "AttributePixMap")
00106      aPixmap.SetPixMap( "mesh_tree_mesh.png" )
00107      anIOR = myStudyBuilder.FindOrCreateAttribute(newMesh, "AttributeIOR")
00108      anIOR.SetValue(IOR)
00109      return newMesh.GetID()
00110 
#------------------------------------------------------------    
def batchmode_smesh.AddSubMesh (   SO_Mesh_Entry,
  SM_IOR,
  ST 
)

Definition at line 259 of file batchmode_smesh.py.

00260                                            :
00261      # VSR: added temporarily - objects are published automatically by the engine
00262      aSO = myStudy.FindObjectIOR( SM_IOR )
00263      if aSO is not None:
00264           return aSO.GetID()
00265      # VSR ######################################################################
00266      
00267      SO_Mesh = myStudy.FindObjectID( SO_Mesh_Entry )
00268      if ( SO_Mesh ) : 
00269     
00270           if  ST == ShapeType["COMPSOLID"] : 
00271                Tag_Shape = Tag_SubMeshOnSolid
00272                Name = "SubMeshes on Solid"
00273           elif ST == ShapeType["FACE"] :
00274                Tag_Shape = Tag_SubMeshOnFace
00275                Name = "SubMeshes on Face"
00276           elif ST == ShapeType["EDGE"] :
00277                Tag_Shape = Tag_SubMeshOnEdge
00278                Name = "SubMeshes on Edge"
00279           elif ST == ShapeType["VERTEX"] :
00280                Tag_Shape = Tag_SubMeshOnVertex
00281                Name = "SubMeshes on Vertex"
00282           else :
00283                     Tag_Shape = Tag_SubMeshOnCompound
00284                Name = "SubMeshes on Compound"
00285           
00286           res, SubmeshesRoot = SO_Mesh.FindSubObject (Tag_Shape)
00287           if SubmeshesRoot is None or res == 0:
00288                     SubmeshesRoot = myStudyBuilder.NewObjectToTag (SO_Mesh, Tag_Shape)
00289                     aName = myStudyBuilder.FindOrCreateAttribute(SubmeshesRoot, "AttributeName")
00290                     aName.SetValue(Name)
00291                     aSelAttr = myStudyBuilder.FindOrCreateAttribute(SubmeshesRoot, "AttributeSelectable")
00292                     aSelAttr.SetSelectable(0)
00293           
00294           SO = myStudyBuilder.NewObject (SubmeshesRoot)
00295           anIOR = myStudyBuilder.FindOrCreateAttribute(SO, "AttributeIOR")
00296           anIOR.SetValue(SM_IOR)
00297           return  SO.GetID()
00298 
00299      return None
00300 
#------------------------------------------------------------
def batchmode_smesh.AddSubMeshOnShape (   Mesh_Entry,
  GeomShape_Entry,
  SM_IOR,
  ST 
)

Definition at line 301 of file batchmode_smesh.py.

00302                                                                 :
00303      # VSR: added temporarily - objects are published automatically by the engine
00304      aSO = myStudy.FindObjectIOR( SM_IOR )
00305      if aSO is not None:
00306           return aSO.GetID()
00307      # VSR ######################################################################
00308      SO_GeomShape = myStudy.FindObjectID( GeomShape_Entry )
00309      if  SO_GeomShape != None : 
00310           SM_Entry = AddSubMesh (Mesh_Entry,SM_IOR,ST)
00311           SO_SM = myStudy.FindObjectID( SM_Entry )
00312 
00313           if  SO_SM != None :
00314                SetShape (GeomShape_Entry, SM_Entry)
00315                return SM_Entry
00316 
00317      return None
00318 
00319 
#------------------------------------------------------------
def batchmode_smesh.Init ( )
def batchmode_smesh.SetAlgorithms (   Mesh_Or_SubMesh_Entry,
  Algorithms_Entry 
)

Definition at line 219 of file batchmode_smesh.py.

00220                                                           :
00221     SO_MorSM = myStudy.FindObjectID( Mesh_Or_SubMesh_Entry )
00222     SO_Algorithms = myStudy.FindObjectID( Algorithms_Entry )
00223     if  SO_MorSM != None and SO_Algorithms != None : 
00224      #Find or Create Applied Algorithms root
00225      res, AHR = SO_MorSM.FindSubObject (Tag_RefOnAppliedAlgorithms)
00226      if AHR is None or res == 0: 
00227                AHR = myStudyBuilder.NewObjectToTag (SO_MorSM, Tag_RefOnAppliedAlgorithms)
00228                aName = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeName")
00229 
00230           # The same name as in SMESH_Mesh_i::AddHypothesis() ##################
00231                aName.SetValue("Applied algorithms")
00232           
00233                aSelAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeSelectable")
00234                aSelAttr.SetSelectable(0)
00235                aPixmap = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributePixMap")
00236                aPixmap.SetPixMap( "mesh_tree_algo.png" )
00237                
00238      # VSR: added temporarily - reference to applied hypothesis is published automatically by the engine
00239      else :
00240           it = myStudy.NewChildIterator(AHR)
00241           while it.More() :
00242                res, Ref = it.Value().ReferencedObject()
00243                if res and Ref is not None and Ref.GetID() == Algorithms_Entry :
00244                     return
00245                it.Next()
00246      # VSR ######################################################################
00247      
00248      SO = myStudyBuilder.NewObject(AHR)
00249      myStudyBuilder.Addreference (SO,SO_Algorithms)
00250   
00251 
#------------------------------------------------------------
def batchmode_smesh.SetHypothesis (   Mesh_Or_SubMesh_Entry,
  Hypothesis_Entry 
)

Definition at line 185 of file batchmode_smesh.py.

00186                                                           :
00187   SO_MorSM = myStudy.FindObjectID( Mesh_Or_SubMesh_Entry )
00188   SO_Hypothesis =  myStudy.FindObjectID( Hypothesis_Entry )
00189 
00190   if  SO_MorSM is not None and SO_Hypothesis is not None : 
00191     
00192         #Find or Create Applied Hypothesis root
00193      res, AHR = SO_MorSM.FindSubObject (Tag_RefOnAppliedHypothesis)
00194      if  AHR is None or res == 0: 
00195                AHR = myStudyBuilder.NewObjectToTag (SO_MorSM, Tag_RefOnAppliedHypothesis)
00196                aName = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeName")
00197           
00198           # The same name as in SMESH_Mesh_i::AddHypothesis() ##################
00199                aName.SetValue("Applied hypotheses")
00200           
00201                aSelAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeSelectable")
00202                aSelAttr.SetSelectable(0)
00203                aPixmap = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributePixMap")
00204                aPixmap.SetPixMap( "mesh_tree_hypo.png" )
00205           
00206      # VSR: added temporarily - reference to applied hypothesis is published automatically by the engine
00207      else :
00208           it = myStudy.NewChildIterator(AHR)
00209           while it.More() :
00210                res, Ref = it.Value().ReferencedObject()
00211                if res and Ref is not None and Ref.GetID() == Hypothesis_Entry :
00212                     return
00213                it.Next()
00214      # VSR ######################################################################
00215      
00216      SO = myStudyBuilder.NewObject(AHR)
00217      myStudyBuilder.Addreference (SO,SO_Hypothesis)
00218 
#------------------------------------------------------------
def batchmode_smesh.SetName (   Entry,
  Name 
)

Definition at line 320 of file batchmode_smesh.py.

Referenced by SMESHGUI_BuildCompoundDlg.ClickOnApply(), SMESHGUI_MeshOp.createMesh(), SMESHGUI_MeshOp.createSubMesh(), SMESHGUI_MeshOp.editMeshOrSubMesh(), StdMeshersGUI_StdHypothesisCreator.storeParams(), and StdMeshersGUI_NbSegmentsCreator.storeParamsToHypo().

00321                         :
00322      SO = myStudy.FindObjectID( Entry )
00323      if SO != None : 
00324           aName = myStudyBuilder.FindOrCreateAttribute(SO, "AttributeName")
00325           aName.SetValue(Name)
def batchmode_smesh.SetShape (   ShapeEntry,
  MeshEntry 
)

Definition at line 169 of file batchmode_smesh.py.

00170                                    :
00171      SO_MorSM = myStudy.FindObjectID( MeshEntry )
00172      SO_GeomShape = myStudy.FindObjectID( ShapeEntry )
00173 
00174      if SO_MorSM is not None and SO_GeomShape is not None :
00175           # VSR: added temporarily - shape reference is published automatically by the engine
00176           res, Ref = SO_MorSM.FindSubObject( Tag_RefOnShape )
00177           if res == 1 :
00178                return
00179           # VSR ######################################################################
00180      
00181           SO = myStudyBuilder.NewObjectToTag (SO_MorSM, Tag_RefOnShape)
00182           myStudyBuilder.Addreference (SO,SO_GeomShape)
00183 
00184 
#------------------------------------------------------------
def batchmode_smesh.UnSetHypothesis (   Applied_Hypothesis_Entry)

Definition at line 252 of file batchmode_smesh.py.

00253                                                :
00254      SO_Applied_Hypothesis = myStudy.FindObjectID( Applied_Hypothesis_Entry )
00255      if SO_Applied_Hypothesis : 
00256           myStudyBuilder.RemoveObject(SO_Applied_Hypothesis)
00257      
00258 
#------------------------------------------------------------

Variable Documentation

tuple batchmode_smesh.aPixmap = myStudyBuilder.FindOrCreateAttribute(father, "AttributePixMap")
tuple batchmode_smesh.Comp = modulecatalog.GetComponent("SMESH")

Definition at line 47 of file batchmode_smesh.py.

tuple batchmode_smesh::father = myStudy.FindComponent("SMESH")
tuple batchmode_smesh.FName = myStudyBuilder.FindOrCreateAttribute(father, "AttributeName")

Definition at line 46 of file batchmode_smesh.py.

tuple batchmode_smesh.modulecatalog = naming_service.Resolve("/Kernel/ModulCatalog")

Definition at line 34 of file batchmode_smesh.py.

tuple batchmode_smesh.mySComponentMesh = father._narrow(SALOMEDS.SComponent)

Definition at line 54 of file batchmode_smesh.py.

tuple batchmode_smesh.myStudyBuilder = myStudy.NewBuilder()

Definition at line 38 of file batchmode_smesh.py.

tuple batchmode_smesh.smesh = lcc.FindOrLoadComponent("FactoryServer", "SMESH")

Definition at line 36 of file batchmode_smesh.py.

dictionary batchmode_smesh.Tag = {"HypothesisRoot":1,"AlgorithmsRoot":2,"RefOnShape":1,"RefOnAppliedHypothesis":2,"RefOnAppliedAlgorithms":3,"SubMeshOnVertex":4,"SubMeshOnEdge":5,"SubMeshOnFace":6,"SubMeshOnSolid":7,"SubMeshOnCompound":8}

Definition at line 69 of file batchmode_smesh.py.

Definition at line 57 of file batchmode_smesh.py.

Referenced by SMESH_Gen_i.GetAlgorithmsRootTag(), and SMESH_TypeFilter.isOk().

Definition at line 59 of file batchmode_smesh.py.

Referenced by SMESH_Gen_i.GetRefOnShapeTag().

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS