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

How to modifie datas in Xrecord ?

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
406 Views, 3 Replies

How to modifie datas in Xrecord ?


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
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous


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
Message 3 of 4
jason.brenton
in reply to: Anonymous

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?
Message 4 of 4
jason.brenton
in reply to: Anonymous

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.

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