Function Syntax: PLLengthByLayer Version: 1.0 Date: 20.06.2026 6:38:49PM N/A 📏 Function Syntax: PLLengthByLayer Version: 1.0 🚀 Command Type PLLengthByLayer in the AutoCAD command line to calculate total lightweight polyline length grouped by layer. 📘 SEO Optimized Description 📏 PLLengthByLayer is an AutoCAD AutoLISP length takeoff utility that scans all LWPOLYLINE objects in the active drawing and reports their total length by layer. 📊 The tool reads each polyline layer, calculates its length with ActiveX, totals the values per layer, and prints a clean command-line summary. 🧰 It is useful for CAD quantity checks, civil drafting reviews, road marking length totals, utility alignment measurements, layer audits, and AutoCAD production QA workflows. 📤 After the report is printed, the user can export the result to TXT or CSV in the current DWG folder. ✅ Functionalities 🔍 Drawing-wide scan - finds all lightweight polylines using ssget "_X". 🏷️ Layer detection - reads the layer name from every polyline entity. 📏 Length calculation - retrieves object length with vla-get-length. 📊 Grouped totals - accumulates the total length for each layer. 🔤 Alphabetical output - sorts layer names before printing the summary. 🧾 Command-line report - displays a readable table with layer and total length columns. 📤 TXT or CSV export - saves the layer-length table for documentation or Excel processing. 🔐 Unique filenames - uses LM:uniquefilename to avoid overwriting previous reports. 🧹 Safe file handling - closes the export file handle through the local error handler if a problem occurs. 🧩 Helper Functions 🧱 vl-string-pad-right formats the command-line table by padding layer names to a fixed width. 💾 LM:uniquefilename creates a safe export filename in the DWG folder. ✅ Practical Result The final result is a fast AutoCAD layer-based polyline length report for quantity takeoff, measurement verification, civil design checking, and project documentation. ⚠️ Important Note This routine processes only lightweight polylines, scans the full drawing, uses current drawing units, and writes exported numeric values with three decimal places.