.NET

Reply
Contributor
FRFR1586
Posts: 11
Registered: ‎01-20-2014
Message 1 of 11 (314 Views)
Accepted Solution

annotative mleader problem

314 Views, 10 Replies
02-04-2014 09:50 AM

Hi everybody,

 

I have a problem about mtext textheight inside annotative mleader.

 

my software create a mleader object in the model space , this mleader use a mtext object

 

the mtext use the default textstyle

 

if , then creating the leader, the annotative scale of the model space is not 1:1 ,

the mtext textheight is autatcly divided by the annotative scale

(for example : original textheight=2.5, annotative scale=20 , after insertion the textheight is 0.125, exactly 2.5/20)

 

How can I create my mleader the the desired textheight ?

 

joined , you can find a sample of my project

 

regards

 

Luc

 

Valued Contributor
CommCorp
Posts: 97
Registered: ‎03-19-2007
Message 2 of 11 (305 Views)

Re: annotative mleader problem

02-04-2014 10:51 AM in reply to: FRFR1586

I just went through adding mleaders myself and i think i can offer some suggestions.

 

Instead of "mText.Height = 30" try "mText.TextHeight = 30". I fell for that same trick and i think this will fix your problem.

 

Also, I had to attach the mtext to the mleader AFTER the mleader had been added to the modelspace, but this may have nothing to do with your issue. 

Distinguished Mentor
JoAnn_Hogan
Posts: 527
Registered: ‎06-25-2012
Message 3 of 11 (297 Views)

Re: annotative mleader problem

02-04-2014 11:37 AM in reply to: CommCorp

HI There,

 

The idea of using annotative text is for viewports. Now if your text height in Model Space is for example 3mm, and you have 4 viewports with different scales, your text height in paper space will remain 3mm even if you have different scales.

 

 

Please let me know if this helps
Jo (P.S follow me on twitter @JoAnn_Hogan)

If this post solved your issue please mark as solved and Kudos are always welcome =)

AutoCAD Certified Professional 2014 / Inventor Certified Professional 2014
Contributor
FRFR1586
Posts: 11
Registered: ‎01-20-2014
Message 4 of 11 (276 Views)

Re: annotative mleader problem

02-04-2014 11:46 PM in reply to: CommCorp

Hi,

 

this don't solve the problem

 

the result is the same then adding then mtext.textheight=2.5 line

 

an other idea ?

 

regards

 

luc

Valued Contributor
CommCorp
Posts: 97
Registered: ‎03-19-2007
Message 5 of 11 (261 Views)

Re: annotative mleader problem

02-05-2014 04:21 AM in reply to: FRFR1586

Is the code you attached working?

I ask because I see that you did not AppendEntity or AddNewlyCreatedDBObject your mtext object.

I tried that in my code and it would not run.

 

I attached what I did, hopefully it will help.

 

 

Contributor
FRFR1586
Posts: 11
Registered: ‎01-20-2014
Message 6 of 11 (247 Views)

Re: annotative mleader problem

02-05-2014 11:57 PM in reply to: CommCorp
hi,

my code is working (expect the text height problem)

I'm working with the 2014 autocad version

while testing your code , I have then same size problem

Have you tested your solution in my sample case ?

regards

Luc
Valued Contributor
CommCorp
Posts: 97
Registered: ‎03-19-2007
Message 7 of 11 (239 Views)

Re: annotative mleader problem

02-06-2014 03:35 AM in reply to: FRFR1586

The only other thing I can think of is your "Annotation Plot Size" setting, is that correct?

 

After that, I'm out of ideas.

Contributor
FRFR1586
Posts: 11
Registered: ‎01-20-2014
Message 8 of 11 (207 Views)

Re: annotative mleader problem

02-11-2014 04:49 AM in reply to: CommCorp

hi,

 

I don't know how to verify Annotation Plot Size in vanilla autocad

 

luc

Valued Contributor
CommCorp
Posts: 97
Registered: ‎03-19-2007
Message 9 of 11 (191 Views)

Re: annotative mleader problem

02-11-2014 07:45 AM in reply to: FRFR1586

On command line type “units”

A dialog box should open, go to the “Scale” tab and “Annotation Plot Size:” is at the top right.

Ours is set to 3/32”

Valued Mentor
jeff
Posts: 325
Registered: ‎05-12-2009
Message 10 of 11 (185 Views)

Re: annotative mleader problem

02-11-2014 08:08 AM in reply to: CommCorp

The mleader just uses the contents of the mtext or just just copies the contents.

To set the hieght use MLeader.TextHeight Property

 

Normally set it from its MleaderStyle.TextHeight

 Leader.TextHeight = 30

 instead of

mText.Height or TextHeight

        <CommandMethod("TST_L", CommandFlags.Modal)> _
        Public Sub TST_L()
            Dim Doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
            Dim ed As Editor = Doc.Editor
            Dim db As Database = ed.Document.Database
            Dim Dl As Autodesk.AutoCAD.ApplicationServices.DocumentLock = Doc.LockDocument(Autodesk.AutoCAD.ApplicationServices.DocumentLockMode.ProtectedAutoWrite, "", "", False)
            Using Dl
                Dim tr As Transaction = db.TransactionManager.StartTransaction()
                Dim btr As BlockTableRecord = DirectCast(tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite), BlockTableRecord)

                Dim PtFleche As New Point3d(0, 0, 0)
                Dim PtFleche2 As New Point3d(PtFleche.X + 4, PtFleche.Y + 4, PtFleche.Z)
                Dim PtTexte As New Point3d(PtFleche.X + 8, PtFleche.Y + 6, PtFleche.Z)


              

                Dim Leader As New MLeader
                Leader.SetDatabaseDefaults()
                Leader.ContentType = ContentType.MTextContent
                'Leader.LayerId = CalqId


                Leader.ArrowSize = 2.0
                Leader.EnableDogleg = False
                Dim idx As Integer = Leader.AddLeaderLine(PtFleche2)
                Leader.AddFirstVertex(idx, PtFleche)
                Leader.Annotative = AnnotativeStates.True

                btr.AppendEntity(Leader)
                tr.AddNewlyCreatedDBObject(Leader, True)


                Using mText As New MText()
                    mText.Contents = "MyTexte"
                    Leader.MText = mText
                End Using
                Leader.TextHeight = 30
                'Dim mlstyle As MLeaderStyle = Leader.MLeaderStyle.GetObject(OpenMode.ForRead)
                'Leader.TextHeight = mlstyle.TextHeight
            

                tr.Commit()
            End Using

            MsgBox("now change the annotation scale to 20 (for exemple)" & vbCrLf & _
                    "then restart the tst_l command" & vbCrLf & vbCrLf & _
                    "then look at the text height of the new leader" & vbCrLf & _
                    "it is le 20th of the previous one")
        End Sub

 

 

 

 

 

 

You can also find your answers @ TheSwamp

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community