Creating a Multileader Style - Answered
Hello,
I have a function that creates the multileader style for my drawing. It works in AutoCad, but in BricsCAD it crashes at the line:
newStyle.TextAttachmentType = TextAttachmentType.AttachmentMiddleOfTop
Public Sub AddMleaderStyle(ByVal dwg_scale As Double)
Dim podDWG As Document = Application.DocumentManager.MdiActiveDocument
Dim podDB As Database = podDWG.Database
Using mldrTrans As Transaction = podDB.TransactionManager.StartTransaction() Const styleName As String = "Amkor" Dim mlstyles As DBDictionary = CType(mldrTrans.GetObject(podDB.MLeaderStyleDictionaryId, OpenMode.ForRead), DBDictionary) Dim mLeaderStyle As ObjectId = ObjectId.Null If Not mlstyles.Contains(styleName) Then Dim newStyle As MLeaderStyle = New MLeaderStyle() Dim txtStyleTbl As TextStyleTable = DirectCast(mldrTrans.GetObject(podDB.TextStyleTableId, OpenMode.ForRead, False), TextStyleTable) Dim mTxtStyleId As ObjectId = txtStyleTbl("Romans") newStyle.TextStyleId = mTxtStyleId newStyle.ArrowSize = 4.4 newStyle.DoglegLength = 5.0 newStyle.EnableLanding = True newStyle.LandingGap = 1 newStyle.TextHeight = 2.2 newStyle.TextAlignAlwaysLeft = False newStyle.TextAttachmentType = TextAttachmentType.AttachmentMiddleOfTop **'<--Crashes here** newStyle.SetTextAttachmentType(TextAttachmentType.AttachmentMiddleOfTop, LeaderDirectionType.LeftLeader) newStyle.SetTextAttachmentType(TextAttachmentType.AttachmentMiddleOfTop, LeaderDirectionType.RightLeader) newStyle.Scale = dwg_scale mLeaderStyle = newStyle.PostMLeaderStyleToDb(podDB, styleName) mldrTrans.AddNewlyCreatedDBObject(newStyle, True) Else mLeaderStyle = mlstyles.GetAt(styleName) End If podDB.MLeaderstyle = mLeaderStyle mldrTrans.Commit() End Using End Sub
I would greatly appreciate some help/direction on this, thanks.
0
Comments
-
Never mind. Just remove the line:
newStyle.TextAttachmentType = TextAttachmentType.AttachmentMiddleOfTop0