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
Solved! Go to Solution.
Solved by jeff. Go to Solution.
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.
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.
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
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.
The only other thing I can think of is your "Annotation Plot Size" setting, is that correct?
After that, I'm out of ideas.
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”
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