mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-27 09:50:34 +05:00
PR: true singleton instance of smesh
This commit is contained in:
parent
76775f17ac
commit
74ba6feb24
@ -87,28 +87,28 @@ if smesh:
|
||||
|
||||
print """
|
||||
===============================================================================
|
||||
WARNING: |
|
||||
Usage of smesh.py is deprecated in SALOME V7.2! |
|
||||
smesh.py will be removed in a future version! |
|
||||
TODO: |
|
||||
The following changes in your scripts are required to avoid this message: |
|
||||
|
|
||||
replace |
|
||||
------- |
|
||||
|
|
||||
import smesh, SMESH, SALOMEDS |
|
||||
smesh.SetCurrentStudy(theStudy) |
|
||||
|
|
||||
with |
|
||||
---- |
|
||||
|
|
||||
import SMESH, SALOMEDS |
|
||||
from salome.smesh import smeshBuilder |
|
||||
smesh = smeshBuilder.New(theStudy) |
|
||||
|
|
||||
you also need to modify some lines where smeshBuilder is used instead of smesh|
|
||||
|
|
||||
algo=smesh.xxxx ==> algo.smeshBuilder.xxxx |
|
||||
|
|
||||
WARNING:
|
||||
Usage of smesh.py is deprecated in SALOME V7.2!
|
||||
smesh.py will be removed in a future version!
|
||||
TODO:
|
||||
The following changes in your scripts are required to avoid this message:
|
||||
|
||||
replace
|
||||
-------
|
||||
|
||||
import smesh, SMESH, SALOMEDS
|
||||
smesh.SetCurrentStudy(theStudy)
|
||||
|
||||
with
|
||||
----
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(theStudy)
|
||||
|
||||
you also need to modify some lines where smeshBuilder is used instead of smesh
|
||||
|
||||
algo=smesh.xxxx ==> algo.smeshBuilder.xxxx
|
||||
|
||||
===============================================================================
|
||||
"""
|
||||
|
@ -285,6 +285,7 @@ def FirstVertexOnCurve(edge):
|
||||
smeshInst = None
|
||||
engine = None
|
||||
doLcc = False
|
||||
created = False
|
||||
|
||||
## This class allows to create, load or manipulate meshes
|
||||
# It has a set of methods to create load or copy meshes, to combine several meshes.
|
||||
@ -312,7 +313,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
|
||||
global engine
|
||||
global smeshInst
|
||||
global doLcc
|
||||
#print "__new__", engine, smeshInst, doLcc
|
||||
#print "==== __new__", engine, smeshInst, doLcc
|
||||
|
||||
if smeshInst is None:
|
||||
# smesh engine is either retrieved from engine, or created
|
||||
@ -327,26 +328,30 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
|
||||
# FindOrLoadComponent called:
|
||||
# 1. CORBA resolution of server
|
||||
# 2. the __new__ method is called again
|
||||
#print "smeshInst = lcc.FindOrLoadComponent ", engine, smeshInst, doLcc
|
||||
#print "==== smeshInst = lcc.FindOrLoadComponent ", engine, smeshInst, doLcc
|
||||
smeshInst = salome.lcc.FindOrLoadComponent( "FactoryServer", "SMESH" )
|
||||
else:
|
||||
# FindOrLoadComponent not called
|
||||
if smeshInst is None:
|
||||
# smeshBuilder instance is created from lcc.FindOrLoadComponent
|
||||
#print "smeshInst = super(smeshBuilder,cls).__new__(cls) ", engine, smeshInst, doLcc
|
||||
#print "==== smeshInst = super(smeshBuilder,cls).__new__(cls) ", engine, smeshInst, doLcc
|
||||
smeshInst = super(smeshBuilder,cls).__new__(cls)
|
||||
else:
|
||||
# smesh engine not created: existing engine found
|
||||
#print "existing ", engine, smeshInst, doLcc
|
||||
#print "==== existing ", engine, smeshInst, doLcc
|
||||
pass
|
||||
|
||||
#print "====1 ", smeshInst
|
||||
return smeshInst
|
||||
|
||||
#print "====2 ", smeshInst
|
||||
return smeshInst
|
||||
|
||||
def __init__(self):
|
||||
#print "__init__"
|
||||
SMESH._objref_SMESH_Gen.__init__(self)
|
||||
global created
|
||||
#print "--------------- smeshbuilder __init__ ---", created
|
||||
if not created:
|
||||
created = True
|
||||
SMESH._objref_SMESH_Gen.__init__(self)
|
||||
|
||||
## Dump component to the Python script
|
||||
# This method overrides IDL function to allow default values for the parameters.
|
||||
|
Loading…
Reference in New Issue
Block a user