AutoCAD – Calculate The Total Length Of Lines

Share this

March 27, 2012

AutoCAD – Calculate The Total Length Of Lines

With this utility, you will be able to calculate the total lines length of a layer (in an AutoCAD drawing). It might be useful in HVAC applications for pipes length calculations.
How to use it
  1. Open your AutoCAD.
  2. In command line write VBAMAN.
  3. Press the Load button in the menu that will appear.
  4. At the browser find the file Lines Length.dvb.
  5. Choose the Enable Macros button and then press the Close button.
  6. Go to Tools > Macros or press ALT + F8.
  7. At the macros menu, press the Run button. A form will appear (see figure above).
  8. In the form press the Select Lines button and then select some lines from a drawing. After exiting the selection mode the selected layers will be reported on the left list box and the unique ones on the right list box.
  9. If you press the Create Excel Spreadsheet button a new spreadsheet will be created containing the name of unique layers and their corresponding total lines length (see figure below).
Excel  unique layers and their corresponding total lines length

If you close the form and want to re-use it just repeat the steps 6 to 9 (provided that the DVB file is already loaded). If you have AutoCAD 2010 or newer, then you will need to download the VBA module from Autodesk since from 2010 version VBA is not installed with AutoCAD.

 Download it from here

Read also

AutoCAD – Total Length Of Lines Per Layer
Draw A Polyline In AutoCAD Using Excel VBA
AutoCAD VBA Add-In: Calculate Polylines Length & Area

Page last modified: January 6, 2019

Christos Samaras

Hi, I am Christos, a Mechanical Engineer by profession (Ph.D.) and a Software Developer by obsession (10+ years of experience)! I founded this site back in 2011 intending to provide solutions to various engineering and programming problems.

Christos E. Samaras

  • Hi Tony,

    When you click the Select Lines button do you see the “Click to a line in order to select it.” message box?
    I suppose that it is probably an issue with your version, but, unfortunately , since I don’t know in which line the code fails I cannot do many things…

    Have you tried in a different PC or AutoCAD version?

  • Hi Christos,
    i have a probem on Autocad 2012, when i click on select button i have the error message below :
    Compile error in hidden module Userform1
    That with both version of your scripts for line measurement.

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
    Add Content Block
    >