TotalLengthPolyline

Short description

📏 TotalLengthPolyline is an AutoCAD AutoLISP utility for calculating the total length of selected drawing objects with the TLEN command. It supports lines, arcs, circles, splines, polylines, lightweight polylines, and ellipses, then displays the combined length in an AutoCAD alert box.

Command:

TLEN

Description:

🚀 TotalLengthPolyline provides a fast AutoCAD length takeoff workflow for CAD drafting, Civil 3D production drawings, quantity checks, and geometry verification.

📐 The TLEN command prompts the user to select drawing entities, scans every selected object, calculates a length contribution for each supported type, sums the values, and reports the final total length in the current drawing units.

🔍 Lines are measured with point-to-point distance, arcs are calculated from radius and angle, and closed or curve-based entities such as circles, splines, polylines, lightweight polylines, and ellipses are processed through AutoCAD perimeter evaluation using the AREA command object option.

📊 The result is displayed in a simple AutoCAD alert window, making the routine useful when the user needs a quick total length check without tables, dialogs, Excel export, or MTEXT placement.

Helper function: (if any)​

🧩 C:TLEN – Main AutoCAD command definition for selection, length calculation, total summation, and result display.
📌 ssget – Collects the user selection set.
📐 distance – Calculates LINE entity length from start point to end point.
🔢 getvar perimeter – Reads the perimeter result after using the AutoCAD AREA command object option.
📝 rtos – Formats the final total length for the AutoCAD alert message.

Functionalities:

📏 Calculates total length from a user-selected set of AutoCAD objects.
🧱 Supports LINE, ARC, CIRCLE, SPLINE, POLYLINE, LWPOLYLINE, and ELLIPSE entities.
📐 Uses direct geometric distance calculation for LINE objects.
🟠 Computes ARC length from radius and angular span.
🔄 Uses AutoCAD AREA object mode to retrieve perimeter values for circles, splines, polylines, lightweight polylines, and ellipses.
➕ Adds every valid entity contribution into one final total.
📢 Displays the result in an AutoCAD alert window.
🧰 Works as a lightweight command-line utility without a DCL dialog or external files.

Result:

✅ The final result is a quick total length report for all supported selected objects. After running TLEN and selecting objects, AutoCAD displays an alert similar to: Total length of selected objects is 123.45.

Images, animations etc.

Pixel

XAML code:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:src="clr-namespace:Autodesk.Windows;assembly=AdWindows">
    
    <src:RibbonToolTip x:Key="TotalLengthPolyline">
        <src:RibbonToolTip.ExpandedContent>
            <StackPanel>
                <TextBlock Background="AntiqueWhite" TextAlignment="Left">
				<Bold>Function Syntax: tlen</Bold>
				<LineBreak/>
				<Hyperlink>https://gist.github.com/kevinluo201/51450de14f63382c046c6d840bb42c96</Hyperlink>
				<LineBreak/>
<Bold><Run Foreground="DodgerBlue">📏 Description</Run></Bold><LineBreak/>
<Run Foreground="White">This AutoLISP program </Run><Bold><Run Foreground="Orange">TLEN</Run></Bold><Run Foreground="White"> calculates and reports the total length of selected AutoCAD drawing objects.</Run><LineBreak/>
<Run Foreground="LimeGreen">It provides a fast AutoCAD length takeoff workflow for CAD drafting, Civil 3D production checks, quantity verification, and geometry measurement.</Run><LineBreak/>
<Run Foreground="White">The result is displayed in an AutoCAD alert window using the current drawing units.</Run><LineBreak/>
<LineBreak/>

<Bold><Run Foreground="DodgerBlue">🚀 Main Command</Run></Bold><LineBreak/>
<Run Foreground="White">Run </Run><Bold><Run Foreground="Orange">TLEN</Run></Bold><Run Foreground="White"> in the AutoCAD command line, select the objects to measure, press Enter, and review the total length result.</Run><LineBreak/>
<LineBreak/>

<Bold><Run Foreground="DodgerBlue">🔍 SEO Optimized Description</Run></Bold><LineBreak/>
<Run Foreground="White">📏 </Run><Bold><Run Foreground="LimeGreen">TotalLengthPolyline</Run></Bold><Run Foreground="White"> is an AutoCAD AutoLISP total length calculator for selected drawing geometry.</Run><LineBreak/>
<Run Foreground="White">📐 The routine measures supported entities such as </Run><Bold><Run Foreground="Orange">LINE</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">ARC</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">CIRCLE</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">SPLINE</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">POLYLINE</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">LWPOLYLINE</Run></Bold><Run Foreground="White">, and </Run><Bold><Run Foreground="Orange">ELLIPSE</Run></Bold><Run Foreground="White"> objects.</Run><LineBreak/>
<Run Foreground="White">📊 It is useful for CAD quantity checks, road and utility drafting, polyline length verification, perimeter checking, and quick production measurements inside AutoCAD and Civil 3D.</Run><LineBreak/>
<LineBreak/>

<Bold><Run Foreground="LimeGreen">⚙️ Functionalities</Run></Bold><LineBreak/>
<Run Foreground="White">• 📌 Prompts the user to select objects to measure with </Run><Bold><Run Foreground="Orange">ssget</Run></Bold><Run Foreground="White">.</Run><LineBreak/>
<Run Foreground="White">• 📐 Computes lengths for </Run><Bold><Run Foreground="Orange">LINE</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">ARC</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">CIRCLE</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">SPLINE</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">POLYLINE</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">LWPOLYLINE</Run></Bold><Run Foreground="White">, and </Run><Bold><Run Foreground="Orange">ELLIPSE</Run></Bold><Run Foreground="White">.</Run><LineBreak/>
<Run Foreground="White">• 📏 Uses geometric point-to-point calculation for line objects with </Run><Bold><Run Foreground="Orange">distance</Run></Bold><Run Foreground="White">.</Run><LineBreak/>
<Run Foreground="White">• 🟠 Calculates arc length from radius and angular span.</Run><LineBreak/>
<Run Foreground="White">• 🔄 For closed or curve-based objects, retrieves perimeter using the AutoCAD </Run><Bold><Run Foreground="Orange">AREA</Run></Bold><Run Foreground="White"> command with the object option.</Run><LineBreak/>
<Run Foreground="White">• ➕ Sums the lengths of all valid selected objects into one final total.</Run><LineBreak/>
<Run Foreground="White">• 📢 Displays the total length in current drawing units via an AutoCAD alert box.</Run><LineBreak/>
<LineBreak/>

<Bold><Run Foreground="DodgerBlue">🧩 Important Commands and Variables</Run></Bold><LineBreak/>
<Run Foreground="White">• </Run><Bold><Run Foreground="Orange">TLEN</Run></Bold><Run Foreground="White"> - Main command to execute the total length calculation.</Run><LineBreak/>
<Run Foreground="White">• </Run><Bold><Run Foreground="Orange">ssget</Run></Bold><Run Foreground="White"> - Gathers the selection set.</Run><LineBreak/>
<Run Foreground="White">• </Run><Bold><Run Foreground="Orange">distance</Run></Bold><Run Foreground="White"> - Calculates line segment length.</Run><LineBreak/>
<Run Foreground="White">• </Run><Bold><Run Foreground="Orange">getvar perimeter</Run></Bold><Run Foreground="White"> - Retrieves the perimeter for supported curve and closed objects.</Run><LineBreak/>
<Run Foreground="White">• </Run><Bold><Run Foreground="Orange">rtos</Run></Bold><Run Foreground="White"> - Formats the total length for display.</Run><LineBreak/>
<LineBreak/>

<Bold><Run Foreground="DodgerBlue">📝 Function Syntax</Run></Bold><LineBreak/>
<Bold><Run Foreground="Orange">TLEN</Run></Bold><LineBreak/>
<LineBreak/>

<Bold><Run Foreground="DodgerBlue">✅ Typical Workflow</Run></Bold><LineBreak/>
<Run Foreground="White">Type </Run><Bold><Run Foreground="Orange">TLEN</Run></Bold><Run Foreground="White">, select multiple supported objects, press Enter, and view the total length displayed in an alert box.</Run><LineBreak/>
<LineBreak/>

<Bold><Run Foreground="DarkRed">⚠️ Important Notes</Run></Bold><LineBreak/>
<Run Foreground="White">Objects outside the supported entity list are ignored with a zero length contribution.</Run><LineBreak/>
<Run Foreground="White">The command reports the result in current AutoCAD drawing units.</Run><LineBreak/>
<Run Foreground="White">The tool displays the result only in an alert box. It does not insert MTEXT, export to Excel, create a table, or copy the result to the clipboard.</Run><LineBreak/>


</TextBlock>
                
                <!-- Use MediaElement for GIF (static first frame) and Image as fallback -->


            </StackPanel>
        </src:RibbonToolTip.ExpandedContent>
    </src:RibbonToolTip>
</ResourceDictionary>

Share this page:

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Tags: 🏷️ Autocad Lisps, 🏷️ BoQ, 🏷️ BoQ_menu, 🏷️ Length
0
Would love your thoughts, please comment.x
()
x