From: TMA salome Date: Wed, 22 Aug 2012 14:35:11 +0000 (+0000) Subject: Merge from V6_main X-Git-Tag: V6_6_0_SIMAN X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8148b6e77a5f088db73047996e25e64fd089b8df;p=modules%2Feficas.git Merge from V6_main --- diff --git a/Makefile.in b/Makefile.in index ce805964..86bef06a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -13,7 +13,7 @@ VPATH=.:@srcdir@:@top_srcdir@/bin:@top_srcdir@/resources:./bin:@top_srcdir@/idl @COMMENCE@ -SUBDIRS = idl src +SUBDIRS = idl src doc RESOURCES_FILES = \ EFICASCatalog.xml \ @@ -22,6 +22,9 @@ eficashomard.png \ eficas.png \ eficaster.png \ eficasternovice.png \ +eficasotstd.png \ +eficasotwrp.png \ +eficascarmel.png \ moins.png \ plus.png \ select1.png \ diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in index 9408f4fc..e65f0022 100644 --- a/adm_local/unix/make_commence.in +++ b/adm_local/unix/make_commence.in @@ -71,10 +71,6 @@ PYQT_LIBS = @PYQT_LIBS@ OGL_INCLUDES=@OGL_INCLUDES@ OGL_LIBS=@OGL_LIBS@ -# VTK -VTK_INCLUDES=@VTK_INCLUDES@ -VTK_LIBS=@VTK_LIBS@ - # OpenCasCade OCC_INCLUDES=@CAS_CPPFLAGS@ @@ -220,8 +216,7 @@ ac_cxx_namespaces.m4 check_omniorb.m4 pyembed.m4 \ check_cas.m4 check_boost.m4 check_swig.m4 ACLOCAL_GUI = \ -check_vtk.m4 check_opengl.m4 check_qt.m4 \ -check_GUI.m4 check_corba_in_GUI.m4 +check_GUI.m4 check_opengl.m4 check_qt.m4 $(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) \ $(ACLOCAL_SRC_DEPREC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/DEPRECATED/%) \ diff --git a/build_configure b/build_configure index ad372268..f7c496ad 100755 --- a/build_configure +++ b/build_configure @@ -213,7 +213,7 @@ aclocal -I adm_local/unix/config_files \ -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/DEPRECATED \ -I ${GUI_ROOT_DIR}/adm_local/unix/config_files -if autoconf +if autoconf --force then echo "done" else diff --git a/clean_configure b/clean_configure new file mode 100755 index 00000000..e71a8bc2 --- /dev/null +++ b/clean_configure @@ -0,0 +1,23 @@ +#!/bin/sh +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +rm -Rf aclocal.m4 autom4te.cache/ configure configure.in_* salome_adm +find . -name "*~" -print -exec rm {} \; +find . -name "*.pyc" -print -exec rm {} \; diff --git a/configure.in b/configure.in index 67eb32c3..7c2add10 100644 --- a/configure.in +++ b/configure.in @@ -148,27 +148,18 @@ CHECK_SALOME_GUI echo echo --------------------------------------------- -echo testing msg2qm +echo Summary echo --------------------------------------------- echo -CHECK_MSG2QM - echo echo --------------------------------------------- -echo Testing Pal +echo Testing Sphinx echo --------------------------------------------- echo -CHECK_PAL - -echo -echo --------------------------------------------- -echo Testing Visu -echo --------------------------------------------- -echo +CHECK_SPHINX -CHECK_VISU echo echo --------------------------------------------- echo Summary @@ -176,7 +167,7 @@ echo --------------------------------------------- echo echo Configure -variables="python_ok threads_ok OpenGL_ok qt_ok omniORB_ok Kernel_ok SalomeGUI_ok msg2qm_ok" +variables="python_ok threads_ok OpenGL_ok qt_ok omniORB_ok Kernel_ok SalomeGUI_ok sphinx_ok" for var in $variables do @@ -188,20 +179,6 @@ echo echo "Default ORB : $DEFAULT_ORB" echo -echo -echo --------------------------------------------- -echo RunTime Dependencies -echo --------------------------------------------- -echo -variables="Visu_ok pal_ok" - -for var in $variables -do - printf " %10s : " `echo \$var | sed -e "s,_ok,,"` - eval echo \$$var -done - - dnl generals files which could be included in every makefile diff --git a/configure.in.base b/configure.in.base index 41efeccf..d6adbe07 100644 --- a/configure.in.base +++ b/configure.in.base @@ -148,27 +148,18 @@ CHECK_SALOME_GUI echo echo --------------------------------------------- -echo testing msg2qm +echo Summary echo --------------------------------------------- echo -CHECK_MSG2QM - echo echo --------------------------------------------- -echo Testing Pal +echo Testing Sphinx echo --------------------------------------------- echo -CHECK_PAL - -echo -echo --------------------------------------------- -echo Testing Visu -echo --------------------------------------------- -echo +CHECK_SPHINX -CHECK_VISU echo echo --------------------------------------------- echo Summary @@ -176,7 +167,7 @@ echo --------------------------------------------- echo echo Configure -variables="python_ok threads_ok OpenGL_ok qt_ok omniORB_ok Kernel_ok SalomeGUI_ok msg2qm_ok" +variables="python_ok threads_ok OpenGL_ok qt_ok omniORB_ok Kernel_ok SalomeGUI_ok sphinx_ok" for var in $variables do @@ -188,20 +179,6 @@ echo echo "Default ORB : $DEFAULT_ORB" echo -echo -echo --------------------------------------------- -echo RunTime Dependencies -echo --------------------------------------------- -echo -variables="Visu_ok pal_ok" - -for var in $variables -do - printf " %10s : " `echo \$var | sed -e "s,_ok,,"` - eval echo \$$var -done - - dnl generals files which could be included in every makefile diff --git a/doc/Makefile.in b/doc/Makefile.in index 069960a6..924f71ba 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,32 +1,55 @@ - -# -* Makefile *- +# Copyright (C) 2011 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. # -# Author : Patrick GOLDBRONN (CEA) -# Date : 30/11/2001 +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# source path -top_srcdir=@top_srcdir@ -top_builddir=.. +# See http://www.salome-platform.org/ or +# email : webmaster.salome@opencascade.com +# + srcdir=@srcdir@ -VPATH=.:@srcdir@ +eficasdocdir=@prefix@/share/doc/salome/gui/EFICAS +INSTALL=@INSTALL@ -SUBDIRS= +SPHINXOPTS = +SOURCEDIR = $(srcdir) +SPHINXBUILD = sphinx-build +PAPEROPT_a4 = -D latex_paper_size=a4 +ALLSPHINXOPTS = -d doctrees $(PAPEROPT_a4) $(SPHINXOPTS) $(SOURCEDIR) doc: - @@SETX@; for d in $(SUBDIRS); do \ - (cd $$d && $(MAKE) $@) || exit 1; \ - done + mkdir -p html doctrees + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) html + @echo + @echo "Build finished. The HTML pages are in html." + +install: + if test -d "html"; then \ + $(INSTALL) -d $(eficasdocdir); \ + cp -rf $$b"html"/* $(eficasdocdir); \ + fi + +uninstall: + chmod -R +w $(eficasdocdir) + rm -rf $(eficasdocdir)/* + clean: - @@SETX@; for d in $(SUBDIRS); do \ - (cd $$d && $(MAKE) $@) || exit 1; \ - done + -rm -rf html doctrees -distclean: clean - @@SETX@; for d in $(SUBDIRS); do \ - (cd $$d && $(MAKE) $@) || exit 1; \ - done +resources:doc -install: - @@SETX@; for d in $(SUBDIRS); do \ - (cd $$d && $(MAKE) $@) || exit 1; \ - done +inc: +depend: +lib: +bin: diff --git a/doc/conf.py b/doc/conf.py new file mode 100644 index 00000000..0b233e4d --- /dev/null +++ b/doc/conf.py @@ -0,0 +1,179 @@ +# -*- coding: utf-8 -*- +# +# EFICAS documentation build configuration file, created by +# sphinx-quickstart on Wed Sep 14 11:40:32 2011. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# The contents of this file are pickled, so don't put values in the namespace +# that aren't pickleable (module imports are okay, they're removed automatically). +# +# All configuration values have a default value; values that are commented out +# serve to show the default value. + +import sys, os + +# If your extensions are in another directory, add it here. If the directory +# is relative to the documentation root, use os.path.abspath to make it +# absolute, like shown here. +#sys.path.append(os.path.abspath('some/directory')) + +# General configuration +# --------------------- + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['sphinx.ext.autodoc'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['.templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General substitutions. +project = 'EFICAS' +copyright = '2011, Pascale Noyret' + +# The default replacements for |version| and |release|, also used in various +# other places throughout the built documents. +# +# The short X.Y version. +version = '6.4' +# The full version, including alpha/beta/rc tags. +release = '6.4.0' + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +today_fmt = '%B %d, %Y' + +# List of documents that shouldn't be included in the build. +#unused_docs = [] + +# List of directories, relative to source directories, that shouldn't be searched +# for source files. +#exclude_dirs = [] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + + +# Options for HTML output +# ----------------------- + +# The style sheet to use for HTML and HTML Help pages. A file of that name +# must exist either in Sphinx' static/ path, or in one of the custom paths +# given in html_static_path. +html_style = 'default.css' + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (within the static path) to place at the top of +# the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +#html_static_path = ['.static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_use_modindex = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, the reST sources are included in the HTML build as _sources/. +#html_copy_source = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = '' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'EFICASdoc' + + +# Options for LaTeX output +# ------------------------ + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, document class [howto/manual]). +latex_documents = [ + ('index', 'EFICAS.tex', 'EFICAS Documentation', + 'Pascale Noyret', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_use_modindex = True diff --git a/doc/eficas_for_Aster.rst b/doc/eficas_for_Aster.rst new file mode 100644 index 00000000..87596f1d --- /dev/null +++ b/doc/eficas_for_Aster.rst @@ -0,0 +1,27 @@ +EFICAS for Aster +================ + +INCLUDE, INCLUDE_MATERIAU and POURSUITE macros have a special behaviour. +the concepts produced by these macros are created by a separated exec (in python sense) of the corresponding (also separated) command file. They are then included in the context of the main command file. +This processing (including in the main JDC the concepts created in INCLUDE, POURSUITE) is almost completely automatic. But, in some particular case, you can have unexpected difficulties. + +Principles are : + +1- Eficas doesn't take account of an invalid file even if some of the commands are completed. + +2- You are able to edit the content of the included file. + +.. image:: images/included.png + :align: center + + +3- Included files are knowned by Eficas according to their UNITE for INCLUDE, according to the materiel(?) 's name. (A file can only have one POURSUITE). so take care not to use the same number UNITE for differents INCLUDE : otherweise, rereading will exec the same file for differents INCLUDE. + + +4- Push the button "Autre Fichier" to command Eficas to change the included file. Using this method, you can force an invalid file to be read and use the valid concepts it includes. + +5- a INCLUDE file can own its INCLUDE file and so weiter... All the concepts can be accessed from the main file and all englobing files. + +5- file's name for INCLUDE_MATERIAU command is build according to the parameter values of the command. Eficas neither asks the user to give its name. + +6- The user is also able to edit simultaneously a JDC and all its POURSUITE or INCLUDE files. Most of the time, modifications will be propaged to the main JDC. However, it could be possible that some errors occurs. In case of doubts, the user should ask about the error reporting ('Rapport de Validation' in JdC Menu) to know more and correct the problem. Reopening files should also be an issue. diff --git a/doc/eficas_in_salome.rst b/doc/eficas_in_salome.rst new file mode 100644 index 00000000..95dc78d0 --- /dev/null +++ b/doc/eficas_in_salome.rst @@ -0,0 +1,44 @@ +EFICAS in Salome +================= + +Launching EFICAS in Salome +--------------------------- +first activate EFICAS module + +.. image:: images/LctDsSalome.png + :align: center + + +Use EFICAS. When a file is saved, Eficas will create an associated entry in the object browser. +It is possible to user the file in other modules (see appropriate module's documentation). + +.. image:: images/ArbreSalome.png + :align: center + +Structural Element (for Aster) +------------------------------ + +Eficas is able to create "structural element" in GEOM or in SMESH in order to +validate data. + +- Create your geometry + +.. image:: images/Salome_Pylone.png + :align: center + +- Create your eficas JDC, and define for example a beam + +.. image:: images/Salome_Pylone-Eficas.png + :align: center + +- Click on "View3D". Eficas shows you the result in GEOM and creates "beams" . + be aware : these "structural element" are not Geometry elements (You can't use it) + It's also possible to verify normals orientation. + +.. image:: images/Salome_Pylone-SE.png + :align: center + + + + + diff --git a/doc/eficas_personnalisation.rst b/doc/eficas_personnalisation.rst new file mode 100644 index 00000000..1c2c207d --- /dev/null +++ b/doc/eficas_personnalisation.rst @@ -0,0 +1,15 @@ +your own custom EFICAS +======================= + +User can choose to custom Eficas. They can decide which catalogs they used +and which pdf reading tool they prefer. +For some codes, they also can choose where their files will be saved. + +- example : for Aster + +.. image:: images/custom.png + :align: center + +a file editeur_salome.ini is created in .Eficas_CODE ( for example .Eficas_MAP) in user's home directory. + + diff --git a/doc/eficas_presentation.rst b/doc/eficas_presentation.rst new file mode 100644 index 00000000..a5e95c01 --- /dev/null +++ b/doc/eficas_presentation.rst @@ -0,0 +1,26 @@ +What's EFICAS +============== + +Name's origin +------------- +EFICAS is the acronym of ' Editeur de FIchier de Commandes et Analyseur Sémantique'. +That means that EFICAS allows users to write a parameter file for a code. +It handles whith syntax and semantics. +It avoids misuse of commands which are not allowed in a given context. +It insures integrity of the file. + +General Behaviour +------------------ +* Catalogs + +EFICAS can be used by multiple codes and handles with multiple versions of each code. It is customized with files named "Catalogue" : It contains all commands for a code. Each command has a name and parametres which are defined by developpers. + + +* Outputs + +Eficas's output is a commands file named ".comm". It may be able to produce various file formats such as .xml for OpenTurns. However, you always must have a '.comm" output: this is the only format Eficas is able to reread. + +Both Command Files and Catalogs are python file. So you have to remind some +:ref:`python-label` + + diff --git a/doc/eficas_principles.rst b/doc/eficas_principles.rst new file mode 100644 index 00000000..470c5f0f --- /dev/null +++ b/doc/eficas_principles.rst @@ -0,0 +1,253 @@ +a new JDC step by step +====================== + +In Eficas, many common commands can be invoked via menus, toolbar buttons as well as keyboard shortcuts. +As in many GUI, a menu widget can be either a pull-down menu or a standalone context menu. Pull-down menus are shown by the menu bar when the user clicks on the respective item or presses the specified shortcut key. Context menus are usually invoked by some special keyboard key or by right-clicking. +Eficas allows you to write (and reread) an unvalid file. At any time, user can save its works. + +Choose a Code +--------------------- + +So try to build a new JDC. + +Eficas will ask you to choose the code you want to work with, each time you click on "Nouveau" or "Open" in the "fichier" Menu, unless you have started Eficas for a specific code ( see how to launch Eficas in Salome) + +.. image:: images/choix_code.png + :align: center + +Choose a version of the Code +---------------------------- + +.. image:: images/choix_cata.png + :align: center + +Enter commands +------------------------- + +Eficas main widget provided two distinct views: The left size always contains the JDC explorer as a tree view. The right widget contains all informations used by the user to constructs the JDC. It shows which commands are available and which :ref:`rules-label` have to be followed. Commands are append after this selected in the JDC tree. + +.. image:: images/command.png + :align: center + + +The user can use "Filtre", which is a filter widget to find a command position. The PushButton "suivant" shows the next matching command. + + + + + +The user also can choose the way the commands are sorted, either by alphabetical order, either by fonctionnalities. + +.. image:: images/groupes.png + :align: center + +Choosing command's keywords +--------------------------------- + +For each command, EFICAS shows which keywords are available. + +.. image:: images/motClef.png + :align: center + + +These keywords depend from the context, ie the value of one other +keyword. + +.. image:: images/motClef2.png + :align: center + +or + + +.. image:: images/motClef3.png + :align: center + +types of item in the JDC (Jeu De Commande) +------------------------------------------- + +In JDC, you can have : + +* PROC : this is a command with all its keywords. + + - example: + - DEBUT() is a proc. + - for ASTER, it initializes memory and files. + +* OPER : creates an object which has a type and a name + + - example : + - MONMAIL=LIRE_MAILLAGE(UNITE=20); + - This line creates a new concept MONMAIL of type "maillage", which can be re-used + +When an oper is valid, the user have to named it. + +.. image:: images/nommerConcept.png + :align: center + + + +* mot-clef facteur + + This is a list of keywords which jointly have a meaning for the code. + Some are mandatory, repeatable . + This list can depend on conditionnal rules. + + +* mot-clef simple . + + this is a simple keyword. it also can be mandatory or not... + + +These items are associated according to rules or conditions. These items are +described in the catalog. + + +Attributes of a keyword +--------------------------- + +a parameter ("mot-clef simple") should have : + +- a type : Real, string, complex, integer or a python class which is defined in the catalog. As we have already seen, LIRE_MAILLAGE produced a "maillage" concept and MODELE in AFFE_MODELE oper waits for a concept of type "maillage". Eficas will propose all the valid concepts of type "maillage". + +.. image:: images/Affe.png + :align: center + + +- a File parameter should be + +an existing file (type='Fichier'), + - a directory (type='Repertoire'), + + - an existing file with specific suffix (type='Fichier','JDC Files (*.comm);;All Files (*)') The contents of the directory are filtered before being shown in the dialog, using a semicolon-separated list of filters specified. + + - a non-allready existant (type=('Fichier',"",'Sauvegarde') + + - a simple string (type='FichierNoAbs') + +This is the way the catalog should look like : + +input_datafile=SIMP(typ='Fichier',fr='',ang='',statut='o',docu='',min=1,max=1,defaut=None), + +input_commfile=SIMP(typ=('Fichier','JDC Files (*.comm);;''All Files (*)'),fr='',ang='',statut='o',docu='',min=1,max=1,defaut=None), + +output_datafile=SIMP(typ=('Fichier','JDC Files (*.comm);;''All Files (*)','Sauvegarde'),fr='',ang='',statut='o',docu='',min=1,max=1,defaut=None), + +datafile=SIMP(typ='FichierNoAbs',fr='',ang='',statut='o',docu='',min=1,max=1,defaut=None), + +repetoire=SIMP(typ='Repertoire',fr='',ang='',statut='o',docu='',min=1,max=1,defaut=None), + + + +- a default value (or not) + +- a cardinality. + +- a short documentation + +- an interval of values or a set of discrete values + + +Input data panel depends on both these attributes. It forces the user to enter a list if needed, it verifies the input type... + +- Example of input Data Pannel for complex valuesNew + +.. image:: images/complex.png + :align: center + + +Color chart +------------- + +a very simple colors chart helps the user to know if a item is valid or not : + +* In the JDC tree view + + - green square : valid objects (JDC, Oper ...) + - red square : unvalid objects + - yellow square : valids OPER the user must name + - green circle : valid keywords + - red circle : unvalid keywords + - green rhomb : condition. all the depending keywords are valid + - yellow rhomb : condition. one of the depending keywords is unvalid + +* In the rules part + + - red is for unobserved rules + - black is for observed rules + + +Context Menus +-------------- +In the JDC tree, Context menus (invoked by right-clicking) allow user to : + +- create comments in the tree +- comment the command itself +- create parameter +- delete the node + +.. image:: images/menus.png + :align: center + + +Parameters +------------ + +The Users can define parameters. As parameters, Eficas accepts : + +- Real +- String +- Integer +- List + +A parameter's definition can use existing parameters such as : +eps=sqrt((((W / NX) ** 2) + ((H / NY) ** 2))) + +Pushing on "Parametres" Pushbutton opens a dialog containing all correct parameters (depending of the attended value's type) + +.. image:: images/parametres.png + :align: center + + +To select the value in the modal dialog widget, highligh the corresponding line and Push on "Valider". + + + +Import data from file +----------------------- + +The user also can import data from a ASCII text file by pushing button "Importer". He chooses to import part of or the complete file. + +.. image:: images/import.png + :align: center + + +Reports +--------------------- +You have acces to + +- Rapport de Validation (Jdc Menu) : It resumes JDC errors +- Fichier Source (JdC Menu) : It shows the text of the initial JDC (in the .comm file). +- Fichier Resultat (JdC Menu) : It shows the text which will be stored at next + +.. image:: images/rapport.png + :align: center + + +Multiples files +--------------------- + +EFICAS allows you to open +simultaneously files with differents catalogs : for example a file with Openturns Study catalog and a file for Openturns wrapper. The user also can easely swap from one file to another by clicking on its tab. + + + +.. image:: images/multiples.png + :align: center + + +If the user want to open the same file in two tabs, Eficas allows it, but corrections in one tabs are not reported in the other. + +.. image:: images/duplication.png + :align: center + + diff --git a/doc/eficas_rules.rst b/doc/eficas_rules.rst new file mode 100644 index 00000000..489a0d46 --- /dev/null +++ b/doc/eficas_rules.rst @@ -0,0 +1,119 @@ +.. _rules-label: + +=============================== +Eficas rules +=============================== + +All the rules can be combinated, creating more complicated rules. + +AU_MOINS_UN +----------- + + AU_MOINS_UN rule obliges the user to create at least one concept of the list. More than one can be created. + +- Example + + Keyword POUTRE in OPER AFFE_CARA_ELEM contains the rule : + + regles=(AU_MOINS_UN( + 'POUTRE','COQUE','DISCRET','CABLE','BARRE','MASSIF','ASSE_GRIL','GRILLE'),) + +- That means if AFFE_CARA_ELEM is used in the JDC, the user must select one at least of the Keyword between POUTRE, COQUE, DISCRET, CABLE, BARRE, MASSIF, ASSE_GRIL, GRILLE : + + * If the user doesn't select any of these keywords, AFFE_CARA_ELEM is unvalid. + * If he selects POUTRE, AFFE_CARA_ELEM is valid. + * If he selects both POUTRE and DISCRET, AFFE_CARA_ELEM is valid. + + +UN_PARMI +-------- + + AU_MOINS_UN rule obliges the user to create one and only one concept of the list. + +- Example + + Oper AFFE_CHAR_MECA contains the rules : + + regles=(UN_PARMI('VECT_Y','ANGL_VRIL'), + +- That means if AFFE_CHAR_MECA is used in the JDC, the user must select VECT_Y or ANGL_VRIL. + + * If the user doesn't select any of these keywords, DEFI_GROUP is unvalid. + * If he selects only VECT_Y, DEFI_GROUP is valid. + * Eficas will not proposed the keyword ANGL_VRIL if VECT_Y already exists. + + +EXCLUS +-------- + + EXCLUS means that, if one of the keyword is created, the other won't be allowed. + + - Example : + DEFI_SQUELETTE contains the rules : + + EXCLUS('SOUS_STRUC','SECTEUR') + +- That means if DEFI_SQUELETTE is used in the JDC + + * If the user doesn't select any of these keywords, DEFI_SQUELETTE is valid. + * If he selects only SOUS_STRUC, DEFI_SQUELETTE is valid. + * Eficas will not proposed the keyword SECTEUR if SOUS_STRUC already exists. + +ENSEMBLE +-------- + + the rule means that if one keyword is selected, the others have to be also. + the keywords order is not meaningful. + +- Example + + GRILLE in AFFE_CARA_ELEM, contains : + + ENSEMBLE('ORIG_AXE','AXE') + +- That means if GRILLE is used in the JDC + + * If the user doesn't select any of these keywords, GRILLE is valid. + * If he selects only ORIG_AXE, GRILLE is invalid. + * If he selects both ORIG_AXE and AXE, GRILLE is valid. + +PRESENT_PRESENT +--------------- + + the rule means that if the FIRST keyword is selected, the others have to be also. + +- Example + + MACRO_MISS_3D contains the rule + + PRESENT_PRESENT('FREQ_MIN','FREQ_MAX','FREQ_PAS') + +- That means if MACRO_MISS_3D is used in the JDC + + * If the user doesn't select any of these keywords, GRILLE is valid. + * If he selects only FREQ_MAX, GRILLE is unvalid. + * If he selects only FREQ_PAS, GRILLE is valid. + * If he selects only FREQ_MIN, GRILLE is invalid. + * If he selects both FREQ_MIN, FREQ_MAX and FREQ_PAS, GRILLE is valid. + + +PRESENT_ABSENT +--------------- + + the rule means that if the FIRST keyword is selected, the others aren't allowed. + +- Example + FORCE_COQUE in AFFE_CHAR_MECA contains + + regles=( PRESENT_ABSENT('FX','PRES','F1','F2','F3','MF1','MF2'), + +- That means if FORCE_COQUE is used in the JDC + + * If the user doesn't select any of these keywords, FORCE_COQUE is valid. + * If he selects only FX, FORCE_COQUE is valid. + * If he selects both PRES and F1, FORCE_COQUE is valid. + + + + + diff --git a/doc/images/Affe.png b/doc/images/Affe.png new file mode 100644 index 00000000..6b3e08ef Binary files /dev/null and b/doc/images/Affe.png differ diff --git a/doc/images/ArbreSalome.png b/doc/images/ArbreSalome.png new file mode 100644 index 00000000..fbf2a24d Binary files /dev/null and b/doc/images/ArbreSalome.png differ diff --git a/doc/images/LctDsSalome.png b/doc/images/LctDsSalome.png new file mode 100644 index 00000000..c81f2df6 Binary files /dev/null and b/doc/images/LctDsSalome.png differ diff --git a/doc/images/Salome_Pylone-Eficas.png b/doc/images/Salome_Pylone-Eficas.png new file mode 100644 index 00000000..6e45453d Binary files /dev/null and b/doc/images/Salome_Pylone-Eficas.png differ diff --git a/doc/images/Salome_Pylone-SE.png b/doc/images/Salome_Pylone-SE.png new file mode 100644 index 00000000..b0962cae Binary files /dev/null and b/doc/images/Salome_Pylone-SE.png differ diff --git a/doc/images/Salome_Pylone.png b/doc/images/Salome_Pylone.png new file mode 100644 index 00000000..ef7e54ee Binary files /dev/null and b/doc/images/Salome_Pylone.png differ diff --git a/doc/images/choix_cata.png b/doc/images/choix_cata.png new file mode 100644 index 00000000..c2d5872f Binary files /dev/null and b/doc/images/choix_cata.png differ diff --git a/doc/images/choix_code.png b/doc/images/choix_code.png new file mode 100644 index 00000000..a665aa30 Binary files /dev/null and b/doc/images/choix_code.png differ diff --git a/doc/images/command.png b/doc/images/command.png new file mode 100644 index 00000000..f137d1f7 Binary files /dev/null and b/doc/images/command.png differ diff --git a/doc/images/complex.png b/doc/images/complex.png new file mode 100644 index 00000000..5a82b509 Binary files /dev/null and b/doc/images/complex.png differ diff --git a/doc/images/custom.png b/doc/images/custom.png new file mode 100644 index 00000000..6755a587 Binary files /dev/null and b/doc/images/custom.png differ diff --git a/doc/images/duplication.png b/doc/images/duplication.png new file mode 100644 index 00000000..da1c44f9 Binary files /dev/null and b/doc/images/duplication.png differ diff --git a/doc/images/groupes.png b/doc/images/groupes.png new file mode 100644 index 00000000..2bb3c75e Binary files /dev/null and b/doc/images/groupes.png differ diff --git a/doc/images/import.png b/doc/images/import.png new file mode 100644 index 00000000..faf2fd00 Binary files /dev/null and b/doc/images/import.png differ diff --git a/doc/images/included.png b/doc/images/included.png new file mode 100644 index 00000000..f3f6fce0 Binary files /dev/null and b/doc/images/included.png differ diff --git a/doc/images/menus.png b/doc/images/menus.png new file mode 100644 index 00000000..528ab6cd Binary files /dev/null and b/doc/images/menus.png differ diff --git a/doc/images/motClef.png b/doc/images/motClef.png new file mode 100644 index 00000000..20af9252 Binary files /dev/null and b/doc/images/motClef.png differ diff --git a/doc/images/motClef2.png b/doc/images/motClef2.png new file mode 100644 index 00000000..dabac83b Binary files /dev/null and b/doc/images/motClef2.png differ diff --git a/doc/images/motClef3.png b/doc/images/motClef3.png new file mode 100644 index 00000000..13833e63 Binary files /dev/null and b/doc/images/motClef3.png differ diff --git a/doc/images/multiples.png b/doc/images/multiples.png new file mode 100644 index 00000000..10300959 Binary files /dev/null and b/doc/images/multiples.png differ diff --git a/doc/images/nommerConcept.png b/doc/images/nommerConcept.png new file mode 100644 index 00000000..f799242f Binary files /dev/null and b/doc/images/nommerConcept.png differ diff --git a/doc/images/parametres.png b/doc/images/parametres.png new file mode 100644 index 00000000..8769d0ff Binary files /dev/null and b/doc/images/parametres.png differ diff --git a/doc/images/rapport.png b/doc/images/rapport.png new file mode 100644 index 00000000..d6bd9d45 Binary files /dev/null and b/doc/images/rapport.png differ diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 00000000..04c3d888 --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,36 @@ +.. EFICAS documentation master file, created by sphinx-quickstart on Wed Sep 14 11:40:32 2011. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to EFICAS's documentation! +================================== + +This documentation covers the usage of Eficas as data setting tool in Salome. +This is intended for end users who want to use Eficas and not for developpers who want to write a catalog. + +The usage of Eficas for OpenTURNS is not described in this guide. Refer to +OpenTURNS module documentation to know how to use Eficas for this code. + +Contents: + +.. toctree:: + :maxdepth: 2 + + eficas_presentation + eficas_principles + eficas_for_Aster + eficas_in_salome + eficas_personnalisation + eficas_rules + python_rules + + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/doc/patchEficasV1_10.diff b/doc/patchEficasV1_10.diff deleted file mode 100644 index 935874cc..00000000 --- a/doc/patchEficasV1_10.diff +++ /dev/null @@ -1,26 +0,0 @@ -diff -Naur EficasV1_10AsterSTA8.orig/Editeur/panelsSalome.py EficasV1_10AsterSTA8/Editeur/panelsSalome.py ---- EficasV1_10AsterSTA8.orig/Editeur/panelsSalome.py 2006-06-20 16:41:50.000000000 +0200 -+++ EficasV1_10AsterSTA8/Editeur/panelsSalome.py 2006-07-18 17:44:45.000000000 +0200 -@@ -100,12 +100,20 @@ - try: - valeur,validite,commentaire=self.get_valeur() - #print 'add_valeur_plusieurs_base', name -- #print 'valeur = %s, validite = %s,commentaire = %s'%( valeur,validite,commentaire ) -+ #print 'valeur = %s, validite = %s,commentaire = %s'%( valeur,validite,commentaire ) - if not valeur: # sélection dans salome - #print 'CS_pbruno selection SALOME' - strSelection = '' - -- selection, msg = self.parent.appli.selectGroupFromSalome() -+ genea = self.node.item.get_genealogie() -+ kwType = None -+ for e in genea: -+ if "GROUP_NO" in e: -+ kwType = "GROUP_NO" -+ if "GROUP_MA" in e: -+ kwType = "GROUP_MA" -+ -+ selection, msg = self.parent.appli.selectGroupFromSalome( kwType ) - - #print 'CS_pbruno selection SALOME selection ->',selection - #print 'CS_pbruno selection SALOME msg ->',msg diff --git a/doc/python_rules.rst b/doc/python_rules.rst new file mode 100644 index 00000000..78d3342e --- /dev/null +++ b/doc/python_rules.rst @@ -0,0 +1,34 @@ +.. _python-label: + +=============================== +rules for python syntax +=============================== + +Variable names and identifier are similar to those in many other languages : +---------------------------------------------------------------------------- + +* They start with a letter (A_Z or a-z) or underscore "_"". +* They are followed by letters, numbers or underscores. +* They are case-sensitive. +* A string is a sequence of caracters enclosed by a matching pair of single or double quotes. + +Unlike python, the name's length for concept are limited by Eficas to 8 characters. + +Some identifiers are reserved words : +------------------------------------- + +* You can't use words of the python language as identifiers. +* Eficas itself uses identifiers which become reserved words. for example you can't use the following word, even if it would make some interesting names: + - BLOC, EXCLUS, OPER, ASSD, + - EVAL, FACT, FORM, JDC, + - REGLE, VALIDATOR, + - ETAPE, ENTITE + +Python's way for assigning values to variables: +------------------------------------------------- + +* Keep in mind that .comm are python files. The simplest form of assignement is : variable = value +* The hash character (#) starts a comment +* Tuples are enclosed in parentheses. +* Lists are enclosed in bracked. +* In tuples or lists, a ',' follows each item especially the last one. diff --git a/idl/EFICAS_Gen.idl b/idl/EFICAS_Gen.idl index e5122c9e..fbd1fc1f 100644 --- a/idl/EFICAS_Gen.idl +++ b/idl/EFICAS_Gen.idl @@ -7,7 +7,7 @@ module EFICAS_ORB { - interface EFICAS_Gen : Engines::Component, SALOMEDS::Driver + interface EFICAS_Gen : Engines::EngineComponent, SALOMEDS::Driver { }; }; diff --git a/resources/EFICAS_en.xml b/resources/EFICAS_en.xml index 7425e387..afcadac1 100644 --- a/resources/EFICAS_en.xml +++ b/resources/EFICAS_en.xml @@ -11,27 +11,14 @@ - - - - - - - - - - - - - - - + - - - + + + diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index 8762806a..758b704e 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -4,9 +4,15 @@ + +
- + +
+
+ +
diff --git a/resources/eficasOM.png b/resources/eficasOM.png new file mode 100644 index 00000000..311fcd91 Binary files /dev/null and b/resources/eficasOM.png differ diff --git a/resources/eficascarmel.png b/resources/eficascarmel.png new file mode 100644 index 00000000..07590ea7 Binary files /dev/null and b/resources/eficascarmel.png differ diff --git a/resources/eficasotstd.png b/resources/eficasotstd.png new file mode 100644 index 00000000..308d7217 Binary files /dev/null and b/resources/eficasotstd.png differ diff --git a/resources/eficasotwrp.png b/resources/eficasotwrp.png new file mode 100644 index 00000000..44d8d01c Binary files /dev/null and b/resources/eficasotwrp.png differ diff --git a/src/EFICAS/EFICAS.py b/src/EFICAS/EFICAS.py index bf236fc0..035906e6 100644 --- a/src/EFICAS/EFICAS.py +++ b/src/EFICAS/EFICAS.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- +print "EFICAS.__init__: 1" import EFICAS_ORB__POA - import SALOMEDS__POA - import SALOME_ComponentPy +print "EFICAS.__init__: 2" diff --git a/src/EFICASGUI/EFICASGUI.py b/src/EFICASGUI/EFICASGUI.py index 901b4a6c..755ec6aa 100644 --- a/src/EFICASGUI/EFICASGUI.py +++ b/src/EFICASGUI/EFICASGUI.py @@ -1,174 +1,233 @@ # -*- coding: utf-8 -*- +import os + """ Interface PyQt """ -import qt -import libSALOME_Swig -import SalomePyQt - -# Variable globale pour stocker le Workspace de Salome - -WORKSPACE=None -currentStudyId=None -desktop=None - -# ----------------------------------------------------------------------------- - -import notifqt - -def g(): - print "lastWindowClosed()" - import Tkinter - root=Tkinter.Tk() - root.destroy() - -qt.QObject.connect(qt.qApp,qt.SIGNAL("lastWindowClosed()"),g) - -# ----------------------------------------------------------------------------- +from PyQt4.QtGui import * +from PyQt4.QtCore import * import salome +import SalomePyQt -sg=salome.sg -sgPyQt=SalomePyQt.SalomePyQt() +from salome.kernel.studyedit import getStudyEditor +sgPyQt=SalomePyQt.SalomePyQt() -import studyManager +# ----------------------------------------------------------------------------- print "EFicasGUI :: :::::::::::::::::::::::::::::::::::::::::::::::::::::" +# Test Eficas directory +eficasRoot = os.getenv("EFICAS_ROOT") +if eficasRoot is None: + QMessageBox.critical(sgPyQt.getDesktop(), "Error", + "Cannot initialize EFICAS module. Environment " + "variable EFICAS_ROOT is not set.") +elif not os.path.isdir(eficasRoot): + QMessageBox.critical(sgPyQt.getDesktop(), "Error", + "Cannot initialize EFICAS module. Directory %s does " + "not exist (check EFICAS_ROOT environment " + "variable)." % eficasRoot) + + +################################################ +# GUI context class +# Used to store actions, menus, toolbars, etc... +################################################ + +class GUIcontext: + # menus/toolbars/actions IDs + EFICAS_MENU_ID = 90 + ASTER_ID = 941 + OM_ID = 942 + MAP_ID = 943 + OT_STUDY_ID = 944 + OT_WRAPPER_ID = 945 + MULTICATALOG_ID = 946 + CARMEL3D_ID = 947 + + # constructor + def __init__(self): + # create top-level menu + self.mid = sgPyQt.createMenu("Eficas", -1, GUIcontext.EFICAS_MENU_ID, + sgPyQt.defaultMenuGroup()) + # create toolbar + self.tid = sgPyQt.createTool("Eficas") + + a = sgPyQt.createAction(GUIcontext.MULTICATALOG_ID, "Eficas MultiCatalogue","Lancer Eficas" , "Lancer Eficas", "eficas.png") + sgPyQt.createMenu(a, self.mid) + sgPyQt.createTool(a, self.tid) + + # create actions conditionally and fill menu and toolbar with actions + self.addActionConditionally("Aster/prefs.py", GUIcontext.ASTER_ID, + "Eficas pour Code_Aster", + "Editer un jeu de commande ASTER avec Eficas", + "eficaster.png") + self.addActionConditionally("Sep/prefs.py", GUIcontext.OM_ID, + "Eficas pour Outils Metier", + "Editer un jeu de commande Outils Metier avec Eficas", + "eficasOM.png") + self.addActionConditionally("MAP/prefs.py", GUIcontext.MAP_ID, + "Eficas pour Map", + "Editer un jeu de commande Map avec Eficas", + "plus.png") + self.addActionConditionally("Openturns_Study/prefs.py", GUIcontext.OT_STUDY_ID, + "Eficas pour Openturns Study", + "Editer un jeu de commande Openturns Study avec Eficas", + "eficasotstd.png") + self.addActionConditionally("Openturns_Wrapper/prefs.py", GUIcontext.OT_WRAPPER_ID, + "Eficas pour Openturns Wrapper", + "Editer un jeu de commande Openturns Wrapper avec Eficas", + "eficasotwrp.png") + self.addActionConditionally("Carmel3D/prefs.py", GUIcontext.CARMEL3D_ID, + "Eficas pour Carmel3D", + "Editer un jeu de commande Carmel3D avec Eficas", + "eficascarmel.png") + + def addActionConditionally(self, fileToTest, commandId, menuLabel, tipLabel, icon): + global eficasRoot + if os.path.isfile(os.path.join(eficasRoot, fileToTest)): + a = sgPyQt.createAction(commandId, menuLabel, tipLabel, tipLabel, icon) + sgPyQt.createMenu(a, self.mid) + sgPyQt.createTool(a, self.tid) + +################################################ +# Global variables +################################################ + +# study-to-context map +__study2context__ = {} +# current context +__current_context__ = None + +### +# set and return current GUI context +# study ID is passed as parameter +### +def _setContext( studyID ): + global eficasRoot + if eficasRoot is None: + return + global __study2context__, __current_context__ + if not __study2context__.has_key(studyID): + __study2context__[studyID] = GUIcontext() + pass + __current_context__ = __study2context__[studyID] + return __current_context__ -# ----------------------------------------------------------------------------- -#Cette méthode est obsolète en V3 -#En V2, si on n'implémente pas cette méthode, le composant fonctionne -#correctement. Un message "Attribute Error" apparait dans la trace. -def setWorkSpace(workSpace): - global WORKSPACE - WORKSPACE=workSpace - # le desktop - desktop=sgPyQt.getDesktop() - - # recuperation du workspace - ws=sgPyQt.getMainFrame() - #print ws - # ----------------------------------------------------------------------------- def OnGUIEvent(commandID) : - print "EficasGUI :: OnGUIEvent :::::::::::::::::::::::::::::::::commandID = ",commandID if dict_command.has_key(commandID): - print "OnGUIEvent :::::::::: commande associée : ",commandID + print "OnGUIEvent :::::::::: commande associée : ",commandID dict_command[commandID]() else: - print "Pas de commande associée a : ",commandID + print "Pas de commande associée a : ",commandID # ----------------------------------------------------------------------------- def setSettings(): """ - Cette méthode permet les initialisations. On définit en particulier - l'identifiant de l'étude courante. + Cette méthode permet les initialisations. """ - # le desktop - desktop=sgPyQt.getDesktop() - global currentStudyId - currentStudyId = sgPyQt.getStudyId() - #print "setSettings: currentStudyId = " + str(currentStudyId) - # _CS_gbo_ Voir si on peut utiliser directement sgPyQt.getStudyId() - # dans salomedsgui? - - studyManager.palStudy.setCurrentStudyID( currentStudyId ) #CS_pbruno + _setContext(sgPyQt.getStudyId()) def activate(): """ - Cette méthode permet l'activation du module, s'il a été chargé mais pas encore - activé dans une étude précédente. + Cette méthode permet l'activation du module, s'il a été chargé mais pas encore + activé dans une étude précédente. Portage V3. """ - print "--------EFICASGUI:: activate" setSettings() # ----------------------------------------------------------------------------- def activeStudyChanged(ID): - # le desktop - desktop=sgPyQt.getDesktop() - global currentStudyId - # ne marche pas car sg est supposé résider dans une etude - # studyId=sg.getActiveStudyId() - currentStudyId=ID - - studyManager.palStudy.setCurrentStudyID( currentStudyId ) #CS_pbruno - + _setContext(ID) -def definePopup(theContext, theObject, theParent): - theContext= "" - theObject = "100" - theParent = "ObjectBrowser" - a=salome.sg.getAllSelected() - #print a + +#def definePopup(theContext, theObject, theParent): +# print "EFICASGUI --- definePopup" +# print "EFICASGUI --- definePopup" +# theContext= "" +# theObject = "100" +# theParent = "ObjectBrowser" +# a=salome.sg.getAllSelected() - selectedEntry = a[0] - aType, aValue = studyManager.palStudy.getTypeAndValue( selectedEntry ) - - if aType == studyManager.FICHIER_EFICAS_ASTER or aType == studyManager.FICHIER_EFICAS_HOMARD \ - or aType == studyManager.FICHIER_EFICAS_HOMARD: - theObject="73" - - return (theContext, theObject, theParent) - - -def customPopup(popup, theContext, theObject, theParent): - print "EFICASGUI --- customPopup" - popup.removeItem(99000) - popup.removeItem(99001) - popup.removeItem(99002) - popup.removeItem(99003) - - -def windows(): - """ - This method is called when GUI module is being created - and initialized. - Should return a map of the SALOME dockable windows id's - needed to be opened when module is activated. - """ - print "ASTERGUI::windows" - from qt import Qt - winMap = {} - winMap[ SalomePyQt.WT_ObjectBrowser ] = Qt.DockLeft - winMap[ SalomePyQt.WT_PyConsole ] = Qt.DockBottom - return winMap +# selectedEntry = a[0] +# mySO = monEditor.study.FindObjectID(selectedEntry); +# aType = monEditor.getFileType(mySO) +# print aType +# return (theContext, theObject, theParent) -# ----------------------------------------------------------------------------- -import eficasSalome +#def customPopup(popup, theContext, theObject, theParent): +# a=salome.sg.getAllSelected() + +# selectedEntry = a[0] +# mySO = monEditor.study.FindObjectID(selectedEntry); +# aType = monEditor.getFileType(mySO) + +# print "EFICASGUI --- customPopup" +# print "EFICASGUI --- customPopup" +# print "EFICASGUI --- customPopup" +# print "EFICASGUI --- customPopup" +# print "EFICASGUI --- customPopup" +# print "EFICASGUI --- customPopup" +# print "EFICASGUI --- customPopup" +# print "EFICASGUI --- customPopup" +# popup.removeItem(99003) + + + +# ----------------------------------------------------------------------------- def runEficas(): print "-------------------------EFICASGUI::runEficas-------------------------" - print currentStudyId + import eficasSalome + eficasSalome.runEficas(multi=True) + +def runEficaspourAster(): + import eficasSalome eficasSalome.runEficas( "ASTER" ) - -def runEficaspourHomard(): - print "runEficas" - desktop=sgPyQt.getDesktop() - eficasSalome.runEficas( "HOMARD" ) -def runEficaspourOpenturns(): - print "runEficas Pour Openturns" - desktop=sgPyQt.getDesktop() - eficasSalome.runEficas( "OPENTURNS" ) +def runEficaspourOpenturnsStudy(): + print "runEficas Pour Openturns Study" + import eficasSalome + eficasSalome.runEficas( "OPENTURNS_STUDY" ) + +def runEficaspourOpenturnsWrapper(): + print "runEficas Pour Openturns Wrapper" + import eficasSalome + eficasSalome.runEficas( "OPENTURNS_WRAPPER" ) + +def runEficaspourOM(): + print "runEficas Pour Outils Metier" + import eficasSalome + eficasSalome.runEficas( "SEP" ) + +def runEficaspourMap(): + print "runEficas Pour Map " + import eficasSalome + eficasSalome.runEficas( "MAP" ) + +def runEficaspourCarmel3D(): + print "runEficas Pour Carmel3D " + import eficasSalome + eficasSalome.runEficas( "CARMEL3D" ) def runEficasFichier(version=None): """ Lancement d'eficas pour ASTER - si un fichier est sélectionné, il est ouvert dans eficas + si un fichier est sélectionné, il est ouvert dans eficas """ fileName = None code = None @@ -176,48 +235,36 @@ def runEficasFichier(version=None): if len(a) == 1: selectedEntry = a[0] - aType, aValue = studyManager.palStudy.getTypeAndValue( selectedEntry ) - if aType == studyManager.FICHIER_EFICAS_ASTER: + editor = getStudyEditor() + mySO = editor.study.FindObjectID(selectedEntry); + aType = editor.getFileType(mySO) + aValue = editor.getFileName(mySO) + if aType != None : fileName = aValue - code = "ASTER" - elif aType == studyManager.FICHIER_EFICAS_HOMARD: - fileName = aValue - code = "HOMARD" - elif aType == studyManager.FICHIER_EFICAS_OPENTURNS: - fileName = aValue - code = "OPENTURNS" - else: - fileName=None - code = "ASTER" + code = aType[15:] else: - code = "ASTER" - + QMessageBox.critical(None, "Selection Invalide", + "Selectionner un seul fichier SVP") + return; + + import eficasSalome if code: - #eficasSalome.runEficas(code,attr,studyId=currentStudyId) - #desktop=sgPyQt.getDesktop() if version : eficasSalome.runEficas( code, fileName, version=version) else : eficasSalome.runEficas( code, fileName) -def runEficasFichierV8(): - runEficasFichier(version="v8.5") - -def runEficasFichierV9(): - runEficasFichier(version="v9.1") - # Partie applicative dict_command={ - 941:runEficasFichier,# runEficas, - 946:runEficaspourHomard, - 946:runEficaspourOpenturns, - 4041:runEficasFichier, #runEficas, - 4046:runEficaspourHomard, - 4047:runEficaspourOpenturns, - 9042:runEficasFichier, - 9043:runEficasFichier, - 9044:runEficasFichierV9, + GUIcontext.ASTER_ID : runEficaspourAster, + GUIcontext.OM_ID : runEficaspourOM, + GUIcontext.MAP_ID : runEficaspourMap, + GUIcontext.OT_STUDY_ID : runEficaspourOpenturnsStudy, + GUIcontext.OT_WRAPPER_ID : runEficaspourOpenturnsWrapper, + GUIcontext.CARMEL3D_ID : runEficaspourCarmel3D, + GUIcontext.MULTICATALOG_ID : runEficas, + + 9041:runEficasFichier, } - diff --git a/src/EFICASGUI/Makefile.in b/src/EFICASGUI/Makefile.in index e86289f1..fb295a12 100644 --- a/src/EFICASGUI/Makefile.in +++ b/src/EFICASGUI/Makefile.in @@ -28,24 +28,16 @@ LIB_CLIENT_IDL = LIB_SERVER_IDL = -# .po files to transform in .qm -PO_FILES = EFICAS_msg_en.po EFICAS_icons.po - EXPORT_PYSCRIPTS = \ +colors.py\ cabri.py\ -SelectMeshDiag_ui.py\ -SelectMainShapeDiag_ui.py\ EFICASGUI.py \ eficasSalome.py \ # _CS_gbo_151104 Ajout pour compatibilité ascendante entre versions de Eficas -EXPORT_PYSCRIPTS+=eficas_etude.py - -# On utilise le pyuic trouvé par le configure plutôt que celui se trouvant dans l'environnement -PYUIC = pyuic -%.py:%.ui - $(PYUIC) $< -o $@ +# PN On l enleve +#EXPORT_PYSCRIPTS+=eficas_etude.py @CONCLUDE@ diff --git a/src/EFICASGUI/colors.py b/src/EFICASGUI/colors.py new file mode 100644 index 00000000..7a2eccdd --- /dev/null +++ b/src/EFICASGUI/colors.py @@ -0,0 +1,18 @@ +# Liste de couleurs pour visualisation +RED = 255,0,0 +GREEN = 0,255,0 +BLUE = 0,0,255 +SANDY = 255,0,128 +ORANGE = 255,128,0 +PURPLE = 128,0,255 +DARK_RED = 128,0,0 +DARK_GREEN = 0,128,0 +DARK_BLUE = 0,0,128 +YELLOW = 255,255,0 +PINK = 255,0,255 +CYAN = 0,255,255 + +ListeColors= (RED, GREEN, BLUE, SANDY,ORANGE , PURPLE, DARK_RED,DARK_GREEN,DARK_BLUE,YELLOW,PINK,CYAN ) + + + diff --git a/src/EFICASGUI/eficasSalome.py b/src/EFICASGUI/eficasSalome.py index 422fe38d..9b19ba74 100644 --- a/src/EFICASGUI/eficasSalome.py +++ b/src/EFICASGUI/eficasSalome.py @@ -1,200 +1,68 @@ # -*- coding: utf-8 -*- +#_____________________________________ -from Logger import ExtLogger -logger=ExtLogger( "EFICAS_SRC.EFICASGUI.eficasSalome.py" ) - -# ----------------------------------------------------------------------------- import sys, os, re,types - - - -""" -# Remplacement de la fonction exit standard par une fonction -# qui n'interrompt pas l'execution - -sys._exit=sys.exit - -def exit(ier): - print "appel de exit: ",ier - - -# Fin remplacement -""" - - -import eficasConfig - -# __GBO__ lignes de path ajoutées pour accéder aux packages python du -# logiciel Eficas. Le package Aster est ajouté explicitement pour -# accéder au module prefs.py. A FAIRE: il convient plutôt de packager -# Eficas pour que le chargement de prefs puisse se faire sans cette -# adaptation (ex: faire un prefs.py chapeau qui aiguille entre les -# prefs spécifiques Aster ou Openturn). +import traceback +from PyQt4.QtGui import QMessageBox + +from salome.kernel.logger import Logger +logger = Logger( "EFICAS_SRC.EFICASGUI.eficasSalome.py" ) + +import eficasConfig +# eficasConfig definit le EFICAS_ROOT +# lignes de path ajoutees pour acceder aux packages python du +# logiciel Eficas. Le package Aster est ajoute explicitement pour +# acceder au module prefs.py. A +# ajout de InterfaceQT4 pour permettre l acces a la fenetre Option sys.path[:0]=[eficasConfig.eficasPath, - os.path.join( eficasConfig.eficasPath,'Aster') - ] - -#sys.path[:0]=[os.path.join( eficasConfig.eficasPath,'Aster'), -# os.path.join( eficasConfig.eficasPath,'Homard'), -# # __GBO__ os.path.join( eficasConfig.eficasPath,'InterfaceQT'), -# os.path.join( eficasConfig.eficasPath,'Openturns'), -# os.path.join( eficasConfig.eficasPath,'Editeur'), -# eficasConfig.eficasPath, -# ] - - - - -# mode de lancement Eficas -ASTER = "ASTER" -HOMARD = "HOMARD" -OPENTURNS = "OPENTURNS" + os.path.join( eficasConfig.eficasPath,'Editeur'), + os.path.join( eficasConfig.eficasPath,'UiQT4'), + os.path.join( eficasConfig.eficasPath,'InterfaceQT4'), + eficasConfig.eficasPath, + ] import Editeur -import qt -from InterfaceQT import qtEficas +from InterfaceQT4 import qtEficas import salome -import meshGui -import PALGUI_API - -# __MEM_GBO: Pour mémoire, on préfère importer visuDriver après -# studyManager car le premier dépend du second. Cependant, le problème -# est résolu à sa source: le fichier visuDriver importe le -# studyManager. Ainsi, il n'est plus nécessaire de se préoccuper -# explicitement de l'ordre des import. -import studyManager -import visuDriver - import SalomePyQt -from SelectMainShapeDiag_ui import SelectMainShapeDiag -from SelectMeshDiag_ui import SelectMeshDiag - - - -# message utilisateur -msgWarning = "Attention" -msgMainShapeSelection = "On travaille sur la géométrie principale : " -msgSubShapeBadMainShape = "La sélection géométrique SALOME ne correspond pas à une sous-géométrie de la géométrie principale : " -msgMeshGroupBadMainShape = "Le groupe de maillage sélectionné dans SALOME ne référence pas la bonne géométrie principale : " -msgIncompleteSelection = "Tous les éléments de la sélection SALOME n'ont pu étre ajoutée" -msgUnAuthorizedSelecion = "Sélection SALOME non authorisé. Autorisé : sous-géométrie, groupe de maille" -msgErrorAddJdcInSalome = "Erreur dans l'export du fichier de commande dans l'arbre d'étude Salome" -msgErrorDisplayShape = "Erreur dans l'affichage de la forme géométrique sélectionnée" -msgErrorDisplayMeshGroup = "Erreur dans l'affichage du groupe de maillage sélectionné" -msgErrorNeedSubShape = "Sélection d'un élément sous géométrique seulement" - -msgErrorGroupMaSelection = "Sélection GROUP_MA ne peut pas prendre un point ou un noeud" -msgWarningGroupNoSelection = "Attention, GROUP_NO devrait prendre un point ou un noeud" +from salome.kernel.studyedit import getStudyEditor - - -# couleur pour visualisation des géometrie CS_CBO -COLORS = ( studyManager.RED, - studyManager.GREEN, - studyManager.BLUE, - studyManager.SANDY, - studyManager.ORANGE, - studyManager.PURPLE, - studyManager.DARK_RED, - studyManager.DARK_GREEN, - studyManager.DARK_BLUE, - studyManager.YELLOW, - studyManager.PINK, - studyManager.CYAN ) - +# couleur pour visualisation des geometries +import colors +COLORS = colors.ListeColors LEN_COLORS = len( COLORS ) - - -class SelectMainShapeDiagImpl( SelectMainShapeDiag ): - def __init__( self, mainShapeEntries, parent = None,name = None,modal = 1,fl = 0 ): - SelectMainShapeDiag.__init__( self,parent,name,modal,fl ) - - self.mainShapes = {} # ( entry, value ) - for entry in mainShapeEntries: - name = studyManager.palStudy.getName( entry ) - self.mainShapes[entry] = name - - self.lbMainShapes.clear() - for entry,name in self.mainShapes.items(): - self.lbMainShapes.insertItem( name ) - self.lbMainShapes.setCurrentItem( 0 ) - - - def getUserSelection( self ): - mainShapeEntry = None - - item = self.lbMainShapes.selectedItem() - mainShapeName = str( item.text() ) - - for entry, name in self.mainShapes.items(): - if mainShapeName == name: - mainShapeEntry = entry - break - - return mainShapeEntry - - -class SelectMeshDiagImpl( SelectMeshDiag ): - def __init__( self, meshGroupEntries, parent = None,name = None,modal = 1,fl = 0 ): - SelectMeshDiag.__init__( self,parent,name,modal,fl ) - - self.meshes = {} # ( entry, value ) - - for meshGroupEntry in meshGroupEntries: - meshEntry = studyManager.palStudy.getMesh(meshGroupEntry) - meshName = studyManager.palStudy.getName(meshEntry) - self.meshes[meshEntry] = meshName - - self.lbMeshes.clear() - for entry,name in self.meshes .items(): - self.lbMeshes.insertItem( name ) - self.lbMeshes.setCurrentItem( 0 ) - - def getUserSelection( self ): - selMeshEntry, keep = None, False - - item = self.lbMeshes.selectedItem() - meshName = str( item.text() ) - for entry, name in self.meshes.items(): - if meshName == name: - selMeshEntry = entry - break - - keep = self.cbAgain.isChecked() - - return selMeshEntry, keep - - - class MyEficas( qtEficas.Appli ): """ - Classe de lancement du logiciel EFICAS dans SALOME. - Cette classe spécialise le logiciel Eficas par l'ajout de: - a)la création de groupes de mailles dans le composant SMESH de SALOME - b)la visualisation d'éléments géométrique dans le coposant GEOM de SALOME par sélection dans EFICAS + Classe de lancement du logiciel EFICAS dans SALOME + Cette classe specialise le logiciel Eficas par l'ajout de: + a)la creation de groupes de mailles dans le composant SMESH de SALOME + b)la visualisation d'elements geometrique dans le coposant GEOM de SALOME par selection dans EFICAS """ - def __init__( self, parent, code = None, fichier = None, module = studyManager.SEficas, version=None): + def __init__( self, parent, code = "ASTER", fichier = None, module = "EFICAS", + version = None, componentName = "Eficas",multi=False): """ Constructeur. - @type parent: @param parent: widget Qt parent - - @type code: string - @param code: catalogue à lancer ( ASTER, HOMARD OPENTURNS ). optionnel ( défaut = ASTER ). - + @param code: catalogue a lancer ( ASTER, HOMARD OPENTURNS ). optionnel ( defaut = ASTER ). @type fichier: string - @param fichier: chemin absolu du fichier eficas à ouvrir à dès le lancement. optionnel + @param fichier: chemin absolu du fichier eficas a ouvrir a das le lancement. optionnel """ - + + dictPathCode={'ASTER':'Aster','OPENTURNS_STUDY':'Openturns_Study','CARMEL3D':'Carmel3D', + 'OPENTURNS_WRAPPER':'Openturns_Wrapper','MAP':'MAP','SEP':'Sep'} + if code in dictPathCode.keys(): + pathCode=dictPathCode[code] + sys.path[:0]=[os.path.join(eficasConfig.eficasPath,pathCode)] + if Editeur.__dict__.has_key( 'session' ): from Editeur import session eficasArg = [] @@ -202,607 +70,514 @@ class MyEficas( qtEficas.Appli ): if fichier: eficasArg += [ fichier ] if version: - print version eficasArg += [ "-c", version ] else : print "noversion" session.parse( eficasArg ) - qtEficas.Appli.__init__( self,code=code,salome=1,parent=parent) + self.editor = getStudyEditor() # Editeur de l'arbre d'etude + + qtEficas.Appli.__init__( self,code=code,salome=1,parent=parent,multi=multi) - #--------------- spécialisation EFICAS dans SALOME ------------------- + #--------------- specialisation EFICAS dans SALOME ------------------- self.parent = parent - self.salome = True #active les parties de code spécifique dans Salome( pour le logiciel Eficas ) - self.module = module #indique sous quel module dans l'arbre d'étude ajouter le JDC. - - - # donnée pour la création de groupe de maille - self.mainShapeNames = {} #dictionnaire pour gérer les multiples fichiers possibles ouverts par - self.mainShapeEntries = {} #eficas ( clé = identifiant du JDC ), une mainshape par fichier ouvert. - self.subShapes = {} #dictionnaire des sous-géométrie de la géométrie principale ( clé = entry, valeur = name ) + self.salome = True #active les parties de code specifique dans Salome( pour le logiciel Eficas ) + self.module = module #indique sous quel module dans l'arbre d'etude ajouter le JDC. + self.componentName = componentName + + # donnee pour la creation de groupe de maille + self.mainShapeNames = {} #dictionnaire pour gerer les multiples fichiers possibles ouverts par + #eficas ( cle = identifiant du JDC ), une mainshape par fichier ouvert. + #dictionnaire des sous-geometrie de la geometrie principale ( cle = entry, valeur = name ) #---------------------------------------------------------------------- - # visualisation groupes de mailles - self.workingMesh = {} #dictionnaire clé = identifiant JDC / valeur = entry Mesh - #---------------------------------------------------------------------- - - self.icolor = 0 # compteur pour mémoriser la couleur courante + self.icolor = 0 # compteur pour memoriser la couleur courante self.show() def closeEvent(self,event): - import InterfaceQT.readercata - if hasattr(InterfaceQT.readercata,'reader') : - del InterfaceQT.readercata.reader + if hasattr(self,'readercata') : + del self.readercata global appli appli = None event.accept() - def __studySync( self ): - """ - IMPORTANT( à appeler préalablement à chaque appel du gestionnaire d'étude ) : spécifique au lancement de Eficas dans Salome, - permet au gestionnaire d'étude ( studyManager.palStudy ) de pointer sur la bonne étude. - - Un retour à False indique qu'il n'y a aucune étude active, dans ce cas ne faire aucune opération avec le gestionnaire d'étude( - gros plantage sinon ) - """ - activeStudyId = salome.sg.getActiveStudyId() - - if activeStudyId == 0: # pas d'étude active - return False - - if activeStudyId != salome.myStudyId: - studyManager.palStudy.setCurrentStudyID( activeStudyId ) - - return True + +# ___________________________ Methodes de l ex Pal __________________________________ + + #---------------------------------------------------------------- + def getCORBAObjectInComponent( self, entry, composant ): + #---------------------------------------------------------------- + object = None + mySO = self.editor.study.FindObjectID(entry) + if mySO: + object = mySO.GetObject() + if not object: + myComponent = salome.lcc.FindOrLoadComponent("FactoryServer", composant) + SCom = self.editor.study.FindComponent( composant ) + print myComponent , SCom + self.editor.builder.LoadWith( SCom , myComponent ) + object = mySO.GetObject() + if not object : + logger.debug("selectedEntry: An error occurs") + return object + + + #---------------------------------------------- + def giveMeshGroups( self,entry,label1,typeMesh): + #---------------------------------------------- + msg=None + names=[] + import SMESH + try: + monMaillage =self.getCORBAObjectInComponent(entry,"SMESH") + if monMaillage != None : # selection d'un groupe de SMESH + if monMaillage._narrow(SMESH.SMESH_Mesh): + mailSO = self.editor.study.FindObjectID(entry) + if mailSO == None : return names, msg + + + subIt = self.editor.study.NewChildIterator(mailSO) + while subIt.More(): + subSO = subIt.Value() + subIt.Next() + + if (subSO.GetName()[0:9]!=label1) : continue + subSSMeshit=self.editor.study.NewChildIterator(subSO) + while subSSMeshit.More(): + subSSMeshSO = subSSMeshit.Value() + subSSMeshit.Next() + if subSSMeshSO.GetObject()._narrow(typeMesh): + names.append(subSSMeshSO.GetName()) + else : + msg=entry + " n est pas un maillage" + except : + logger.debug(' giveMeshGroups pb avec ( entry = %s ) ' %entry ) + msg=' giveMeshGroup pb avec ( entry = %s ) '+ entry + return names, msg + + #------------------------------------- + def isMeshGroup( self,entry): + #------------------------------------- + result=False + import SMESH + try: + monObjet =self.getCORBAObjectInComponent(entry,"SMESH") + if monObjet != None : # selection d'un groupe de SMESH + if monObjet._narrow(SMESH.SMESH_GroupBase): + result = True + except : + logger.debug(' isMeshGroup pb avec ( entry = %s ) ' %entry ) + return result + + #------------------------------------- + def isShape( self,entry): + #------------------------------------- + result=False + import GEOM + try: + monObjet =self.getCORBAObjectInComponent(entry,"GEOM") + if monObjet != None : # selection d'un objet GEOM + if monObjet._narrow(GEOM.GEOM_Object ): + result = True + except : + logger.debug(' isShape pb avec ( entry = %s ) ' %entry ) + return result + + #----------------------------------------------------------------- + def getMainShapeEntry(self,entry): + #----------------------------------------------------------------- + result=None + try: + mainShapeEntry = entry.split(':')[:4] + if len(mainShapeEntry) == 4: + strMainShapeEntry = '%s:%s:%s:%s'%tuple(mainShapeEntry) + if self.isMainShape(strMainShapeEntry): + result = strMainShapeEntry + except: + logger.debug( 'Erreur pour SalomeStudy.getMainShapeEntry( entry = %s ) ' %entry ) + result = None + return result + + #----------------------------------------------------------------- + def isMainShape(self,entry): + #----------------------------------------------------------------- + result = False + try: + monObjet =self.getCORBAObjectInComponent(entry,"GEOM") + import GEOM + shape = monObjet._narrow( GEOM.GEOM_Object ) + if shape.IsMainShape(): + result = True + except: + logger.debug( 'Errreur pour SalomeStudy.isMainShape( entry = %s ) ' %entry ) + result = False + return result - - def __createOCCView( self ): - """ - Création vue Occ - """ - #salome.salome_init() - import iparameters - - # On détermine le nombre de GUI states déjà présents dans l'arbre d'étude - GUIStateID = 1 - - ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", GUIStateID)) - properties = ipar.getProperties() - - while properties != []: - GUIStateID += 1 - ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", GUIStateID)) - properties = ipar.getProperties() - - print "GUIStateID: ", GUIStateID - - #Set up visual properties: - ipar.setProperty("AP_ACTIVE_VIEW", "OCCViewer_0_0") - ipar.setProperty("AP_WORKSTACK_INFO", "(splitter orientation=0 sizes=1045 (views active='OCCViewer_0_0' 'OCCViewer_0_0'))") - ipar.setProperty("AP_SAVEPOINT_NAME", "GUI state: %i"%(GUIStateID)) - - #Set up lists: - # fill list AP_VIEWERS_LIST - ipar.append("AP_VIEWERS_LIST", "OCCViewer_1") - # fill list OCCViewer_1 - ipar.append("OCCViewer_1", "OCC scene:1 - viewer:1") - ipar.append("OCCViewer_1", "1.000000000000e+00*0.000000000000e+00*0.000000000000e+00*5.773502588272e-01*-5.773502588272e-01*5.773502588272e-01*0.000000000000e+00*0.000000000000e+00*0.000000000000e+00*0.000000000000e+00*2.886751294136e+02*-2.886751294136e+02*2.886751294136e+02") - - if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(1) - iparameters.getSession().restoreVisualState(GUIStateID) - - - def __selectWorkingMesh( self, meshGroupEntries ): - """ - Sélection intéractive du maillage sur lequel on travail - """ - selMeshEntry, keep = None, False - diag = SelectMeshDiagImpl( meshGroupEntries, self.parent ) - if diag.exec_loop() == qt.QDialog.Accepted: - selMeshEntry, keep = diag.getUserSelection() - return selMeshEntry, keep - - - - def __selectMainShape( self, groupeMaNamesIn, groupeNoNamesIn, editor ): + #----------------------------------------------------------------- + def ChercheType( self, shape ): + #----------------------------------------------------------------- + tgeo = shape.GetShapeType() + geomEngine = salome.lcc.FindOrLoadComponent( "FactoryServer", "GEOM" ) + #print dir(self.editor.study) + groupIMeasureOp = geomEngine.GetIMeasureOperations(self.editor.study._get_StudyId()) + if tgeo != "COMPOUND" : return tgeo + + strInfo = groupIMeasureOp.WhatIs( shape ) + dictInfo = {} + l = strInfo.split('\n') + + for couple in l: + nom, valeur = couple.split(':') + dictInfo[ nom.strip() ] = valeur.strip() + + ordre = [ "COMPSOLID", "SOLID", "SHELL", "FACE", "WIRE", "EDGE", "VERTEX" ] + for t in ordre: + if dictInfo[ t ] != '0': + tgeo = t + return tgeo + return None + + + #----------------------------------------------------------------- + def selectShape( self, editor, entry, kwType = None ): + #----------------------------------------------------------------- """ - Sélection intéractive de la main shape + selection sous-geometrie dans Salome: + -test1) si c'est un element sous-geometrique . + -test2) si appartient a la geometrie principale. """ - groupeMaNamesOut, groupeNoNamesOut = [], [] - selectedMainShape = None - mainShapes = {} - mainShapeEntries = [] - - # liste des main shape possibles - for groups in ( groupeMaNamesIn, groupeNoNamesIn ): - for subShapeName in groups: - entries = studyManager.palStudy.getEntriesFromName( studyManager.SGeom, subShapeName ) - for entry in entries: - mainShapeEntry = studyManager.palStudy.getMainShapeEntry( entry ) - if mainShapeEntry != entry: - if mainShapes.has_key(subShapeName): - mainShapes[ subShapeName ].append( mainShapeEntry ) - else: - mainShapes[ subShapeName ] = [ mainShapeEntry ] - if not mainShapeEntry in mainShapeEntries: - mainShapeEntries += [ mainShapeEntry ] - - if mainShapes: - if len(mainShapeEntries)>1: - diag = SelectMainShapeDiagImpl( mainShapeEntries, self.parent ) - - if diag.exec_loop() == qt.QDialog.Accepted: - selectedMainShape = diag.getUserSelection() - print 'main shape user selection ->',selectedMainShape - - else: - selectedMainShape = mainShapeEntries[0] - - self.mainShapeEntries[ editor ] = selectedMainShape - - # filtre sur la main shape sélectionnée - for name in groupeMaNamesIn: - try: - if selectedMainShape in mainShapes[ name ] : - groupeMaNamesOut += [ name ] - except: - pass - - for name in groupeNoNamesIn: - try: - if selectedMainShape in mainShapes[ name ] : - groupeNoNamesOut += [ name ] - except: - pass - - return groupeMaNamesOut, groupeNoNamesOut - - - - - def __selectShape( self, editor, selectedEntry, kwType = None ): - """ - sélection sous-géométrie dans Salome: - -test1) si c'est un élément sous-géométrique . - -test2) si appartient à la géométrie principale. - - met à jours la liste self.subShapes si test ok - """ name, msgError = '','' - - selectedMainShapeEntry = studyManager.palStudy.getMainShapeEntry( selectedEntry ) - - if selectedMainShapeEntry and selectedMainShapeEntry != selectedEntry: #ok test1) - - tGeo = studyManager.palStudy.getRealShapeType( selectedEntry ) - if kwType == "GROUP_NO" and tGeo != studyManager.VERTEX: - msgError = msgWarningGroupNoSelection - elif kwType == "GROUP_MA" and tGeo == studyManager.VERTEX: - name, msgError = '', msgErrorGroupMaSelection - return name, msgError - - if not self.mainShapeEntries.has_key( editor ): - self.mainShapeEntries[ editor ] = selectedMainShapeEntry - name = studyManager.palStudy.getName( selectedMainShapeEntry ) - msgError = msgMainShapeSelection + name - if selectedMainShapeEntry == self.mainShapeEntries[ editor ]: - name = studyManager.palStudy.getName( selectedEntry ) - self.subShapes[ selectedEntry ] = name - else: - if not self.mainShapeNames.has_key( editor ): - self.mainShapeNames[ editor ] = studyManager.palStudy.getName( self.mainShapeEntries[ editor ] ) - msgError = msgSubShapeBadMainShape + self.mainShapeNames[ editor ] - else: - name, msgError = '', msgErrorNeedSubShape - - return name, msgError - - - - def __selectMeshGroup( self, editor, selectedEntry, kwType = None ): - """ - sélection groupe de maille dans Salome: - -test 1) si c'est un groupe de maille - -test 2) si le maillage fait référence à la géométrie principale - """ - name, msgError = '','' - - selectedMeshEntry = studyManager.palStudy.getMesh( selectedEntry ) - - if selectedMeshEntry: # ok test 1) - tGroup = studyManager.palStudy.getGroupType( selectedEntry ) - if kwType == "GROUP_NO" and tGroup != studyManager.NodeGroups: - msgError = msgWarningGroupNoSelection - elif kwType == "GROUP_MA" and tGroup == studyManager.NodeGroups: - name, msgError = '', msgErrorGroupMaSelection - return name, msgError - - selectedMainShapeEntry = studyManager.palStudy.getShapeFromMesh( selectedMeshEntry ) - - if selectedMainShapeEntry: #test 2) - if not self.mainShapeEntries.has_key( editor ): - self.mainShapeEntries[ editor ] = selectedMainShapeEntry - name = studyManager.palStudy.getName( selectedMainShapeEntry ) - msgError = msgMainShapeSelection + name - if selectedMainShapeEntry == self.mainShapeEntries[ editor ]: - name = studyManager.palStudy.getName( selectedEntry ) #ok test 2) - else: - if not self.mainShapeNames.has_key( editor ): - self.mainShapeNames[ editor ] = studyManager.palStudy.getName( - self.mainShapeEntries[ editor ] ) - msgError = msgMeshGroupBadMainShape + self.mainShapeNames[ editor ] - else: - # on authorise quand même les groupes de maillage ne faisant - # pas référence à une géométrie principale (dixit CS_CBO ) - name = studyManager.palStudy.getName( selectedEntry ) - + mySO = self.editor.study.FindObjectID(entry) + if mySO == None : + return name, msgError + object = mySO.GetObject() + if object == None : + return name, msgError + + import GEOM + shape = object._narrow( GEOM.GEOM_Object ) + if not shape : + return name, msgError + + tGeo=self.ChercheType(shape) + if not tGeo : + return name, msgError + #if kwType == "GROUP_NO" and str(tGeo) != "VERTEX": + # name,msgError = '',"la selection n est pas un Vertex" + # return name, msgError + if kwType == "GROUP_MA" and str(tGeo) == "VERTEX": + name, msgError = '', "la selection n est pas un groupe de maille" + return name, msgError + + mainShapeEntry = self.getMainShapeEntry( entry ) + if self.mainShapeNames.has_key( editor ): + #print "------------- self.mainShapeNames[editor]" , self.mainShapeNames[editor] + if self.mainShapeNames[editor] == mainShapeEntry: + name=mySO.GetName() + else : + msgError="Le groupe reference la geometrie " + mainShapeEntry + " et non " + self.mainShapeNames[editor] + else : + self.mainShapeNames[editor] = mainShapeEntry + name=mySO.GetName() + return name, msgError - - - - def __updateSubShapes( self, editor, groupeNames ): + + #----------------------------------------------------------------- + def selectMeshGroup( self, editor, selectedEntry, kwType = None ): + #----------------------------------------------------------------- """ - mise à jours de la liste self.subShapes à partir de la liste des noms de groupe fourni en entré + selection groupe de maille dans Salome: + -test 1) si c'est un groupe de maille + -test 2) si le maillage fait reference a la geometrie principale """ - for name in groupeNames: - entries = studyManager.palStudy.getEntriesFromName( studyManager.SGeom, name ) - for entry in entries: - if not self.subShapes.has_key( entry ): - ok, msgError = self.__selectShape( editor, entry ) # filtre - if ok: - self.subShapes[ entry ] = name - - def __getAllGroupeMa(self, item ): + name, msgError = '','' + + mySO=self.editor.study.FindObjectID(selectedEntry ) + from salome.smesh.smeshstudytools import SMeshStudyTools + monSMeshStudyTools=SMeshStudyTools(self.editor) + meshSO = monSMeshStudyTools.getMeshFromGroup(mySO) + if meshSO == None : return name, msgError + + # on verifie que l entree selectionnee a le bon type (NODE ou EDGE...) + tGroup = "" + groupObject = self.getCORBAObjectInComponent(selectedEntry,"SMESH") + if not groupObject : + logger.debug("selectedMeshEntry: An error occurs") + + import SMESH + aGroup = groupObject._narrow( SMESH.SMESH_GroupBase ) + if aGroup: tGroup = aGroup.GetType() + + if kwType == "GROUP_NO" and tGroup != SMESH.NODE: + msgError = "GROUP_NO attend un groupe de noeud" + return name, msgError + elif kwType == "GROUP_MA" and tGroup == SMESH.NODE: + msgError = "GROUP_MA attend un point goupe de maille" + return name, msgError + + # on cherche la shape associee + #PN PN mesh_Object est un SOject + meshObject = meshSO.GetObject() + mesh = meshObject._narrow( SMESH.SMESH_Mesh ) + if mesh: #c'est bien un objet maillage + shape = mesh.GetShapeToMesh() + if shape: + ior = salome.orb.object_to_string( shape ) + if ior: + sObject = self.editor.study.FindObjectIOR( ior ) + mainShapeID = sObject.GetID() + else : + mainShapeID=0 + else : + return name, "Type d objet non permis" + + # on cherche si la shape associee est la bonne + #print "------------- mainShapeID" , mainShapeID + if self.mainShapeNames.has_key( editor ): + #print "------------- self.mainShapeNames[editor]" , self.mainShapeNames[editor] + if self.mainShapeNames[editor] == mainShapeID: + name=mySO.GetName() + else : + msgError="Le groupe reference la geometrie " + mainShapeID + " et non " + self.mainShapeNames[editor] + else : + self.mainShapeNames[editor] = mainShapeID + name=mySO.GetName() + + #print "------------------------------ name :", name + #print "------------------------------ name :", name + #print "------------------------------ name :", name + return name,msgError + + + def displayMeshGroups(self, meshGroupName): """ - Récupère tous les GROUPE_MA dans le JDC courant + visualisation group de maille de nom meshGroupName dans salome """ - groupMa = () + ok, msgError = False, '' try: #if 1 : - itemName = item.get_nom() - if 'GROUP_MA' in itemName: - itemValue = item.get_valeur() - if type( itemValue ) == str: - groupMa += ( itemValue , ) - elif type( itemValue ) == tuple: - groupMa += itemValue - elif type( itemValue ) == list: - groupMa += tuple(itemValue) - elif type( itemValue ) == types.InstanceType and itemValue.has_key('GROUP_MA'): - # pour créer le groupe de mailles dans DEFI_GROUP> CREA_GROUP_MA> GROUP_MA - groupMa += ( itemValue['GROUP_MA'], ) - else : - # sert pour DEFI_GROUP_MA / UNION - mc=item.get_definition() - if type( mc ) == types.InstanceType : - children = item._GetSubList() - for child in children: - try : - if 'grma' in repr(child.get_definition().type[0]) : - val=tuple(child.get_valeur()) - groupMa += val - except : - pass - else: - children = item._GetSubList() - for child in children: - groupMa += self.__getAllGroupeMa( child ) + sg = salome.ImportComponentGUI('SMESH') + meshGroupEntries = [] + selMeshEntry = None + selMeshGroupEntry = None + + # liste des groupes de maille de nom meshGroupName + listSO = self.editor.study.FindObjectByName(meshGroupName, "SMESH") + #print listSO + #print "liste des groupes de maille de nom %s: "%(meshGroupName), listSO + + if len(listSO)>1: + return 0,'Plusieurs objets portent ce nom' + if len(listSO) ==0 : + return 0,'Aucun objet ne porte ce nom' + SObjet=listSO[0] + groupEntry = SObjet.GetID() + myComponent = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") + SCom = self.editor.study.FindComponent("SMESH") + myBuilder = self.editor.study.NewBuilder() + myBuilder.LoadWith( SCom , myComponent ) + sg.CreateAndDisplayActor(groupEntry) + #color = COLORS[ self.icolor % LEN_COLORS ] + #self.icolor = self.icolor + 1 + #sg.SetColor(groupEntry, color[0], color[1], color[2]) + salome.sg.Display(groupEntry) + salome.sg.FitAll() + ok = True + except: #else : - # traitement des MCLIST Pour CREA_GROUP_MA - try: - itemName = item.get_nom() - if 'GROUP_MA' in itemName: - children = item._GetSubList() - for child in children: - groupMa += self.__getAllGroupeMa( child ) - except: - pass - return groupMa - - - def __getAllGroupeNo(self, item ): - """ - Récupère tous les GROUPE_NO dans le JDC courant - """ - groupNo = () - try: - itemName = item.get_nom() - if 'GROUP_NO' in itemName: - itemValue = item.get_valeur() - if type( itemValue ) == str: - groupNo += ( itemValue , ) - elif type( itemValue ) == tuple: - groupNo += itemValue - elif type( itemValue ) == list: - groupNo += tuple(itemValue) - elif type( itemValue ) == types.InstanceType and itemValue.has_key('GROUP_NO'): - # pour créer le groupe de Noeuds dans DEFI_GROUP> CREA_GROUP_NO> GROUP_NO - groupNo += ( itemValue['GROUP_NO'], ) - else: - children = item._GetSubList() - for child in children: - groupNo += self.__getAllGroupeNo( child ) - except: - # traitement des MCLIST Pour CREA_GROUP_NO dans DEFI_GROUP - try: - itemName = item.get_nom() - if 'GROUP_NO' in itemName: - children = item._GetSubList() - for child in children: - groupNo += self.__getAllGroupeNo( child ) - except: - pass - return groupNo + msgError = "Impossible d afficher "+shapeName + logger.debug(50*'=') + return ok, msgError - - #----------------------- LISTE DES NOUVEAUX CAS D'UTILISATIONS ----------- +# ___________________________ Methodes appelees par EFICAS __________________________________ + #---------------------------------------------------------------- def selectGroupFromSalome( self, kwType = None, editor=None): + #---------------------------------------------------------------- """ - Sélection d'élément(s) d'une géométrie ( sub-shape ) ou d'élément(s) de maillage ( groupe de maille) à partir de l'arbre salome + Selection d'element(s) d'une geometrie ( sub-shape ) ou d'element(s) de maillage ( groupe de maille) partir de l'arbre salome retourne ( la liste des noms des groupes, message d'erreur ) - - Note: Appelé par EFICAS lorsqu'on clique sur le bouton ajouter à la liste du panel AFF_CHAR_MECA + + Note: Appele par EFICAS lorsqu'on clique sur le bouton ajouter la liste du panel GROUPMA """ names, msg = [], '' try: - self.editor=editor - atLeastOneStudy = self.__studySync() + atLeastOneStudy = self.editor.study if not atLeastOneStudy: return names, msg - # récupère toutes les sélections de l'utilsateur dans l'arbre Salome + + # recupere toutes les selections de l'utilsateur dans l'arbre Salome entries = salome.sg.getAllSelected() nbEntries = len( entries ) if nbEntries >= 1: for entry in entries: - if studyManager.palStudy.isMeshGroup( entry ): #sélection d'un groupe de maille - name, msg = self.__selectMeshGroup( editor, entry, kwType ) - elif studyManager.palStudy.isShape( entry ): #sélection d'une sous-géométrie - name, msg = self.__selectShape( editor, entry, kwType ) + if self.isMeshGroup(entry): # selection d 'un sous maillage + name, msg = self.selectMeshGroup( editor, entry, kwType ) + elif self.isShape(entry): # selection d'une sous-geometrie + name, msg = self.selectShape( editor, entry, kwType ) else: - name, msg = '', msgUnAuthorizedSelecion + name, msg = None, "Selection SALOME non autorisee." if name: - names.append( name ) + names.append( name ) - if names and len( names ) < nbEntries: - msg = msgIncompleteSelection except: logger.debug("selectGroupFromSalome: An error occurs") + #print "=================== selectGroupFromSalome ", names, msg + #print "=================== selectGroupFromSalome ", names, msg + #print "=================== selectGroupFromSalome ", names, msg return names, msg - + #--------------------------------------------- def addJdcInSalome( self, jdcPath ): + #--------------------------------------------- """ - Ajoute le Jeu De Commande ASTER ou HOMARD dans l'arbre d'étude Salome dans la rubrique EFICAS + Ajoute le Jeu De Commande dans l'arbre d'etude Salome dans la rubrique EFICAS + Revu pour QT4 """ - ok, msgError = False, msgErrorAddJdcInSalome - #try: - if 1: - atLeastOneStudy = self.__studySync() + msgError = "Erreur dans l'export du fichier de commande dans l'arbre d'etude Salome" + ok = False + try: + atLeastOneStudy = self.editor.study if not atLeastOneStudy: return ok, msgError - fileType = { 'ASTER' : studyManager.FICHIER_EFICAS_ASTER, - 'HOMARD' : studyManager.FICHIER_EFICAS_HOMARD , - 'OPENTURNS': studyManager.FICHIER_EFICAS_OPENTURNS} + fileType = { 'ASTER' : "FICHIER_EFICAS_ASTER", + 'SEP' : "FICHIER_EFICAS_SEP", + 'MAP' : "FICHIER_EFICAS_MAP", + 'OPENTURNS': "FICHIER_EFICAS_OPENTURNS", + 'OPENTURNS_STUDY': "FICHIER_EFICAS_OPENTURNS_STUDY", + 'OPENTURNS_WRAPPER': "FICHIER_EFICAS_OPENTURNS_WRAPPER", + 'CARMEL3D': "FICHIER_EFICAS_CARMEL3D", + } folderName = { 'ASTER' : 'AsterFiles', - 'HOMARD' : 'HomardFiles' , - 'OPENTURNS': 'OpenturnsFiles'} - - folderType = { 'ASTER': studyManager.ASTER_FILE_FOLDER, - 'HOMARD': studyManager.ASTER_FILE_FOLDER, - 'OPENTURNS': studyManager.OPENTURNS_FILE_FOLDER - } + 'SEP' : 'OMFiles' , + 'CARMEL3D' : 'CARMEL3DFiles' , + 'MAP' : 'MapFiles' , + 'OPENTURNS_STUDY': 'OpenturnsFiles', + 'OPENTURNS_WRAPPER': 'OpenturnsFiles'} + + folderType = { 'ASTER': "ASTER_FILE_FOLDER", + 'SEP': "SEP_FILE_FOLDER", + 'MAP': "MAP_FILE_FOLDER", + 'CARMEL3D': "CARMEL3D_FILE_FOLDER", + 'OPENTURNS_STUDY':"OPENTURNS_FILE_FOLDER", + 'OPENTURNS_WRAPPER': "OPENTURNS_FILE_FOLDER"} - moduleEntry = studyManager.palStudy.addComponent(self.module) + moduleEntry = self.editor.findOrCreateComponent(self.module, self.componentName) itemName = re.split("/",jdcPath)[-1] - fatherEntry = studyManager.palStudy.addItem( + fatherEntry = self.editor.findOrCreateItem( moduleEntry, - itemName = folderName[self.code], - itemIcon = "ICON_COMM_FOLDER", - itemType = folderType[self.code], - bDoublonCheck = True ) + name = folderName[self.code], + #icon = "ICON_COMM_FOLDER", + fileType = folderType[self.code]) - commEntry = studyManager.palStudy.addItem( fatherEntry , - itemName = itemName, - itemType = fileType[ self.code ], - itemValue = jdcPath, - itemComment = str( jdcPath ), - itemIcon = "ICON_COMM_FILE", - bDoublonCheck = True ) - studyManager.palStudy.refresh() - print 'addJdcInSalome commEntry->', commEntry + commEntry = self.editor.findOrCreateItem( fatherEntry , + name = itemName, + fileType = fileType[ self.code ], + fileName = jdcPath, + #icon = "ICON_COMM_FILE", + comment = str( jdcPath )) + + salome.sg.updateObjBrowser(1) + + #print 'addJdcInSalome commEntry->', commEntry if commEntry: ok, msgError = True, '' - #except: - logger.debug(50*'=') + except Exception, exc: + msgError = "Can't add Eficas file to Salome study tree" + logger.debug(msgError, exc_info = True) + QMessageBox.warning(self, self.tr("Warning"), + self.tr("%s. Reason:\n%s\n\nSee logs for " + "more details." % (msgError, exc))) return ok, msgError - - def createOrUpdateMesh( self, editor ): - """ - Ouverture d'une boite de dialogue : Creation de groupes de mailles dans un maillage existant ou un nouveau maillage. - Note: Appelé par EFICAS à la sauvegarde du JDC. - """ - try: - atLeastOneStudy = self.__studySync() - if not atLeastOneStudy: - return - - groupeMaNames = self.__getAllGroupeMa( editor.tree.item ) - groupeNoNames = self.__getAllGroupeNo( editor.tree.item ) - - # on elimine les doublons de la liste - groupeMaNames = dict.fromkeys(groupeMaNames).keys() - groupeNoNames = dict.fromkeys(groupeNoNames).keys() - - #print 'CS_pbruno createOrUpdateMesh groupeNoNames', groupeNoNames - - # mise à jours de la liste des sous-géométrie ( self.subShapes ) - if not self.mainShapeEntries.has_key( editor ): - # l'utilisateur n'a sélectionné aucune sous-géométrie et donc pas de géométrie principale - groupeMaNames, groupeNoNames = self.__selectMainShape( groupeMaNames, groupeNoNames, editor ) - - if groupeMaNames or groupeNoNames: - print 'CS_pbruno createOrUpdateMesh groupeMaNames', groupeMaNames - print 'CS_pbruno createOrUpdateMesh groupeNoNames', groupeNoNames - self.__updateSubShapes( editor, groupeMaNames + groupeNoNames ) - - # recupération des identifiants( entries ) associés aux noms des groupes - groupeMaEntries = [] - groupeNoEntries = [] - - for entry, name in self.subShapes.items(): - if name in groupeMaNames: - groupeMaEntries.append( entry ) - if name in groupeNoNames: - groupeNoEntries.append( entry ) - - if groupeMaEntries or groupeNoEntries: - diag = meshGui.MeshUpdateDialogImpl( - self.mainShapeEntries[editor], - groupeMaEntries, - groupeNoEntries, - studyManager.palStudy, - self.parent ) - diag.show() - - self.subShapes.clear() - self.mainShapeNames.clear() - self.mainShapeEntries.clear() - except: - logger.debug(50*'=') - - - def displayMeshGroups(self, meshGroupName): - """ - visualisation group de maille de nom meshGroupName dans salome - """ - ok, msgError = False, '' - try: - sg = salome.ImportComponentGUI('SMESH') - currentjdcID = self.editor.nb.getcurselection() - meshGroupEntries = [] - selMeshEntry = None - selMeshGroupEntry = None - - # liste des groupes de maille de nom meshGroupName - listSO = studyManager.palStudy._myStudy.FindObjectByName(meshGroupName, "SMESH") - print "liste des groupes de maille de nom %s: "%(meshGroupName), listSO - - if len(listSO)>0: - for SObjet in listSO: - groupEntry = SObjet.GetID() - meshGroupEntries += [groupEntry] - - if len(meshGroupEntries)>1: - - # choix d'un maillage - if not self.workingMesh.has_key(currentjdcID): # aucun maillage de défini par défaut encore - #selMeshEntry = "0:1:3:5" #CS_pbruno todo : choix maillage + test si c un maillage - selMeshEntry, keep = self.__selectWorkingMesh(meshGroupEntries) - if keep: - self.workingMesh[currentjdcID] = selMeshEntry - else: # déja un de défini par défaut - selMeshEntry = self.workingMesh[currentjdcID] - - # le groupe de maille est il ds ce maillage? - lselMeshEntry = len(selMeshEntry) - for groupEntry in meshGroupEntries: - if selMeshEntry == groupEntry[0:lselMeshEntry]: - selMeshGroupEntry = groupEntry - break - - else: - selMeshGroupEntry = meshGroupEntries[0] - - # on affiche le groupe ds la vue VTK - if selMeshGroupEntry: - #CS_pbruno: marche QUE si le module SMESH est activé - myComponent = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") - SCom = studyManager.palStudy._myStudy.FindComponent("SMESH") - studyManager.palStudy._myBuilder.LoadWith( SCom , myComponent ) - sg.CreateAndDisplayActor(selMeshGroupEntry) - salome.sg.Display(selMeshGroupEntry) - salome.sg.FitAll() - ok = True - except: - msgError = msgErrorDisplayMeshGroup - logger.debug(50*'=') - return ok, msgError - - + + #--------------------------------------- def displayShape( self, shapeName ): + #--------------------------------------- """ - visualisation géométrie de nom shapeName dans salome + visualisation de nom shapeName dans salome """ ok, msgError = False, '' - try: - import VISU - import visu_gui - currentViewType = None - m = visu_gui.myVisu.GetViewManager() - v = m.GetCurrentView() - if v: - currentViewType = v.GetType() - - atLeastOneStudy = self.__studySync() - if not atLeastOneStudy: - return ok, msgError + #try: + if 1 : + import SalomePyQt + sgPyQt = SalomePyQt.SalomePyQt() + myActiveView=sgPyQt.getActiveView() + if myActiveView < 0 : + return ok, 'pas de vue courante' - #salome.sg.EraseAll() - print 'displayShapestrGeomShape shapeName -> ', shapeName - - if currentViewType == VISU.TVIEW3D: # maillage - print 'Vue courante = VTK : affichage groupe de maille' + currentViewType=sgPyQt.getViewType(myActiveView) + if str(currentViewType) != "OCCViewer" : # maillage ok, msgError = self.displayMeshGroups(shapeName) else: #geometrie - print 'Vue courante = OCC : affichage element geometrique' - #self.__createOCCView() current_color = COLORS[ self.icolor % LEN_COLORS ] - ok = studyManager.palStudy.displayShapeByName( shapeName, current_color ) + from salome.geom.geomtools import GeomStudyTools + myGeomTools=GeomStudyTools(self.editor) + ok = myGeomTools.displayShapeByName( shapeName, current_color ) salome.sg.FitAll() self.icolor = self.icolor + 1 if not ok: - msgError = msgErrorDisplayShape - except: + msgError = "Impossible d afficher "+shapeName + #except: + else : logger.debug(50*'=') return ok, msgError - - - def creeConfigTxt(self,fichier,dico): - """ - sauvegarde = asksaveasfilename(title="fichier config.txt", - defaultextension='.txt', - initialdir = fichier) - f=open(sauvegarde,'w+') - for unite in dico.keys(): - type=dico[unite][0] - fic=dico[unite][1:] - ligne="fort."+str(unite)+" "+type+" "+fic - f.write(ligne) - f.close() - self.rangeInStudy(sauvegarde) - print "===============================" - """ - pass #CS_pbruno à implémenter - + + #--------------------------------------- + def ChercheGrpMeshInSalome(self): + print "je passe par la" + import SMESH + names, msg = [], '' + try : + entries = salome.sg.getAllSelected() + nbEntries = len( entries ) + names, msg = None, "Selection SALOME non autorisee." + if nbEntries == 1: + for entry in entries: + print entry + names,msg=self.giveMeshGroups(entry,"SubMeshes",SMESH.SMESH_subMesh) + print names + except : + print "bim bam boum" + return(msg,names) + + #--------------------------------------- + def ChercheGrpMailleInSalome(self): + import SMESH + names, msg = [], '' + #try : + if 1: + entries = salome.sg.getAllSelected() + nbEntries = len( entries ) + names, msg = None, "Selection SALOME non autorisee." + if nbEntries == 1: + for entry in entries: + print entry + names,msg=self.giveMeshGroups(entry,"Groups of",SMESH.SMESH_GroupBase) + print names + #except : + else: + print "bim bam boum" + return(msg,names) + + + #--------------------------------------- - def buildCabriGeom( self, name, **param ): +# def buildCabriGeom( self, name, **param ): """ - visualisation dans GEOM d'une géométrie CABRI + visualisation dans GEOM d'une geometrie CABRI """ - import cabri - qt.QApplication.setOverrideCursor( qt.QCursor.waitCursor ) - cabri.tetra( name, **param ) - qt.QApplication.restoreOverrideCursor() +# import cabri +# qt.QApplication.setOverrideCursor( qt.QCursor.waitCursor ) +# cabri.tetra( name, **param ) +# qt.QApplication.restoreOverrideCursor() @@ -812,62 +587,50 @@ class MyEficas( qtEficas.Appli ): def envoievisu(self,liste_commandes): - import traceback try: - atLeastOneStudy = self.__studySync() + from salome.geom.structelem import StructuralElementManager, InvalidParameterError + except ImportError: + QMessageBox.critical(self, self.tr("Error"), + self.tr("Cannot display structural elements: " + "module GEOM is not installed.")) + return + try: + atLeastOneStudy = self.editor.study if not atLeastOneStudy: return - logger.debug(10*'#'+":envoievisu: creating a visuDriver instance") - monDriver=visuDriver.visuDriver(studyManager.palStudy,liste_commandes) - - logger.debug(10*'#'+":envoievisu: analyse visu commandes using the visuDriver "+str(monDriver)) - monId = monDriver.analyse() - logger.debug(10*'#'+":envoievisu: display the structural elements using PALGUI") - PALGUI_API.displaySE(monId) + logger.debug(10*'#'+":envoievisu: creating a StructuralElementManager instance") + structElemManager = StructuralElementManager() + elem = structElemManager.createElement(liste_commandes) + elem.display() + salome.sg.updateObjBrowser(True) + except InvalidParameterError, err: + trStr = self.tr("Invalid parameter for group %(group)s: %(expr)s must be " + "greater than %(minval)g (actual value is %(value)g)") + msg = str(trStr) % {"group": err.groupName, "expr": err.expression, + "minval": err.minValue, "value": err.value} + QMessageBox.warning(self, self.tr("Error"), msg) except: traceback.print_exc() logger.debug(10*'#'+":pb dans envoievisu") - #------------------------------------------------------------------------------------------------------- # Point d'entree lancement EFICAS # -def runEficas( code="ASTER", fichier=None, module = studyManager.SEficas, version=None ): +def runEficas( code=None, fichier=None, module = "EFICAS", version=None, componentName = "Eficas",multi=False): logger.debug(10*'#'+":runEficas: START") - global appli + #global appli logger.debug(10*'#'+":runEficas: code="+str(code)) logger.debug(10*'#'+":runEficas: fichier="+str(fichier)) logger.debug(10*'#'+":runEficas: module="+str(module)) logger.debug(10*'#'+":runEficas: version="+str(version)) - if not appli: #une seul instance possible! - appli = MyEficas( SalomePyQt.SalomePyQt().getDesktop(), code = code, fichier = fichier, module = module, version=version ) + #if not appli: #une seul instance possible! + appli = MyEficas( SalomePyQt.SalomePyQt().getDesktop(), code = code, fichier = fichier, + module = module, version = version, componentName = componentName,multi=multi ) + #if not appli: #une seul instance possible! + # appli = MyEficas( SalomePyQt.SalomePyQt().getDesktop(), code = code, fichier = fichier, + # module = module, componentName = componentName, version=version ) logger.debug(10*'#'+":runEficas: END") - - -# pour compatibilitee -def runHomard( code="HOMARD", fichier=None ): - global appli - if not appli: #une seul instance possible! - appli = MyEficas( SalomePyQt.SalomePyQt().getDesktop(), code = code, fichier = fichier ) - - - - -""" -def runAster(parent = SalomePyQt.SalomePyQt().getDesktop(), palStudyManager = studyManager.palStudy, code="ASTER", fichier=None ) : - global appli - if not appli: #une seul instance possible! - appli = MyEficas( parent, palStudyManager, code = code, fichier = fichier ) -""" - -appli = None - - - - - - diff --git a/src/STUDY/EficasStudy.py b/src/STUDY/EficasStudy.py index eedfcbee..5570f798 100644 --- a/src/STUDY/EficasStudy.py +++ b/src/STUDY/EficasStudy.py @@ -12,7 +12,7 @@ try : except : pass -from Logger import Logger +from salome.kernel.logger import Logger logger=Logger( "EficasStudy" ) diff --git a/src/TestsEltsVisu/Barres/barrerectanglecreuse.comm b/src/TestsEltsVisu/Barres/barrerectanglecreuse.comm index a2f3c44d..1579cb51 100644 --- a/src/TestsEltsVisu/Barres/barrerectanglecreuse.comm +++ b/src/TestsEltsVisu/Barres/barrerectanglecreuse.comm @@ -1,5 +1,4 @@ - DEBUT(); maillage=LIRE_MAILLAGE(); @@ -15,6 +14,6 @@ Affe=AFFE_CARA_ELEM(MODELE=modele, BARRE=_F(GROUP_MA='element1D', SECTION='RECTANGLE', CARA=('HZ','HY','EPY','EPZ',), - VALE=(3.0,4.0,1.0,2.0,),),); + VALE=(3.0,4.0,1.0,0.5,),),); FIN(); diff --git a/src/TestsEltsVisu/Coques/coqueexcangle.comm b/src/TestsEltsVisu/Coques/coqueexcangle.comm index c5a0f5da..467ece42 100644 --- a/src/TestsEltsVisu/Coques/coqueexcangle.comm +++ b/src/TestsEltsVisu/Coques/coqueexcangle.comm @@ -1,5 +1,4 @@ - DEBUT(); maillage=LIRE_MAILLAGE(); @@ -13,9 +12,9 @@ P1 = 3; Affe=AFFE_CARA_ELEM(MODELE=modele, COQUE=_F(GROUP_MA='element2D', - EPAIS=3.0, - ANGL_REP=(0.0,90.0,), - EXCENTREMENT=-0.3, + EPAIS=10, + ANGL_REP=(0.,90.0,), + EXCENTREMENT=30, INER_ROTA='OUI',),); FIN(); diff --git a/src/TestsEltsVisu/Poutres/pcarreconstcreuse.comm b/src/TestsEltsVisu/Poutres/pcarreconstcreuse.comm index 3c231407..31fa7f63 100644 --- a/src/TestsEltsVisu/Poutres/pcarreconstcreuse.comm +++ b/src/TestsEltsVisu/Poutres/pcarreconstcreuse.comm @@ -1,5 +1,4 @@ - DEBUT(); maillage=LIRE_MAILLAGE(); @@ -15,6 +14,6 @@ Affe=AFFE_CARA_ELEM(MODELE=modele, POUTRE=_F(GROUP_MA='element1D', SECTION='RECTANGLE', CARA=('H','EP',), - VALE=(3.0,2.0,),),); + VALE=(3.0,1,),),); FIN(); diff --git a/src/TestsEltsVisu/Poutres/pcarrehomocreuse.comm b/src/TestsEltsVisu/Poutres/pcarrehomocreuse.comm index 5ea84cd3..3e388870 100644 --- a/src/TestsEltsVisu/Poutres/pcarrehomocreuse.comm +++ b/src/TestsEltsVisu/Poutres/pcarrehomocreuse.comm @@ -1,5 +1,4 @@ - DEBUT(); maillage=LIRE_MAILLAGE(); @@ -16,6 +15,6 @@ Affe=AFFE_CARA_ELEM(MODELE=modele, SECTION='RECTANGLE', VARI_SECT='HOMOTHETIQUE', CARA=('HY1','EPY1','HZ1','EPZ1','HZ2','EPZ2','HY2','EPY2',), - VALE=(0.1,0.05,0.1,0.05,0.1,0.05,0.1,0.05,),),); + VALE=(0.1,0.04,0.1,0.04,0.1,0.04,3,1,),),); FIN(); diff --git a/src/TestsEltsVisu/Poutres/pcarrehomopleine.comm b/src/TestsEltsVisu/Poutres/pcarrehomopleine.comm index 08c9ced2..6be46ea3 100644 --- a/src/TestsEltsVisu/Poutres/pcarrehomopleine.comm +++ b/src/TestsEltsVisu/Poutres/pcarrehomopleine.comm @@ -1,5 +1,4 @@ - DEBUT(); maillage=LIRE_MAILLAGE(); @@ -15,7 +14,7 @@ Affe=AFFE_CARA_ELEM(MODELE=modele, POUTRE=_F(GROUP_MA='element1D', SECTION='RECTANGLE', VARI_SECT='HOMOTHETIQUE', - CARA=('HY1','HZ1','HZ2','EPZ2','HY2','EPY2',), - VALE=(0.1,0.1,0.1,0.,0.1,0.,),),); + CARA=('HY1','HZ1','HZ2','HY2',), + VALE=(2,3,0.2,0.3,),),); FIN(); diff --git a/src/TestsEltsVisu/Poutres/pcercleconstcreuse.comm b/src/TestsEltsVisu/Poutres/pcercleconstcreuse.comm index f157d315..6ee0510a 100644 --- a/src/TestsEltsVisu/Poutres/pcercleconstcreuse.comm +++ b/src/TestsEltsVisu/Poutres/pcercleconstcreuse.comm @@ -1,5 +1,4 @@ - DEBUT(); maillage=LIRE_MAILLAGE(); @@ -15,6 +14,6 @@ Affe=AFFE_CARA_ELEM(MODELE=modele, POUTRE=_F(GROUP_MA='element1D', SECTION='CERCLE', CARA=('R','EP',), - VALE=(2.0,1.0,),),); + VALE=(2.0,0.5,),),); FIN(); diff --git a/src/TestsEltsVisu/Poutres/pcerclehomocreuse.comm b/src/TestsEltsVisu/Poutres/pcerclehomocreuse.comm index 7a2f98f0..74ac5279 100644 --- a/src/TestsEltsVisu/Poutres/pcerclehomocreuse.comm +++ b/src/TestsEltsVisu/Poutres/pcerclehomocreuse.comm @@ -1,5 +1,4 @@ - DEBUT(); maillage=LIRE_MAILLAGE(); @@ -16,6 +15,6 @@ Affe=AFFE_CARA_ELEM(MODELE=modele, SECTION='CERCLE', VARI_SECT='HOMOTHETIQUE', CARA=('R1','R2','EP1','EP2',), - VALE=(3.0,5.0,2.0,3.0,),),); + VALE=(3.0,15.0,1,0.1,),),); FIN(); diff --git a/src/TestsEltsVisu/Poutres/prectaffcreuse.comm b/src/TestsEltsVisu/Poutres/prectaffcreuse.comm index 7b01a3ab..cf3c250b 100644 --- a/src/TestsEltsVisu/Poutres/prectaffcreuse.comm +++ b/src/TestsEltsVisu/Poutres/prectaffcreuse.comm @@ -1,5 +1,4 @@ - DEBUT(); maillage=LIRE_MAILLAGE(); @@ -16,6 +15,6 @@ Affe=AFFE_CARA_ELEM(MODELE=modele, SECTION='RECTANGLE', VARI_SECT='AFFINE', CARA=('HY','HZ1','HZ2','EPY','EPZ1','EPZ2',), - VALE=(0.1,0.1,0.2,0.05,0.05,0.07,),),); + VALE=(1,2,4,0.4,0.8,1.8,),),); FIN(); diff --git a/src/TestsEltsVisu/Poutres/prectconstcreuse.comm b/src/TestsEltsVisu/Poutres/prectconstcreuse.comm index 774af13b..d6df1f19 100644 --- a/src/TestsEltsVisu/Poutres/prectconstcreuse.comm +++ b/src/TestsEltsVisu/Poutres/prectconstcreuse.comm @@ -1,5 +1,4 @@ - DEBUT(); maillage=LIRE_MAILLAGE(); @@ -15,6 +14,6 @@ Affe=AFFE_CARA_ELEM(MODELE=modele, POUTRE=_F(GROUP_MA='element1D', SECTION='RECTANGLE', CARA=('HY','HZ','EPY','EPZ',), - VALE=(3.0,4.0,2.0,2.0,),),); + VALE=(3.0,4.0,1,1,),),); FIN(); diff --git a/src/TestsEltsVisu/Poutres/precthomopleine.comm b/src/TestsEltsVisu/Poutres/precthomopleine.comm index 57a890e2..7a27b76b 100644 --- a/src/TestsEltsVisu/Poutres/precthomopleine.comm +++ b/src/TestsEltsVisu/Poutres/precthomopleine.comm @@ -1,5 +1,4 @@ - DEBUT(); maillage=LIRE_MAILLAGE(); @@ -16,6 +15,6 @@ Affe=AFFE_CARA_ELEM(MODELE=modele, SECTION='RECTANGLE', VARI_SECT='HOMOTHETIQUE', CARA=('HY1','HZ1','HZ2','HY2',), - VALE=(0.1,0.2,0.1,0.2,),),); + VALE=(0.1,0.2,1,2,),),); FIN();