DrawSpline method

Microsoft Visio Developer Reference

DrawSpline method

       

Creates a new shape whose path follows a given sequence of points.

Version added

4.1

Syntax

objRet = object.DrawSpline(xyArray, tolerance, flags)

objRet

A Shape object that represents the new spline.

object

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

xyArray

Required Double. An array of alternating x and y values that define points in the new shape's path.

tolerance

Required Double. How closely the path of the new shape must approximate the given points.

flags

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

Remarks

The DrawSpline method creates a new shape whose path falls within the given tolerance of the given array of points. To fit the given points exactly, specify a tolerance of zero (0). Typically, the DrawSpline method fits spline segments through the points, but it sometimes produces line or circular arc segments in the new shape.

The control points and tolerance are in internal drawing units (inches) with respect to the coordinate space of the page, master, or group where the shape is being dropped. The passed array should be a 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 error from the points to the path of the resulting shape is roughly within tolerance. When the number of points is large, the actual error may sometimes exceed the prescribed tolerance.

The flags argument is a bit mask that specifies options for drawing the new shape. Its value should be a combination of zero or more of the following values.

Constant

Value

visSplinePeriodic

1(&H1)

visSplineDoCircles

2(&H2)

visSplineAbrupt

4(&H4)

visSpline1D

8(&H8)

If flags includes visSplinePeriodic and the following conditions are met, the application attempts to draw a periodic spline. Otherwise, Visio draws a non-periodic spline:

  • The last point must be a repetition of the first one.
  • If the flag visSplineAbrupt is included as well, the entire closed path outlined by the points must be free of abrupt changes of direction and curvature.

If flags includes visSplineDoCircles, Visio recognizes circular segments in the given array of points and generates circular arcs instead of spline rows for those segments.

If flags includes visSplineAbrupt, Visio breaks the spline whenever it detects an abrupt change of direction or curvature in the point's trail. An abrupt change of direction is defined by three consecutive points A, B, C in the list, for which the distance between B and the line segment AC is more than twice the tolerance. The application also considers point B to be an abrupt change if one of the segments AB or BC is more than twice as long as the other. At a point where an abrupt change is detected, the application ends the current piece (line, arc, or spline) and starts a fresh one.

If flags includes visSpline1D and the first and last points in xyArray don't coincide, the DrawSpline 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 DrawSpline method produces a filled shape.