.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modifing a ResultBuffer/XRecord

1 REPLY 1
Reply
Message 1 of 2
KurtzDavid
483 Views, 1 Reply

Modifing a ResultBuffer/XRecord

Hello,

As you can see in the attached print screen TheProblen.png I need to modify the XRecord within a file header sub directories.

I have managed to loop through the file directories and sub-directories and even extracted the ResultBuffer of the correct sub-directory.

I now have a ResultBuffer/XRecord that has an array of typed values in it and I need to modify one of the typed values.

 How do I do it?

 

Thanks in advance,

David.

1 REPLY 1
Message 2 of 2
KurtzDavid
in reply to: KurtzDavid

I've could not upload my *.vb file so here is my code.

 

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Geometry
'Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Colors
Imports System
Imports System.Collections.Specialized
Public Class BentleyXDAta
    <CommandMethod("TEST", CommandFlags.UsePickSet)> Public Sub TEST()
        '' Get the current document editor
        Dim acDocEd As Editor = Application.DocumentManager.MdiActiveDocument.Editor

        '' Get the current document and database
        Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
        Dim acCurDb As Database = acDoc.Database

        Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
            Dim NOD As DBDictionary = acTrans.GetObject(HostApplicationServices.WorkingDatabase.NamedObjectsDictionaryId, OpenMode.ForRead)
            If NOD.Contains("AT_REBIS_APP") Then
                For Each NODEnt As DBDictionaryEntry In NOD
                    If NODEnt.Key.ToString = "AT_REBIS_APP" Then
                        Dim RebDB As DBDictionary = acTrans.GetObject(NODEnt.Value, OpenMode.ForRead)
                        If RebDB.Contains("AT_REBIS_APP_DB") Then
                            For Each RebDBEnt As DBDictionaryEntry In RebDB
                                If RebDBEnt.Key.ToString = "AT_REBIS_APP_DB" Then
                                    Dim oXrecord As Xrecord = acTrans.GetObject(RebDBEnt.m_value, OpenMode.ForRead, False)
                                    Dim oResultBuffer As ResultBuffer = oXrecord.Data
                                    Dim oResultBufferArray As TypedValue() = oResultBuffer.AsArray
                                    Dim FlagNext As Boolean = False
                                    For Each Result As TypedValue In oResultBufferArray
                                        If FlagNext = True Then
                                            Beep()
                                            FlagNext = False
                                        End If
                                        If Result.TypeCode = 1 Then
                                            If Result.Value = "AT_REBIS_APP_DB_DOCTAGID" Then
                                                FlagNext = True
                                            End If
                                        End If
                                    Next
                                    'Dim RebAppDB As DBDictionary = acTrans.GetObject(RebDB.ExtensionDictionary, OpenMode.ForRead)
                                    ''Dim RebAppDB As DBDictionary = acTrans.GetObject(RebDBEnt.Value, OpenMode.ForRead)
                                    ''For Each RebAppDBEnt As DBDictionaryEntry In RebAppDB
                                    ''    acDocEd.WriteMessage("Rebis RebAppDBKey: " + RebAppDBEnt.Key.ToString + vbCrLf)
                                    ''Next
                                End If
                                acDocEd.WriteMessage("RebDBEnt Key: " + RebDBEnt.Key.ToString + vbCrLf)
                            Next
                        End If
                    End If
                    acDocEd.WriteMessage("NODEnt Key: " + NODEnt.Key.ToString + vbCrLf)
                Next
            End If

        End Using

    End Sub
End Class

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost