Cell Example

AEC Auto

Cell Example

Sub Example_Cell()

    'This example will add anchor a new mass element to cell in a 2D layout grid.
    
    Dim grid As AecGridAssembly
    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 AecGridAssembly Then
        Set grid = obj
        Set mass = ThisDrawing.ModelSpace.AddCustomObject("AecMassElement")
        Dim anchor As New AecAnchorEntToGridAssembly
        anchor.Reference = grid
        ' anchor the mass element to the first cell in the grid
        anchor.Cell = 1
        mass.AttachAnchor anchor
    Else
        MsgBox "No Layout Grid selected", vbInformation, "Node Example"
    End If

End Sub