.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

annotative mleader problem

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
FRFR1586
1369 Views, 10 Replies

annotative mleader problem

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

 

10 REPLIES 10
Message 2 of 11
jshimkus
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. 

Message 3 of 11
JoAnn_Hogan
in reply to: jshimkus

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.

 

 

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

Jo - Ann
Twitter: @JoAnn_Hogan
Revit Architecture Certified Professional / Revit Structure Certified Professional / AutoCAD Certified Professional
Message 4 of 11
FRFR1586
in reply to: jshimkus

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

Message 5 of 11
jshimkus
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.

 

 

Message 6 of 11
FRFR1586
in reply to: jshimkus

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
Message 7 of 11
jshimkus
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.

Message 8 of 11
FRFR1586
in reply to: jshimkus

hi,

 

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

 

luc

Message 9 of 11
jshimkus
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”

Message 10 of 11
jeff
in reply to: jshimkus

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
Message 11 of 11
FRFR1586
in reply to: jeff

Thanks Jeff,

 

good solution

 

luc

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost