From a7455be5999266c97f54520a1ec12aa316b3cf5b Mon Sep 17 00:00:00 2001 From: salome <> Date: Fri, 10 Dec 2004 16:46:59 +0000 Subject: [PATCH] =?utf8?q?Ajout=20de=20l'interface=20idl=20necessaire=20po?= =?utf8?q?ur=20la=20V2=5F1=5F0b1=20Adaptation=20de=20SMESH=5Futil.py=20pou?= =?utf8?q?r=20conformit=C3=A9=20au=20nouveau=20format=20V2=5F1=5F0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- idl/EFICAS_Gen.idl | 15 +++++++++ idl/Makefile.in | 60 +++++++++++++++++++++++++++++++++ src/EFICAS/EFICAS.py | 21 ++++++++++++ src/EFICAS/Makefile.in | 20 +++++++++++ src/EFICASGUI/SMESH_utils.py | 65 +++++++++++++++++++++++++++++++----- src/Makefile.in | 4 +-- 6 files changed, 174 insertions(+), 11 deletions(-) create mode 100644 idl/EFICAS_Gen.idl create mode 100644 idl/Makefile.in create mode 100644 src/EFICAS/EFICAS.py create mode 100644 src/EFICAS/Makefile.in diff --git a/idl/EFICAS_Gen.idl b/idl/EFICAS_Gen.idl new file mode 100644 index 00000000..454c191b --- /dev/null +++ b/idl/EFICAS_Gen.idl @@ -0,0 +1,15 @@ +#ifndef __EFICAS_GEN__ +#define __EFICAS_GEN__ + +#include "SALOME_Component.idl" +#include "SALOME_Exception.idl" + +module EFICAS_ORB +{ + interface EFICAS_Gen : Engines::Component + { + }; +}; + +#endif + diff --git a/idl/Makefile.in b/idl/Makefile.in new file mode 100644 index 00000000..2234cd1c --- /dev/null +++ b/idl/Makefile.in @@ -0,0 +1,60 @@ +# +# generate dependencies for idl file : +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +VPATH=.:$(srcdir):${KERNEL_ROOT_DIR}/idl/salome + +@COMMENCE@ + +IDL_FILES = EFICAS_Gen.idl + +PY_CLIENT_IDL = $(IDL_FILES) + +# we copy all idl file in $(top_builddir)/idl +inc: $(IDL_FILES:%=$(top_builddir)/idl/%) + +$(IDL_FILES:%=$(top_builddir)/idl/%):$(top_builddir)/idl/%:% + #$(CP) $< $@ + cp -f $< $@ + +lib: pyidl + +PYTHON_BUILD_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/@PACKAGE@ + +pyidl: $(PYTHON_BUILD_SITE) $(IDL_FILES:%.idl=$(PYTHON_BUILD_SITE)/%_idl.py) + +$(PYTHON_BUILD_SITE): + $(INSTALL) -d $@ + +$(PYTHON_BUILD_SITE)/%_idl.py: %.idl + $(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_BUILD_SITE) $< + +# install python client (generated from idl file +install: install-pyidl install-idl + +# create directory $(idldir) and copy idl files into it +install-idl: $(IDL_FILES) + $(INSTALL) -d $(idldir) + cp -p $^ $(idldir) + +install-pyidl: $(IDL_FILES) + $(INSTALL) -d $(PYTHON_SITE_INSTALL) + @for file in $^ dummy; do \ + if [ $$file != "dummy" ]; then \ + $(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_SITE_INSTALL) $$file ; \ + fi ; \ + done ; + + +cleandep: + -$(RM) .dep* + +distclean: + -$(RM) *.py + -$(RM) $(IDL_FILES:%=$(top_builddir)/idl/%) + -$(RM) Makefile + diff --git a/src/EFICAS/EFICAS.py b/src/EFICAS/EFICAS.py new file mode 100644 index 00000000..3d6fc04b --- /dev/null +++ b/src/EFICAS/EFICAS.py @@ -0,0 +1,21 @@ +import EFICAS_ORB__POA +import SALOME_ComponentPy + +class EFICAS(EFICAS_ORB__POA.EFICAS_Gen, + SALOME_ComponentPy.SALOME_ComponentPy_i): + """ + Pour etre un composant SALOME cette classe Python + doit avoir le nom du composant et heriter de la + classe EFICAS_Gen issue de la compilation de l'idl + par omniidl et de la classe SALOME_ComponentPy_i + qui porte les services generaux d'un composant SALOME + """ + def __init__ (self, orb, poa, contID, containerName, instanceName, + interfaceName): + print "EFICAS.__init__: ",containerName,' ',instanceName + SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa, + contID, containerName,instanceName, interfaceName, 0 ) + # On stocke dans l'attribut _naming_service, une reference sur + # le Naming Service CORBA + self._naming_service=SALOME_ComponentPy.SALOME_NamingServicePy_i(self._orb) + diff --git a/src/EFICAS/Makefile.in b/src/EFICAS/Makefile.in new file mode 100644 index 00000000..fddd3330 --- /dev/null +++ b/src/EFICAS/Makefile.in @@ -0,0 +1,20 @@ +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome + +@COMMENCE@ + +EXPORT_PYSCRIPTS = \ +EFICAS.py + +# Libraries targets + +LIB_SERVER_IDL = +LIB_CLIENT_IDL = + +# Executables targets + +@CONCLUDE@ + diff --git a/src/EFICASGUI/SMESH_utils.py b/src/EFICASGUI/SMESH_utils.py index d9c097db..beffcfe1 100644 --- a/src/EFICASGUI/SMESH_utils.py +++ b/src/EFICASGUI/SMESH_utils.py @@ -4,7 +4,7 @@ # Author : Paul RASCLE, EDF # Project : SALOME # Copyright : EDF 2003 -# $Header: /home/salome/PlateFormePAL/Bases_CVS_EDF/Modules_EDF/ASTER_SRC/src/ASTER/SMESH_utils.py,v 1.1.1.1.2.1 2004/05/18 11:40:20 salome Exp $ +# $Header: /home/salome/PlateFormePAL/Bases_CVS_EDF/Modules_EDF/EFICAS_SRC/src/EFICASGUI/SMESH_utils.py,v 1.1.1.1 2004/09/28 09:41:16 salome Exp $ #============================================================================= from omniORB import CORBA @@ -39,10 +39,30 @@ def entryToIor(myStudy,entry): print "no IOR attribute on study object: ", entry else: iorString = iorso.Value() - print iorString + print ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>iorString =",iorString ior = orb.string_to_object(iorString) return ior + +def entryToIor2(myStudy,entry): + myBuilder = myStudy.NewBuilder() + ior = None + SO = None + try: + SO = myStudy.FindObjectID(entry) + except: + print "invalid entry: ",entry + SO = None + if SO != None: + boo,iorso = myBuilder.FindAttribute(SO,"AttributeIOR") + if boo == 0: + print "no IOR attribute on study object: ", entry + else: + iorString = iorso.Value() + ior = orb.string_to_object(iorString) + return iorString + + #-------------------------------------------------------------------------- def entryToName2(myStudy,entry): @@ -82,34 +102,52 @@ def entryToName(myStudy,entryList): #-------------------------------------------------------------------------- - + """ def getMainShape(myStudy,entry): anObject=entryToIor(myStudy,entry) - subShape=anObject._narrow(GEOM.GEOM_Shape) + subShape=anObject._narrow(GEOM.GEOM_Object) if subShape == None: print "entry does not give a shape: ", entry return None - isMain=subShape._get_IsMainShape() + isMain=subShape.IsMainShape() if isMain: iorMain=subShape else: iorStringMain=subShape._get_MainName() iorMain = orb.string_to_object(iorStringMain) return iorMain - + """ + def getMainShapeName(myStudy,entry): anObject=entryToIor(myStudy,entry) - subShape=anObject._narrow(GEOM.GEOM_Shape) + subShape=anObject._narrow(GEOM.GEOM_Object) + iorMain = subShape.GetMainShape() + stringior= orb.object_to_string(iorMain) + print "###############>stringior", stringior + return stringior + +def getMainShapeName3(myStudy,entry): + anObject=entryToIor(myStudy,entry) + subShape=anObject._narrow(GEOM.GEOM_Object) + stringior = subShape.GetMainShape().GetName() + print "###############>stringior", stringior + return stringior + +def getMainShapeName2(myStudy,entry): + anObject=entryToIor(myStudy,entry) + subShape=anObject._narrow(GEOM.GEOM_Gen) if subShape == None: print "entry does not give a shape: ", entry return None - isMain=subShape._get_IsMainShape() + isMain=subShape.IsMainShape() if isMain: iorMain=subShape else: + print "############### iorStringMain=subShape._get_MainName()" iorStringMain=subShape._get_MainName() iorMain = orb.string_to_object(iorStringMain) + stringior= orb.object_to_string(iorMain) return stringior #-------------------------------------------------------------------------- @@ -119,9 +157,18 @@ def getSMESHSubShapeIndexes(myStudy, entryList, typenoeudorcell = 0): # typenoeudorcell = 1 on traite des faces refList = [] subShapeIndexes = [] + + print "################ len(entryList)=", len(entryList) if len(entryList) > 0: iorMain = getMainShapeName(myStudy, entryList[0]) + if iorMain == None: + raise RuntimeException("L'ior CORBA n'est pas défini") + + print "################ iormain=", iorMain + # _CS_gbo Test + #iorMain = "facebas2 facebas1" + myCL=smesh.GetOrCreateCL(str(iorMain)) if len(entryList) > 0: @@ -156,8 +203,8 @@ def getAsterGroupMa(myStudy,entryList): labelGroupMa = [] for val in subShapeIndexes: #label="GMM%d"%(val) + print "################> val = ", val labelGroupMa.append(val) - print labelGroupMa return labelGroupMa #-------------------------------------------------------------------------- diff --git a/src/Makefile.in b/src/Makefile.in index 4694a720..d83b3d9e 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -4,7 +4,7 @@ # Author : Paul RASCLE, EDF # Project : SALOME # Copyright : EDF 2001 -# $Header: /home/salome/PlateFormePAL/Bases_CVS_EDF/Modules_EDF/ASTER_SRC/src/Makefile.in,v 1.3.2.1 2004/06/07 17:40:26 salome Exp $ +# $Header: /home/salome/PlateFormePAL/Bases_CVS_EDF/Modules_EDF/EFICAS_SRC/src/Makefile.in,v 1.1.1.1 2004/09/28 09:41:16 salome Exp $ #============================================================================== # source path @@ -15,6 +15,6 @@ VPATH=.:@srcdir@ @COMMENCE@ -SUBDIRS = TclQtNotifier EFICASGUI +SUBDIRS = TclQtNotifier EFICAS EFICASGUI @MODULE@ -- 2.39.2