Civil and construction design tools

Circular Column section

How to draw Circular column section in AutoCAD using Excel VBA

Automate Your Drafting: Draw Circular Reinforced Concrete Columns in AutoCAD directly from Excel

Stop drawing column sections manually!

After receiving a request on my YouTube channel, I wrote a simple VBA script that automates the drafting of circular column sections. Whether you have one column or one hundred, this script takes your Excel data and plots the concrete section, stirrups, and longitudinal reinforcement in AutoCAD instantly.

 How it works:

  1. Define your inputs in Excel (Diameter, Cover, Number of Bars, Bar Size).

  2. Run the Macro.

  3. Click a point in AutoCAD.

  4. Done.

Get the Tool: I have attached a ready-to-use Excel file (.xlsm) with the code already set up. Just enable macros and you are good to go!

(If you prefer to build it yourself, the VBA code is pasted below)

 The Inputs (Setup your Excel Sheet):

  • Cell F5: Column Diameter

  • Cell F6: Concrete Cover

  • Cell F8: Number of Bars

  • Cell F9: Bar Size

 The VBA Code: (Copy and paste this into a Module in Excel)

Option Explicit

Const PI = 3.14159265358979

Sub DrawCircularColumn()
    Dim AutocadApp As Object
    Dim ActDoc As Object
    Dim Column As Object
    Dim Stirrup As Object
    Dim CirObj As Object
    Dim FilledCir As Object
    
    Dim ColumnCenter As Variant
    Dim OffsetRect As Variant
    Dim rebarsectionPos As Variant
    Dim Marray(0) As Object
    
    Dim ColumnDiameter As Double
    Dim Barsize As Double
    Dim Cover As Double 'Changed to Double for precision
    Dim Nbrbar As Integer
    Dim i As Integer
    Dim angle As Double

    '****** 1. Launch/Connect to AutoCAD ****
    On Error Resume Next
    Set AutocadApp = GetObject(, "Autocad.application")
    On Error GoTo 0
    
    If AutocadApp Is Nothing Then
        Set AutocadApp = CreateObject("Autocad.application")
        AutocadApp.Visible = True
    End If
    
    '****** 2. Read Inputs from Active Sheet ****
    'Ensure your Excel sheet has data in these cells
    ColumnDiameter = ActiveSheet.Range("F5").Value
    Cover = ActiveSheet.Range("F6").Value
    Nbrbar = ActiveSheet.Range("F8").Value
    Barsize = ActiveSheet.Range("F9").Value

    '****** 3. Setup Document ****
    On Error Resume Next
    Set ActDoc = AutocadApp.ActiveDocument
    If ActDoc Is Nothing Then
        Set ActDoc = AutocadApp.Documents.Add
    End If
    On Error GoTo 0

    '****** 4. Draw Geometry ****
    'Get insertion point from user
    ColumnCenter = ActDoc.Utility.GetPoint(, "Select the position of the column center: ")
    
    'Draw Concrete Column
    Set Column = ActDoc.ModelSpace.AddCircle(ColumnCenter, ColumnDiameter / 2)
    
    'Draw Stirrup (Offset from column)
    OffsetRect = Column.Offset(-Cover)
    Set Stirrup = OffsetRect(0)
    Stirrup.ConstantWidth = 5 'Poline width for visibility
    
    'Draw Longitudinal Bars
    angle = 0
    For i = 1 To Nbrbar
        'Calculate bar position using Polar coordinates
        rebarsectionPos = ActDoc.Utility.PolarPoint(ColumnCenter, angle, (ColumnDiameter / 2 - Barsize / 2 - Cover))
        
        'Draw the rebar circle
        Set CirObj = ActDoc.ModelSpace.AddCircle(rebarsectionPos, Barsize / 2)
        CirObj.Color = acRed
        
        'Hatch/Fill the rebar
        Set FilledCir = ActDoc.ModelSpace.AddHatch(0, "Solid", True) '0 = acHatchPatternTypePreDefined
        Set Marray(0) = CirObj
        
        With FilledCir
            .AppendOuterLoop (Marray)
            .Evaluate
            .Color = acRed
            .Update
        End With
        
        'Increment angle for next bar
        angle = angle + (2 * PI) / Nbrbar
    Next i
    
    AutocadApp.ZoomExtents
    
    'Cleanup
    Set AutocadApp = Nothing
    Set ActDoc = Nothing
    Set CirObj = Nothing
    Set FilledCir = Nothing
End Sub

How to use this program?

🎥 Watch the full tutorial here: HERE ON YouTube

5 thoughts on “How to draw Circular column section in AutoCAD using Excel VBA”

  1. I found your blog website on google and check a couple of of your early posts. Proceed to keep up the excellent operate. I just extra up your RSS feed to my MSN News Reader. Looking for forward to studying more from you afterward!…