# pyNetwork

class pygeo.pyNetwork.pyNetwork(curves)[source]

A class for manipulating a collection of curve objects.

pyNetwork is the 1 dimensional analog of pyGeo (surfaces 2D) and pyBlock (volumes 3D). The idea is that a ‘network’ is a collection of 1D splines that are connected in some manner. This module provides facility for dealing with such structures.

Parameters
curveslist of pySpline.Curve objects

Individual curves to form the network.

getBounds(curves=None)[source]

Determine the extents of the set of curves.

Parameters
curveslist

Optional list of the indices of the curve objects to include.

Returns
xMinarray of length 3

Lower corner of the bounding box

xMaxarray of length 3

Upper corner of the bounding box

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

Project one or more points onto the nearest curve. This algorihm isn’t exactly efficient: We simply project the nodes on each of the curves and take the lowest one.

Parameters
pointsarray

A single point (array length 3) or a set of points (N,3) array

curveslist

An optional list of curve indices to you. If not given, all curve objects are used.

kwargsdict

Keyword arguments passed to curve.projectPoint() function

Returns
curveIDint

The index of the curve with the closest distance

sfloat or array

The curve parameter on self.curves[curveID] that is cloested to the point(s).

projectRays(points, axis, curves=None, raySize=1.5, **kwargs)[source]

Given a set of points and a vector defining a direction, i.e. a ray, determine the minimum distance between these rays and any of the curves this object has.

Parameters
pointsarray

A single point (array length 3) or a set of points (N,3) array

axisarray

A single direction vector (length 3) or a (N,3) array of direction vectors

curveslist

An optional list of curve indices to you. If not given, all curve objects are used.

raySizefloat

The ray direction is based on the axis vector. The magnitude of the ray is estimated based on the minimum distance between the point and the set of curves. That distance is then multiplied by “raySize” to get the final ray vector. Then we find the intersection between the ray and the curves. If the ray is not long enough to actually intersect with any of the curves, then the link will be drawn to the location on the curve that is closest to the end of the ray, which will not be a projection along “axis” unless the curve is perpendicular to the axis vector. The default of 1.5 works in most cases but can cause unexpected behavior sometimes which can be fixed by increasing the default.

kwargsdict

Keyword arguments passed to Curve.projectCurve() function

Returns
curveIDint

The index of the curve with the closest distance

sfloat or array

The curve parameter on self.curves[curveID] that is cloested to the point(s).

writeTecplot(fileName, orig=False, curves=True, coef=True, curveLabels=False, nodeLabels=False)[source]

Write the pyNetwork Object to Tecplot .dat file

Parameters
fileNamestr

File name for tecplot file. Should have .dat extension

curvesbool

Flag to write discrete approximation of the actual curve

coefbool

Flag to write b-spline coefficients

curveLabelsbool

Flag to write a separate label file with the curve indices

nodeLabelsbool

Flag to write a separate node label file with the node indices