RemoveItems - Does it work in VB.NET??

RemoveItems - Does it work in VB.NET??

Anonymous
Not applicable
626 Views
3 Replies
Message 1 of 4

RemoveItems - Does it work in VB.NET??

Anonymous
Not applicable
Could anyone show an example of removing a subset of entities from an existing selection set via RemoveItems?

I am starting to think it is not possible. I find many examples of VBA solutions, but when I try to convert them to VB.NET...RemoveItems treats the object SS as a method rather than a "target" but putting the element array in parenthesis.

If for some reason this functionality is not available to VB.NET users...what is the solution for removing a subset of entities from a selection set? (...or simulating this action.)

Or maybe I don't have any idea what the heck I'm doing...

Any help gratefully received.
0 Likes
627 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
This is what I have done to remove items from a selection set using the
ActiveX API through vb.net:

Try
'build a selectionset filtering first for appname xdata
GeoSS = CreateSelectionSet(AcadApp, "XdataSelectionSet")
gpCode(0) = -3
gpCode(1) = 1001
dataValue(1) = "CTTB"

GeoSS.Select(AcSelect.acSelectionSetAll, , , gpCode, dataValue)

For Each XdataObject In GeoSS
XdataObject.GetXData("", xtypeOut, xdataOut)
If xdataOut(1) = TopGUID Then
XdataObject.Delete()
End If
'Stop
Next

AcadApp.Update()

Catch ex As Exception
MsgBox("Failed to erase geometry.")

End Try
PellaCAD wrote:
> Could anyone show an example of removing a subset of entities from an existing selection set via RemoveItems?
>
> I am starting to think it is not possible. I find many examples of VBA solutions, but when I try to convert them to VB.NET...RemoveItems treats the object SS as a method rather than a "target" but putting the element array in parenthesis.
>
> If for some reason this functionality is not available to VB.NET users...what is the solution for removing a subset of entities from a selection set? (...or simulating this action.)
>
> Or maybe I don't have any idea what the heck I'm doing...
>
> Any help gratefully received.
0 Likes
Message 3 of 4

Anonymous
Not applicable
Nevermind. I misunderstood the question. I am deleting from the
drawing here, not removing from the selection set.

Sorry.

Tim J wrote:
> This is what I have done to remove items from a selection set using the
> ActiveX API through vb.net:
>
> Try
> 'build a selectionset filtering first for appname xdata
> GeoSS = CreateSelectionSet(AcadApp, "XdataSelectionSet")
> gpCode(0) = -3
> gpCode(1) = 1001
> dataValue(1) = "CTTB"
>
> GeoSS.Select(AcSelect.acSelectionSetAll, , , gpCode, dataValue)
>
> For Each XdataObject In GeoSS
> XdataObject.GetXData("", xtypeOut, xdataOut)
> If xdataOut(1) = TopGUID Then
> XdataObject.Delete()
> End If
> 'Stop
> Next
>
> AcadApp.Update()
>
> Catch ex As Exception
> MsgBox("Failed to erase geometry.")
>
> End Try
> PellaCAD wrote:
>> Could anyone show an example of removing a subset of entities from an existing selection set via RemoveItems?
>>
>> I am starting to think it is not possible. I find many examples of VBA solutions, but when I try to convert them to VB.NET...RemoveItems treats the object SS as a method rather than a "target" but putting the element array in parenthesis.
>>
>> If for some reason this functionality is not available to VB.NET users...what is the solution for removing a subset of entities from a selection set? (...or simulating this action.)
>>
>> Or maybe I don't have any idea what the heck I'm doing...
>>
>> Any help gratefully received.
0 Likes
Message 4 of 4

Anonymous
Not applicable
Did you checked your post in VBA NG? Someone has pointed out the logical
error in your code while you think it is language problem (with bracket or
not around the parameter you paased to a method). The array you passed to
RemoveItems() method is wrong, not the bracket (yes, VB.NET use () around
the parameters passed, while VB/VBA does not unless you preceded with
"CALL").


"PellaCAD" wrote in message news:5911310@discussion.autodesk.com...
Could anyone show an example of removing a subset of entities from an
existing selection set via RemoveItems?

I am starting to think it is not possible. I find many examples of VBA
solutions, but when I try to convert them to VB.NET...RemoveItems treats the
object SS as a method rather than a "target" but putting the element array
in parenthesis.

If for some reason this functionality is not available to VB.NET
users...what is the solution for removing a subset of entities from a
selection set? (...or simulating this action.)

Or maybe I don't have any idea what the heck I'm doing...

Any help gratefully received.
0 Likes