Short description
π MleaderStraight is an AutoCAD and Civil 3D AutoLISP utility for straightening selected MultiLeader leader lines into clean horizontal or vertical orthogonal segments.
π§ The tool includes a compact DCL chooser that can process either manually selected MLeader objects or every MultiLeader in the current Model/Paper space layout.
Command:
π Main command: MleaderStraightTools
π Selection mode: process preselected or interactively selected MULTILEADER objects.
π Current-space mode: process all MULTILEADER objects on the active CTAB layout using the 410 layout filter.
Description:
π MleaderStraight provides an SEO-friendly AutoCAD MLeader alignment workflow for CAD users who need cleaner annotation geometry, straighter leader lines, and more consistent Civil 3D drafting presentation.
π§© The routine reads the first leader-line vertices from each MULTILEADER, determines whether the leader is closer to a horizontal or vertical adjustment, and rewrites the leader vertices so the resulting segment is orthogonal.
π±οΈ A temporary embedded DCL dialog lets the user choose between interactive selection and all MultiLeaders in the current drawing space.
ποΈ The routine is ModelSpace and PaperSpace aware: it uses the active document space object for temporary construction geometry and uses CTAB to target the correct layout when processing all leaders.
Helper function: (if any)β
π§© rh:sammlung_n groups raw vertex coordinate lists into 3D point chunks.
π§© MleaderStraightTools:get-space-obj returns the active ModelSpace or PaperSpace VLA object.
π§© MleaderStraightTools:get-all-mleaders-current-space builds a selection set of all MULTILEADER entities on the current CTAB layout.
π§© MleaderStraightTools:process-ss performs the leader vertex recalculation, temporary XLINE construction, closest-point calculation, vertex update, and viewport regeneration.
π§© MleaderStraightTools:write-dcl-to-temp writes the embedded DCL definition to a temporary dialog file.
π§© The local *error* handler unloads the DCL and deletes the temporary DCL file on cancellation or error.
Functionalities:
β
Straighten MultiLeader leader geometry for cleaner AutoCAD annotation.
β
Choose between selected MLeader processing and all MLeaders in the current space.
β
Supports PICKFIRST preselection via ssget “_I” and manual selection via ssget.
β
Uses MULTILEADER filters to avoid processing unrelated entity types.
β
Creates a temporary construction XLINE only for geometric calculation and deletes it immediately after use.
β
Regenerates all viewports after processing so the updated leader geometry is visible.
Result:
π Selected MultiLeader objects are updated with cleaner orthogonal leader-line vertices.
π The command prints the number of processed MultiLeaders at the command line.
π§Ή Temporary DCL files and temporary XLINE objects are removed after processing.
Images, animations etc.
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="MleaderStraight">
<src:RibbonToolTip.ExpandedContent>
<StackPanel>
<TextBlock Background="AntiqueWhite" TextAlignment="Left">
<Bold>Function Syntax: MleaderStraightTools</Bold>
<LineBreak/>
<Bold>Version: 1 Date: 29.09.2025</Bold>
<LineBreak/>
<LineBreak/>
<Hyperlink>AI+https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-mleader-aligner-function-to-apply-to-all-mleaders-in/m-p/9062067#M83632</Hyperlink>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">Description</Run></Bold><LineBreak/>
<Run Foreground="White">π MleaderStraight is an AutoCAD and Civil 3D AutoLISP utility for straightening selected MultiLeader leader lines into clean horizontal or vertical orthogonal segments.</Run><LineBreak/>
<Run Foreground="LimeGreen">π§ The tool includes a compact DCL chooser that can process either manually selected MLeader objects or every MultiLeader in the current Model/Paper space layout.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">Function Syntax</Run></Bold><LineBreak/>
<Run Foreground="White">π Main command: MleaderStraightTools</Run><LineBreak/>
<Run Foreground="White">π Selection mode: process preselected or interactively selected MULTILEADER objects.</Run><LineBreak/>
<Run Foreground="White">π Current-space mode: process all MULTILEADER objects on the active CTAB layout using the 410 layout filter.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">SEO Optimized Overview</Run></Bold><LineBreak/>
<Run Foreground="White">π MleaderStraight provides an SEO-friendly AutoCAD MLeader alignment workflow for CAD users who need cleaner annotation geometry, straighter leader lines, and more consistent Civil 3D drafting presentation.</Run><LineBreak/>
<Run Foreground="White">π§© The routine reads the first leader-line vertices from each MULTILEADER, determines whether the leader is closer to a horizontal or vertical adjustment, and rewrites the leader vertices so the resulting segment is orthogonal.</Run><LineBreak/>
<Run Foreground="White">π±οΈ A temporary embedded DCL dialog lets the user choose between interactive selection and all MultiLeaders in the current drawing space.</Run><LineBreak/>
<Run Foreground="White">ποΈ The routine is ModelSpace and PaperSpace aware: it uses the active document space object for temporary construction geometry and uses CTAB to target the correct layout when processing all leaders.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="LimeGreen">Primary Workflow</Run></Bold><LineBreak/>
<Run Foreground="White">1οΈβ£ Load </Run><Bold><Run Foreground="Orange">MleaderStraight.lsp</Run></Bold><Run Foreground="White"> in AutoCAD or Civil 3D.</Run><LineBreak/>
<Run Foreground="White">2οΈβ£ Run the command listed above from the AutoCAD command line.</Run><LineBreak/>
<Run Foreground="White">3οΈβ£ Follow the prompts or DCL dialog options shown by the routine.</Run><LineBreak/>
<Run Foreground="White">4οΈβ£ Review the result in the drawing and use AutoCAD Undo if you need to revert the operation.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">Core Functionalities</Run></Bold><LineBreak/>
<Run Foreground="White">β
Straighten MultiLeader leader geometry for cleaner AutoCAD annotation.</Run><LineBreak/>
<Run Foreground="White">β
Choose between selected MLeader processing and all MLeaders in the current space.</Run><LineBreak/>
<Run Foreground="White">β
Supports PICKFIRST preselection via ssget "_I" and manual selection via ssget.</Run><LineBreak/>
<Run Foreground="White">β
Uses MULTILEADER filters to avoid processing unrelated entity types.</Run><LineBreak/>
<Run Foreground="White">β
Creates a temporary construction XLINE only for geometric calculation and deletes it immediately after use.</Run><LineBreak/>
<Run Foreground="White">β
Regenerates all viewports after processing so the updated leader geometry is visible.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">Important Helper Functions and AutoCAD API Calls</Run></Bold><LineBreak/>
<Run Foreground="White">π§© rh:sammlung_n groups raw vertex coordinate lists into 3D point chunks.</Run><LineBreak/>
<Run Foreground="White">π§© MleaderStraightTools:get-space-obj returns the active ModelSpace or PaperSpace VLA object.</Run><LineBreak/>
<Run Foreground="White">π§© MleaderStraightTools:get-all-mleaders-current-space builds a selection set of all MULTILEADER entities on the current CTAB layout.</Run><LineBreak/>
<Run Foreground="White">π§© MleaderStraightTools:process-ss performs the leader vertex recalculation, temporary XLINE construction, closest-point calculation, vertex update, and viewport regeneration.</Run><LineBreak/>
<Run Foreground="White">π§© MleaderStraightTools:write-dcl-to-temp writes the embedded DCL definition to a temporary dialog file.</Run><LineBreak/>
<Run Foreground="White">π§© The local *error* handler unloads the DCL and deletes the temporary DCL file on cancellation or error.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">Result</Run></Bold><LineBreak/>
<Run Foreground="White">π Selected MultiLeader objects are updated with cleaner orthogonal leader-line vertices.</Run><LineBreak/>
<Run Foreground="White">π The command prints the number of processed MultiLeaders at the command line.</Run><LineBreak/>
<Run Foreground="White">π§Ή Temporary DCL files and temporary XLINE objects are removed after processing.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DarkRed">Important Notes</Run></Bold><LineBreak/>
<Run Foreground="White">β οΈ The routine modifies existing MULTILEADER vertex geometry, so test on a copy of production drawings when validating a new annotation standard.</Run><LineBreak/>
<Run Foreground="White">β οΈ It processes leader line index 0 and is intended for standard MultiLeader objects; complex MLeader configurations with multiple leader branches may need separate review.</Run><LineBreak/>
<Run Foreground="White">π§ Best selection experience is obtained with PICKFIRST = 1 and PICKADD = 2, as noted in the source comments.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="Yellow">Tags</Run></Bold><LineBreak/>
<Run Foreground="Yellow">π·οΈ AutoCAD, π·οΈ AutoLISP, π·οΈ Civil 3D, π·οΈ MLeader, π·οΈ MultiLeader, π·οΈ Leader Alignment, π·οΈ MLeader Straighten, π·οΈ DCL Dialog, π·οΈ CAD Annotation, π·οΈ Drafting Automation</Run><LineBreak/>
</TextBlock>
<Grid>
<Image Source="PNG" Stretch="Uniform"/>
</Grid>
<Grid>
<MediaElement
Source="GIF"
Stretch="Uniform"
Visibility="Visible"/>
</Grid>
</StackPanel>
</src:RibbonToolTip.ExpandedContent>
</src:RibbonToolTip>
</ResourceDictionary>

Leave a Reply
You must be logged in to post a comment.