This code does what I want, although it iterates through all of the figures instead of just using the figure I select:
Public Sub ChangesSurveyFigureToNonBreakline()
Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim oAcadApp As Autodesk.AutoCAD.Interop.AcadApplication = Nothing
Dim oAeccSurveyApp As Autodesk.AECC.Interop.UiSurvey.AeccSurveyApplication = Nothing
Dim oAeccSurveyDoc As Autodesk.AECC.Interop.UiSurvey.AeccSurveyDocument = Nothing
Dim oAeccSurveyDB As Autodesk.AECC.Interop.Survey.AeccSurveyDatabase = Nothing
Dim opt1 As New PromptEntityOptions(vbCrLf & "Select survey figure to change to non-breakline: ")
opt1.SetRejectMessage(vbCrLf & "error!")
opt1.AppendKeywordsToMessage = False
opt1.AddAllowedClass(GetType(SurveyFigure), True)
Dim Res1 As PromptEntityResult = ed.GetEntity(opt1)
If (Res1.Status = PromptStatus.OK) Then
Using trans As Transaction = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction()
Try
If oAcadApp Is Nothing Then
oAcadApp = GetObject(, "AutoCAD.Application")
End If
Catch ex As Autodesk.AutoCAD.Runtime.Exception
ed.WriteMessage(ex.Message)
End Try
Try
oAeccSurveyApp = oAcadApp.GetInterfaceObject("AeccXUiSurvey.AeccSurveyApplication.10.3")
oAeccSurveyDoc = oAeccSurveyApp.ActiveDocument
oAeccSurveyDB = oAeccSurveyApp.ActiveDocument.Database
Dim oEnt As Autodesk.AutoCAD.DatabaseServices.Entity = trans.GetObject(Res1.ObjectId, OpenMode.ForRead)
Dim TmpFigure As SurveyFigure = TryCast(oEnt, SurveyFigure)
Dim oSF As SurveyFigure = nothing
Dim oCurrentProject As AeccSurveyProject = oAeccSurveyDB.CurrentProject
For i As Integer = 0 To oCurrentProject.Figures.Count - 1
Dim oSurveyFigure As AeccSurveyFigure = oCurrentProject.Figures.Item(i)
Dim FigureId As ObjectId = New ObjectId(New IntPtr(oSurveyFigure.GetObjectId))
oSF = TryCast(trans.GetObject(FigureId, OpenMode.ForRead), SurveyFigure)
If oSF.Id = TmpFigure.Id Then
oSurveyFigure.IsBreakline = False
oSurveyFigure.Save()
End If
Next
Catch ex As Autodesk.AutoCAD.Runtime.Exception
ed.WriteMessage("Error : ", ex.Message & vbCrLf)
End Try
End Using
End If
End Sub
I'm still at a loss with deleteing a figure from the database though. I see the erase method in the .net SurveyFigure object but it only appears to erase it from modelspace and not the database?