pyCAPS
pyCAPS: A Python Extension Module for CAPS
|
Functions to interact with a CAPS geometry object. More...
Public Member Functions | |
def | buildGeometry (self) |
Manually force a build of the geometry. More... | |
def | saveGeometry (self, filename="myGeometry", directory=os.getcwd(), extension=".egads") |
Save the current geometry to a file. More... | |
def | setGeometryVal (self, varname=None, value=None) |
Sets a GEOMETRYIN variable for the geometry object. More... | |
def | getGeometryVal (self, varname=None, kwargs) |
Gets a GEOMETRYIN variable for the geometry object. More... | |
def | getGeometryOutVal (self, varname=None, kwargs) |
Gets a GEOMETRYOUT variable for the geometry object. More... | |
def | viewGeometry (self, kwargs) |
View or take a screen shot of the geometry configuration. More... | |
def | getAttributeVal (self, attributeName, kwargs) |
Retrieve a list of attribute values of a given name ("attributeName") for the bodies in the current geometry. More... | |
def | getAttributeMap (self, getInternal=False, kwargs) |
Create attribution map (embeded dictionaries) of each body in the current geometry. More... | |
def | createTree (self, filename="myGeometry", kwargs) |
Create a HTML dendrogram/tree of the current state of the geometry. More... | |
Public Attributes | |
geomName | |
Geometry file loaded into problem. More... | |
Functions to interact with a CAPS geometry object.
Should be created with capsProblem.loadCAPS (not a standalone class).
def buildGeometry | ( | self | ) |
Manually force a build of the geometry.
The geometry will only be rebuilt if a design parameter (see setGeometryVal) has been changed.
def createTree | ( | self, | |
filename = "myGeometry" , |
|||
kwargs | |||
) |
Create a HTML dendrogram/tree of the current state of the geometry.
The HTML file relies on the open-source JavaScript library, D3, to visualize the data. This library is freely available from https://d3js.org/ and is dynamically loaded within the HTML file. If running on a machine without internet access a (miniaturized) copy of the library may be written to a file alongside the generated HTML file by setting the internetAccess keyword to False. If set to True, internet access will be necessary to view the tree.
filename | Filename to use when saving the tree (default - "myGeometry"). Note an ".html" is automatically appended to the name (same with ".json" if embedJSON = False). |
**kwargs | See below. |
Valid keywords:
embedJSON | Embed the JSON tree data in the HTML file itself (default - True). If set to False a seperate file is generated for the JSON tree data. |
internetAccess | Is internet access available (default - True)? If set to True internet access will be necessary to view the tree. |
internalGeomAttr | Show the internal attributes (denoted by starting with an underscore, for example "_AttrName") that exist on the geometry (default - False). |
reverseMap | Reverse the attribute map (default - False). See getAttributeMap for details. |
def getAttributeMap | ( | self, | |
getInternal = False , |
|||
kwargs | |||
) |
Create attribution map (embeded dictionaries) of each body in the current geometry.
Dictionary layout:
Dictionary layout (reverseMap = True):
getInternal | Get internal attributes (denoted by starting with an underscore, for example "_AttrName") that exist on the geometry (default - False). |
**kwargs | See below. |
Valid keywords:
reverseMap | Reverse the attribute map (default - False). See above table for details. |
def getAttributeVal | ( | self, | |
attributeName, | |||
kwargs | |||
) |
Retrieve a list of attribute values of a given name ("attributeName") for the bodies in the current geometry.
Level in which to search the bodies is determined by the attrLevel keyword argument.
attributeName | Name of attribute to retrieve values for. |
**kwargs | See below. |
Valid keywords:
bodyIndex | Specific body in which to retrieve attribute information from. |
attrLevel | Level to which to search the body(ies). Options: 0 (or "Body") - search just body attributes 1 (or "Face") - search the body and all the faces [default] 2 (or "Edge") - search the body, faces, and all the edges 3 (or "Node") - search the body, faces, edges, and all the nodes |
def getGeometryOutVal | ( | self, | |
varname = None , |
|||
kwargs | |||
) |
Gets a GEOMETRYOUT variable for the geometry object.
varname | Name of geometry (local) parameter to retrieve from the geometry. If no name is provided a dictionary containing all local variables is returned. |
**kwargs | See below. |
Valid keywords:
namesOnly | Return only a list of parameter names (no values) if creating a dictionary (default - False). |
ignoreAt | Ignore @ geometry variables when creating a dictionary (default - True). |
def getGeometryVal | ( | self, | |
varname = None , |
|||
kwargs | |||
) |
Gets a GEOMETRYIN variable for the geometry object.
varname | Name of geometry design parameter to retrieve from the geometry. If no name is provided a dictionary containing all design parameters is returned. |
**kwargs | See below. |
Valid keywords:
namesOnly | Return only a list of parameter names (no values) if creating a dictionary (default - False). |
def saveGeometry | ( | self, | |
filename = "myGeometry" , |
|||
directory = os.getcwd() , |
|||
extension = ".egads" |
|||
) |
Save the current geometry to a file.
filename | File name to use when saving geometry file. |
directory | Directory where to save file. Default current working directory. |
extension | Extension type for file if filename does not contain an extension. |
def setGeometryVal | ( | self, | |
varname = None , |
|||
value = None |
|||
) |
Sets a GEOMETRYIN variable for the geometry object.
varname | Name of geometry design parameter to set in the geometry. |
value | Value of geometry design parameter. Type casting is automatically done based on value indicated by CAPS. |
def viewGeometry | ( | self, | |
kwargs | |||
) |
View or take a screen shot of the geometry configuration.
The use of this function requires the matplotlib module. Important: If both showImage = True and filename is not None, any manual view changes made by the user in the displayed image will be reflected in the saved image.
**kwargs | See below. |
Valid keywords:
viewerType | What viewer should be used (default - capsViewer). Options: capsViewer or matplotlib (options are case insensitive). Important: if $filename is not None, the viewer is changed to matplotlib. |
portNumber | Port number to start the server listening on (default - 7681). |
title | Title to add to each figure (default - None). |
filename | Save image(s) to file specified (default - None). Note filename should not contain '.' other than to indicate file type extension (default type = *.png). 'file' - OK, 'file2.0Test' - BAD, 'file2_0Test.png' - OK, 'file2.0Test.jpg' - BAD. |
directory | Directory path were to save file. If the directory doesn't exist it will be made. (default - current directory). |
viewType | Type of view for the image(s). Options: "isometric" (default), "fourview", "top" (or "-zaxis"), "bottom" (or "+zaxis"), "right" (or "+yaxis"), "left" (or "-yaxis"), "front" (or "+xaxis"), "back" (or "-xaxis"). |
combineBodies | Combine all bodies into a single image (default - False). |
ignoreBndBox | Ignore the largest body (default - False). |
showImage | Show image(s) (default - False). |
showAxes | Show the xyz axes in the image(s) (default - False). |
showTess | Show the edges of the tessellation (default - False). |
dpi | Resolution in dots-per-inch for the figure (default - None). |
tessParam | Custom tessellation paremeters, see EGADS documentation for makeTessBody function. values will be scaled by the norm of the bounding box for the body (default - [0.0250, 0.0010, 15.0]). |
geomName |
Geometry file loaded into problem.
Note that the directory path has been removed.