YPositionTo Example
Sub Example_YPositionTo() ' This example will make a mass element and and anchor it's center 200 units ' from the left 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.YDistance = 200 ' set the Y Distance for the anchor anchor.YPositionTo = aecEdgePositionCenter ' set the anchor to measure to the center of the entity mass.AttachAnchor anchor ' attach the anchor to the mass element
End Sub