Wednesday, 27 June 2012

AutoCAD – Total Length Of Lines Per Layer

Some months ago I developed a VBA add-in that was able to calculate the total lines length of a layer and then export the results in a new excel workbook. Although this was useful for reporting purposes it was not so handy for everyday use. So, in this variation of the add-in the results are not exported in excel, but, are showed in a list box (the right one on the form). Thereby, you can have a continuous overview of the results without leaving AutoCAD. So, if you have an HVAC application and need to determine the total pipe length for example, this utility might help you.

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 Total Length Of Lines Per Layer.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, while the unique ones on the middle list box.
  9. Finally, if you press the Calculate Length button the right list box will be populated with the total lines length of unique layers that were selected in step 8. A text box below the right list box will contain the total lines length of all unique layers. It should be noted that length values are rounded in two digits.
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 VBA is not installed with AutoCAD.

 Download it from here

Read also

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

Did you like this post? If yes, then share it with your friends. Thank you!


Mechanical Engineer (Ph.D. cand.), M.Sc. Cranfield University, Dipl.-Ing. Aristotle University, Thessaloniki - Greece.
Communication: tel. +30-6973513308, e-mail , Facebook , Twitter , Google+ and Linkedin. Full CV