Skip to content
Snippets Groups Projects
Select Git revision
  • 25d2d4841b587afa22cf2d301781a6c2ca0d87f6
  • master default
  • cgnsUnstructured
  • partitioning
  • poppler
  • HighOrderBLCurving
  • gmsh_3_0_4
  • gmsh_3_0_3
  • gmsh_3_0_2
  • gmsh_3_0_1
  • gmsh_3_0_0
  • gmsh_2_16_0
  • gmsh_2_15_0
  • gmsh_2_14_1
  • gmsh_2_14_0
  • gmsh_2_13_2
  • gmsh_2_13_1
  • gmsh_2_12_0
  • gmsh_2_11_0
  • gmsh_2_10_1
  • gmsh_2_10_0
  • gmsh_2_9_3
  • gmsh_2_9_2
  • gmsh_2_9_1
  • gmsh_2_9_0
  • gmsh_2_8_6
26 results

List.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    t9.py 2.79 KiB
    # ------------------------------------------------------------------------------
    #
    #  Gmsh Python tutorial 9
    #
    #  Plugins
    #
    # ------------------------------------------------------------------------------
    
    import gmsh
    import os
    import sys
    
    # Plugins can be added to Gmsh in order to extend its capabilities. For example,
    # post-processing plugins can modify views, or create new views based on
    # previously loaded views. Several default plugins are statically linked with
    # Gmsh, e.g. Isosurface, CutPlane, CutSphere, Skin, Transform or Smooth.
    #
    # Plugins can be controlled through the API functions with the `gmsh.plugin'
    # prefix, or from the graphical interface (right click on the view button, then
    # `Plugins').
    
    gmsh.initialize()
    gmsh.option.setNumber("General.Terminal", 1)
    
    # Let us for example include a three-dimensional scalar view:
    path = os.path.dirname(os.path.abspath(__file__))
    gmsh.merge(os.path.join(path, '..', 'view3.pos'))
    
    # We then set some options for the `Isosurface' plugin (which extracts an
    # isosurface from a 3D scalar view), and run it:
    gmsh.plugin.setNumber("Isosurface", "Value", 0.67)
    gmsh.plugin.setNumber("Isosurface", "View", 0)
    gmsh.plugin.run("Isosurface")
    
    # We also set some options for the `CutPlane' plugin (which computes a section
    # of a 3D view using the plane A*x+B*y+C*z+D=0), and then run it:
    gmsh.plugin.setNumber("CutPlane", "A", 0)
    gmsh.plugin.setNumber("CutPlane", "B", 0.2)
    gmsh.plugin.setNumber("CutPlane", "C", 1)
    gmsh.plugin.setNumber("CutPlane", "D", 0)
    gmsh.plugin.setNumber("CutPlane", "View", 0)
    gmsh.plugin.run("CutPlane")
    
    # Add a title (By convention, for window coordinates a value greater than 99999
    # represents the center. We could also use `General.GraphicsWidth / 2', but that
    # would only center the string for the current window size.):
    gmsh.plugin.setString("Annotate", "Text", "A nice title")
    gmsh.plugin.setNumber("Annotate", "X", 1.e5)
    gmsh.plugin.setNumber("Annotate", "Y", 50)
    gmsh.plugin.setString("Annotate", "Font", "Times-BoldItalic")
    gmsh.plugin.setNumber("Annotate", "FontSize", 28)
    gmsh.plugin.setString("Annotate", "Align", "Center")
    gmsh.plugin.setNumber("Annotate", "View", 0)
    gmsh.plugin.run("Annotate")
    
    gmsh.plugin.setString("Annotate", "Text", "(and a small subtitle)")
    gmsh.plugin.setNumber("Annotate", "Y", 70)
    gmsh.plugin.setString("Annotate", "Font", "Times-Roman")
    gmsh.plugin.setNumber("Annotate", "FontSize", 12)
    gmsh.plugin.run("Annotate")
    
    # We finish by setting some options:
    gmsh.option.setNumber("View[0].Light", 1)
    gmsh.option.setNumber("View[0].IntervalsType", 1)
    gmsh.option.setNumber("View[0].NbIso", 6)
    gmsh.option.setNumber("View[0].SmoothNormals", 1)
    gmsh.option.setNumber("View[1].IntervalsType", 2)
    gmsh.option.setNumber("View[2].IntervalsType", 2)
    
    # show the GUI at the end
    if '-nopopup' not in sys.argv:
        gmsh.fltk.run()
    
    gmsh.finalize()