pyGeo

class pygeo.pyGeo.pyGeo(initType, *args, **kwargs)[source]

pyGeo is a (fairly) complete geometry surfacing engine. It performs multiple functions including producing surfaces from cross sections and globally fitting surfaces. The actual b-spline surfaces are of the pySpline Surface type.

The initialization type, initType, specifies what type of initialization will be used. There are currently 3 initialization types: plot3d, iges, and liftingSurface

Parameters
initTypestr, {‘plot3d’, ‘iges’, ‘liftingSurface’}

A key word defining how this geo object will be defined.

fileNamestr

Used for ‘plot3d’ and ‘iges’ only. Name of file to load.

xsectionslist of filenames

List of the cross section coordinate files. Length = N

scalelist or array

List of the scaling factors (chord) for cross sections. Length = N

offsetList or array

List of x-y offset to apply before scaling. Length = N

XsecList or array

List of spatial coordinates as to the placement of cross sections. Size (N, 3)

x, y, zlist or array

If Xsec is not given, x,y,z arrays each of length N can be given individually.

rotList or array

List of x-y-z rotations to apply to cross sections. Length = N

rotX, rotY, rotZlist or arrays

Individual lists of x,y, and z rotations. Each of length N

nCtlint

Number of control points to use for fitting. If it is None, local interpolation is performed which typically yields better results when a small number of sections. When trying to match wing geometries, a larger number of sections are often required. In this case, the number of control points also needs to be increased to prevent the file from becoming overly large.

kSpanint

The spline order in span-wise direction. 2 for linear, 3 for quadratic and 4 for cubic

kuint

Spline order in u (for plot3d input files only)

kvint

Spline order in v (for plot3d input files only)

nCtluint

Number of control points in u (for plot3d input files only)

nCtlvint

Number of control points in v (for plot3d input files only)

doConnectivity(fileName=None, nodeTol=0.0001, edgeTol=0.0001)[source]

This is the only public edge connectivity function. If fileName exists it loads the file OR it calculates the connectivity and saves to that file.

Parameters
fileNamestr

Filename for con file

nodeTolfloat

The tolerance for identical nodes

edgeTolfloat

The tolerance for midpoint of edges being identical

fitGlobal()[source]

Perform a global B-spline surface fit to determine the coefficients of each patch. This is only used with an plot3D init type

getBounds(surfs=None)[source]

Determine the extents of the collection of surfaces

Parameters
surfslist or array

Indices of surfaces defining subset for which to get the bounding box

Returns
xMinarray of length 3

Lower corner of the bounding box

xMaxarray of length 3

Upper corner of the bounding box

printConnectivity()[source]

Print the Edge connectivity to the screen

projectCurve(curve, *args, surfs=None, **kwargs)[source]

Project a pySpline curve onto the pyGeo object

Parameters
curvepySpline.Curve object

Curve to use for the intersection

surfslist or array

Indices of surface defining subset for which to get the bounding box

Returns
Try it and see!

Notes

This algorithm is not efficient at all. We basically do the curve-surface projection algorithm for each surface the loop back over them to see which is the best in terms of closest distance. This intent is that the curve actually intersects one of the surfaces.

projectPoints(points, *args, surfs=None, **kwargs)[source]

Project on or more points onto the nearest surface.

Parameters
pointslist or array

Singe point (size 3) or list of points size (N,3) points to project onto the surfaces

surfslist or array

Indices of surface defining subset for which to use for projection

Returns
ufloat or array

u parameter values of closest point

vfloat or array

v parameter values of closest point

PIDint or int array

Patch index corresponding to the u,v parameter values

setSurfaceCoef()[source]

Set the surface coef list from the pyspline surfaces

writeIGES(fileName)[source]

Write the surface to IGES format

Parameters
fileNamestr

File name of iges file. Should have .igs extension.

writeTecplot(fileName, orig=False, surfs=True, coef=True, directions=False, surfLabels=False, edgeLabels=False, nodeLabels=False)[source]

Write the pyGeo Object to Tecplot dat file

Parameters
fileNamestr

File name for tecplot file. Should have .dat extension

surfsbool

Flag to write discrete approximation of the actual surface

coef: bool

Flag to write b-spline coefficients

directionsbool

Flag to write surface direction visualization

surfLabelsbool

Flag to write file with surface labels

edgeLabelsbool

Flag to write file with edge labels

nodeLabelsbool

Falg to write file with node labels

writeTin(fileName)[source]

Write the surfaces to ICEMCFD .tin format

Parameters
fileNamestr

File name of tin file. Should have .tin extension.