Message 1 of 19
select filter by xdata regappname does not always work
Not applicable
03-05-2009
12:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear Forum Users;
I've been working with .NET and the AutoCAD API for a while now,
but here's something I really don't get.
I've added an entity to a drawing, that contains the following XData (each line represents a new TypedValue):
type: 1001, value: 200903021622150430002
type: 1002, value: {
type: 1000, value: Somestring
type: 1002, value: }
The value displayed in the first xdata-line is a RegAppName which I have added as a RegAppTableRecord to the RegAppTable.
My drawing is full of entities, but I'd like to find exáctly this entity.
I do this by creating a selection filter and calling the selectAll method on the Autodesk.Autocad.EditorInput.Editor-object.
See the sample code below
{code}
'variable ID is of string value "200903021622150430002"
Dim ent As Entity = nothing
Dim filter As TypedValue() = {New TypedValue(DxfCode.ExtendedDataRegAppName, ID)}
Dim selfilter As New SelectionFilter(filter)
Dim pres As PromptSelectionResult = ed.SelectAll(selfilter)
If Not pres.Value Is Nothing Then
Dim idarray As ObjectId() = pres.Value.GetObjectIds()
If idarray.Length > 0 Then
Using tr As Transaction = db.TransactionManager.StartTransaction
Try
ent = DirectCast(tr.GetObject(idarray(0), OpenMode.ForRead, False), Entity)
Catch ex As System.Exception
Debug.WriteLine(ex.Message)
End Try
End Using
End If
End If
{code}
The Problem;
This method does not álways seem to work.
In most cases, the entity i am looking for will be found and retrieved by from the Database.
However, sometimes PromptSectionResult.Value is just Nothing.
What could be the possible cause of (and solution to) this?
i already tried recovering the drawing, thus no errors might exist in the drawing i guess¿
Also, adding a typedvalue that contains DxfCode.XDataSTart does not make a difference:
Dim filter As TypedValue() = {New TypedValue(DxfCode.XDataStart), New TypedValue(DxfCode.ExtendedDataRegAppName, ID)}
I've been working with .NET and the AutoCAD API for a while now,
but here's something I really don't get.
I've added an entity to a drawing, that contains the following XData (each line represents a new TypedValue):
type: 1001, value: 200903021622150430002
type: 1002, value: {
type: 1000, value: Somestring
type: 1002, value: }
The value displayed in the first xdata-line is a RegAppName which I have added as a RegAppTableRecord to the RegAppTable.
My drawing is full of entities, but I'd like to find exáctly this entity.
I do this by creating a selection filter and calling the selectAll method on the Autodesk.Autocad.EditorInput.Editor-object.
See the sample code below
{code}
'variable ID is of string value "200903021622150430002"
Dim ent As Entity = nothing
Dim filter As TypedValue() = {New TypedValue(DxfCode.ExtendedDataRegAppName, ID)}
Dim selfilter As New SelectionFilter(filter)
Dim pres As PromptSelectionResult = ed.SelectAll(selfilter)
If Not pres.Value Is Nothing Then
Dim idarray As ObjectId() = pres.Value.GetObjectIds()
If idarray.Length > 0 Then
Using tr As Transaction = db.TransactionManager.StartTransaction
Try
ent = DirectCast(tr.GetObject(idarray(0), OpenMode.ForRead, False), Entity)
Catch ex As System.Exception
Debug.WriteLine(ex.Message)
End Try
End Using
End If
End If
{code}
The Problem;
This method does not álways seem to work.
In most cases, the entity i am looking for will be found and retrieved by from the Database.
However, sometimes PromptSectionResult.Value is just Nothing.
What could be the possible cause of (and solution to) this?
i already tried recovering the drawing, thus no errors might exist in the drawing i guess¿
Also, adding a typedvalue that contains DxfCode.XDataSTart does not make a difference:
Dim filter As TypedValue() = {New TypedValue(DxfCode.XDataStart), New TypedValue(DxfCode.ExtendedDataRegAppName, ID)}