pyCAPS
pyCAPS: A Python Extension Module for CAPS
Public Member Functions | Static Public Attributes | List of all members
capsViewer Class Reference

Defines a CAPS viewer object. More...

Public Member Functions

def __init__ (self, browserName=None, portNumber=7681, oneBias=True, html=None)
 Initialize the viewer object. More...
 
def startServer (self, enableCheck=True, unifyBoundingBox=True)
 Start the server. More...
 
def addVertex (self, xyz, name=None)
 Add a vertex set. More...
 
def addIndex (self, connectivity, name=None)
 Add a element connectivity set. More...
 
def addLineIndex (self, connectivity, name=None)
 Add a element connectivity set with the intention of creating graphical lines on triangular primitives. More...
 
def addPointIndex (self, connectivity, name=None)
 Add a point connectivity set with the intention of creating graphical points on line or triangular primitives. More...
 
def addColor (self, colorData, minColor=None, maxColor=None, numContour=0, reverseMap=False, colorMap="blues", name=None)
 Add color/scalar data set. More...
 
def addLineColor (self, colorData, minColor=None, maxColor=None, numContour=0, reverseMap=False, colorMap="blues", name=None)
 Add color/scalar data set for the graphical lines on triangular primitives. More...
 
def addPointColor (self, colorData, minColor=None, maxColor=None, numContour=0, reverseMap=False, colorMap="blues", name=None)
 Add color/scalar data set for the graphical points on line or triangular primitives. More...
 
def createPrimitive (self, type, items=None, name=None, lines=True)
 Create a generic graphic primitive. More...
 
def createPoint (self, items=None, name=None)
 Create a point graphic primitive. More...
 
def createLine (self, items=None, name=None, turnOn=True)
 Create a line graphic primitive. More...
 
def createTriangle (self, items=None, name=None, turnOn=True, lines=True)
 Create a triangular graphic primitive. More...
 
def clearItems (self)
 Clear the "current" list of "wvData items (objects)". More...
 
def addDataSet (self, dataSet)
 Add a _capsDataSet (see _capsDataSet) object(s). More...
 
def addBound (self, bound, dataSetType="both")
 Alias to addDataBound.
 
def addDataBound (self, bound, dataSetType="both")
 Add a _capsBound (see _capsBound) object(s). More...
 
def addTecplot (self, filename)
 Add a Tecplot file. More...
 
def addUnstructMesh (self, meshFile)
 Add a unstructured mesh file. More...
 
def addGeometry (self, geomFile, flags=0, dictFile=None)
 Add a geometry file. More...
 

Static Public Attributes

 colorMap
 Ryan: how do I set pSize = 6 ?!?!?
 
 numTess
 Display an array of EGADS bodies. More...
 

Detailed Description

Defines a CAPS viewer object.

A capsViewer object is a Pythonized version of Bob Haimes's "wv: A General Web-based 3D Viewer" API. wv's goal is "to generate a visual tool targeted for the 3D needs found within the MDAO process. A WebBrowser-based approach is considered, in that it provides the broadest possible platform for deployment."

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  browserName = None,
  portNumber = 7681,
  oneBias = True,
  html = None 
)

Initialize the viewer object.

See webviewer.py for an example use case.

Parameters
browserNameName of browser to load (default - None). If left as None the system level default browser will be used.
portNumberPort number to start the server listening on (default - 7681).
oneBiasFlag to indicate the index biasing of the data. Options: 1 bias (default - True) or 0 bias (False) indexed.
htmlSpecify an alternative HTML file to launch when starting the server, see startServer (default - None or env $CAPS_START)

Member Function Documentation

◆ addColor()

def addColor (   self,
  colorData,
  minColor = None,
  maxColor = None,
  numContour = 0,
  reverseMap = False,
  colorMap = "blues",
  name = None 
)

Add color/scalar data set.

See webviewer.py for an example use case.

Parameters
colorDataA list of color/scalar data to be applied at each node (e.g. [ node1_Color, node2_Color, node3_Color, etc.]). Cell-centered coloring isn't currently supported. Alternatively, a Hex string (e.g. '#ff0000' == the color red) may be used to set all nodes to a constant color.
minColorMinimum color value to use for scaling (default - None). If None, the minimum value is determined automatically from the colorData provided. When plotting multiple color/data sets a minimum value should be provided to ensure that all data is scaled the same.
maxColorMaximum color value to use for scaling (default - None). If None, the maximum value is determined automatically from the colorData provided. When plotting multiple color/data sets a maximum value should be provided to ensure that all data is scaled the same.
numContourNumber of contour levels to use in the color map (default - 0 for a continuous color map).
reverseMapReverse or invert the color map (default - False).
colorMapName of color map to use of visualization. Options: "blues" (default), "reds", "greys" (or "grays"), "blue_red" (or "bwr"), "jet", "rainbow", "hot", "cool".
nameName of color set (default - None).
Returns
Optionally returns a reference to the "wvData item (object)" in which the data is stored.

◆ addDataBound()

def addDataBound (   self,
  bound,
  dataSetType = "both" 
)

Add a _capsBound (see _capsBound) object(s).

Parameters
boundA single or list of instances of _capsBound objects.
dataSetTypeSpecifies which type of data sets in the bound should be added, source or destination. Options: "source", "destination, or "both" (default) - values are case insensitive.

◆ addDataSet()

def addDataSet (   self,
  dataSet 
)

Add a _capsDataSet (see _capsDataSet) object(s).

A graphic primitive will be created automatically for each data set. Note, however, if multiple data sets share the same vertex set (see _capsVertexSet) the data in the repeated vertex sets will be appended into a single primitive.

Parameters
dataSetA single or list of instances of _caspDataSet objects.

◆ addGeometry()

def addGeometry (   self,
  geomFile,
  flags = 0,
  dictFile = None 
)

Add a geometry file.

Files are loaded by extension: *.igs, *.iges, *.stp, *.step, *.brep (for native OpenCASCADE files), *.egads (for native files with persistent Attributes, splits ignored), or *.csm (ESP file)

Parameters
geomFileName of geometry file to load.
flagsOptions (default - None) : 1 - Don’t split closed and periodic entities 2 - Split to maintain at least C1 in BSPLINEs 4 - Don’t try maintaining Units on STEP read (always millimeters)
dictFileDictionary file name when loading *.csm files, if applicable (default - None)

◆ addIndex()

def addIndex (   self,
  connectivity,
  name = None 
)

Add a element connectivity set.

See webviewer.py for an example use case.

Parameters
connectivityA list of lists of connectivity information (e.g. [ [node1, node2, node3], [node2, node3, node7, node8], etc. ]). Elements that >3 edges will internally be decomposed into triangles. Note that whether or not the connectivity information is one biased was specified during capsViewer initialization (see capsViewer.__init__ ), no further checks are currently made.
nameName of connectivity set (default - None).
Returns
Optionally returns a reference to the "wvData item (object)" in which the data is stored.

◆ addLineColor()

def addLineColor (   self,
  colorData,
  minColor = None,
  maxColor = None,
  numContour = 0,
  reverseMap = False,
  colorMap = "blues",
  name = None 
)

Add color/scalar data set for the graphical lines on triangular primitives.

(addLineIndex ). See webviewer.py for an example use case.

Parameters
colorDataA list of color/scalar data to be applied at each node (e.g. [ node1_Color, node2_Color, node3_Color, etc.]). Alternatively, a Hex string (e.g. '#ff0000' == the color red) may be used to set all nodes to a constant color.
minColorMinimum color value to use for scaling (default - None). If None, the minimum value is determined automatically from the colorData provided. When plotting multiple color/data sets a minimum value should be provided to ensure that all data is scaled the same.
maxColorMaximum color value to use for scaling (default - None). If None, the maximum value is determined automatically from the colorData provided. When plotting multiple color/data sets a maximum value should be provided to ensure that all data is scaled the same.
numContourNumber of contour levels to use in the color map (default - 0 for a continuous color map).
reverseMapReverse or invert the color map (default - False).
colorMapName of color map to use of visualization. Options: "blues" (default), "reds", "greys" (or "grays"), "blue_red" (or "bwr"), "jet", "rainbow", "hot", "cool".
nameName of color set (default - None).
Returns
Optionally returns a reference to the "wvData item (object)" in which the data is stored.

◆ addLineIndex()

def addLineIndex (   self,
  connectivity,
  name = None 
)

Add a element connectivity set with the intention of creating graphical lines on triangular primitives.

See webviewer.py for an example use case.

Parameters
connectivityA list of lists of connectivity information (e.g. [ [node1, node2, node3], [node2, node3, node7, node8], etc. ]). Note that whether or not the connectivity information is one biased was specified during capsViewer initialization (see capsViewer.__init__ ), no further checks are currently made.
nameName of line set (default - None).
Returns
Optionally returns a reference to the "wvData item (object)" in which the data is stored.

◆ addPointColor()

def addPointColor (   self,
  colorData,
  minColor = None,
  maxColor = None,
  numContour = 0,
  reverseMap = False,
  colorMap = "blues",
  name = None 
)

Add color/scalar data set for the graphical points on line or triangular primitives.

(addPointIndex ). See webviewer.py for an example use case.

Parameters
colorDataA list of color/scalar data to be applied at each node (e.g. [ node1_Color, node2_Color, node3_Color, etc.]). Alternatively, a Hex string (e.g. '#ff0000' == the color red) may be used to set all nodes to a constant color.
minColorMinimum color value to use for scaling (default - None). If None, the minimum value is determined automatically from the colorData provided. When plotting multiple color/data sets a minimum value should be provided to ensure that all data is scaled the same.
maxColorMaximum color value to use for scaling (default - None). If None, the maximum value is determined automatically from the colorData provided. When plotting multiple color/data sets a maximum value should be provided to ensure that all data is scaled the same.
numContourNumber of contour levels to use in the color map (default - 0 for a continuous color map).
reverseMapReverse or invert the color map (default - False).
colorMapName of color map to use of visualization. Options: "blues" (default), "reds", "greys" (or "grays"), "blue_red" (or "bwr"), "jet", "rainbow", "hot", "cool".
nameName of color set (default - None).
Returns
Optionally returns a reference to the "wvData item (object)" in which the data is stored.

◆ addPointIndex()

def addPointIndex (   self,
  connectivity,
  name = None 
)

Add a point connectivity set with the intention of creating graphical points on line or triangular primitives.

Parameters
connectivityA list of connectivity information (e.g. [ node1, node2, node3, etc. ]). Note that whether or not the connectivity information is one biased was specified during capsViewer initialization (see capsViewer.__init__ ), no further checks are currently made.
nameName of point set (default - None).
Returns
Optionally returns a reference to the "wvData item (object)" in which the data is stored.

◆ addTecplot()

def addTecplot (   self,
  filename 
)

Add a Tecplot file.

Parameters
filenameName of Tecplot file to load.

◆ addUnstructMesh()

def addUnstructMesh (   self,
  meshFile 
)

Add a unstructured mesh file.

Note that in most cases the mesh's name (see capsUnstructMesh.$name) will be used for the name of the primitive.

Parameters
meshFileName of unstructured mesh file to load or an instance of a capsUnstructMesh(see capsUnstructMesh) object.

◆ addVertex()

def addVertex (   self,
  xyz,
  name = None 
)

Add a vertex set.

See webviewer.py for an example use case.

Parameters
xyzA list of lists of x,y, z values (e.g. [ [x1, y1, z1], [x2, y2, z2],[x3, y3, z3], etc. ] )
nameName of vertex set (default - None).
Returns
Optionally returns a reference to the "wvData item (object)" in which the data is stored.

◆ clearItems()

def clearItems (   self)

Clear the "current" list of "wvData items (objects)".

◆ createLine()

def createLine (   self,
  items = None,
  name = None,
  turnOn = True 
)

Create a line graphic primitive.

Parameters
itemsList of "wvData items (objects)" used to create the triangle (default - None). If none are provided all current items added will be used!
nameName of graphic primitive (default - GPrim_#, where # is 1 + number of primitives previously loaded). Important: If specified, the name must be unique.
Returns
Optionally returns a reference to the graphicPrimitive object.

◆ createPoint()

def createPoint (   self,
  items = None,
  name = None 
)

Create a point graphic primitive.

Parameters
itemsList of "wvData items (objects)" used to create the triangle (default - None). If none are provided all current items added will be used!
nameName of graphic primitive (default - GPrim_#, where # is 1 + number of primitives previously loaded). Important: If specified, the name must be unique.
Returns
Optionally returns a reference to the graphicPrimitive object.

◆ createPrimitive()

def createPrimitive (   self,
  type,
  items = None,
  name = None,
  lines = True 
)

Create a generic graphic primitive.

Parameters
typeType of primitive to create. Options: "point", "line", or "triangle" (case insensitive)
itemsList of "wvData items (objects)" used to create the triangle (default - None). If none are provided all current items added will be used!
nameName of graphic primitive (default - GPrim_#, where # is 1 + number of primitives previously loaded). Important: If specified, the name must be unique.
linesLines in the primiteve on or off

◆ createTriangle()

def createTriangle (   self,
  items = None,
  name = None,
  turnOn = True,
  lines = True 
)

Create a triangular graphic primitive.

See webviewer.py for an example use case.

Parameters
itemsList of "wvData items (objects)" used to create the triangle (default - None). If none are provided all current items added will be used!
nameName of graphic primitive (default - GPrim_#, where # is 1 + number of primitives previously loaded). Important: If specified, the name must be unique.
linesLines in the primiteve on or off
Returns
Optionally returns a reference to the graphicPrimitive object.

◆ startServer()

def startServer (   self,
  enableCheck = True,
  unifyBoundingBox = True 
)

Start the server.

The port number specified when initializing the viewer object will be used (see capsViewer.__init__ ). Note that the server will continue to run as long as the browser is still connected, once the connection is broken the capViewer object should be deleted! See webviewer.py for an example use case.

Parameters
enableCheckEnable checks to ensure all primitives have the same number colors and that the limits for each color are initially the same.
unifyBoundingBoxUnify the bounding boxes of all primatives (so all images are within the viewering area)

Member Data Documentation

◆ numTess

numTess
static

Display an array of EGADS bodies.

Parameters
numBodyNumber of bodies in array.
bodyArray of EGADS body objects. Display an array of EGADS tessellations
numTessNumber of tessellations in array.
tessArray of EGADS tessellation objects.

The documentation for this class was generated from the following file: