XPositionTo Example
Sub Example_XPositionTo() ' This example will make a mass element and and anchor it's center 200 units ' from the end 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 anchor.XPositionFrom = aecCurvePositionEnd ' set the anchor to measure from the end of the curve anchor.XPositionTo = aecEdgePositionCenter ' set the anchor to measure to the center of the entity mass.AttachAnchor anchor ' attach the anchor to the mass element
End Sub