Does anyone know how to set the overall scale of a multileader? I have set the .Scale property, but that seems to have done nothing.
MleaderStyle.Annotative = AnnotativeStates.False MleaderStyle.LeaderLineType = LeaderType.StraightLeader MleaderStyle.ArrowSize = Me.ArrowHeadSize MleaderStyle.BreakSize = Me.DimensionBreak MleaderStyle.DoglegLength = Me.LandingLength MleaderStyle.EnableLanding = True MleaderStyle.EnableDogleg = True MleaderStyle.EnableFrameText = False MleaderStyle.LandingGap = 2 MleaderStyle.MaxLeaderSegmentsPoints = 50 MleaderStyle.DrawMLeaderOrderType = DrawMLeaderOrderType.DrawLeaderFirst MleaderStyle.LeaderLineColor = Me.LeaderColour '' Text Settings MleaderStyle.ContentType = Autodesk.AutoCAD.DatabaseServices.ContentType.MTex
tContent MleaderStyle.TextHeight = 2.5 MleaderStyle.TextAlignAlwaysLeft = True MleaderStyle.TextAttachmentType = TextAttachmentType.AttachmentMiddleOfTop MleaderStyle.TextAlignmentType = TextAlignmentType.LeftAlignment MleaderStyle.TextColor = Color.FromColorIndex(ColorMethod.ByPen, CShort(Project.DimensionTextColour)) MleaderStyle.Scale = 50 MleaderStyle.PostMLeaderStyleToDb(db, "50m") tr.AddNewlyCreatedDBObject(MleaderStyle, True)
Everything else works, but the overall scale is always 1.
Solved! Go to Solution.
Is your code changing an actual instance of a MleaderStyle?
MLeaderStyle mlStyle = dbentry.GetObject(OpenMode.ForWrite) as MLeaderStyle;
mlStyle.Scale = 20;
Instead of setting the properties I copied from standard stlye and change the scale factor
Creates a new style named "newStyle"
<CommandMethod("CreateMleaderStyle")> _ Public Sub CreateMleaderStyle() Dim doc As Document = Application.DocumentManager.MdiActiveDocument Dim db As Database = doc.Database Dim ed As Editor = doc.Editor Using trx As Transaction = db.TransactionManager.StartTransaction() Dim mldrStyleDictionary As DBDictionary = db.MLeaderStyleDictionaryId.GetObject(OpenMode.ForWrite) Dim copyMleaderstyle As MLeaderStyle = mldrStyleDictionary.GetAt("Standard").GetObject(OpenMode.ForWrite) Dim newMleaderstyle As New MLeaderStyle() mldrStyleDictionary.SetAt("newStyle", newMleaderstyle) newMleaderstyle.CopyFrom(copyMlead
erstyle) newMleaderstyle.Scale = 50 trx.AddNewlyCreatedDBObject(newMle aderstyle, True) trx.Commit() End Using End Sub
I have tried the code, and an interesting thig happens. In the MultiLeaderStyle dialog box, the scale is showing 50 - just what I want, but when I draw the MLeader and select it, the overall scale is 1.
To change the scale of the actual mleader mleader I do not think there is a way .Net with exception of PInvoke.
The scale the code is setting is for style which should effect all mleaders on that style, but for indivdual mleaders scale property see link.
If that helps at all are if that is what you are after.
I have the same issue. Could you please show me how to do it in C#? Thanks!
The link in the post 2 above yours which takes you to the Swamp has the C# solution.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register