MleaderStraight

Short description

  • MLeader Perp Align + DCL chooser (Model or Paper space aware)
  • Aligns MLeader landing by projecting the first vertex to a perpendicular reference through the end vertex
  • Scope chooser: interactive selection or all MLeaders in current space/layout
  • Works in ModelSpace or PaperSpace based on current active space

Command:

  • MleaderStraightTools

Description:

  • Displays a small DCL dialog to choose processing scope: select MLeaders interactively or process all MLeaders in the current space.
  • Detects whether you are in ModelSpace or PaperSpace and uses the corresponding VLA space object for temporary geometry and updates.
  • For each MLeader, reads leader vertices, computes an orthogonal alignment reference through the end point, then resets the leader line vertices to straighten/perpendicularly align the leader segment.
  • Regenerates viewports and reports how many MultiLeaders were processed.

Helper function: (if any)​

  • rh:sammlung_n — groups a flat list into chunks of N (used to convert vertex arrays into 3D point lists).
  • MleaderStraightTools:get-space-obj — returns the active VLA space object: ModelSpace if ActiveSpace is model, otherwise PaperSpace.
  • MleaderStraightTools:get-all-mleaders-current-space — builds a selection set of all MULTILEADER objects in the current space/layout using group code 410 = current CTAB name.
  • MleaderStraightTools:write-dcl-to-temp — writes embedded DCL text to a temporary .dcl file and returns the file path for loading.

Functionalities:

  • DCL scope chooser — dialog offers Select MLeaders interactively (default) or All MLeaders in current space.
  • Interactive selection — attempts preselection with ssget "_I"; if none, prompts user to select MLeaders and finish with Enter; supports typical add/remove behavior depending on selection settings.
  • All-in-space selection — uses a global filter ssget "_X" restricted to current CTAB to process all MLeaders on that space/layout.
  • Per-MLeader vertex read — reads leader vertices via GetLeaderLineVertices for leader index 0, groups into 3D points, and uses the first two points as begin/end reference.
  • Choose perpendicular reference — compares ΔX vs ΔY between begin/end to decide whether to create a vertical or horizontal XLINE through the end point.
  • Project begin point — finds closest point from the begin point to that XLINE (perpendicular projection), then deletes the XLINE.
  • Rewrite leader vertices — updates leader line vertices to a two-point list (b_pt r_pt) using SetLeaderLineVertices for leader index 0.
  • Regen + report — calls Regen and prints processed count; prints “Nothing to process” if selection set is empty.
  • Robust cleanup — custom *error* handler unloads dialog, deletes temp DCL file, and reports non-cancel errors.

Result:

  • MLeaders are adjusted so the leader segment is “straightened” by projecting the begin vertex to a perpendicular reference line through the end vertex (horizontal or vertical, chosen automatically).
  • You can run the command in either ModelSpace or PaperSpace; the routine uses the current active space and can process either a chosen set or all MLeaders in the current layout/space.
  • After processing, the drawing regenerates and the command prints how many MultiLeaders were processed, or indicates nothing was found/canceled.

Images, animations etc.

Pixel

Additional info:

Share this page:

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Tags: Dimnesions, Leader
0
Would love your thoughts, please comment.x
()
x