filter by handle

filter by handle

Anonymous
Not applicable
426 Views
9 Replies
Message 1 of 10

filter by handle

Anonymous
Not applicable
Hello!!
How can i filter in selection set by handle??
i've tried

Dim selecthandle As AcadSelectionSet
Set selecthandle =
ThisDrawing.SelectionSets.Add("selectbyhandle")

Dim intcodes(0) As Integer
Dim varcodevalues(0) As Variant
intcodes(0) = 5 'this supose is the dxf code of handle
varcodevalues(0) = "9A3A" 'this is the entity handle

selecthandle.Select acSelectionSetAll, , , intcodes,
varcodevalues


and it does not work

thanks
0 Likes
427 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
Why not use the ObjecToHandle function?

Dim MyObj as AcadObject
Dim MyHandle as String

MyHandle = "9A3A"
Set MyObj = ThisDrawing.HandleToObject(MyHandle)



Jimmy Lopez wrote:

> Hello!!
> How can i filter in selection set by handle??
> i've tried
>
> Dim selecthandle As AcadSelectionSet
> Set selecthandle =
> ThisDrawing.SelectionSets.Add("selectbyhandle")
>
> Dim intcodes(0) As Integer
> Dim varcodevalues(0) As Variant
> intcodes(0) = 5 'this supose is the dxf code of handle
> varcodevalues(0) = "9A3A" 'this is the entity handle
>
> selecthandle.Select acSelectionSetAll, , , intcodes,
> varcodevalues
>
> and it does not work
>
> thanks
0 Likes
Message 3 of 10

Anonymous
Not applicable
The object to handle function works great for a single object, but I want to filter for more than one handle and make them part of a selection set!

I would appreciate any help!
0 Likes
Message 4 of 10

Anonymous
Not applicable
SSI,

I'm not sure if this will help but....isn't a handle a Long Data Type? Does changing from string to numeric help?

Regards,

Bob Coward
CADS, Inc

800-366-0946
bcoward@mindspring.com
0 Likes
Message 5 of 10

Anonymous
Not applicable
Jimmy,

I need to create a selection set using multiple handles. Were you able to get Group Code 5 to work or did you find a work around?

Thanks,
0 Likes
Message 6 of 10

Anonymous
Not applicable
Con,

The example you provided works great, but I need to filter by for multiple handles and make them part of a selection set.

I would appreciate any help you can provide!

Thanks,
0 Likes
Message 7 of 10

Anonymous
Not applicable
Why not create a comma-separated list of handles passing it subsequently to the SelSet filter (DXF code 5 if I'm right?) You can also use wildcards (*) in filters, but not in this specific case. Regards, Maksim Sestic www.geoinova.com "SSI Services, Inc." wrote in message news:20641122.1084984322988.JavaMail.jive@jiveforum1.autodesk.com... > Con, > > The example you provided works great, but I need to filter by for multiple handles and make them part of a selection set. > > I would appreciate any help you can provide! > > Thanks,
0 Likes
Message 8 of 10

Anonymous
Not applicable
I am using VBA! Group Code 5 does not appear to work in VBA! Any other ideas?
0 Likes
Message 9 of 10

Anonymous
Not applicable
Loop through your list of handles and add them individually to the selection set using the SelectionSet.AddItems method. You may need to wrap them into a variant array to be a valid parameter for AddItems. You could using single-cell arrays, one at a time, or put them all into one array and use a single AddItems call -- your choice. I don't really see the advantages of doing this. If you already know which objects you're interested in, and you have to loop through them anyway to use HandleToObject, building a SelectionSet may just be extra work for you and the computer. But, then again, every project has its own quirks and workarounds... Good luck, James
0 Likes
Message 10 of 10

Anonymous
Not applicable
VBA doesn't seem to accept Group Code 5. If you need all your objects in a selection set I would do this:
1. Create a blank selection set
2. Use HandleToObject to get the first object
3. Use the AddItems method of the selection set to add the object
4. Repeat steps 2 & 3 for all remaining handles
Regards - Nathan
0 Likes