We previously created a MultiLeader (MLeader) jig to demonstrate how to jig the arrow header location and the standing point for the MText. The jig also dynamically collected the text content during the jigging process instead of statically outside of the jig itself.
The MultiLeader (MLeader) jig works well enough. UCS was perfectly honored; code concise enough; and performance good. However, there were some implications in the jig implementation, which we didn’t elaborate last time. In this post, let’s discuss about them in a bit detail.
The MLeader class has some methods handling its vertices such as SetFirstVertex(), SetLasttVertex(), AddFirstVertex(), AddLasttVertex(), RemoveFirstVertex(), and RemoveLasttVertex(). It is obvious that after a leader line is created by the MLeader.AddLeaderLine() call, we can change the leader line end points with the SetFirstVertex() and the SetLastVertex(). The interesting thing about the MLeader.AddLeaderLine(…) call is that it accepts a point argument, but whether it is the first or last vertex of the leader line depends on circumstances.
Another tricky part is the MText object and pointer. After the newly created MText object is assigned to the MLeader, the MText content cannot be updated automatically. That explains why we have to recreate the MText and reassign the pointer to the MLeader after the text content has finally been collected.
In order for the JigPrompts.AcquireString to function well, the UserInputControls.AcceptOtherInputString needs to be specified; otherwise, AutoCAD would interpret the input as point, which looked pretty odd.
The behavior of our MultiLeader (MLeader) jig is still a bit different than the default of the AutoCAD MLeader command, mostly about the text content input. The AutoCAD one accepts multiple line text input, but due to the limitation of the JigPrompts.AcquireString(), the jig can only accept a single line of text. It may indicate that the JigPrompts needs to provide another method, e.g. AcquireMLineString(). Not sure though if the new line escape characters such as “\n” work or not. Please feel free to give it a try if interested in.
The MLeader itself seems to have more implications that are waiting to be found out. Some other articles may be posted in the future to address those. Some other jigs about the MLeader may also be provided. Please stay tuned.
If you find the article, code, or any wizards/coders/widgets or AcadNetAddinWizardPro, please kindly make a donation.
Recent Comments