Author Topic: LabelCurve Add  (Read 1300 times)

0 Members and 1 Guest are viewing this topic.

Micaletti

  • Guest
LabelCurve Add
« on: April 16, 2013, 02:27:37 PM »
I have been trying to add a LabelCurve to a Member with no success. Unfortunately a dotPeek at AecbBldSrvMgd.dll only exposes a thin managed wrapper so I couldn't really find anything useful with it. I have experience adding MVBlock references via .NET however I am not sure if an Anchor is required here. Listening to the Database Appended/Modified events while adding a LabelCurve via the built-in command shows that no new Anchor is added to the database. Here is what I have however it doesn't work. Nothing is visually added to the Member.

Code: [Select]
<Extension> Public Sub Add(LCS As LabelCurveStyle, Member As Member)
        Dim Lock = Document.LockDocument
        Dim T = Database.TransactionManager.StartTransaction
        Try
            Dim BTR As BlockTableRecord = T.GetObject(Database.CurrentSpaceId, OpenMode.ForWrite)
            Member = T.GetObject(Member.ObjectId, OpenMode.ForWrite)
            Dim LC As New LabelCurve
            LC.SetToStandard(Database)
            LC.SetDatabaseDefaults(Database)
            LC.StyleId = LCS.Id
            LC.CurveId = Member.Id
            LC.SetDefaultLayer()
            LC.LayoutCurveNodes.AddLayoutCurveNode(0)
            BTR.AppendEntity(LC)
            T.AddNewlyCreatedDBObject(LC, True)
            T.Commit()
        Catch ex As System.Exception
            MsgBox(ex.tostring)
        Finally
            Lock.Dispose()
            T.Dispose()
        End Try
    End Sub
« Last Edit: April 20, 2013, 04:29:03 PM by Micaletti »

Micaletti

  • Guest
Re: LabelCurve Add
« Reply #1 on: April 16, 2013, 08:15:26 PM »
The code above is working now. The solution was to call LC.LayoutCurveNodes.AddLayoutCurveNode.