Function Syntax: MLTOOLS / MLADDVERT / MLADDVERT_HANDLE / MLVERSION Version: 1.0 Date: 01.07.2026 10:33:18 Version: 1.1 Date: 01.07.2026 12:16:11PM N/A Description This program is an AutoCAD and Civil 3D .NET plugin used to inspect, preview, select, highlight, and modify existing MLeader objects. The main purpose of the tool is to let the user select an existing MLeader label and add or update an inflection vertex on the leader arrow line. The plugin works inside AutoCAD or Civil 3D after the DLL is loaded with NETLOAD. General workflow • The user loads the compiled DLL in AutoCAD or Civil 3D using NETLOAD. • The program displays its version and build stamp, for example 1.0.008_01.07.2026_09.12.41. • The user opens the modeless MLeader tool window. • The user clicks Pick MLeader and selects an existing MLeader object from the drawing. • The selected MLeader is highlighted in the AutoCAD viewport. • The tool reads the leader indexes, leader line indexes, vertex count, text location, and leader geometry. • The existing leader geometry is displayed in the preview panel. • The user can pick or define a new bend point. • The user clicks Update MLeader to apply the new inflection vertex to the selected MLeader. • The user can click Clear All to reset the form state, remove selected rows, clear the preview, and remove the viewport highlight. Functionalities • Selects an existing Autodesk.AutoCAD.DatabaseServices.MLeader object from the drawing. • Opens the selected MLeader for write access before editing it. • Reads the real leader index and leader line index instead of assuming index zero. • Reads the existing MLeader vertices and displays them in a grid. • Draws a 2D preview of the selected leader geometry in the form. • Uses a world-to-preview transform so the leader geometry fits inside the preview panel. • Highlights the selected MLeader in the AutoCAD viewport using Editor.SetImpliedSelection. • Updates the AutoCAD viewport after selection changes using Editor.UpdateScreen. • Adds a new inflection vertex by appending the old tail point and converting the previous tail into the new bend point. • Keeps the original end of the leader line stable after inserting the new bend point. • Allows the user to clear the current selection and pick another MLeader without restarting the command. • Uses a modeless WinForms dialog so the user can keep the form open while working in Model Space or Paper Space. • Uses a dark C3D-style interface with themed buttons, panels, preview area, grid, and command log. • Records command actions in a visible log panel. • Writes log entries with timestamps, level names, source names, and method descriptions. • Stores log files locally so previous tool behavior can be reviewed later. • Generates uniquely named NETLOAD DLL copies to avoid rebuilding into a DLL that AutoCAD is already locking. Important commands and buttons Pick MLeader selects a new MLeader object from the drawing and loads its leader data into the form. Update MLeader applies the new bend or inflection vertex to the currently selected MLeader. Clear All clears the grid, preview, selected object, selected point, current highlight, and current form state. MLVERSION reports the loaded plugin version, build stamp, and NETLOAD path. NETLOAD is the AutoCAD command used to load the generated DLL. How the MLeader update works • The program starts a transaction in the active AutoCAD database. • The selected object is opened as MLeader with write access. • The program calls GetLeaderIndexes to find the actual leader cluster. • The program calls GetLeaderLineIndexes to find the actual leader line. • The program calls VerticesCount to determine how many points already exist on the leader line. • The program gets the old last vertex so the original leader endpoint can be preserved. • The program calls AddLastVertex to duplicate the old tail point at the end of the leader line. • The program calls SetVertex to replace the previous tail point with the new inflection point. • The result is a leader line with one additional bend while keeping the original final endpoint. • The transaction is committed and the graphics are marked as modified. Viewport highlight behavior • When a row or selected MLeader changes, the corresponding AutoCAD object is highlighted in the drawing. • The highlight is performed with Editor.SetImpliedSelection. • The screen is refreshed with Editor.UpdateScreen. • When Clear All is used, the implied selection is cleared so the previous MLeader is no longer highlighted. • Before selecting a new label, the old highlight is cleared to avoid confusing the old object with the new one. Preview panel behavior • The preview panel does not use AutoCAD drawing APIs after the points are collected. • The program converts world coordinates into panel pixel coordinates. • The scale is calculated from the available panel width and height. • The preview keeps the leader geometry centered and visible. • The leader line is drawn with standard WinForms graphics drawing. • Important vertices are shown with visual markers so the user can recognize the bend points. User interface behavior • The form uses a dark Civil 3D-inspired theme. • The form uses SizableToolWindow so it stays compact and suitable for AutoCAD work. • The form is modeless, so the user can continue working in the drawing while it remains open. • Pressing Escape is intercepted so the form is not closed accidentally while the user works in the viewport. • The interface includes a header, toolbar, grid, preview panel, command log, and status area. • Important buttons use different colors based on their role. • Update actions use green styling because they perform the main positive operation. • Clear or destructive actions use red or dark red styling because they reset state or remove selection. • Informational actions use blue or orange styling because they show state, version, or command information. Logging behavior • The tool displays a live command log inside the form. • Each log entry includes the current time, severity level, component name, and action description. • Example log format is 05:29:43 [INFO] [PvSplitApi] SplitDataLines.Add(Double rawStation, Double datum). • Informational messages are used for normal selection, loading, preview, and update operations. • Warning messages are used when a selection is missing or an operation cannot continue. • Error messages are used when AutoCAD rejects the operation or the selected object cannot be edited. • Log files are stored locally so previous behavior can be inspected after the session. Build and loading behavior • The project targets x64 because AutoCAD, Civil 3D, and ObjectARX managed references are AMD64. • The project imports the Civil 3D and ObjectARX reference file from the user path. • Intermediate build files are redirected outside the OneDrive project folder to avoid Windows path-length issues. • Compile output and NETLOAD output are separated. • Each build creates a uniquely named DLL copy with a build stamp. • This avoids the common AutoCAD problem where a loaded DLL cannot be overwritten because AutoCAD keeps it locked. • The build prints the exact DLL path that should be loaded with NETLOAD. Important limitations • The selected object must be an MLeader. • The MLeader must be opened for write access before it can be modified. • The MLeader style must allow enough leader points for an additional vertex. • The tool must run on the AutoCAD main thread when highlighting objects in the viewport. • If AutoCAD already loaded a previous DLL, rebuilds must use the uniquely generated NETLOAD DLL path instead of overwriting the locked DLL. • If the selected leader has unusual geometry or no leader line indexes, the update operation cannot continue safely. Result This tool gives the user a controlled graphical workflow for editing MLeader arrow geometry without manually using grips in AutoCAD. It improves recognition of selected labels through viewport highlighting, improves confidence through the preview panel, and improves debugging through persistent command logging. The final result is an updated MLeader with an additional inflection vertex on the leader arrow line.