XDistance Example

AEC Auto

XDistance Example

Sub Example_XDistance()

    ' This example will make a mass element and and anchor it 200 units
    ' from the start of a line.

    Dim mass As AecMassElement
    Dim line As AcadLine
    Dim anchor As New AecAnchorEntToCurve
    Dim pt1(0 To 2) As Double
    Dim pt2(0 To 2) As Double
    
    pt2(0) = 1000: pt2(1) = 1000
    
    ' this makes a new mass element 120 x 120 x 120 at 0,0,0
    Set mass = ThisDrawing.ModelSpace.AddCustomObject("AecMassElement")
    ' draws a line from 0,0 to 1000,1000
    Set line = ThisDrawing.ModelSpace.AddLine(pt1, pt2)
        
    anchor.Reference = line ' set the line as the object (curve) to anchor to
    anchor.XDistance = 200 ' set the X Distance for the anchor
    mass.AttachAnchor anchor ' attach the anchor to the mass element

End Sub