Extend and Trim Objects

AutoCAD ActiveX

 
Extend and Trim Objects
 
 
 

You can change the angle of arcs and you can change the length of open lines, arcs, open polylines, elliptical arcs, and open splines. The results are similar to both extending and trimming objects.

You can extend or trim an object by editing its properties. For example, to lengthen a line, simply change the coordinates of the StartPoint or EndPoint properties. To change the angle of an arc, change the StartAngle or EndAngle property of the arc. Once you have altered an object's property or properties, use the Update method to see your changes in the drawing.

For more information about extending and trimming objects, see “Resize or Reshape Objects” in the User's Guide.

Lengthen a line

This example creates a line and then changes the endpoint of that line, resulting in a longer line.

Sub Ch4_LengthenLine()
    ' Define and create the line
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2)  As Double
    startPoint(0) = 0
    startPoint(1) = 0
    startPoint(2) = 0
    endPoint(0) = 1
    endPoint(1) = 1
    endPoint(2) = 1
    Set lineObj = ThisDrawing.ModelSpace. _
 AddLine(startPoint, endPoint)
    lineObj.Update
      
    ' Lengthen the line by changing the
    ' endpoint to 4, 4, 4
    endPoint(0) = 4
    endPoint(1) = 4
    endPoint(2) = 4
    lineObj.endPoint = endPoint
    lineObj.Update
End Sub