Edit Splines

AutoCAD ActiveX

 
Edit Splines
 
 
 

Use the following editable properties to change splines:

ControlPoints

Specifies the control points of a spline.

EndTangent

Specifies the end tangent of the spline as a directional vector.

FitPoints

Specifies all the fit points of a spline.

FitTolerance

Refits the spline to the existing points with new tolerance values.

Knots

Specifies the knots vector for the spline.

StartTangent

Specifies the start tangent for the spline.

In addition, you can use the following methods to edit splines:

AddFitPoint

Adds a single fit point to the spline at a given index.

DeleteFitPoint

Deletes the fit point of a spline at a given index.

ElevateOrder

Elevates the order of the spline to the given order.

GetFitPoint

Gets the fit point of the spline at a given index. (Gets one fit point only. To query all the fit points of the spline, use the FitPoints property.)

Reverse

Reverses the direction of a spline.

SetControlPoint

Sets the control point of the spline at a given index.

SetFitPoint

Sets the fit point of the spline at a given index. (Sets one fit point only. To change all the fit points of the spline, use the FitPoints property.)

SetWeight

Sets the weight of the control point at a given index.

Use the following read-only properties to query splines:

Area

Gets the enclosed area of a spline.

Closed

Indicates whether the spline is open or closed.

Degree

Gets the degree of the spline's polynomial representation.

IsPeriodic

Specifies if the given spline is periodic.

IsPlanar

Specifies if the given spline is planar.

IsRational

Specifies if the given spline is rational.

NumberOfControlPoints

Gets the number of control points of the spline.

NumberOfFitPoints

Gets the number of fit points of the spline.

For more information about editing splines, see “Modify Splines” in the User's Guide.

Change a control point on a spline

This example creates a spline and then changes the first control point for the spline.

Sub Ch4_ChangeSplineControlPoint()
    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double
      
    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace. _
 AddSpline(fitPoints, startTan, endTan)
    splineObj.Update
      
    ' Change the coordinate of the first fit point
    Dim controlPoint(0 To 2) As Double
    controlPoint(0) = 0
    controlPoint(1) = 3
    controlPoint(2) = 0
    splineObj.SetControlPoint 0, controlPoint
    splineObj.Update
End Sub