.NET

Reply
Mentor
BrentBurgess1980
Posts: 161
Registered: ‎06-16-2008
Message 1 of 11 (1,201 Views)
Accepted Solution

Multileader scale

1201 Views, 10 Replies
03-21-2011 01:17 AM

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.MTextContent
                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.

Valued Mentor
Jeffrey_H
Posts: 372
Registered: ‎01-20-2010
Message 2 of 11 (1,158 Views)

Re: Multileader scale

03-23-2011 04:46 PM in reply to: BrentBurgess1980

Is your code changing an actual instance of a MleaderStyle?

Something Like?

 

MLeaderStyle mlStyle = dbentry.GetObject(OpenMode.ForWrite) as MLeaderStyle;
mlStyle.Scale = 20;

You can also find your answers @ TheSwamp
Mentor
BrentBurgess1980
Posts: 161
Registered: ‎06-16-2008
Message 3 of 11 (1,155 Views)

Re: Multileader scale

03-23-2011 05:01 PM in reply to: BrentBurgess1980

Yeah I am trying to create a multileader style and set the scale to 50. I might try creating it and the getting it from the DB and changing the scale.

Mentor
BrentBurgess1980
Posts: 161
Registered: ‎06-16-2008
Message 4 of 11 (1,150 Views)

Re: Multileader scale

03-23-2011 05:47 PM in reply to: Jeffrey_H

That didnt seem to work either. Do you know if there is any documentation on MLeaders?

Valued Mentor
Jeffrey_H
Posts: 372
Registered: ‎01-20-2010
Message 5 of 11 (1,145 Views)

Re: Multileader scale

03-23-2011 07:14 PM in reply to: BrentBurgess1980

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(copyMleaderstyle)
                newMleaderstyle.Scale = 50
                trx.AddNewlyCreatedDBObject(newMleaderstyle, True)
                trx.Commit()
 
            End Using
 
        End Sub

 

You can also find your answers @ TheSwamp
Mentor
BrentBurgess1980
Posts: 161
Registered: ‎06-16-2008
Message 6 of 11 (1,136 Views)

Re: Multileader scale

03-23-2011 08:33 PM in reply to: Jeffrey_H

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.

Valued Mentor
Jeffrey_H
Posts: 372
Registered: ‎01-20-2010
Message 7 of 11 (1,136 Views)

Re: Multileader scale

03-23-2011 09:12 PM in reply to: BrentBurgess1980

To change the scale of the actual mleader mleader I do not think there is a way .Net with exception of PInvoke.

see http://www.theswamp.org/index.php?topic=31861.msg386494#msg386494

 

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.

You can also find your answers @ TheSwamp
Mentor
BrentBurgess1980
Posts: 161
Registered: ‎06-16-2008
Message 8 of 11 (1,130 Views)

Re: Multileader scale

03-24-2011 12:14 AM in reply to: BrentBurgess1980

Thats excellent!! now it is showing the scale I want.

 

New Member
runCAD
Posts: 1
Registered: ‎03-31-2012
Message 9 of 11 (914 Views)

Re: Multileader scale

03-31-2012 09:05 PM in reply to: BrentBurgess1980

Dear Sir,

 

I have the same issue. Could you please show me how to do it in C#? Thanks!

*Expert Elite*
Jeff_M
Posts: 4,194
Registered: ‎07-22-2003
Message 10 of 11 (893 Views)

Re: Multileader scale

04-02-2012 07:35 PM in reply to: runCAD

runCAD wrote:

Dear Sir,

 

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.

Jeff_M, also a frequent Swamper

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