get and use extended ent data?

get and use extended ent data?

mdhutchinson
Advisor Advisor
288 Views
6 Replies
Message 1 of 7

get and use extended ent data?

mdhutchinson
Advisor
Advisor
I've done lisp for a long time ... and am trying to learn VBA - but am finding it difficult ...
The extended data in lisp looks like the following...

(-3 ("MyApplication" (1002 . "{")
(1011 522.909 -15481.2 0.0) (1011 17682.1 -15450.2 0.0) (1011 17679.0 -13712.5
0.0) (1011 519.768 -13743.5 0.0) (1002 . "}"))))

In VBA I am having a difficult time getting the data ... the GetXData call runs without error ...
but I can't seem to get a look at the extended ent data when I toggle a breakpoint there ...

What I trying to do is to extract this ext data, pull out a window defined by the four 1011 coordinates and use them in
a selection to grab other entities that lay within the window.
I can do this in lisp very easy ... but in VBA I find it a struggle.

Can someone give me a leg up?

*******************
Dim xdata As Variant
Dim xtype As Variant
Dim blkObj As AcadBlockReference

blkObj.GetXData "MyApplication", xtype, xdata
0 Likes
289 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
xtype will be an array the holds the dxf-style codes of the XData. xdata is
an array that holds the actual data stored with each dxf-style code.

xtype(0) = 1001
xdata(0) = "My data"

--
R. Robert Bell


wrote in message news:5421454@discussion.autodesk.com...
I've done lisp for a long time ... and am trying to learn VBA - but am
finding it difficult ...
The extended data in lisp looks like the following...

(-3 ("MyApplication" (1002 . "{")
(1011 522.909 -15481.2 0.0) (1011 17682.1 -15450.2 0.0) (1011
17679.0 -13712.5
0.0) (1011 519.768 -13743.5 0.0) (1002 . "}"))))

In VBA I am having a difficult time getting the data ... the GetXData call
runs without error ...
but I can't seem to get a look at the extended ent data when I toggle a
breakpoint there ...

What I trying to do is to extract this ext data, pull out a window defined
by the four 1011 coordinates and use them in
a selection to grab other entities that lay within the window.
I can do this in lisp very easy ... but in VBA I find it a struggle.

Can someone give me a leg up?

*******************
Dim xdata As Variant
Dim xtype As Variant
Dim blkObj As AcadBlockReference

blkObj.GetXData "MyApplication", xtype, xdata
0 Likes
Message 3 of 7

mdhutchinson
Advisor
Advisor
xtype(2) returns 1011 the group code for the coodinate...
but when I do xdata(2) I get a type mismatch error...

... a little more help please?
0 Likes
Message 4 of 7

Anonymous
Not applicable
More code would help.

Are you providing a variant for the 3D point you are attempting to retrieve?

--
R. Robert Bell


wrote in message news:5421498@discussion.autodesk.com...
xtype(2) returns 1011 the group code for the coodinate...
but when I do xdata(2) I get a type mismatch error...

... a little more help please?
0 Likes
Message 5 of 7

Anonymous
Not applicable
Since the 1011 group holds a point's coordinates, the xdata(2) will be
returning a 3 element array(Variant).......

If IsArray(xData(2)) Then
Debug.Print "The X value = " & xData(2)(0)
End If

wrote in message news:5421498@discussion.autodesk.com...
xtype(2) returns 1011 the group code for the coodinate...
but when I do xdata(2) I get a type mismatch error...

... a little more help please?
0 Likes
Message 6 of 7

mdhutchinson
Advisor
Advisor
Jeff M... Thanks big time...

I want to store an array of variants... that will be a suitable for SelectBytPolygon method... (4 points that form the verts of a polygon)

Would the below be a way to do this then?

Dim Vertices(0 To 11) As Variant

For j = 0 To UBound(xtype)
If IsArray(xdata(j)) Then
Vertices(k) = xdata(j)(0)
k = k + 1
Vertices(k) = xdata(j)(1)
k = k + 1
Vertices(k) = xdata(j)(2)
k = k + 1
End If
Next
0 Likes
Message 7 of 7

mdhutchinson
Advisor
Advisor
This looks like it will work...
but is it a eloquent way to do it?

I haven't tried the SelectByPolygon method yet...
0 Likes