]> SALOME platform Git repositories - modules/eficas.git/commitdiff
Salome HOME
Ajout de l'interface idl necessaire pour la V2_1_0b1
authorsalome <>
Fri, 10 Dec 2004 16:46:59 +0000 (16:46 +0000)
committersalome <>
Fri, 10 Dec 2004 16:46:59 +0000 (16:46 +0000)
Adaptation de SMESH_util.py pour conformité au nouveau
format V2_1_0

idl/EFICAS_Gen.idl [new file with mode: 0644]
idl/Makefile.in [new file with mode: 0644]
src/EFICAS/EFICAS.py [new file with mode: 0644]
src/EFICAS/Makefile.in [new file with mode: 0644]
src/EFICASGUI/SMESH_utils.py
src/Makefile.in

diff --git a/idl/EFICAS_Gen.idl b/idl/EFICAS_Gen.idl
new file mode 100644 (file)
index 0000000..454c191
--- /dev/null
@@ -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 (file)
index 0000000..2234cd1
--- /dev/null
@@ -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 (file)
index 0000000..3d6fc04
--- /dev/null
@@ -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 (file)
index 0000000..fddd333
--- /dev/null
@@ -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@
+
index d9c097db90eecf2c5fda758ecaad60eca82b10a0..beffcfe1915deab7a01f5bbc8ebdf5f96cc4336d 100644 (file)
@@ -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
 
     #--------------------------------------------------------------------------
index 4694a7205c271cee407edc2448fadc8998e83df7..d83b3d9e37c5a75c4877c80c53f14f6820445872 100644 (file)
@@ -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@