.NET

Reply
*Alan
Message 1 of 4 (230 Views)

How to modifie datas in Xrecord ?

230 Views, 3 Replies
07-20-2005 02:16 AM

Hi,

 

After to create Xrecord, How to modifie datas in
Xrecords ?.

 

Dim XrecDict As Xrecord

Try

    XrecDict =
CType(Trans.GetObject(SSDict.GetAt("APP_UNITS"), OpenMode.ForWrite),
Xrecord)

    If XrecDict.Data.AsArray.Length
> 0 Then

        ReDim
XrecList(XrecDict.Data.AsArray.Length - 1)

        Dim
i As Integer

        Dim ResBuf As
TypedValue

        For i = 0 To
XrecDict.Data.AsArray.Length - 1

       
    ResBuf = XrecDict.Data.AsArray(i)

       
    XrecList.SetValue(String.Format("{0}", ResBuf.Value),
i)


size=2>        Next

    End If

 

.....How to modifie datas in Xrecords
?.

 

Danks ! Alain
*Bobby C. Jones
Message 2 of 4 (230 Views)

Re: How to modifie datas in Xrecord ?

07-20-2005 12:35 PM in reply to: *Alan

You cannot directly modify the data in an Xrecord.  You
will need to create a new ResultBuffer, add the desired TypedValue objects to
it, and assign it to the Data property of the Xrecord.
--
Bobby C.
Jones
http://www.acadx.com


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">


Hi,

 

After to create Xrecord, How to modifie datas in
Xrecords ?.

 

Dim XrecDict As Xrecord

Try

    XrecDict =
CType(Trans.GetObject(SSDict.GetAt("APP_UNITS"), OpenMode.ForWrite),
Xrecord)

    If
XrecDict.Data.AsArray.Length > 0 Then

        ReDim
XrecList(XrecDict.Data.AsArray.Length - 1)


size=2>        Dim i As
Integer

        Dim ResBuf
As TypedValue

        For i = 0
To XrecDict.Data.AsArray.Length - 1

       
    ResBuf = XrecDict.Data.AsArray(i)

       
    XrecList.SetValue(String.Format("{0}", ResBuf.Value),
i)


size=2>        Next

    End If

 

.....How to modifie datas in Xrecords
?.

 

Danks !
Alain
Active Contributor
jason.brenton
Posts: 38
Registered: ‎10-02-2007
Message 3 of 4 (230 Views)

Re: How to modifie datas in Xrecord ?

10-02-2007 02:57 PM in reply to: *Alan
According to this and similar articles, I have been trying to edit xrecord values by changing the appropriate data values.

However, the value does not stay after trans.commit.


Public Sub SaveInfo(Prefs As Autodesk.AutoCAD.DatabaseServices.DBDictionary, Trans As Autodesk.AutoCAD.DatabaseServices.Transaction, sBlockLabel as String)

Dim rXrec As DatabaseServices.Xrecord = Trans.GetObject(Prefs.GetAt(sBlockLabel), Autodesk.AutoCAD.DatabaseServices.OpenMode.ForWrite, True, True)
dim ResBuf as New DatabaseServices.ResultBuffer(New DatabaseServices.TypedValue(1, me.ToString))

rXrec.Data = ResBuf
Prefs.SetAt(sBlockLabel, rXrec)'likely redundant

End Sub

here with a proven functional connection to its dictionary, and transaction, is some of my edit code. Previous value being unnecessary, are skipped at this point, but the record exists so cannot be re-added to dictionary.

Is there some Other step for editing i need?
Active Contributor
jason.brenton
Posts: 38
Registered: ‎10-02-2007
Message 4 of 4 (230 Views)

Re: How to modifie datas in Xrecord ?

10-02-2007 03:48 PM in reply to: *Alan
As a note, perhaps i see this the wrong way coming from a sql background.

Most Data manipulations in such areas area done with make the change and update the database/table.

Perhaps in this one you have to delete and remake the xrecord the data was atached too?

This process i not directly referenced in any labs i have found so far.
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 or visit the Installation and Licensing Forum to get help installing your software.