Salome HOME
Merge from V7_3_BR branch 18/12/2013
authorvsr <vsr@opencascade.com>
Wed, 18 Dec 2013 16:18:55 +0000 (16:18 +0000)
committervsr <vsr@opencascade.com>
Wed, 18 Dec 2013 16:18:55 +0000 (16:18 +0000)
15 files changed:
CMakeLists.txt
HEXABLOCK_version.h.in
bin/runAppli.in
doc/_static/gui_addshape.png [new file with mode: 0644]
doc/conf.py.in
doc/gui_add_geometry.rst [new file with mode: 0644]
doc/interactive.rst
doc/python.rst
doc/tui_add_geometry.rst [new file with mode: 0644]
src/HEXABLOCK/CMakeLists.txt
src/HEXABLOCKGUI/HEXABLOCKGUI.cxx
src/HEXABLOCKGUI/MyDlgRef/CMakeLists.txt
src/HEXABLOCKGUI/MyDlgRef/MyDlgRef.hxx
src/HEXABLOCKGUI/resources/SalomeApp.xml.in
src/TEST_PY/cas_2013/cas_2013.py [new file with mode: 0755]

index 966facdd0223d64e023adbbd340c266dc4e73b78..b3e2c68f2ad5c666168a93257bacde2b16d04e6c 100755 (executable)
@@ -28,7 +28,7 @@ CMAKE_POLICY(SET CMP0003 NEW)
 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
 
 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7)
-SET(${PROJECT_NAME_UC}_MINOR_VERSION 2)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 3)
 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
 SET(${PROJECT_NAME_UC}_VERSION
   ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
index b2dc846e854b4f71ef12c0f0db249423d98840e7..d448bd61784f18517e84d1a2d16be3d3aa299da7 100755 (executable)
   HEXABLOCK_VERSION is (major << 16) + (minor << 8) + patch.
 */
 
-#define HEXABLOCK_VERSION_STR "@VERSION@"
-#define HEXABLOCK_VERSION     @XVERSION@
-#define HEXABLOCK_DEVELOPMENT @VERSION_DEV@
+
+/*!
+  Specify version of SALOME HEXABLOCK module, as follows
+
+HEXABLOCK_VERSION_MAJOR       : (integer) number identifying major version
+HEXABLOCK_VERSION_MINOR       : (integer) number identifying minor version
+HEXABLOCK_VERSION_MAINTENANCE : (integer) number identifying maintenance version
+HEXABLOCK_VERSION_STR         : (string)  complete version number "major.minor.maintenance"
+HEXABLOCK_VERSION             : (hex)     complete version number (major << 16) + (minor << 8) + maintenance
+HEXABLOCK_DEVELOPMENT         : (integer) indicates development version when set to 1
+ */
+
+#define HEXABLOCK_VERSION_MAJOR       @SALOMEHEXABLOCK_MAJOR_VERSION@
+#define HEXABLOCK_VERSION_MINOR       @SALOMEHEXABLOCK_MINOR_VERSION@
+#define HEXABLOCK_VERSION_MAINTENANCE @SALOMEHEXABLOCK_PATCH_VERSION@
+#define HEXABLOCK_VERSION_STR         "@SALOMEHEXABLOCK_VERSION@"
+#define HEXABLOCK_VERSION             @SALOMEHEXABLOCK_XVERSION@
+#define HEXABLOCK_DEVELOPMENT         @SALOMEHEXABLOCK_VERSION_DEV@
 
 #endif // __HEXABLOCK_VERSION_H__
index 08cfde0a6ad2e078bc7ed4a650a098518311244b..559d02198870affb308b903c635a1b8b06ceb523 100755 (executable)
@@ -21,8 +21,8 @@
 if [ -z "${KERNEL_ROOT_DIR}" ] ; then 
 export KERNEL_ROOT_DIR=@KERNEL_ROOT_DIR@
 fi
-if [ -z "${HEXA_ROOT_DIR}" ] ; then 
-export HEXA_ROOT_DIR=@prefix@
+if [ -z "${HEXABLOCK_ROOT_DIR}" ] ; then 
+export HEXABLOCK_ROOT_DIR=@CMAKE_INSTALL_PREFIX@
 fi
 
 searchFreePort() {
diff --git a/doc/_static/gui_addshape.png b/doc/_static/gui_addshape.png
new file mode 100644 (file)
index 0000000..a093009
Binary files /dev/null and b/doc/_static/gui_addshape.png differ
index ef8a962abaaf254e801c52ea233f0a81ce1e81b7..c5f403fb9a319e2372b7b1c1749d3d18ce58e28e 100644 (file)
@@ -77,6 +77,11 @@ release = '@SALOMEHEXABLOCK_VERSION@'
 # for source files.
 exclude_trees = []
 
+# A list of glob-style patterns that should be excluded when looking for source
+# files. They are matched against the source file names relative to the
+# source directory, using slashes as directory separators on all platforms.
+exclude_patterns = ['**/CVS']
+
 # The reST default role (used for this markup: `text`) to use for all documents.
 #default_role = None
 
diff --git a/doc/gui_add_geometry.rst b/doc/gui_add_geometry.rst
new file mode 100644 (file)
index 0000000..9b0343a
--- /dev/null
@@ -0,0 +1,29 @@
+:tocdepth: 3
+
+.. _guiaddgeometry:
+
+============================
+Add a geometry to a document
+============================
+
+Only geometries added to a document can be used by that document.
+Vertices, Edges and Quadrangles of the model of blocks of a document can only be associated to those of a geometry that 
+has already been added to that document.
+
+To add a geometry to a document:
+
+- *1-* Import the geometry (.brep, .step, ...) in the GEOM Module
+- *2-* Activate HexaBlock
+- *3-* Open your document or create a new one 
+- *4-* In the **Main Menu** select **Association -> Add geometry** 
+- *5-* Select the imported geometry and click the **Apply** button of the **Add geometry** Dialog Box
+ .. image:: _static/gui_addshape.png
+   :align: center
+
+.. centered::
+   Adding geometry to a document
+    
+    
+TUI command: :ref:`tuiaddgeometry`
\ No newline at end of file
index 2b507e59163949c05d82b5092f63eaca8fb66f16..2bf64fa1453472bfc0cd4b29dc4d74c6c84656ce 100644 (file)
@@ -65,6 +65,7 @@ It provides the toolset allowing to:
    gui_modify_elmts.rst
    gui_modify_symmetry.rst
    gui_association.rst
+   gui_add_geometry.rst
    gui_asso_quad_to_geom.rst
    gui_asso_vertex_to_geom.rst
    gui_groups.rst
index dbc72ed00112ca368d29f5fdf6cf294e24870810..762cf5bd8af61dc91ef6b6a98bc60883d3a06bf1 100644 (file)
@@ -32,6 +32,7 @@ By the links below you can find sample scripts for all operations provided by He
    tui_modify_elmts.rst
    tui_quad_revolution.rst
    tui_association.rst
+   tui_add_geometry.rst
    tui_asso_quad_to_geom.rst
    tui_asso_vertex_to_geom.rst
    tui_groups.rst
diff --git a/doc/tui_add_geometry.rst b/doc/tui_add_geometry.rst
new file mode 100644 (file)
index 0000000..6e7ba0e
--- /dev/null
@@ -0,0 +1,22 @@
+:tocdepth: 3
+
+
+.. _tuiaddgeometry:
+
+============================
+Add a geometry to a document
+============================
+
+To add a geometry to a document in python mode, you need the following arguments:
+
+- *doc*        : the document
+- *geom*       : the geometry
+- *shape_name* : the name of the geometry
+
+Use the function **addShape**::
+
+    doc   = hexablock.addDocument (doc_name)
+    geom  = geompy.ImportBREP  (shape_name + ".brep")
+    shape = hexablock.addShape (doc, geom , shape_name)
+       
+GUI command: :ref:`guiaddgeometry`
index 602cd3d4642f75fae5f372bc838fb3d4d320c161..88fd8f74e154e4075069daef84abe5981498458f 100644 (file)
@@ -69,6 +69,7 @@ SET(HEXABLOCKEngine_HEADERS
   HexHexa.hxx
   HexMatrix.hxx
   HexQuad.hxx
+  HexQpattern.hxx
   HexVertex.hxx
   HexLaw.hxx
   HexCloner.hxx
@@ -105,6 +106,7 @@ SET(HEXABLOCKEngine_SOURCES
   HexVertex.cxx
   HexEdge.cxx
   HexQuad.cxx
+  HexQpattern.cxx
   HexHexa.cxx
   HexHexa_disco.cxx
   HexVector.cxx
index c243f38da4d8be8175ff789c5b8ac9717e08e301..63ebc656a7c23085cc726e82e882974f7cae8e9b 100755 (executable)
@@ -941,6 +941,7 @@ void HEXABLOCKGUI::createAndFillDockWidget()
     _dwInputPanel = new QDockWidget(aParent);
     _dwInputPanel->setVisible(false);
     _dwInputPanel->setWindowTitle("Input Panel");
+    _dwInputPanel->setObjectName("InputPanelDockWidget");
 //    _dwInputPanel->setMinimumWidth(DWINPUT_MINIMUM_WIDTH); // --- force a minimum until display
 
 //    _treeViewDelegate = new DocumentDelegate(_dwInputPanel);
@@ -951,6 +952,7 @@ void HEXABLOCKGUI::createAndFillDockWidget()
     _dwPattern->setVisible(false);
     _dwPattern->setWindowTitle("Model");
     _dwPattern->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display
+    _dwPattern->setObjectName("ModelDockWidget");
 
     QFrame*      patternFrame  = new QFrame(_dwPattern);
     patternFrame->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
@@ -985,6 +987,7 @@ void HEXABLOCKGUI::createAndFillDockWidget()
     _dwGroups->setVisible(false);
     _dwGroups->setWindowTitle("Groups");
     _dwGroups->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display
+    _dwGroups->setObjectName("GroupsDockWidget");
     _groupsTreeView = new QTreeView(_dwGroups);
     _groupsTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
 //    _groupsTreeView->setItemDelegate(_treeViewDelegate);
@@ -996,6 +999,7 @@ void HEXABLOCKGUI::createAndFillDockWidget()
     _dwMesh->setVisible(false);
     _dwMesh->setWindowTitle("Mesh");
     _dwMesh->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display
+    _dwMesh->setObjectName("MeshDockWidget");
     _meshTreeView = new QTreeView(_dwMesh);
     _meshTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
     _meshTreeView->setSelectionMode(QAbstractItemView::SingleSelection);
index d3fa1289a055217c85196a8da6e567e2babea75b..37083852c89be79ff1cc650d8d4f675e9bc21ac1 100644 (file)
@@ -51,58 +51,11 @@ SET(_other_SOURCES
 
 # uic files / to be processed by pyuic
 SET(_pyuic_files
-  DlgRef_1List1Spin1Btn_QTD.ui
-  DlgRef_1Sel1Check1List_QTD.ui
-  DlgRef_1Sel1Check1Sel_QTD.ui
-  DlgRef_1Sel1Check_QTD.ui
-  DlgRef_1Sel1List1Check3Btn_QTD.ui
-  DlgRef_1Sel1Spin1Check_QTD.ui
-  DlgRef_1Sel1Spin_QTD.ui
-  DlgRef_1Sel2Spin1View1Check_QTD.ui
   DlgRef_1Sel2Spin_QTD.ui
-  DlgRef_1Sel3Check_QTD.ui
   DlgRef_1Sel3Spin_QTD.ui
-  DlgRef_1Sel3Spin1Check_QTD.ui
-  DlgRef_1Sel4Spin2Check_QTD.ui
-  DlgRef_1Sel4Spin_QTD.ui
-  DlgRef_1Sel5Spin1Check_QTD.ui
-  DlgRef_1Sel5Spin_QTD.ui
-  DlgRef_1Sel_QTD.ui
-  DlgRef_1SelExt_QTD.ui
-  DlgRef_1Spin_QTD.ui
-  DlgRef_2Sel1List1Check_QTD.ui
-  DlgRef_2Sel1List2Check_QTD.ui
-  DlgRef_2Sel1List_QTD.ui
-  DlgRef_2Sel1Spin2Check_QTD.ui
   DlgRef_2Sel1Spin_QTD.ui
-  DlgRef_2Sel1SpinInt_QTD.ui
-  DlgRef_2Sel2List_QTD.ui
-  DlgRef_2Sel2Spin1Check_QTD.ui
-  DlgRef_2Sel2Spin3Check_QTD.ui
-  DlgRef_2Sel2Spin_QTD.ui
-  DlgRef_2Sel3Spin2Rb_QTD.ui
-  DlgRef_2Sel3Spin_QTD.ui
-  DlgRef_2Sel4Spin1Check_QTD.ui
   DlgRef_2Sel_QTD.ui
-  DlgRef_2SelExt_QTD.ui
-  DlgRef_2Spin_QTD.ui
-  DlgRef_3Check_QTD.ui
-  DlgRef_3Radio_QTD.ui
-  DlgRef_3Radio1Sel1Spin_QTD.ui
-  DlgRef_3Sel1Check_QTD.ui
-  DlgRef_3Sel1Spin_QTD.ui
-  DlgRef_3Sel2Spin_QTD.ui
-  DlgRef_3Sel3Spin1Check_QTD.ui
-  DlgRef_3Sel3Spin2Check_QTD.ui
-  DlgRef_3Sel4Spin2Check_QTD.ui
-  DlgRef_3Sel_QTD.ui
-  DlgRef_3Spin1Check_QTD.ui
   DlgRef_3Spin_QTD.ui
-  DlgRef_4Sel1List1Check_QTD.ui
-  DlgRef_4Sel1List_QTD.ui
-  DlgRef_4Sel1Spin2Check_QTD.ui
-  DlgRef_4Sel1Spin3Check_QTD.ui
-  DlgRef_6Sel_QTD.ui
   DlgRef_Skeleton_QTD.ui
 )
 
index 2b28da74770a5be8dd13142178038e8e59d9ea38..44977499348cbdf28d15a7052b3244671c7f62b4 100644 (file)
@@ -22,7 +22,7 @@
 #define MYGEOM_MYDLGREF_HXX
 
 #if defined WIN32
-#  if defined MYDLGREF_EXPORTS || defined MYDlgRef_EXPORTS
+#  if defined MYDLGREF_EXPORTS || defined MyDlgRef_EXPORTS
 #    define MYDLGREF_EXPORT __declspec( dllexport )
 #  else
 #    define MYDLGREF_EXPORT __declspec( dllimport )
index a003c8e690404ed180bc4a36bf3e85a22b54c2b4..16ab98d943d36ed73bcc2980770df59e1a397081 100755 (executable)
     <!-- Major module parameters -->
     <parameter name="name"          value="HexaBlock"/>
     <parameter name="icon"          value="ModuleHexablock.png"/>
-    <parameter name="version"       value="@VERSION@"/>        
+    <parameter name="version"       value="@SALOMEHEXABLOCK_VERSION@"/>        
     <parameter name="documentation" value="hexablock_help"/>
   </section>
   <section name="hexablock_help" >
     <parameter name="sub_menu"          value="%1 module"/>
-    <parameter name="User's Guide"      value="${HEXABLOCK_ROOT_DIR}/share/doc/salome/gui/HEXABLOCK/index.html"/>
+    <parameter name="User's Guide"      value="%HEXABLOCK_ROOT_DIR%/share/doc/salome/gui/HEXABLOCK/index.html"/>
   </section>
   <section name="resources">
     <!-- Module resources -->
-    <parameter name="HEXABLOCK" value="${HEXABLOCK_ROOT_DIR}/share/salome/resources/hexablock"/>
+    <parameter name="HEXABLOCK" value="%HEXABLOCK_ROOT_DIR%/share/salome/resources/hexablock"/>
   </section>
 </document>
diff --git a/src/TEST_PY/cas_2013/cas_2013.py b/src/TEST_PY/cas_2013/cas_2013.py
new file mode 100755 (executable)
index 0000000..55d61fa
--- /dev/null
@@ -0,0 +1,167 @@
+# !/bin/python
+# -*- coding: latin-1 -*-
+# Hexa : Creation d'hexaedres 
+
+import hexablock
+import os
+
+#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
+
+doc  = hexablock.addDocument ("default")
+vx   = doc.addVector (1,0,0)
+vy   = doc.addVector (0,1,0)
+vz   = doc.addVector (0,0,1)
+
+vxy  = doc.addVector (1,1,0)
+
+nbr_files = 0
+
+
+# ======================================================= save_vtk
+def save_vtk () :
+
+    global nbr_files
+    nom = "lecas%d.vtk" % nbr_files
+    nbr_files += 1
+    doc.saveVtk (nom)
+
+# ======================================================= carre
+def carre (x) :
+    return x*x
+
+# ======================================================= get_center
+def get_center (quad) :
+    px = 0
+    py = 0
+    pz = 0
+    for nv in range (4) :
+        vertex = quad.getVertex (nv) 
+        px += vertex.getX() / 4
+        py += vertex.getY() / 4
+        pz += vertex.getZ() / 4
+    return [ px, py, pz ]
+# ======================================================= nearest
+def nearest (grid, vertex) :
+    nbre = grid.countVertex()
+    dmin   = 1e+6
+    result = None
+    px = vertex.getX()
+    py = vertex.getY()
+    pz = vertex.getZ()
+    for nro in range (nbre) :
+        v1 = grid.getVertex (nro)
+        d2 = carre(px-v1.getX()) + carre(py-v1.getY()) + carre(pz-v1.getZ()) 
+        if (d2 < dmin) :
+           result = v1
+           dmin   = d2
+
+    print  vertex.getName () , px, py, pz, " -> ", result.getName()
+    return result
+
+# ======================================================= nearest_quad
+def nearest_quad (grid, quad) :
+    dmin   = 1e+16
+    result = None
+    [ox, oy, oz]   = get_center (quad)
+    nbre   = grid.countQuad ()
+    for nro in range (nbre) :
+        q1  = grid.getQuad (nro)
+        if q1 != None :
+           [px, py, pz] = get_center (q1)
+           d2 = carre(px-ox) + carre(py-oy) + carre(pz-oz) 
+           if (d2 < dmin) :
+              result = q1
+              dmin   = d2
+
+    print  quad.getName () , px, py, pz, " -> ", result.getName()
+    return result
+
+# ======================================================= insert_cylinder
+def insert_cylinder (plaque, nx, ny) :
+
+    hexa   = plaque.getHexaIJK (nx,   ny,   0)
+    xmin =  666  ;   ymin = xmin ;   zmin = xmin
+    xmax = -666  ;   ymax = xmax ;   zmax = xmax
+
+    tabv1 = []
+    for nv in range (8) :
+        node = hexa.getVertex (nv)
+        xmin = min (xmin, node.getX())   ;  xmax = max (xmax, node.getX())
+        ymin = min (ymin, node.getY())   ;  ymax = max (ymax, node.getY())
+        zmin = min (zmin, node.getZ())   ;  zmax = max (zmax, node.getZ())
+        tabv1.append (node)
+        
+    doc.removeHexa (hexa)
+    save_vtk ()
+
+    dx    = (xmax - xmin)/2
+    dz    = (zmax - zmin)/2
+    xorig = (xmin + xmax)/2 
+    yorig = (ymin + ymax)/2 
+    zorig = (zmin + zmax)/2 - dz
+
+    orig = doc.addVertex (xorig, yorig, zorig)
+    nr = 1
+    na = 4
+    nh = 1
+    rext  = dx
+    rint  = rext/2
+    haut  = 1
+    angle = 360
+    pipe  = doc.makePipeUni (orig, vxy,vz, rint,rext,angle,haut, nr,na,nh)
+
+    hexablock.what () 
+
+    tabquad  = []
+    tabv0 = []
+    for nq in range (4) :
+        quad = pipe.getQuadJK (1, nq, 0)
+        tabquad.append (quad)
+
+    print  " .. tabquad[0] = ", tabquad[0].getName ()
+    cible = nearest_quad (plaque, tabquad[0])
+    tabquad[0]. setColor (5)
+    cible . setColor (5)
+    save_vtk ()
+
+    va1   = tabquad[0].getVertex (0)
+    va2   = tabquad[0].getVertex (1)
+    vb1   = cible.nearestVertex  (va1)
+    vb2   = cible.nearestVertex  (va2)
+    doc.setLevel (1)
+    doc.joinQuadsUni (tabquad, cible, va1, vb1, va2, vb2, 1)
+    hexablock.what () 
+    save_vtk ()
+
+    return
+    doc.setLevel (1)
+    for nv in range (8) :
+        ier = doc.mergeVertices (tabv0[nv], tabv1[nv])
+        print "ier = ", ier
+        save_vtk ()
+
+
+# ======================================================= test_2013
+def test_2013 () :
+
+    orig = doc.addVertex (0,0,0)
+
+    lx  = 3
+    ly  = lx
+    lz  = 1
+    nx  = 3
+    ny  = nx
+    nz  = 1
+
+    plaque = doc.makeCartesianUni (orig, vx,vy,vz, lx, ly, lz, nx,ny,nz)
+    save_vtk ()
+
+    insert_cylinder (plaque, 1, 1)
+    return doc
+
+# ================================================================= Begin
+
+doc = test_2013  ()
+doc.addLaws (0.1, True)
+
+mesh_hexas = hexablock.mesh (doc)