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

SelectionSets: Select By Handle in VB.Net

1 REPLY 1
Reply
Message 1 of 2
rghill76
1201 Views, 1 Reply

SelectionSets: Select By Handle in VB.Net


I am trying to use selectionsets to select an entity by its handle.

Here is my code:



Public Acad As Autodesk.AutoCAD.Interop.AcadApplication

Public AcDwg As Autodesk.AutoCAD.InteropAcadDocument



Public Const AcByBlock As Short = 2

Public Const AcByHandle As Short = 5



Sub SelectByHandle

Dim AcFilterType(0) As Short

Dim AcFilterData(0) As Object

Dim AcSS As Autodesk.AutoCAD.Interop.AcadSelectionSet



StartAutoCAD() 'Starts AutoCAD and sets AcDwg as the correct drawing



AcFilterType(0) = AcByHandle

AcFilterData(0) = "B4F"



AcSS.Select(Autodesk.AutoCAD.Interop.Common.AcSelect.acSelectionSetAll,,,AcFilterType,AcFilterData)

'Causes ArgumentException error: "Invalid argument filter list in Select"

End Sub



The code works if I use AcFilterType(0) = AcByBlock



Any sugguestions would be greatly appreciated.



Rob



1 REPLY 1
Message 2 of 2
chiefbraincloud
in reply to: rghill76

Since you're using the COM interface, then just do AcadObject = AcadDocument.HandleToObject(Handle)
Dave O.                                                                  Sig-Logos32.png

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