Associative MLeader using .NET

Associative MLeader using .NET

Anonymous
Not applicable
2,747 Views
12 Replies
Message 1 of 13

Associative MLeader using .NET

Anonymous
Not applicable
Is it possible to do associative mleader using the .NET api - I couldn't
find any wrapper classes for the required AcDb* classes (AcDbMLeader,
e.g.). Any help much is appreciated. Thanks!

Gagan
0 Likes
2,748 Views
12 Replies
Replies (12)
Message 2 of 13

Anonymous
Not applicable
I found this post on Kean's blog helpful.

http://through-the-interface.typepad.com/through_the_interface/2007/09/creating-an-aut.html
0 Likes
Message 3 of 13

Anonymous
Not applicable
todavew91 wrote:
> I found this post on Kean's blog helpful.
>
> http://through-the-interface.typepad.com/through_the_interface/2007/09/creating-an-aut.html

Thank you, I will take a look.

-Gagan
0 Likes
Message 4 of 13

Sinc
Advisor
Advisor
I'm having a ton of issues trying to create MLeaders via the API.

Through lots of trial and error, I've mostly figured out the order I must create items in order to get it to work. But I'm still having some issues I can't solve. One of those issues is that I can't seem to create an MLeader that has the leader coming out of the right side of the text. How do I do that?

When I look at that post by Kean, he gets an MLeader that has leaders coming out of both sides of the text. However, when I copy-and-paste his code and try to run it, I get all leaders coming out the left side only, as shown in the attached image.

After creating the leader, if I select it and drag the text a miniscule amount, it "refreshes" the MLeader, and I get MLeaders coming out of both sides. But no matter what I try, I can't get leaders coming out the right side when I createe MLeaders via the API.

Any help is greatly appreciated - this MLeader API is killing me.

-- Sinc
http://ejsurveying.com
http://www.quux.biz
http://sincpac3d.com
Sinc
0 Likes
Message 5 of 13

Sinc
Advisor
Advisor
...and attached here, is an image of what happens if I select the MLeader text, and drag it a miniscule amount.

At this point, it switches to something like in the image Kean posted. But why don't I get the same result as him when I run his unmodified code?
Sinc
0 Likes
Message 6 of 13

Anonymous
Not applicable
Getting to the bottom of your issue would involve some effort I'm afraid, so without working code to test, I'm not in a position to offer much help.

The behavior you describe might suggest that you should set the coordinates for the text and leader last, as doing that *might* be what's triggering the recalculation that gives the desired result.

Also (I don't know if this has any relevance), see the thread titled 'mleader text attachment' in this newsgroup.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

wrote in message news:5974072@discussion.autodesk.com...
I'm having a ton of issues trying to create MLeaders via the API.

Through lots of trial and error, I've mostly figured out the order I must create items in order to get it to work. But I'm still having some issues I can't solve. One of those issues is that I can't seem to create an MLeader that has the leader coming out of the right side of the text. How do I do that?

When I look at that post by Kean, he gets an MLeader that has leaders coming out of both sides of the text. Howeve
r, when I copy-and-paste his code and try to run it, I get all leaders coming out the left side only, as shown in the attached image.

After creating the leader, if I select it and drag the text a miniscule amount, it "refreshes" the MLeader, and I get MLeaders coming out of both sides. But no matter what I try, I can't get leaders coming out the right side when I createe MLeaders via the API.

Any help is greatly appreciated - this MLeader API is killing me.

-- Sinc
http://ejsurve
ying.com
http://www.quux.biz
http://sincpac3d.com
0 Likes
Message 7 of 13

Sinc
Advisor
Advisor
I am using the code copy-and-pasted from Kean's Blog entry, with absolutely no changes.
Sinc
0 Likes
Message 8 of 13

Sinc
Advisor
Advisor
Oh, and since you didn't seem to already know that, you must not be reading this newsgroup via the website. Otherwise, you would know I was replying to a post that contained a link.

Here's the link:

http://through-the-interface.typepad.com/through_the_interface/2007/09/creating-an-aut.html
Sinc
0 Likes
Message 9 of 13

Sinc
Advisor
Advisor
Just to see if something in our template or style settings might be having any effect, I tried starting a new drawing from Autodesk's standard NCS template, using the Standard MLeader style in that template.

I get the same results - all leaders come out of the left side of the text. That's running Kean's code, unmodified, on a new drawing created from the NCS template.
Sinc
0 Likes
Message 10 of 13

Anonymous
Not applicable
I'll see if I can get the right attachment later on today, but if Kean's solution isn't working the way he says it should, he typically welcomes comments.
0 Likes
Message 11 of 13

Sinc
Advisor
Advisor
Well, as an interesting data point, if I try to run Kean's code in Civil-3D 2008, I get the same results that he does. It's only when I try to run it in Civil-3D 2009 that the leaders only come out the left side.
Sinc
0 Likes
Message 12 of 13

Sinc
Advisor
Advisor
Sure enough, Kean had the answer.

The MLeader works differently in the 2009 series of products. Include this line as the last step, after creating the MLeader and just before committing the transaction:

mld.MoveMLeader(new Vector3d(), MoveType.MoveAllPoints);

Since it uses a 0 vector, this doesn't actually move the MLeader, but it forces the geometry to be recalculated.
Sinc
Message 13 of 13

Anonymous
Not applicable
Good to hear the resolution.