YRotation Example

AEC Auto

YRotation Example

Sub Example_YRotation()

    'This example will add anchor a new mass element to a 2D layout grid in the
    ' drawing.
    
    Dim grid As AecLayoutGrid2D
    Dim mass As AecMassElement
    Dim pt As Variant
    Dim obj As AcadObject
    
    ThisDrawing.Utility.GetEntity obj, pt, "Select grid to attach to"
    If TypeOf obj Is AecLayoutGrid2D Then
        Set grid = obj
        Set mass = ThisDrawing.ModelSpace.AddCustomObject("AecMassElement")
        Dim anchor As New AecAnchorEntToLayoutNode
        anchor.Reference = grid
        ' anchor the mass element to the first node on the grid
        anchor.Node = 1
        anchor.YRotation = Atn(1) ' 45 degrees
        mass.AttachAnchor anchor
    Else
        MsgBox "No Layout Grid selected", vbInformation, "Node Example"
    End If

End Sub