DrawNURBS Method

Microsoft Visio Developer Reference

DrawNURBS Method

   Example   

Creates a new shape whose path consists of a single NURBS (nonuniform rational B-spline) segment.

Version added

2000

Syntax

objRet = object.DrawNURBS(degree, xyArray, knots, flags, weights)

objRet

An object that represents the new NURBS curve.

object

Required. An expression that returns a Page, Master, or Shape object in which to draw the shape.

degree

Required Integer. The spline's degree; an integer between 1 and 25.

xyArray

Required Double. An array of alternating x and y values that define the control points coordinates; use internal drawing units (inches).

knots

Required Double. An array of knots.

flags

Required Integer. Flags that influence how the shape is drawn.

weights

Optional Variant. An array of weights.

Remarks

The DrawNURBS method creates a new shape whose path consists of a single NURBS segment as specified by the arguments.

The control points should be in internal drawing units (inches) with respect to the coordinate space of the page, master, or group where the shape is being dropped. The xyArray, knots, and weights arrays should be of type SAFEARRAY of 8-byte floating point values passed by reference (VT_R8|VT_ARRAY|VT_BYREF). This is how Microsoft Visual Basic passes arrays to Automation objects.

The knots argument is unit-less. The sequence of knots should be non-decreasing. In other words, knots(i + 1) < knots(i) is not acceptable. knots(i + 1) = knots(i) is permitted, and then the value is repeated, but the following restrictions apply:

  • The first knot may not be repeated more than degree + 1 times.
  • The last knot may not be repeated.
  • Any knot between the first and last may not be repeated more than degree times.
  • If the first knot is repeated less than degree+1 times, the spline is periodic.
  • The list of weights is optional. Its absence signals that the spline is non-rational. Weights are unit-less.

The following rules apply to the sizes of the lists. For a spline with n control points:

  • If the spline is periodic, then n > 2. Otherwise, n > degree.
  • The size of xyArray is 2n.
  • The size of the weights array is n (if present).
  • The size of the knots array is n + 1.

The conventional non-periodic spline requires n + degree + 1 knots, but the application implies the repeated knots at the end. For example, the degree 2 knot list (0,0,0,2,5,8) is interpreted in the application as the conventional knot sequence (0,0,0,2,5,8,8,8).

The flags parameter is a bit mask that specifies options for drawing the new shape. Its value should be either zero (0) or visSpline1D (8). If flags is visSpline1D and if the first and last points in xyArray don't coincide, the DrawNURBS method produces a shape with one-dimensional (1-D) behavior; otherwise, it produces a shape with two-dimensional (2-D) behavior.

If the first and last points in xyArray do coincide, the DrawNURBS method produces a filled shape.