Create Curved Objects

AutoCAD ActiveX

 
Create Curved Objects
 
 
 

You can create a variety of curved objects with AutoCAD, including spline curves, circles, arcs, and ellipses. All curves are created on the XY plane of the current WCS.

To create a curve, use one of the following methods:

AddArc

Creates an arc given the center, radius, start and end angles.

AddCircle

Creates a circle given the center point and radius.

AddEllipse

Creates an ellipse given the center point, a point on the major axis, and the radius ratio.

AddSpline

Creates a quadratic or cubic NURBS (nonuniform rational B-spline) curve.

Create a Spline object

This example creates a spline in model space using three points (0, 0, 0), (5, 5, 0), and (10, 0, 0). The spline has start and end tangents of (0.5, 0.5, 0.0).

Sub Ch4_CreateSpline()
    ' This example creates a spline object in model space.
    ' Declare the variables needed
    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
      
    ' Define the variables
    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
      
    ' Create the spline
    Set splineObj = ThisDrawing.ModelSpace.AddSpline _
 (fitPoints, startTan, endTan)
    ZoomAll
End Sub

For more information about splines, see the Spline object and AddSpline method documentation in the AutoCAD ActiveX and VBA Reference.