TotalLengthAreaDetailed_vs_01

Short description

Short description Calculates total length or area of selected objects, copies an Excel ready formula to the clipboard, and optionally places a formatted result as MText in AutoCAD using the current UCS.
totallengthareadetailed 000

Command:

Command name TotalLengthAreaDetailed

Description:

What it doesDialog choice Lets you choose between Length or Area, set Excel related options, and define decimal precision.Entity selection Prompts you to select relevant entities, then sums their geometric length or area depending on the chosen mode.Expression building Builds a term by term expression like v1+v2+v3 using the chosen decimal precision.Excel output Converts the expression to =expression or =ceiling(expression,5) according to the selected Excel options and copies it to the clipboard.MText creation If enabled, asks for an insertion point and creates MText in the current UCS reading either just the single value or the full expression with its total.

Helper function: (if any)​

Helper functionswriteLengthAreaDCL Dynamically writes the DCL file that defines the dialog with radio buttons, toggles, and precision edit box.radioLengthAreaDCL Loads the DCL, initializes default values, captures user choices, and stores them in global variables.copy-to-clipboard Uses a hidden htmlfile object to copy plain text or Excel formulas to the Windows clipboard.format-excel-expr Wraps the raw expression as =expression or =ceiling(expression,5) depending on the Excel and Excel ceiling toggles.insert-result-text Converts the picked point from UCS to WCS, then inserts MText containing either only the total (for one entity) or expression equals total (for multiple entities).TotalLengthDetailed Computes per entity length values, accumulates the total, builds the expression, calls helper functions, and prints a summary for length mode.TotalAreaDetailed Similar to TotalLengthDetailed but for area, using only suitable closed or area capable entities.

Functionalities:

Functional options in the dialogLength or Area Radio buttons to choose whether to sum linear lengths or areas.Excel When checked, the clipboard expression is prefixed with an equal sign for direct use in Excel.Excel ceiling When checked, wraps the expression in a ceiling call with step 5, overriding the simple Excel option.Place result in Acad When checked, prompts for an insertion point and creates MText showing the numeric result inside the drawing.Decimal precision Edit box where you specify the global number of decimal places used in expressions, MText, and command line output, default value is 2.

Result:

Result in practiceClipboard You can immediately paste an Excel compatible formula such as =ceiling(10.25+5.75,5) into a worksheet.Drawing annotation The routine optionally places a UCS aware MText label like 10.25+5.75=16.00 for multiple entities or just 16.00 when a single entity is selected.Feedback Command line messages display the summed length or area with the same configured precision.

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="TotalLengthAreaDetailed">
<src:RibbonToolTip.ExpandedContent>
<StackPanel>
<TextBlock Background="AntiqueWhite" TextAlignment="Left">
<Bold>Function Syntax: TotalLengthAreaDetailed</Bold>
<LineBreak/>
<Bold>Version: 1 Date: 07.07.2026 11:14:02AM</Bold>
<LineBreak/>
<Hyperlink>N/A</Hyperlink>
<LineBreak/>

<Bold><Run Foreground="DodgerBlue">🚀 Function Syntax: TotalLengthAreaDetailed</Run></Bold><LineBreak/>
<Bold><Run Foreground="Orange">Version: SEO-friendly description based on TotalLengthAreaDetailed v02</Run></Bold><LineBreak/>
<Hyperlink>N/A</Hyperlink><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">📘 SEO Optimized Description</Run></Bold><LineBreak/>
<Run Foreground="White">📏 TotalLengthAreaDetailed is an AutoCAD and Civil 3D AutoLISP quantity takeoff utility for calculating total length or total area from selected drawing entities.</Run><LineBreak/>
<Run Foreground="White">📐 The routine builds a detailed additive expression, copies the result to the clipboard, and can place the calculation directly in the drawing as UCS-aware MTEXT.</Run><LineBreak/>
<Run Foreground="LimeGreen">✅ This makes it useful for CAD measurement checks, BoQ preparation, Excel reporting, quantity summaries, cable route measurement, profile calculations, and drawing-based audit annotations.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">🧰 Main Command</Run></Bold><LineBreak/>
<Run Foreground="White">🚀 Run </Run><Bold><Run Foreground="Orange">TotalLengthAreaDetailed</Run></Bold><Run Foreground="White"> in the AutoCAD command line.</Run><LineBreak/>
<Run Foreground="White">The command opens a DCL dialog where the user chooses </Run><Bold><Run Foreground="Orange">Length</Run></Bold><Run Foreground="White"> or </Run><Bold><Run Foreground="Orange">Area</Run></Bold><Run Foreground="White"> and configures clipboard, Excel, CEILING, MTEXT, decimal, layer-label, and KK profile settings.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="LimeGreen">⚙️ User Workflow</Run></Bold><LineBreak/>
<Run Foreground="White">1️⃣ Start the command </Run><Bold><Run Foreground="Orange">C:TotalLengthAreaDetailed</Run></Bold><Run Foreground="White">.</Run><LineBreak/>
<Run Foreground="White">2️⃣ Select </Run><Bold><Run Foreground="Orange">Length</Run></Bold><Run Foreground="White"> or </Run><Bold><Run Foreground="Orange">Area</Run></Bold><Run Foreground="White"> in the dialog.</Run><LineBreak/>
<Run Foreground="White">3️⃣ Configure Excel formula output, CEILING rounding, decimal precision, ceiling step, AutoCAD MTEXT placement, and result label mode.</Run><LineBreak/>
<Run Foreground="White">4️⃣ Select supported entities in the drawing.</Run><LineBreak/>
<Run Foreground="White">5️⃣ Optionally pick a UCS-aware insertion point for the drawing result text.</Run><LineBreak/>
<Run Foreground="White">6️⃣ Use the clipboard expression in Excel or keep the placed MTEXT annotation in AutoCAD.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="LimeGreen">📏 Length Mode</Run></Bold><LineBreak/>
<Run Foreground="White">📌 Supported length objects include </Run><Bold><Run Foreground="Orange">LINE</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">, </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">ELLIPSE</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">SPLINE</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">MLINE</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">REGION</Run></Bold><Run Foreground="White">, and </Run><Bold><Run Foreground="Orange">MPOLYGON</Run></Bold><Run Foreground="White">.</Run><LineBreak/>
<Run Foreground="White">🔗 Where possible, the MTEXT result uses dynamic AutoCAD fields for properties such as Length, ArcLength, Circumference, and Perimeter.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="LimeGreen">📐 Area Mode</Run></Bold><LineBreak/>
<Run Foreground="White">📌 Supported area objects include closed polylines, circles, ellipses, regions, hatches, and mpolygons.</Run><LineBreak/>
<Run Foreground="White">🔒 Open polylines do not contribute to area because the routine checks closed state before using polyline area.</Run><LineBreak/>
<Run Foreground="White">🔗 Where possible, the MTEXT result uses dynamic AutoCAD Area fields linked to the selected objects.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="LimeGreen">🧮 KK Profile Workflow</Run></Bold><LineBreak/>
<Run Foreground="White">🟧 The dialog includes KK profile presets: </Run><Bold><Run Foreground="Orange">KK Gr. I i.F_220X275</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">KK Gr. II i.F_400X275</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">KK Gr. IIIa i.F_515X275</Run></Bold><Run Foreground="White">, and </Run><Bold><Run Foreground="Orange">KK Gr. IV i.F_700X285</Run></Bold><Run Foreground="White">.</Run><LineBreak/>
<Run Foreground="White">📊 When a KK profile is selected in Area mode, the expression is converted into a profile-width formula such as </Run><Bold><Run Foreground="Orange">(A+B+C)/0.4</Run></Bold><Run Foreground="White"> before Excel CEILING output is applied.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="LimeGreen">📋 Clipboard and Excel Output</Run></Bold><LineBreak/>
<Run Foreground="White">📤 Base clipboard output is an additive expression such as </Run><Bold><Run Foreground="Orange">1.25+3.50+2.00</Run></Bold><Run Foreground="White">.</Run><LineBreak/>
<Run Foreground="White">🧾 Excel mode outputs </Run><Bold><Run Foreground="Orange">=expression</Run></Bold><Run Foreground="White">.</Run><LineBreak/>
<Run Foreground="White">🔢 Excel ceiling mode outputs </Run><Bold><Run Foreground="Orange">=CEILING(expression,step)</Run></Bold><Run Foreground="White"> and has priority over the normal Excel toggle.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="LimeGreen">📝 AutoCAD MTEXT Result</Run></Bold><LineBreak/>
<Run Foreground="White">📌 The insertion point is transformed from UCS to WCS, so the annotation is placed correctly in custom UCS workflows.</Run><LineBreak/>
<Run Foreground="White">🏷️ Version 02 places the MTEXT on the first selected entity layer and uses that same selected layer name in the </Run><Bold><Run Foreground="Orange">Length_Layer</Run></Bold><Run Foreground="White"> or </Run><Bold><Run Foreground="Orange">Area_Layer</Run></Bold><Run Foreground="White"> label.</Run><LineBreak/>
<Run Foreground="White">🔄 Supported objects can generate dynamic field text, while unsupported field-readable properties fall back to fixed numeric values.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="LimeGreen">💾 Saved Settings</Run></Bold><LineBreak/>
<Run Foreground="White">🧠 The tool stores dialog preferences using environment variables such as </Run><Bold><Run Foreground="Orange">CTC_LAST_OPTION</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">CTC_EXCEL</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">CTC_EXCEL_CEILING</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">CTC_PLACE_ACAD</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">CTC_PREC</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">CTC_CEIL_STEP</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">CTC_RES_MODE</Run></Bold><Run Foreground="White">, and </Run><Bold><Run Foreground="Orange">CTC_KK_PROFILE</Run></Bold><Run Foreground="White">.</Run><LineBreak/>
<Run Foreground="White">🔁 The next run opens with the last-used options, which speeds up repetitive CAD quantity takeoff workflows.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">✅ Practical Result</Run></Bold><LineBreak/>
<Run Foreground="White">✅ TotalLengthAreaDetailed creates a reliable bridge between AutoCAD geometry, Civil 3D production drawings, Excel quantity formulas, and annotated drawing results.</Run><LineBreak/>
<Run Foreground="LimeGreen">🚀 The final workflow is faster measurement review, cleaner quantity documentation, better CAD audit trails, and more efficient BoQ preparation.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DarkRed">⚠️ Important Notes</Run></Bold><LineBreak/>
<Run Foreground="White">⚠️ Objects outside the command selection filters are not measured.</Run><LineBreak/>
<Run Foreground="White">⚠️ Dynamic field output depends on object property support inside AutoCAD.</Run><LineBreak/>
<Run Foreground="White">⚠️ Clipboard export depends on COM availability for the </Run><Bold><Run Foreground="Orange">htmlfile</Run></Bold><Run Foreground="White"> clipboard method.</Run><LineBreak/>
<Run Foreground="White">⚠️ In Area mode, zero-area or open-polyline contributions are excluded from the additive expression.</Run><LineBreak/>



</TextBlock>
            
<Grid>
<Image Source="Image_000.jpg" Stretch="Uniform"/>
</Grid>

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

Additional info:

Share this page:

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