
- Calculate the length of all polylines, as well as the area of all closed polylines from a selected layer.
- Calculate the length of all polylines, as well as the area of all closed polylines from all the layers of the current drawing.
- Export the results to a new Excel workbook.
I should point out that the add-in calculates the area from closed polylines only. So, this means that when the polyline was drawn, the closed option should have been used at the end. If a polyline was left opened or it was manually closed (by linking the last point with the first point), then the code will not take its area into account. However, its length will be measured. The video below has an example of polylines who look closed, but they aren’t.
- Open your AutoCAD.
- In command line write VBAMAN.
- Press the Load button in the menu that will appear.
- At the browser find the file Polyline Area.dvb.
- Choose the Enable Macros button and then press the Macros button.
- At the macros menu, press the Run button. A form will appear (see figure above).
- In the form you have two choices: you can either select a layer from the combo box, or you can check the checkbox to loop through all the layers of the current drawing. In both cases press the Calculate Length & Area button after. The list box will be populated with information from all the polylines of the selected layer or all the layers of the drawing. Two text boxes below the list box will contain the total length and the total area.
-
Finally, if you press the Export To Excel button, a new workbook will be created and will contain all the results of the list box to be further processed (for reporting purposes).
Demonstration video
Download it from here
Read also
Draw A Polyline In AutoCAD Using Excel VBA
AutoCAD – Calculate The Total Length Of Lines
AutoCAD – Total Length Of Lines Per Layer
Dhruvi,
Thank you for your nice comment.
It is great to hear that this small utility saved you so many hours.
Best Regards,
Christos
Thank you so much for providing this much good work. Please keep posting stuff like this.. 🙂 It saved my 8 hours of work and I am done with is in just half hour.
Hi, Marco,
Thank you for your kind words.
Regarding your question, you will find the answer here.
Best Regards,
Christos
Dear Christos,
I’m Marco, electrical engineer and reasearcher. I worked a lot with Excel and VBA but it’s the first time that I meet VBA for Autocad. In Excel I’ve made a very big energy tool that you can download here for free following the link down in the message.
I appreciated very much your work, and I’d like to make some upgrades to your software without commercial revenues. So, if you are interested to share your code in some form of collaboration, you can write me to the e-mail below.
Thank you very much.
Marco
Hi, qwerty,
This answer is here.
Best Regards,
Christos
Hi sir, can I have the password to open and view its vba codes please.
That’s great, thank you for your kind words!
Hi, Kern,
Have you installed the VBA in your AutoCAD?
Best Regards,
Christos
*.dvb I mean
I can not load my cad file because it says *.dvd file name from your video
Mr. Christos,
Thank you for the app. it works nicely.